Skip to content

Commit 290cfb5

Browse files
badrishcCopilot
andcommitted
chore: make CallOnFlush/CallOnEvict/CallOnDiskRead default to false via DIM
All three gate properties on IRecordTriggers now have default implementations returning false. Implementations that don't need any trigger callbacks (like GarnetRecordTriggers) no longer need to explicitly declare them — the empty struct body suffices. Co-authored-by: Copilot <223556219+Copilot@users.noreply.github.com>
1 parent 2104e39 commit 290cfb5

4 files changed

Lines changed: 4 additions & 14 deletions

File tree

libs/server/Storage/Functions/GarnetRecordTriggers.cs

Lines changed: 0 additions & 8 deletions
Original file line numberDiff line numberDiff line change
@@ -13,13 +13,5 @@ namespace Garnet.server
1313
/// </summary>
1414
public readonly struct GarnetRecordTriggers : IRecordTriggers
1515
{
16-
/// <inheritdoc/>
17-
public bool CallOnFlush => false;
18-
19-
/// <inheritdoc/>
20-
public bool CallOnEvict => false;
21-
22-
/// <inheritdoc/>
23-
public bool CallOnDiskRead => false;
2416
}
2517
}

libs/server/Storage/Functions/MainStore/RMWMethods.cs

Lines changed: 0 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1706,7 +1706,6 @@ public readonly bool PostCopyUpdater<TSourceLogRecord>(in TSourceLogRecord srcLo
17061706
if (functionsState.appendOnlyFile != null)
17071707
rmwInfo.UserData |= NeedAofLog; // Mark that we need to write to AOF
17081708

1709-
// Account for the new record's value-side heap contribution.
17101709
return true;
17111710
}
17121711

libs/storage/Tsavorite/cs/src/core/Allocator/AllocatorBase.cs

Lines changed: 1 addition & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -1426,9 +1426,8 @@ internal void EvictPageForRecovery(long page)
14261426
{
14271427
_wrapper.EvictRecordsInRange(start, end, source);
14281428
}
1429-
else if (onEvictionObserver is not null)
1429+
if (onEvictionObserver is not null)
14301430
{
1431-
// Legacy observer path for consumers still using SubscribeEvictions.
14321431
MemoryPageScan(start, end, onEvictionObserver);
14331432
}
14341433

libs/storage/Tsavorite/cs/src/core/Index/StoreFunctions/IRecordTriggers.cs

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -31,21 +31,21 @@ public interface IRecordTriggers
3131
/// If true, <see cref="OnFlush(ref LogRecord)"/> is called per valid record on the
3232
/// original in-memory page before it is flushed to disk.
3333
/// </summary>
34-
bool CallOnFlush { get; }
34+
bool CallOnFlush => false;
3535

3636
/// <summary>
3737
/// If true, <see cref="OnEvict(ref LogRecord, EvictionSource)"/> is called per non-tombstoned
3838
/// record when a page is evicted past HeadAddress. Returning false lets the allocator skip the
3939
/// per-record OnEvict callback when the application has no work to do.
4040
/// Note: Tsavorite's internal heap-size accounting runs regardless of this flag.
4141
/// </summary>
42-
bool CallOnEvict { get; }
42+
bool CallOnEvict => false;
4343

4444
/// <summary>
4545
/// If true, <see cref="OnDiskRead(ref LogRecord)"/> is called per record loaded from
4646
/// disk into memory (recovery, delta log apply, pending reads, push scans).
4747
/// </summary>
48-
bool CallOnDiskRead { get; }
48+
bool CallOnDiskRead => false;
4949

5050
/// <summary>
5151
/// Called when a record is disposed due to delete, expiration, CAS failure, elision,

0 commit comments

Comments
 (0)