[feature][bug] Add tcp transport event dispatcher unsched flag & fix RDMA event dispatcher unsched flag#3238
Merged
yanglimingcn merged 8 commits intoapache:masterfrom Mar 9, 2026
Merged
Conversation
…atcher unsched flag
[feature][bugfix] Add tcp transport event dispatcher unsched flag & fix RDMA event dispatcher
There was a problem hiding this comment.
Pull request overview
This PR unifies “unsched” scheduling behavior across TCP and RDMA transports by introducing a single dispatcher-layer flag/helper, and updates transport event processing to use that unified decision (also correcting RDMA’s urgent/background selection).
Changes:
- Added
event_dispatcher_edisp_unschedandEventDispatcherUnsched()as the single source of truth for “unsched” behavior (with legacy RDMA flag OR’ed in when enabled). - Updated
TcpTransport::ProcessEventandRdmaTransport::ProcessEventto pickbthread_start_urgentvsbthread_start_backgroundviaEventDispatcherUnsched(). - Updated RDMA docs to describe the unified flag and deprecation of
rdma_edisp_unsched.
Reviewed changes
Copilot reviewed 8 out of 8 changed files in this pull request and generated 5 comments.
Show a summary per file
| File | Description |
|---|---|
| src/brpc/tcp_transport.cpp | Switches ProcessEvent scheduling decision to EventDispatcherUnsched(). |
| src/brpc/rdma_transport.cpp | Uses unified unsched helper and fixes urgent/background selection for RDMA. |
| src/brpc/rdma/rdma_endpoint.h | Removes the legacy rdma_edisp_unsched declaration from an installed header. |
| src/brpc/rdma/rdma_endpoint.cpp | Removes the legacy rdma_edisp_unsched definition (re-homed elsewhere). |
| src/brpc/event_dispatcher.h | Declares new unified flag and helper (but has an incorrect semantics comment). |
| src/brpc/event_dispatcher.cpp | Defines new unified flag + legacy flag (deprecated) and implements EventDispatcherUnsched(). |
| docs/en/rdma.md | Documents unified flag semantics and deprecation (contains an incorrect example). |
| docs/cn/rdma.md | Same as English RDMA doc update (contains an incorrect example). |
💡 Add Copilot custom instructions for smarter, more guided reviews. Learn how to get started.
[note] Solving document content issues
yanglimingcn
reviewed
Mar 9, 2026
Contributor
|
LGTM |
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.
Event Dispatcher Unsched Flag
What problem does this PR solve?
Problem Summary:
rdma_edisp_unsched), while TCP had no unified switch.bthread_start_urgentandbthread_start_backgroundlogic was reversed, causing behavior opposite to expected unsched semantics.What is changed and the side effects?
Changed:
event_dispatcher_edisp_unsched.EventDispatcherUnsched()helper inevent_dispatcher.{h,cpp}as single source of truth.TcpTransport::ProcessEventandRdmaTransport::ProcessEventto useEventDispatcherUnsched():false->bthread_start_urgenttrue->bthread_start_backgroundbthread_start_urgentandbthread_start_backgroundbranches were previously swapped.rdma_edisp_unschedand kept compatibility through dispatcher-layer unified check.test/brpc_event_dispatcher_unittest.cpp:event_dispatcher_unsched_by_unified_flagevent_dispatcher_unsched_by_legacy_rdma_flag(whenBRPC_WITH_RDMA)tcp_unsched_true_returns_before_onedge_finishtcp_unsched_false_blocks_caller_when_single_workerEffects:
event_dispatcher_edisp_unsched=truemay reduce immediate foreground switching of dispatcher path.rdma_edisp_unschedis deprecated.Check List: