Skip to content

Conversation

@pav-kv
Copy link
Collaborator

@pav-kv pav-kv commented Nov 20, 2025

This commit moves disabling of the latch assertions from the latch declaration phase to the body of the corresponding commands. This serves two purposes:

  1. Disabling of the assertions is now more targeted. It is per command rather than per batch.
  2. The disabling behaviour is ephemeral, so we can remove the bool in SpanSet that doesn't belong there. It's a data structure that should have no opinion on whether the checks are enabled.

Epic: none
Release note: none

This commit moves disabling of the latch assertions from the latch
declaration phase to the body of the corresponding commands. This serves
two purposes:

1. Disabling of the assertions is now more targeted. It is per command
   rather than per batch.
2. The disabling behaviour is ephemeral, so we can remove the bool in
   SpanSet that doesn't belong there. It's a data structure that should
   have no opinion on whether the checks are enabled.

Epic: none
Release note: none
@pav-kv pav-kv requested a review from iskettaneh November 20, 2025 16:45
@pav-kv pav-kv requested a review from a team as a code owner November 20, 2025 16:45
@blathers-crl
Copy link

blathers-crl bot commented Nov 20, 2025

It looks like your PR touches production code but doesn't add or edit any test code. Did you consider adding tests to your PR?

🦉 Hoot! I am a Blathers, a bot for CockroachDB. My owner is dev-inf.

@cockroach-teamcity
Copy link
Member

This change is Reviewable

@pav-kv
Copy link
Collaborator Author

pav-kv commented Nov 20, 2025

@iskettaneh I tested locally, with CrdbTestBuild instead of RaceEnabled. The kvserver tests pass, and I couldn't make kvnemesis fail.

Comment on lines -394 to -395
// undeclared access to spans. This is generally set by requests that rely on
// other forms of synchronization for correctness (e.g. GCRequest).
Copy link
Collaborator Author

Choose a reason for hiding this comment

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

"rely on other forms of synchronization" looks like a useful note, need to retain it in some form

@pav-kv pav-kv marked this pull request as draft November 20, 2025 17:04
//
// See call to `AssertAllowed()` in GetGCThreshold() to understand why we need
// to disable these assertions for export requests.
reader = spanset.DisableReaderAssertions(reader)
Copy link
Contributor

Choose a reason for hiding this comment

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

The problem is, we probably need to retain some control of which assertions are we disabling. For now, DisableReaderAssertions will unwrap the SpanSetBatch, which will disable all assertions really. Now, we only have one assertion type (Latch assertions), but we are soon planning to add a new assertion (Forbidden spans)

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