Skip to content

Commit 41ada27

Browse files
committed
Merge branch 'fix-retrying-pending-checkpoint' into devbuild
2 parents 1312157 + b519608 commit 41ada27

File tree

1 file changed

+10
-0
lines changed

1 file changed

+10
-0
lines changed

packages/common/src/client/sync/stream/AbstractStreamingSyncImplementation.ts

Lines changed: 10 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -714,6 +714,8 @@ The next upload iteration will be delayed.`);
714714

715715
if (isStreamingSyncCheckpoint(line)) {
716716
targetCheckpoint = line.checkpoint;
717+
// New checkpoint - existing validated checkpoint is no longer valid
718+
pendingValidatedCheckpoint = null;
717719
const bucketsToDelete = new Set<string>(bucketMap.keys());
718720
const newBuckets = new Map<string, BucketDescription>();
719721
for (const checksum of line.checkpoint.buckets) {
@@ -735,7 +737,13 @@ The next upload iteration will be delayed.`);
735737
if (result.endIteration) {
736738
return;
737739
} else if (!result.applied) {
740+
// "Could not apply checkpoint due to local data". We need to retry after
741+
// finishing uploads.
738742
pendingValidatedCheckpoint = targetCheckpoint;
743+
} else {
744+
// Nothing to retry later. This would likely already be null from the last
745+
// checksum or checksum_diff operation, but we make sure.
746+
pendingValidatedCheckpoint = null;
739747
}
740748
} else if (isStreamingSyncCheckpointPartiallyComplete(line)) {
741749
const priority = line.partial_checkpoint_complete.priority;
@@ -771,6 +779,8 @@ The next upload iteration will be delayed.`);
771779
if (targetCheckpoint == null) {
772780
throw new Error('Checkpoint diff without previous checkpoint');
773781
}
782+
// New checkpoint - existing validated checkpoint is no longer valid
783+
pendingValidatedCheckpoint = null;
774784
const diff = line.checkpoint_diff;
775785
const newBuckets = new Map<string, BucketChecksum>();
776786
for (const checksum of targetCheckpoint.buckets) {

0 commit comments

Comments
 (0)