Repository navigation
Add max_grv_queue_delay transaction option - #13085
tclinkenbeard-oai merged 17 commits into
Conversation
tclinkenbeard-oai
left a comment
There was a problem hiding this comment.
Generated by Codex.
What is it trying to do?
This adds a max_grv_queue_delay transaction option. When set, the native client forwards the threshold through GRV requests, and the GRV proxy can reject incoming non-immediate GRV requests with transaction_grv_queue_rejected if its ratekeeper-based queue-delay estimate exceeds the threshold. The PR also adds a simulation workload for the option and exposes the setting in mako.
Is it correct?
I think the implementation is correct by inspection. The option is parsed as a bounded integer transaction option, carried through the client GRV batcher key so coalesced requests share the same threshold, serialized on GetReadVersionRequest, and enforced before normal GRV queue accounting/insertion. The new error is intentionally not added to the client retryable paths, which matches the PR description that retry/propagation decisions are left to the application.
Are there bugs?
I did not find any correctness bugs.
Are there omissions?
No blocking omissions. The new workload covers the main end-to-end behavior: no-option baseline, permissive threshold, and a tight threshold that should produce at least one rejection. It does not cover every edge, such as immediate-priority bypass or tagged requests, but those do not look necessary for this change.
Are there better ways of doing things?
Nothing I would require. The current approach keeps the option local to GRV admission and avoids changing behavior for transactions that do not set it. Keeping post-queue rejection out also makes the feature advisory rather than turning it into a hard deadline, which matches the option description.
Should this CL be LGTMd?
Yes, LGTM. I reviewed the client option plumbing, GRV proxy admission logic, rate estimate helper, workload, and mako integration. No build or test validation was run.
Result of foundationdb-pr-clang-ide on Linux RHEL 9
|
Result of foundationdb-pr-macos-m1 on macOS Ventura 13.x
|
Result of foundationdb-pr-clang-arm on Linux CentOS 7
|
Result of foundationdb-pr-macos on macOS Ventura 13.x
|
Result of foundationdb-pr-clang on Linux RHEL 9
|
Result of foundationdb-pr on Linux RHEL 9
|
Result of foundationdb-pr-cluster-tests on Linux RHEL 9
|
Result of foundationdb-pr-clang-ide on Linux RHEL 9
|
Result of foundationdb-pr-clang-arm on Linux CentOS 7
|
Result of foundationdb-pr-clang on Linux RHEL 9
|
Result of foundationdb-pr on Linux RHEL 9
|
Result of foundationdb-pr-cluster-tests on Linux RHEL 9
|
| if (args.transaction_timeout_tx > 0) { | ||
| tx.setOption(FDB_TR_OPTION_TIMEOUT, args.transaction_timeout_tx); | ||
| } | ||
| if (args.max_grv_queue_delay_ms >= 0) { |
| } | ||
|
|
||
| int64_t queuedTransactionCount(Deque<GetReadVersionRequest> const& queue) { | ||
| int64_t count = 0; |
| ++stats->txnRequestErrors; | ||
| } | ||
|
|
||
| bool rejectIncomingForMaxGrvQueueDelay(GetReadVersionRequest const& req, |
There was a problem hiding this comment.
This would be a good interface to write some tests against based on canned queue contents and calculated/expected outcomes. I think it would also address whether point (3) in the AI review makes sense or not
There was a problem hiding this comment.
What I'm thinking of specifically is various scenarios with enough work that there is no delay and the answer is "not throttled", and other scenarios where there is enough work to cause a delay. Some of these scenarios could be close to the line to ensure the logic gets it right. Essentially this requires the test to contain separate, independent implementations of things like estimateRemainingGrvQueueDelay()/estimateDelay()/shouldRejectForMaxGrvQueueDelay() logic. Without this the policy calculations in the main code could break but would probably not be detected until production. Possibly a table of inputs and expected outputs could drive testing. Also putting all this stuff in a separate test-only file would make sense.
I realize this is a higher bar than typical and more code but for critical logic that just does pure calculations over in-memory state to implement important policies I feel like this is the right way to go.
There was a problem hiding this comment.
@tclinkenbeard-oai Another possibility here is the following:
- check in the code as-is
- I review existing documentation and revise it to ensure the GRV queuing/pushback is clearly documented (i.e. that I can understand it) and have you review doc PRs if any here
- I have my agent write the tests as described above.
If you are already in the middle of putting in the tests as described in my earlier comment then please continue. Alternatively we can proceed as above. I'm getting used to the idea of just going and putting in tests instead of suggesting them to people in code review.
Result of foundationdb-pr-clang-ide on Linux RHEL 9
|
Result of foundationdb-pr-clang on Linux RHEL 9
|
Result of foundationdb-pr on Linux RHEL 9
|
Result of foundationdb-pr-clang-ide on Linux RHEL 9
|
Result of foundationdb-pr-clang-arm on Linux CentOS 7
|
Result of foundationdb-pr-macos-m1 on macOS Ventura 13.x
|
Result of foundationdb-pr-clang on Linux RHEL 9
|
Result of foundationdb-pr on Linux RHEL 9
|
Result of foundationdb-pr-cluster-tests on Linux RHEL 9
|
Result of foundationdb-pr-macos on macOS Ventura 13.x
|
Result of foundationdb-pr-clang-ide on Linux RHEL 9
|
Result of foundationdb-pr-macos-m1 on macOS Ventura 13.x
|
Result of foundationdb-pr-clang on Linux RHEL 9
|
Result of foundationdb-pr-clang-arm on Linux CentOS 7
|
Result of foundationdb-pr-macos on macOS Ventura 13.x
|
Result of foundationdb-pr on Linux RHEL 9
|
Result of foundationdb-pr-cluster-tests on Linux RHEL 9
|
Result of foundationdb-pr-macos-m1 on macOS Ventura 13.x
|
Result of foundationdb-pr-clang-arm on Linux CentOS 7
|
Result of foundationdb-pr-clang-ide on Linux RHEL 9
|
Result of foundationdb-pr-cluster-tests on Linux RHEL 9
|
Result of foundationdb-pr on Linux RHEL 9
|
Result of foundationdb-pr-clang on Linux RHEL 9
|
Result of foundationdb-pr-macos on macOS Ventura 13.x
|
|
@tclinkenbeard-oai Looks like this change is causing some simulation failures. Can you please check? Some failures on Commit ID: 3dd521c |


This PR adds a new
max_grv_queue_delaytransaction option that can be used to reject GRV requests early if the GRV proxy estimates that the request would be queued for too long. This is particularly useful for clients with tight deadlines that want early feedback that their transactions cannot be started. These clients will receive a newtransaction_grv_queue_rejectederror. This error is not retryable by default, so retry/propagation decisions much be made at the application layer.A new
MaxGrvQueueDelayWorkloadworkload is added to test this new transaction option.For clients that choose not to set this new option, behavior is unchanged.