Rename ExecuteOptions.unique_id to loadshed_valve_id#893
Open
bgwines wants to merge 1 commit into
Open
Conversation
The Snake load shedder uses this ExecuteOptions field as its per-valve contention key, but the field was named unique_id while the RFC and the loadshed package both call the concept a "valve ID". The mismatch made the wiring hard to follow: callers read GetUniqueId() and passed the result into Acquire(ctx, valveID, ...). Rename the proto field unique_id -> loadshed_valve_id (field number 22 is unchanged, so the wire format is backwards-compatible) and update the two reader call sites and their tests to match. ExecuteOptions is forwarded from vtgate to vttablet wholesale, so no per-field passthrough wiring is needed. Also relocate the "empty valve ID is valid" explanation from the two call sites into Acquire's doc comment, where the contract actually lives. AI disclosure: Claude Code assisted with development. Every line of code was either written by or carefully reviewed by me :) Co-authored-by: Claude Opus 4.8 <noreply@anthropic.com> Signed-off-by: Brett Wines <bwines@slack-corp.com>
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
Background / Why?
The Snake load shedder keys its per-valve self-contention layer on a field of
ExecuteOptions, but that field was namedunique_idwhile both the Snake RFC and theloadshedpackage call the concept a "valve ID". The mismatch made the wiring confusing to follow — call sites readGetUniqueId()and immediately passed the result intoAcquire(ctx, valveID, ...), so a reader had to know thatunique_idwas the valve ID. The RFC specifies the field should be namedloadshed_valve_id.This renames the proto field
unique_id→loadshed_valve_id. Field number 22 is unchanged, so the wire format stays backwards-compatible; only the Go symbol and JSON name change.ExecuteOptionsis forwarded from vtgate to vttablet wholesale, so there is no per-field passthrough to update — the only readers are the two Snake acquire sites (QueryExecutor.getConnandTxPool.Begin), which now callGetLoadshedValveId().While here, the "an empty valve ID is valid" explanation that previously sat at both call sites is moved into
Snake.Acquire's doc comment, where the contract actually lives, so it is not duplicated and is visible to any future caller.The generated
.pb.gofiles were regenerated with the sameprotoc-gen-goversion already used for the checked-in code (v1.36.11), so the diff is limited to the rename rather than a toolchain-version reformat.Testing
Updated the existing Snake unit tests to use the renamed field (
LoadshedValveIdinExecuteOptionsliterals) and rango testforgo/vt/vttablet/tabletserverandgo/vt/vttablet/tabletserver/loadshed.go build ./go/vt/...confirms the rename is consistent across the tree (the only non-generated readers are the two acquire sites).AI disclosure: Claude Code assisted with development. Every line of code was either written by or carefully reviewed by me :)