Skip to content

Convert LoadBalance.actor.h to standard coroutines - #13854

Draft
tclinkenbeard-oai wants to merge 3 commits into
apple:mainfrom
tclinkenbeard-oai:dev/tclinkenbeard/loadbalance-header-coroutines-20260812
Draft

Convert LoadBalance.actor.h to standard coroutines#13854
tclinkenbeard-oai wants to merge 3 commits into
apple:mainfrom
tclinkenbeard-oai:dev/tclinkenbeard/loadbalance-header-coroutines-20260812

Conversation

@tclinkenbeard-oai

Copy link
Copy Markdown
Collaborator

Summary

  • Convert load-balancing, replica-comparison, and TSS-comparison actors to standard C++ coroutines.
  • Consolidate the migrated implementation into fdbrpc/LoadBalance.h and update direct includes so the header no longer requires actor compilation.
  • Preserve request ownership, cancellation, inert Never() handling, race ordering, replica consistency checks, and Void-reply compatibility.

Testing

  • fdbrpc_test -f /fdbrpc/waitValueOrSignal/ — 3 tests passed.
  • fdbclient_test -f /StorageServerInterface/TSSCompare/ — 1 test passed.
  • Built fdbserver successfully.
  • tests/fast/CycleTest.toml with replica consistency checking enabled — 2 simulation tests passed.
  • clang-format and git diff --check passed.

@foundationdb-ci

This comment has been minimized.

@foundationdb-ci

This comment has been minimized.

@foundationdb-ci

This comment has been minimized.

@foundationdb-ci

This comment has been minimized.

@foundationdb-ci

This comment has been minimized.

@foundationdb-ci

This comment has been minimized.

@foundationdb-ci

This comment has been minimized.

@foundationdb-ci

This comment has been minimized.

@foundationdb-ci

This comment has been minimized.

@foundationdb-ci

This comment has been minimized.

@foundationdb-ci

This comment has been minimized.

@foundationdb-ci

This comment has been minimized.

@foundationdb-ci

This comment has been minimized.

@foundationdb-ci

This comment has been minimized.

@tclinkenbeard-oai tclinkenbeard-oai left a comment

Copy link
Copy Markdown
Collaborator Author

Choose a reason for hiding this comment

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

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.

@foundationdb-ci

Copy link
Copy Markdown
Contributor

Result of foundationdb-pr-clang-arm on Linux RHEL 9

  • Commit ID: 241ad54
  • Duration 0:45:16
  • Result: ✅ SUCCEEDED
  • Error: N/A
  • Build Log terminal output (available for 30 days)
  • Build Workspace zip file of the working directory (available for 30 days)

@foundationdb-ci

Copy link
Copy Markdown
Contributor

Result of foundationdb-pr-clang-ide on Linux RHEL 9

  • Commit ID: 241ad54
  • Duration 0:53:26
  • Result: ✅ SUCCEEDED
  • Error: N/A
  • Build Log terminal output (available for 30 days)
  • Build Workspace zip file of the working directory (available for 30 days)

@foundationdb-ci

Copy link
Copy Markdown
Contributor

Result of foundationdb-pr-macos on macOS 14.x

  • Commit ID: 241ad54
  • Duration 1:23:26
  • Result: ✅ SUCCEEDED
  • Error: N/A
  • Build Log terminal output (available for 30 days)
  • Build Workspace zip file of the working directory (available for 30 days)

@foundationdb-ci

Copy link
Copy Markdown
Contributor

Result of foundationdb-pr on Linux RHEL 9

  • Commit ID: 241ad54
  • Duration 1:25:44
  • Result: ✅ SUCCEEDED
  • Error: N/A
  • Build Log terminal output (available for 30 days)
  • Build Workspace zip file of the working directory (available for 30 days)

@foundationdb-ci

Copy link
Copy Markdown
Contributor

Result of foundationdb-pr-clang on Linux RHEL 9

  • Commit ID: 241ad54
  • Duration 1:29:14
  • Result: ✅ SUCCEEDED
  • Error: N/A
  • Build Log terminal output (available for 30 days)
  • Build Workspace zip file of the working directory (available for 30 days)

@foundationdb-ci

This comment has been minimized.

@foundationdb-ci

Copy link
Copy Markdown
Contributor

Result of foundationdb-pr-cluster-tests on Linux RHEL 9

  • Commit ID: 241ad54
  • Duration 1:42:01
  • Result: ✅ SUCCEEDED
  • Error: N/A
  • Build Log terminal output (available for 30 days)
  • Build Workspace zip file of the working directory (available for 30 days)
  • Cluster Test Logs zip file of the test logs (available for 30 days)

@foundationdb-ci

Copy link
Copy Markdown
Contributor

Result of foundationdb-pr-macos-m1 on macOS 14.x

  • Commit ID: 241ad54
  • Duration 2:58:53
  • Result: ✅ SUCCEEDED
  • Error: N/A
  • Build Log terminal output (available for 30 days)
  • Build Workspace zip file of the working directory (available for 30 days)

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.

2 participants