diff --git a/libs/cluster/Server/ClusterProvider.cs b/libs/cluster/Server/ClusterProvider.cs index b9636242a2..9153f0cb5c 100644 --- a/libs/cluster/Server/ClusterProvider.cs +++ b/libs/cluster/Server/ClusterProvider.cs @@ -156,6 +156,10 @@ public void SafeTruncateAOF(StoreType storeType, bool full, long CheckpointCover // Used to delete old checkpoints and cleanup and also cleanup during attachment to new primary replicationManager.AddCheckpointEntry(entry, storeType, full); + // Only truncate AOF if 1) both stores were checkpointed OR 2) only Main was checkpointed but Object was not enabled + if (storeType != StoreType.All && !(storeType == StoreType.Main && serverOptions.DisableObjects)) + return; + if (clusterManager.CurrentConfig.LocalNodeRole == NodeRole.PRIMARY) _ = replicationManager.SafeTruncateAof(CheckpointCoveredAofAddress); else diff --git a/libs/server/StoreWrapper.cs b/libs/server/StoreWrapper.cs index ce84ac6da3..c65aa2e3eb 100644 --- a/libs/server/StoreWrapper.cs +++ b/libs/server/StoreWrapper.cs @@ -693,8 +693,6 @@ private async Task InitiateCheckpoint(bool full, CheckpointType checkpointType, objectStoreCheckpointResult = await objectStore.TakeHybridLogCheckpointAsync(checkpointType, tryIncremental); } - // Only truncate AOF if both stores are checkpointed - if (storeType == StoreType.All) { // If cluster is enabled the replication manager is responsible for truncating AOF if (serverOptions.EnableCluster && serverOptions.EnableAOF) @@ -703,8 +701,11 @@ private async Task InitiateCheckpoint(bool full, CheckpointType checkpointType, } else { - appendOnlyFile?.TruncateUntil(CheckpointCoveredAofAddress); - appendOnlyFile?.Commit(); + if (storeType == StoreType.All || (storeType == StoreType.Main && serverOptions.DisableObjects)) + { + appendOnlyFile?.TruncateUntil(CheckpointCoveredAofAddress); + appendOnlyFile?.Commit(); + } } }