Skip to content

Commit

Permalink
Only truncate AOF if both stores are checkpointed
Browse files Browse the repository at this point in the history
  • Loading branch information
chenhao-ye committed Jun 12, 2024
1 parent 66ebaa7 commit 6d7ebb1
Showing 1 changed file with 12 additions and 8 deletions.
20 changes: 12 additions & 8 deletions libs/server/StoreWrapper.cs
Original file line number Diff line number Diff line change
Expand Up @@ -693,15 +693,19 @@ private async Task InitiateCheckpoint(bool full, CheckpointType checkpointType,
objectStoreCheckpointResult = await objectStore.TakeHybridLogCheckpointAsync(checkpointType, tryIncremental);
}

// If cluster is enabled the replication manager is responsible for truncating AOF
if (serverOptions.EnableCluster && serverOptions.EnableAOF)
// Only truncate AOF if both stores are checkpointed
if (storeType == StoreType.All)
{
clusterProvider.SafeTruncateAOF(storeType, full, CheckpointCoveredAofAddress, storeCheckpointResult.token, objectStoreCheckpointResult.token);
}
else
{
appendOnlyFile?.TruncateUntil(CheckpointCoveredAofAddress);
appendOnlyFile?.Commit();
// If cluster is enabled the replication manager is responsible for truncating AOF
if (serverOptions.EnableCluster && serverOptions.EnableAOF)
{
clusterProvider.SafeTruncateAOF(storeType, full, CheckpointCoveredAofAddress, storeCheckpointResult.token, objectStoreCheckpointResult.token);
}
else
{
appendOnlyFile?.TruncateUntil(CheckpointCoveredAofAddress);
appendOnlyFile?.Commit();
}
}

if (objectStore != null)
Expand Down

0 comments on commit 6d7ebb1

Please sign in to comment.