Skip to content

fix(store): reject cross-shard duplicates during standby restore - #3527

Merged
ykwd merged 1 commit into
kvcache-ai:mainfrom
982945902:codex/20260819-standby-restore-duplicate-route
Aug 21, 2026
Merged

fix(store): reject cross-shard duplicates during standby restore#3527
ykwd merged 1 commit into
kvcache-ai:mainfrom
982945902:codex/20260819-standby-restore-duplicate-route

Conversation

@982945902

@982945902 982945902 commented Aug 19, 2026

Copy link
Copy Markdown
Contributor

Summary

  • reject standby snapshot entries when the same (tenant, key) already exists under the current metadata routing
  • perform the duplicate check before restoring metrics, segment state, or routing metadata
  • add regression coverage for ungrouped-to-grouped and grouped-to-different-group cross-shard duplicates

Root cause

RestoreFromStandbySnapshot() checked only the shard selected by the incoming snapshot entry's group_id. If an existing object was routed by its key or by another group, restore could insert duplicate metadata into a different shard.

Tests

  • MasterServiceHATest.RestoreRejectsUngroupedObjectDuplicatedIntoAnotherShard
  • MasterServiceHATest.RestoreRejectsGroupedObjectDuplicatedIntoAnotherGroupShard
  • all MasterServiceHATest.Restore* tests: 11 passed
  • full master_service_ha_test: 83 passed, 1 unrelated failure (MasterServiceBatchRecordE2ETest.PromotionCatchesUpToDurablePrefix) because the local build used STORE_USE_ETCD=OFF; tracked by [Bug]: HotStandbyService tests do not exercise claimed etcd behaviors #3496
  • git diff --check

Fixes #3398

@Icedcoco Icedcoco left a comment

Copy link
Copy Markdown
Collaborator

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

LGTM

@ykwd
ykwd merged commit f4e1de1 into kvcache-ai:main Aug 21, 2026
25 checks passed
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Projects

None yet

Development

Successfully merging this pull request may close these issues.

[Bugfix] Standby restore misses duplicate objects routed to another shard

3 participants