Skip to content

fix: fail closed instead of silently dropping keys whose region cannot be resolved (#244) - #544

Merged
s2x merged 9 commits into
masterfrom
fix/244-fail-unresolved-region-keys-ci
Sep 9, 2026
Merged

fix: fail closed instead of silently dropping keys whose region cannot be resolved (#244)#544
s2x merged 9 commits into
masterfrom
fix/244-fail-unresolved-region-keys-ci

Conversation

@s2x

@s2x s2x commented Sep 9, 2026

Copy link
Copy Markdown
Member

Description

Closes #244

Changes

  • Fail closed: RegionResolver::batchResolveRegions() throws a TiKvException naming the first key PD could not resolve to a region, instead of silently omitting it (previously batchPut() reported success without writing the key and batchGet() returned null as if the key did not exist)
  • Fix the root cause: scanRegions($minKey, $maxKey) is half-open, so a batch's maximum key sitting on a region boundary always failed resolution — the scan now uses $maxKey . "\x00" as its upper bound, mirroring client-go's inclusive resolution of the last key
  • Defense in depth: RegionGrouper::groupKeysByRegionBatch(), groupItemsByRegion() and TxnReader::batchGetFromTiKV() throw on an unresolvable key instead of continue-ing; the "silently skipped" contract is removed from the docs
  • Update affected unit tests (including TransactionTest tests that silently passed while every key was dropped before any RPC) and add new coverage
  • Add CHANGELOG entry and FAQ lessons

Changelog

Code Review

  • Pending subagent code review

@s2x s2x self-assigned this Sep 9, 2026
@s2x
s2x force-pushed the fix/244-fail-unresolved-region-keys-ci branch 2 times, most recently from f169cd1 to 8ce9a38 Compare September 9, 2026 18:54
s2x added 7 commits September 9, 2026 22:38
…on contract (#244)

Since #244 batch keys that cannot be resolved to a region throw instead of
being silently dropped. Update the Grpc-suite tests that relied on the old
silent-drop path: stub scanRegions where resolution is required and expect
BatchPartialFailureException at the (unreachable) transport layer, and expect
TiKvException when ingest() is called with an unresolvable key.
@s2x
s2x marked this pull request as ready for review September 9, 2026 20:44
@s2x
s2x force-pushed the fix/244-fail-unresolved-region-keys-ci branch from 698fd71 to 0e7d9f6 Compare September 9, 2026 20:49
@s2x
s2x merged commit 8527a0c into master Sep 9, 2026
9 checks passed
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.

[REG-13] Fail instead of silently dropping keys whose region cannot be resolved

1 participant