Skip to content

roachpb: add lock table metadata structures#76611

Merged
craig[bot] merged 1 commit intocockroachdb:masterfrom
AlexTalks:proto_lock_table
Mar 9, 2022
Merged

roachpb: add lock table metadata structures#76611
craig[bot] merged 1 commit intocockroachdb:masterfrom
AlexTalks:proto_lock_table

Conversation

@AlexTalks
Copy link
Copy Markdown
Contributor

@AlexTalks AlexTalks commented Feb 15, 2022

This change adds the protobuf structures, as well as the method, needed
to capture the state of a replica's lock table. This is part of the
work coming out of #75541, and is needed to be able to implement the
QueryLocks RPC.

Release justification: (Category 2) The structures created here are
entirely new, for the purposes of observability, and do not represent a
risk to any existing code or functionality.

Release note: None

@AlexTalks AlexTalks requested a review from a team as a code owner February 15, 2022 21:00
@cockroach-teamcity
Copy link
Copy Markdown
Member

This change is Reviewable

@AlexTalks AlexTalks force-pushed the proto_lock_table branch 4 times, most recently from 591d362 to a6e8aa4 Compare February 22, 2022 18:37
@AlexTalks AlexTalks force-pushed the proto_lock_table branch 2 times, most recently from 5e6fc00 to 87790bc Compare February 24, 2022 04:08
@AlexTalks AlexTalks force-pushed the proto_lock_table branch 2 times, most recently from 686f785 to a85db7b Compare February 24, 2022 18:54
Copy link
Copy Markdown
Contributor

@nvb nvb left a comment

Choose a reason for hiding this comment

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

Reviewed 12 of 12 files at r1, all commit messages.
Reviewable status: :shipit: complete! 0 of 0 LGTMs obtained (waiting on @AlexTalks)


pkg/kv/kvserver/concurrency/lock/lock_waiter.proto, line 22 at r1 (raw file):

// KeyAccessType represents the type of operation that a transaction holding or
// waiting on a lock intends to carry out, once necessary locks are acquired.
enum KeyAccessType {

I think this can be replaced by the Strength enum. Currently, we only support two strengths, None (which maps to read-only here) and Exclusive (which maps to read-write here).


pkg/kv/kvserver/concurrency/lock/lock_waiter.proto, line 31 at r1 (raw file):

// LockWaiter represents a transaction (or non-transactional operation) that is
// waiting in the wait queue of readers or writers on an individual lock.
message LockWaiter {

nit: this package is called lock, so we can call this message Waiter {. There's a part of the style guide we use that talks about package name "stuttering", though I'm having trouble finding it.


pkg/kv/kvserver/concurrency/lock/locking.go, line 29 at r1 (raw file):

// SafeValue implements redact.SafeValue.
func (Durability) SafeValue() {}

Want to do the same for Strength sine you're here?


pkg/roachpb/data.proto, line 558 at r1 (raw file):

  bytes key = 2 [(gogoproto.casttype) = "Key"];
  // The metadata on the current lock holder, or nil if the lock is not held.
  LockAcquisition lock_holder = 3;

I think we decided that we should inline the txn and durability fields, since we don't need the LockAcquisition's Span and that message is used in a slightly different context. Or am I misremembering?


pkg/roachpb/data.proto, line 562 at r1 (raw file):

  google.protobuf.Duration hold_duration = 4 [(gogoproto.nullable) = false,
    (gogoproto.stdduration) = true];
  // The queue of readers and writers currently waiting on the lock.

Let's note the order of this list, or mention that the order is arbitrary.


pkg/roachpb/method.go, line 100 at r1 (raw file):

	// aborting it.
	RecoverTxn
	// QueryLocks requests the current state of concurrency control's lock table.

I don't think we meant to include this in this PR.

Copy link
Copy Markdown
Contributor

@nvb nvb left a comment

Choose a reason for hiding this comment

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

Sorry, didn't mean to mark this as approved quite yet 😃

Copy link
Copy Markdown
Contributor Author

@AlexTalks AlexTalks left a comment

Choose a reason for hiding this comment

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

Reviewable status: :shipit: complete! 0 of 0 LGTMs obtained (waiting on @nvanbenschoten)


pkg/roachpb/method.go, line 100 at r1 (raw file):

Previously, nvanbenschoten (Nathan VanBenschoten) wrote…

I don't think we meant to include this in this PR.

I did, though it was an artifact of an earlier version of the PR in which I included all API/proto updates in the same change (and running a generate build is very slow)

Copy link
Copy Markdown
Contributor

@nvb nvb 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 8 of 9 files at r2, 3 of 3 files at r3, all commit messages.
Reviewable status: :shipit: complete! 1 of 0 LGTMs obtained (waiting on @AlexTalks)

@AlexTalks
Copy link
Copy Markdown
Contributor Author

bors r+

@craig
Copy link
Copy Markdown
Contributor

craig bot commented Mar 7, 2022

Build failed (retrying...):

craig bot pushed a commit that referenced this pull request Mar 7, 2022
76611: roachpb: add lock table metadata structures r=AlexTalks a=AlexTalks

This change adds the protobuf structures, as well as the method, needed
to capture the state of a replica's lock table.  This is part of the
work coming out of #75541, and is needed to be able to implement the
`QueryLocks` RPC.

Release note: None

77159: roachtest/tests: move prometheus client interface to separate package r=irfansharif a=ajwerner

This way mockgen does not depend on the `roachtest/tests` package.

Touches #76851.

Release justification: non-production code change

Release note: None

77301: loqrecovery: fix json field name in replica info file r=erikgrinaker a=aliher1911

Previously protobuf used camelcase name for repeated field
for descriptor change. This was wrong as it was not parsed
correctly by marshaller.
This fix adds explicit name to proto specification to avoid
default name generation.

Release justification: This change is low risk as it fixes
a bug in new functionality.

Release note: None

Fixes #77282

Co-authored-by: Alex Sarkesian <sarkesian@cockroachlabs.com>
Co-authored-by: Andrew Werner <awerner32@gmail.com>
Co-authored-by: Oleg Afanasyev <oleg@cockroachlabs.com>
@craig
Copy link
Copy Markdown
Contributor

craig bot commented Mar 7, 2022

Build failed (retrying...):

@ajwerner
Copy link
Copy Markdown
Contributor

ajwerner commented Mar 7, 2022

bors r-

this doesn't pass CI, needs more generation

@craig
Copy link
Copy Markdown
Contributor

craig bot commented Mar 7, 2022

Canceled.

@AlexTalks AlexTalks requested a review from a team March 8, 2022 01:20
@AlexTalks AlexTalks force-pushed the proto_lock_table branch 3 times, most recently from f88539c to f4f3095 Compare March 8, 2022 01:40
@AlexTalks
Copy link
Copy Markdown
Contributor Author

bors r+

@craig
Copy link
Copy Markdown
Contributor

craig bot commented Mar 8, 2022

👎 Rejected by PR status

This change adds the protobuf structures, as well as the method, needed
to capture the state of a replica's lock table.  This is part of the
work coming out of cockroachdb#75541, and is needed to be able to implement the
`QueryLocks` RPC.

Release justification: (Category 2) The structures created here are
entirely new, for the purposes of observability, and do not represent a
risk to any existing code or functionality.

Release note: None
@AlexTalks
Copy link
Copy Markdown
Contributor Author

bors r+

@craig
Copy link
Copy Markdown
Contributor

craig bot commented Mar 8, 2022

Build failed (retrying...):

@craig
Copy link
Copy Markdown
Contributor

craig bot commented Mar 9, 2022

Build succeeded:

@craig craig bot merged commit f15acd1 into cockroachdb:master Mar 9, 2022
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.

4 participants