[Store] Preserve ReplicaID during standby restore - #3811
Conversation
|
Heads up on an overlap you will want to sequence deliberately: #3806 rewrites the validation and construction phases of the same RestoreFromStandbySnapshot for issue #3760 (tolerant per-entry restore with keep-latest overlap resolution), and it lands on the same construction sites this PR edits. One integration point worth deciding before either merges: whether an invalid or duplicate ReplicaID should reject just that object or the whole restore. The tolerant-restore model in #3806 would carry your ID validation naturally as a per-entry rejection with a reason label, keeping the atomicity you want for IDs without reintroducing all-or-nothing for unrelated corruption. |
|
One edge case remains in the current restore path: if a standby snapshot contains ReplicaID 0, UINT64_MAX, or duplicate ReplicaIDs within one object, the pre-scan returns INVALID_PARAMS before any object is committed. Since the supervisor currently treats INVALID_PARAMS as a fatal recovery error, a single malformed object can prevent the promoted primary from serving, and otherwise valid objects in the same snapshot are not restored. This is known malformed-state behavior and should not occur in normal operation. For I00, we intentionally choose fail-closed over partial recovery: we do not regenerate an ID or arbitrarily select one of the conflicting replicas, because either choice could expose metadata with an incorrect identity. The trade-off is reduced availability, and potentially losing otherwise valid objects from the same malformed snapshot, in exchange for not introducing incorrect data. A follow-up PR will define object-level/degraded recovery and explicit safe-discard rules, and will narrow the recovery error classification and handling, including the overly broad recovery-failure scope identified in #3774. I00 keeps the current all-or-nothing behavior until that policy is implemented. |
|
issue: Please make ID exhaustion explicit instead of allowing |
|
Thanks for catching this edge case. In normal operation, exhausting the full We will keep the existing |
|
Thanks for clarifying. I agree that fully propagating allocator-exhaustion errors may require a broader follow-up, but the restore boundary introduced here should not seed an immediately invalid allocator state. Restoring @Aionw @he-yufeng, could you weigh in on whether I00 should at least reject this restored high-water mark, while leaving the broader allocator API redesign to a follow-up? |
Description
Implement PR-I00 standby promotion identity semantics. Restore now preserves descriptor ReplicaID values, rejects invalid or duplicate IDs within one object, and advances the shared Replica::next_id_ high-water mark only after a complete successful restore. Failed restores remain atomic and do not consume IDs.
Module
mooncake-store)Type of Change
How Has This Been Tested?
Test commands:
Also compiled the changed production and HA test translation units using the existing CMake compile database.
Test results:
extern/pybind11submodule, so a clean CMake configure cannot complete)Checklist
AI Assistance Disclosure