Threading refactor (3/7): Executor isolation#3
Open
igorbernstein2 wants to merge 5 commits into
Open
Conversation
igorbernstein2
force-pushed
the
threading-refactor-phase-3
branch
from
June 17, 2026 20:02
8f18528 to
b32ff78
Compare
igorbernstein2
force-pushed
the
threading-refactor-phase-2
branch
from
June 17, 2026 20:02
a702c4e to
0f6a9e4
Compare
mutianf
approved these changes
Jun 18, 2026
nimf
approved these changes
Jun 20, 2026
| featureFlags = featureFlags.toBuilder().setSessionsRequired(true).build(); | ||
| } | ||
|
|
||
| java.util.concurrent.ExecutorService userCallbackExecutor = |
There was a problem hiding this comment.
why do we need to create one here. Is there any problem always create that in the Client only?
Owner
Author
There was a problem hiding this comment.
The intent is to extract it from the gax InstantiatingGrpcChannelProvider/StubSettings in case the user overrode it
| deadline, | ||
| isIdempotent, | ||
| tracer, | ||
| new OpExecutor(MoreExecutors.directExecutor(), t -> {})); |
There was a problem hiding this comment.
I see the handler here is no-op for tests. But to make sure we can only use this method in tests maybe change it to package-private?
igorbernstein2
force-pushed
the
threading-refactor-phase-2
branch
from
June 22, 2026 21:41
0f6a9e4 to
932ad80
Compare
igorbernstein2
force-pushed
the
threading-refactor-phase-3
branch
from
June 22, 2026 21:41
b32ff78 to
5c4f476
Compare
Client (and ShimImpl) own a dedicated bigtable-callback-%d cached pool, plumbed through *Async / TableBase. A blocked user callback can no longer starve heartbeats, retry delays, or pool bookkeeping (all of which run on backgroundExecutor). The op-level SerializingExecutor in a later commit will dispatch onto this pool.
VOperationImpl now constructs OpExecutor over a per-call SequentialExecutor on the shared userCallbackExecutor, replacing the per-call SynchronizationContext. OpExecutor gains an UncaughtExceptionHandler ctor arg — the safety net that the removed RetryingVRpc-owned SyncContext provided. The 3-arg VRpcCallContext.create defaults to a no-op handler for tests; production callers go through VOperationImpl.
CallOptions.withExecutor(MoreExecutors.directExecutor()) on the session stream so Netty I/O threads deliver SessionStream.Listener callbacks directly; sessionSyncContext immediately trampolines off them.
igorbernstein2
force-pushed
the
threading-refactor-phase-2
branch
from
June 29, 2026 17:20
932ad80 to
f285a29
Compare
igorbernstein2
force-pushed
the
threading-refactor-phase-3
branch
from
June 29, 2026 17:20
5c4f476 to
e4ca57f
Compare
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.
Summary
Phase 3 of 7. Decouples thread pools so that a blocked user callback can't starve session bookkeeping, and pushes the per-op executor onto a serializing path off the shared user-callback pool.
What's in here
chore: isolate user-callback executor on a cached thread poolClient(andShimImpl) own a dedicatedbigtable-callback-%dcached pool, plumbed through*Async/TableBase. A blocked user callback can no longerbackgroundExecutor).chore: back OpExecutor with SerializingExecutor(userCallbackExecutor)VOperationImplnow constructsOpExecutorover a per-callSequentialExecutoron the shareduserCallbackExecutor, replacing the per-callSynchronizationContext.OpExecutorgains anUncaughtExceptionHandlerctor arg — the safety net the removedRetryingVRpc-owned SyncContext provided.chore: configure gRPC session streams with DirectExecutorCallOptions.withExecutor(MoreExecutors.directExecutor())on the session stream so Netty I/O threads deliverSessionStream.Listenercallbacks directly;sessionSyncContextimmediately trampolines off them.Stack position
threading-refactor-phase-2threading-refactor-phase-4— pool & op-executor contract