Commit c6d6dd9
refactor: move tombstone after OnDispose so triggers see pre-tombstone state
Session functions (ISessionFunctions) should not be responsible for heap-size
tracking on destruction paths — that's IRecordTriggers' job. Two places were
setting Tombstone BEFORE OnDispose(Deleted) fired, causing CalculateHeapMemorySize
to return 0 and preventing the trigger from decrementing the tracked heap:
1. SessionFunctionsWrapper.InPlaceDeleter: set Tombstone+Dirty before returning
to InternalDelete, which then called OnDispose(Deleted). Fixed by moving
SetTombstone+SetDirtyAndModified to InternalDelete after OnDispose.
2. SessionFunctionsWrapper.InPlaceUpdater (ExpireAndStop): set Tombstone before
returning to InternalRMW, which then called OnDispose(Deleted). Fixed by
moving SetTombstone+SetDirtyAndModified to InternalRMW after OnDispose.
This removes the manual cacheSizeTracker decrement from MainStore.InPlaceDeleter
(it was a workaround for the wrong ordering) and makes GarnetRecordTriggers.OnDispose
the single destruction-side decrement path for all record types.
Also tightened PageEvictionFiresOnEvictForEveryLiveRecord test to use precise
counts by observing TailAddress movement to distinguish mutable vs immutable deletes.
Co-authored-by: Copilot <223556219+Copilot@users.noreply.github.com>1 parent 0358eea commit c6d6dd9
5 files changed
Lines changed: 38 additions & 42 deletions
File tree
- libs
- server/Storage/Functions/MainStore
- storage/Tsavorite/cs
- src/core
- ClientSession
- Index/Tsavorite/Implementation
- test
| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
| |||
28 | 28 | | |
29 | 29 | | |
30 | 30 | | |
31 | | - | |
32 | | - | |
33 | | - | |
34 | | - | |
35 | | - | |
36 | | - | |
37 | | - | |
38 | | - | |
39 | 31 | | |
40 | 32 | | |
41 | 33 | | |
| |||
Lines changed: 5 additions & 3 deletions
| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
| |||
193 | 193 | | |
194 | 194 | | |
195 | 195 | | |
196 | | - | |
| 196 | + | |
| 197 | + | |
197 | 198 | | |
198 | 199 | | |
199 | 200 | | |
| |||
238 | 239 | | |
239 | 240 | | |
240 | 241 | | |
241 | | - | |
242 | | - | |
| 242 | + | |
| 243 | + | |
| 244 | + | |
243 | 245 | | |
244 | 246 | | |
245 | 247 | | |
| |||
Lines changed: 5 additions & 2 deletions
| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
| |||
124 | 124 | | |
125 | 125 | | |
126 | 126 | | |
127 | | - | |
128 | | - | |
| 127 | + | |
| 128 | + | |
| 129 | + | |
129 | 130 | | |
130 | 131 | | |
| 132 | + | |
| 133 | + | |
131 | 134 | | |
132 | 135 | | |
133 | 136 | | |
| |||
Lines changed: 6 additions & 6 deletions
| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
| |||
156 | 156 | | |
157 | 157 | | |
158 | 158 | | |
159 | | - | |
160 | | - | |
161 | 159 | | |
162 | 160 | | |
163 | 161 | | |
164 | 162 | | |
165 | | - | |
166 | | - | |
167 | | - | |
168 | | - | |
| 163 | + | |
| 164 | + | |
| 165 | + | |
169 | 166 | | |
170 | 167 | | |
| 168 | + | |
| 169 | + | |
| 170 | + | |
171 | 171 | | |
172 | 172 | | |
173 | 173 | | |
| |||
| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
| |||
459 | 459 | | |
460 | 460 | | |
461 | 461 | | |
462 | | - | |
463 | | - | |
464 | | - | |
465 | | - | |
| 462 | + | |
| 463 | + | |
466 | 464 | | |
467 | 465 | | |
468 | 466 | | |
469 | 467 | | |
470 | 468 | | |
471 | 469 | | |
472 | 470 | | |
473 | | - | |
| 471 | + | |
| 472 | + | |
474 | 473 | | |
475 | 474 | | |
| 475 | + | |
476 | 476 | | |
477 | 477 | | |
478 | 478 | | |
| 479 | + | |
| 480 | + | |
479 | 481 | | |
| 482 | + | |
| 483 | + | |
| 484 | + | |
480 | 485 | | |
| 486 | + | |
| 487 | + | |
481 | 488 | | |
482 | 489 | | |
483 | 490 | | |
484 | 491 | | |
485 | | - | |
486 | | - | |
| 492 | + | |
487 | 493 | | |
488 | 494 | | |
489 | | - | |
490 | | - | |
491 | | - | |
492 | | - | |
493 | | - | |
494 | | - | |
495 | | - | |
496 | | - | |
497 | | - | |
498 | | - | |
499 | | - | |
500 | | - | |
501 | | - | |
| 495 | + | |
| 496 | + | |
| 497 | + | |
| 498 | + | |
| 499 | + | |
| 500 | + | |
| 501 | + | |
| 502 | + | |
| 503 | + | |
502 | 504 | | |
503 | 505 | | |
504 | | - | |
505 | | - | |
506 | 506 | | |
507 | 507 | | |
508 | | - | |
509 | 508 | | |
510 | 509 | | |
511 | 510 | | |
| |||
0 commit comments