Skip to content

Commit 1124bf7

Browse files
Fix finalizeData
By copilot's suggestion I fixed to if AOF and checkpoint both enabled then we need to try if aof failed then checkpoint microsoft#1825 (comment)
1 parent a90f34e commit 1124bf7

1 file changed

Lines changed: 4 additions & 2 deletions

File tree

libs/host/GarnetServer.cs

Lines changed: 4 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -671,6 +671,8 @@ private long GetActiveConnectionCount()
671671

672672
/// <summary>
673673
/// Persists data during shutdown using AOF or checkpoint based on configuration.
674+
/// Both Enabled AOF and checkpoint, but AOF is prioritized.
675+
/// IF AOF commit failed, checkpoint will be performed.
674676
/// </summary>
675677
private async Task FinalizeDataAsync(CancellationToken token)
676678
{
@@ -683,6 +685,7 @@ private async Task FinalizeDataAsync(CancellationToken token)
683685
if (commitSuccess)
684686
{
685687
logger?.LogDebug("AOF committed successfully.");
688+
return; // skip checkpoint
686689
}
687690
else
688691
{
@@ -693,8 +696,6 @@ private async Task FinalizeDataAsync(CancellationToken token)
693696
{
694697
logger?.LogError(ex, "Error committing AOF during shutdown");
695698
}
696-
697-
return;
698699
}
699700

700701
if (!opts.EnableStorageTier)
@@ -717,6 +718,7 @@ private async Task FinalizeDataAsync(CancellationToken token)
717718
{
718719
logger?.LogError(ex, "Error taking checkpoint during shutdown");
719720
}
721+
return;
720722
}
721723

722724
/// <summary>

0 commit comments

Comments
 (0)