Skip to content

Commit

Permalink
Make sure HybridLogCheckpointInfo is disposed.
Browse files Browse the repository at this point in the history
  • Loading branch information
badrishc committed Mar 23, 2023
1 parent c496dce commit 8c52f54
Showing 1 changed file with 5 additions and 3 deletions.
8 changes: 5 additions & 3 deletions cs/src/core/Index/Recovery/Recovery.cs
Original file line number Diff line number Diff line change
Expand Up @@ -144,6 +144,7 @@ public void GetLatestCheckpointTokens(out Guid hlogToken, out Guid indexToken)
{
GetClosestHybridLogCheckpointInfo(-1, out hlogToken, out var recoveredHlcInfo, out var _);
GetClosestIndexCheckpointInfo(ref recoveredHlcInfo, out indexToken, out var _);
recoveredHlcInfo.Dispose();
}

/// <summary>
Expand All @@ -152,10 +153,11 @@ public void GetLatestCheckpointTokens(out Guid hlogToken, out Guid indexToken)
/// <returns></returns>
public long GetLatestCheckpointVersion()
{
GetClosestHybridLogCheckpointInfo(-1, out var hlogToken, out var _, out var _);
GetClosestHybridLogCheckpointInfo(-1, out var hlogToken, out var hlcInfo, out var _);
hlcInfo.Dispose();
if (hlogToken == default)
return -1;
HybridLogCheckpointInfo current = new();
using var current = new HybridLogCheckpointInfo();
current.Recover(hlogToken, checkpointManager, hlog.LogPageSizeBits,
out var _, false);
return current.info.nextVersion;
Expand All @@ -168,7 +170,7 @@ public long GetLatestCheckpointVersion()
/// <returns></returns>
public long GetSnapshotFileSizes(Guid token)
{
HybridLogCheckpointInfo current = new();
using var current = new HybridLogCheckpointInfo();
current.Recover(token, checkpointManager, hlog.LogPageSizeBits,
out var _, false);
return current.info.finalLogicalAddress;
Expand Down

0 comments on commit 8c52f54

Please sign in to comment.