Skip to content

Commit

Permalink
Ensure that all in-memory records are checkpointed when not using --s…
Browse files Browse the repository at this point in the history
…torage-tier (#117)

Co-authored-by: Badrish Chandramouli <[email protected]>
  • Loading branch information
TedHartMS and badrishc authored Mar 25, 2024
1 parent f9e62df commit 2513b20
Showing 1 changed file with 5 additions and 2 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -226,7 +226,9 @@ public override void GlobalBeforeEnteringState<Key, Value>(SystemState next, Tsa
store._hybridLogCheckpoint.snapshotFileDevice.Initialize(store.hlog.GetSegmentSize());
store._hybridLogCheckpoint.snapshotFileObjectLogDevice.Initialize(-1);

store._hybridLogCheckpoint.info.snapshotStartFlushedLogicalAddress = store.hlog.FlushedUntilAddress;
// If we are using a NullDevice then storage tier is not enabled and FlushedUntilAddress may be ReadOnlyAddress; get all records in memory.
store._hybridLogCheckpoint.info.snapshotStartFlushedLogicalAddress = store.hlog.IsNullDevice ? store.hlog.HeadAddress : store.hlog.FlushedUntilAddress;

long startPage = store.hlog.GetPage(store._hybridLogCheckpoint.info.snapshotStartFlushedLogicalAddress);
long endPage = store.hlog.GetPage(store._hybridLogCheckpoint.info.finalLogicalAddress);
if (store._hybridLogCheckpoint.info.finalLogicalAddress >
Expand All @@ -251,7 +253,8 @@ public override void GlobalBeforeEnteringState<Key, Value>(SystemState next, Tsa
break;
case Phase.PERSISTENCE_CALLBACK:
// Set actual FlushedUntil to the latest possible data in main log that is on disk
store._hybridLogCheckpoint.info.flushedLogicalAddress = store.hlog.FlushedUntilAddress;
// If we are using a NullDevice then storage tier is not enabled and FlushedUntilAddress may be ReadOnlyAddress; get all records in memory.
store._hybridLogCheckpoint.info.flushedLogicalAddress = store.hlog.IsNullDevice ? store.hlog.HeadAddress : store.hlog.FlushedUntilAddress;
base.GlobalBeforeEnteringState(next, store);
store._lastSnapshotCheckpoint = store._hybridLogCheckpoint.Transfer();
break;
Expand Down

0 comments on commit 2513b20

Please sign in to comment.