You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
The current manifest snapshot archiving process requires deduplication during every merge operation involving a single snapshot file and multiple SST files. Let's first look at the snapshot archiving procedure:
The duplication scenario can only exist when the manifest merger reads an old metafile that has already gone through the merging procedure once. This inconsistent problem is due to the failure to delete the meta files after the persistence of the snapshot file. The failure itself can lie in many reasons like network problem or crashing of the running process.
This issue is an idempotency problem, or in other words, the merge, write, and delete operations must be performed within a single transaction.
Proposal
We could design a batch operation transaction mechanism to ensure that:
If the last merge procedure was successfully completed, there is no need to perform deduplication.
If the last merge procedure was partially completed, deduplication is required.
If it is unclear whether the last merge procedure was successful or not, deduplication should be performed.
To determine which scenario applies, we need to record the states of the merge operations and store them locally. This allows us to handle the scenarios as follows:
a. If the state file does not exist, proceed to scenario 3.
b. If the state file indicates that the delete operation is complete, proceed to scenario 1.
c. If the state file indicates that the snapshot was successfully stored but the delete operation is incomplete, proceed to scenario 2.
The pseudo code is like below:
fndo_merge(){let sstfiles = ...;let snapshot = ...;let ops = MergeOps::new(snapshot, sstfiles);{let ops_guard = BatchOpsGuard::transaction(ops);
ops_guard.execute(|| batch_ops.merge_sst_meta());
ops_guard.execute(|| batch_ops.store_snapshot());
ops_guard.execute(|| batch_ops.delete_sst_meta());}}traitBatchOps{typeState;fnneed_redo(state:State) -> bool;fnredo(state:State) -> Result<()>;fnstart() -> State;fnfinish() -> State;}implBatchOpsforMergeOps{typeState = MergeState;fnneed_redo(state:State) -> bool{// check the states to determine if to redo}fnredo(state:State) -> Result<()>{// just do dedup}fnstart() -> State;fnfinish() -> State;fnmerge_sst_meta(..) -> State;fnstore_snapshot(..) -> State;fndelete_sst_meta(..) -> State;}implBatchOpsGuard{fntransaction(ops) -> Selfwhereops:BatchOps;{let state = read_file(..);if ops.need_redo(state){
ops.redo(state);}let state = ops.start();save_file(state);Self{ ops }}fnexecute(&self,fn:F)whereF:Fn -> BatchOps::State{let state = fn();save_file(state);}}implDropforBatchOpsGuard{fndrop(&mutself){let state = self.ops.finish();save_file(state);}}
Additional Context
No response
The text was updated successfully, but these errors were encountered:
Describe This Problem
The current manifest snapshot archiving process requires deduplication during every merge operation involving a single snapshot file and multiple SST files. Let's first look at the snapshot archiving procedure:
The duplication scenario can only exist when the manifest merger reads an old metafile that has already gone through the merging procedure once. This inconsistent problem is due to the failure to delete the meta files after the persistence of the snapshot file. The failure itself can lie in many reasons like network problem or crashing of the running process.
This issue is an idempotency problem, or in other words, the merge, write, and delete operations must be performed within a single transaction.
Proposal
We could design a batch operation transaction mechanism to ensure that:
To determine which scenario applies, we need to record the states of the merge operations and store them locally. This allows us to handle the scenarios as follows:
a. If the state file does not exist, proceed to scenario 3.
b. If the state file indicates that the delete operation is complete, proceed to scenario 1.
c. If the state file indicates that the snapshot was successfully stored but the delete operation is incomplete, proceed to scenario 2.
The pseudo code is like below:
Additional Context
No response
The text was updated successfully, but these errors were encountered: