You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
refactor: internalize CopyUpdated value-object accounting into Tsavorite
The CopyUpdated path is a partial clear (value-object slot only, key stays on
the record). Expecting IRecordTriggers implementers to know this nuance — that
they should subtract only ValueObject.HeapMemorySize and not the full
CalculateHeapMemorySize — is error-prone.
Move the accounting entirely into Tsavorite's InternalRMW:
- Decrement logSizeTracker by ValueObject.HeapMemorySize before clearing
- Call IHeapObject.Dispose() on the freed value object
- Then ClearValueIfHeap() nulls the ObjectIdMap slot
Remove OnDispose(CopyUpdated) from the trigger call site — the trigger is no
longer involved in CopyUpdate accounting. GarnetRecordTriggers.OnDispose now
only handles DisposeReason.Deleted. The IRecordTriggers doc is updated to
reflect that CopyUpdated is handled internally.
The trigger contract is now simple:
- OnDispose(Deleted): subtract CalculateHeapMemorySize (full record heap)
- OnEvict: subtract CalculateHeapMemorySize (whatever remains at eviction)
- Creation sites (PostInitialUpdater/Writer/CopyUpdater, InPlaceUpdater):
add the new/changed heap
Co-authored-by: Copilot <223556219+Copilot@users.noreply.github.com>
0 commit comments