Convert LoadBalance.actor.h to standard coroutines - #13854
Convert LoadBalance.actor.h to standard coroutines#13854tclinkenbeard-oai wants to merge 3 commits into
Conversation
This comment has been minimized.
This comment has been minimized.
This comment has been minimized.
This comment has been minimized.
This comment has been minimized.
This comment has been minimized.
This comment has been minimized.
This comment has been minimized.
This comment has been minimized.
This comment has been minimized.
This comment has been minimized.
This comment has been minimized.
This comment has been minimized.
This comment has been minimized.
This comment has been minimized.
This comment has been minimized.
This comment has been minimized.
This comment has been minimized.
This comment has been minimized.
This comment has been minimized.
This comment has been minimized.
This comment has been minimized.
This comment has been minimized.
This comment has been minimized.
This comment has been minimized.
This comment has been minimized.
This comment has been minimized.
This comment has been minimized.
tclinkenbeard-oai
left a comment
There was a problem hiding this comment.
Generated by Codex.
What is it trying to do?
Convert FoundationDB’s load-balancing, replica-comparison, and testing-storage-server comparison actors to standard C++ coroutines. Consolidate the implementation into LoadBalance.h, update consumers and documentation, and add regression tests for completed-request ownership.
Is it correct?
The migration preserves the important behavioral contracts: request retries, cancellation, at-most-once delivery handling, failure-monitor integration, speculative second requests, queue-model accounting, replica comparison, and deterministic race ordering.
Both load-balancer implementations move their owning request and server-team parameters into coroutine-body locals, ensuring those resources are released before completion callbacks run. The new regression tests exercise real WaitMetricsRequest objects and verify that completed futures no longer retain server-team references or reply promises.
No serialized fields, persisted formats, or protocol compatibility boundaries are changed.
Current-head clang-format and clang-tidy have passed. The Windows check failed while downloading Boost with HTTP 503, before FoundationDB was configured or built; the same dependency failure is visible on unrelated changes and upstream main, so it does not indicate a defect in this PR.
This review was source-only; I did not run builds or tests.
Are there bugs?
I did not find any remaining correctness bugs.
Are there omissions?
The new regression tests cover successful, single-server request completion but do not directly exercise cancellation during an outstanding request, retryable errors, at-most-once failures, or speculative second requests. These are residual coverage gaps rather than demonstrated defects.
Two references to the deleted actor header also remain in design/AI-generated/subsystem_02_rpc_transport.md; the primary hand-written load-balancing design document has already been corrected.
Are there better ways of doing things?
race(firstRequestData.response, secondDelay) materializes an ErrorOr<Reply> inside its result variant even though this call site only uses the winning index and rereads the response separately. An index-only completion helper could avoid that reply copy on the read path if profiling demonstrates that it matters. The previous implementation also allocated a helper coroutine, so the current code does not establish an additional allocation by itself.
Should this CL be LGTMd?
I would wait for the current-head FoundationDB builders and cluster tests to complete, then LGTM if they pass. The outstanding Windows failure is an independently verified external Boost-download problem, not a source-level correctness blocker.
Result of foundationdb-pr-clang-arm on Linux RHEL 9
|
Result of foundationdb-pr-clang-ide on Linux RHEL 9
|
Result of foundationdb-pr-macos on macOS 14.x
|
Result of foundationdb-pr on Linux RHEL 9
|
Result of foundationdb-pr-clang on Linux RHEL 9
|
This comment has been minimized.
This comment has been minimized.
Result of foundationdb-pr-cluster-tests on Linux RHEL 9
|
Result of foundationdb-pr-macos-m1 on macOS 14.x
|
Summary
fdbrpc/LoadBalance.hand update direct includes so the header no longer requires actor compilation.Never()handling, race ordering, replica consistency checks, andVoid-reply compatibility.Testing
fdbrpc_test -f /fdbrpc/waitValueOrSignal/— 3 tests passed.fdbclient_test -f /StorageServerInterface/TSSCompare/— 1 test passed.fdbserversuccessfully.tests/fast/CycleTest.tomlwith replica consistency checking enabled — 2 simulation tests passed.clang-formatandgit diff --checkpassed.