Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

storage: populate timestamp field in lock table values #111223

Merged

Conversation

nvanbenschoten
Copy link
Member

@nvanbenschoten nvanbenschoten commented Sep 25, 2023

Informs #109645.

This commit starts writing the Timestamp field in lock table MVCCMetadata values for shared and exclusive locks. This mirrors the behavior of intent locks. This is not strictly needed, as the timestamp is always equal to Txn.WriteTimestamp, but it is cheap to do and helps unify some stats logic, which uses this field to compute "lock age".

Maybe we'll get rid of this for all lock strengths one day...

Release note: None

This commit starts writing the Timestamp field in lock table MVCCMetadata values
for shared and exclusive locks. This mirrors the behavior of intent locks. This
is not strictly needed, as the timestamp is always equal to txn.WriteTimestamp,
but it is cheap to do and helps unify some stats logic, which uses this field to
compute "lock age".

Maybe we'll get rid of this for all lock strengths one day...

Release note: None
@cockroach-teamcity
Copy link
Member

This change is Reviewable

Copy link
Collaborator

@arulajmani arulajmani left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

:lgtm:

Reviewed 6 of 6 files at r1, all commit messages.
Reviewable status: :shipit: complete! 1 of 0 LGTMs obtained (waiting on @nvanbenschoten and @sumeerbhola)


-- commits line 10 at r1:
The GC queue also uses it to compute "lock age", so can we really get rid of it one day? Or were you imagining we'd get rid of this intent age concept from the GC queue as well?

Copy link
Member Author

@nvanbenschoten nvanbenschoten left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

TFTR!

bors r+

Reviewable status: :shipit: complete! 1 of 0 LGTMs obtained (waiting on @arulajmani and @sumeerbhola)


-- commits line 10 at r1:

Previously, arulajmani (Arul Ajmani) wrote…

The GC queue also uses it to compute "lock age", so can we really get rid of it one day? Or were you imagining we'd get rid of this intent age concept from the GC queue as well?

I was imagining that we would compute the lock age from the Txn.WriteTimestamp field, instead of the Timestamp field.

@craig
Copy link
Contributor

craig bot commented Sep 25, 2023

Build succeeded:

@craig craig bot merged commit 46cb4e3 into cockroachdb:master Sep 25, 2023
3 checks passed
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

3 participants