Skip to content

relay: add CrossExecFilter for executor-crossing track/fetch delivery#327

Merged
afrind merged 1 commit into
mainfrom
pr327
May 25, 2026
Merged

relay: add CrossExecFilter for executor-crossing track/fetch delivery#327
afrind merged 1 commit into
mainfrom
pr327

Conversation

@afrind
Copy link
Copy Markdown
Contributor

@afrind afrind commented May 25, 2026

CrossExecFilter (TrackConsumer), CrossExecSubgroupFilter (SubgroupConsumer),
and FetchCrossExecFilter (FetchConsumer) each forward all calls to a target
executor via fire-and-forget lambdas. Requires a FIFO executor so delivery
order is preserved without locks.

beginSubgroup() returns a CrossExecSubgroupFilter immediately; the inner
beginSubgroup runs on the target executor, and FIFO ordering guarantees it
completes before any subsequent object/endOf* lambdas execute.

deepCopyPayload (default true for subgroup/track, false for fetch) calls
cloneCoalesced()+unshare() before crossing executor boundaries to prevent
contention on the underlying buffer's atomic refcount.

SubgroupConsumerUtil.h adds ObjectPayloadByteTracker, a helper that tracks
multi-part object byte delivery so objectPayload() can return the correct
ObjectPublishStatus.

Full unit test suite (CrossExecFilterTest.cpp) using folly::ManualExecutor.

Co-Authored-By: Claude Sonnet 4.6 noreply@anthropic.com



This change is Reviewable

CrossExecFilter (TrackConsumer), CrossExecSubgroupFilter (SubgroupConsumer),
and FetchCrossExecFilter (FetchConsumer) each forward all calls to a target
executor via fire-and-forget lambdas. Requires a FIFO executor so delivery
order is preserved without locks.

beginSubgroup() returns a CrossExecSubgroupFilter immediately; the inner
beginSubgroup runs on the target executor, and FIFO ordering guarantees it
completes before any subsequent object/endOf* lambdas execute.

deepCopyPayload (default true for subgroup/track, false for fetch) calls
cloneCoalesced()+unshare() before crossing executor boundaries to prevent
contention on the underlying buffer's atomic refcount.

SubgroupConsumerUtil.h adds ObjectPayloadByteTracker, a helper that tracks
multi-part object byte delivery so objectPayload() can return the correct
ObjectPublishStatus.

Full unit test suite (CrossExecFilterTest.cpp) using folly::ManualExecutor.

Co-Authored-By: Claude Sonnet 4.6 <noreply@anthropic.com>
@afrind afrind merged commit 5df0709 into main May 25, 2026
15 of 19 checks passed
@afrind afrind deleted the pr327 branch May 25, 2026 16:41
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