test: pin batch region-error retry contract (#330) - #546
Merged
Conversation
s2x
force-pushed
the
fix/330-test-batch-region-error-retry
branch
from
September 9, 2026 20:14
5c6febb to
62b5d76
Compare
s2x
marked this pull request as ready for review
September 9, 2026 20:14
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.
Description
Implements #330 ([TEST-10]): pins the retry behaviour for region errors returned inside batch responses (
RawBatchGetResponse/RawBatchPutResponsetop-levelregion_error).batchGetWithRetry()runs only the dispatch insideRetryExecutor::execute(); the region-error check happens inBatchAsyncExecutor's wait phase (CheckedGrpcFuture::waitForExecutor()→RegionErrorHandler::check()), outside the retry executor entirely. The pinned contract: a region error inside a batch response is not retried, does not switch the cached leader, and does not invalidate the region cache — it surfaces as aBatchPartialFailureException.Changes
testBatchGetNotLeaderInsideResponseIsNotRetriedSurfacesAsPartialFailure— NotLeader hint (store 2) inside the response drives exactly one RPC (no reissue), no cache invalidation, and aBatchPartialFailureExceptioncarrying aRegionExceptionwith the NotLeader hint, keyed by regionIdtestEpochNotMatchInsideBatchResponseIsNotInvalidatedEither— pins the multi-regionfromCallable()waiter path: non-NotLeader region errors also surface without invalidationtestBatchPutPartialFailureReportsWhichRegionsFailedAndDispatched— 3 regions, region 2 fails:getRegionErrors()keys identify region 2, all 3 regions dispatched before the wait-phase short-circuit,getTotalRegions() == 3testBatchGetSplitsIntoSubBatchesAtMaxBatchLimit— 600 keys in one region → exactly 2RawBatchGetRPCs (512-key limit)testBatchPutSplitsOnByteSizeNotOnlyCount— 10 × ~2 KB pairs → exactly 2RawBatchPutRPCs (16384-byte limit)testBatchGetWithDuplicateKeysDoesNotDuplicateRegionDispatch— 3 keys (2 duplicates) → exactly 1 RPCRawKvBatchhardcodesnew Call(...), the region-error tests drive the exact wait-boundary composition RawKvBatch builds (CheckedGrpcFuture::fromGrpcFuture/fromCallableover a mocked\Grpc\Call) throughBatchAsyncExecutor::executeParallel(); the split tests count dispatches via thegetChannelmock against a dead channelRawKvBatch.phpstatement coverage: 15/352 (4.3%) → 220/348 (63%)[Unreleased]Tests entry; learnings added todocs/helpers/faq.mdCloses #330
Changelog
BatchPartialFailureExceptionwith per-region keys; auto-split limits (512 keys / 16384 bytes) pinned by dispatch counts;RawKvBatch.phpcoverage 4.3% → 63%. ([TEST-10] Pin the retry behaviour for region errors returned inside batch responses #330)Code Review