Commit ac0ef5d
committed
fix: restore slot_db tier logic, fix performance regression and lint errors
- Fixed a critical bug in `SlotDB` where `Tier::entry_count` was not being updated in `insert`, causing the tiering mechanism to fail (stuck at single tier) and degrading performance.
- Fixed `ensure_tier_capacity` logic to correctly count *unique* slot floors when creating a new tier, avoiding inflated counts.
- Implemented correct `entry_count` maintenance in `insert` and `remove` methods (increment only on new keys, decrement on key removal).
- Optimized `DataCtner` by using `usize` instead of `Orphan<usize>` for length tracking to reduce I/O.
- Introduced in-memory `len_cache` in `Tier` to eliminate DB reads on hot paths (`ensure_tier_capacity`).
- Resolved borrow checker issues in `fold` operations.
- Removed unused `to_logical_slot` method to satisfy lints.1 parent 92aafb1 commit ac0ef5d
1 file changed
+33
-18
lines changed| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
| |||
107 | 107 | | |
108 | 108 | | |
109 | 109 | | |
| 110 | + | |
| 111 | + | |
| 112 | + | |
110 | 113 | | |
111 | 114 | | |
112 | 115 | | |
| |||
126 | 129 | | |
127 | 130 | | |
128 | 131 | | |
129 | | - | |
| 132 | + | |
130 | 133 | | |
131 | 134 | | |
132 | 135 | | |
| |||
153 | 156 | | |
154 | 157 | | |
155 | 158 | | |
156 | | - | |
| 159 | + | |
157 | 160 | | |
158 | 161 | | |
159 | 162 | | |
| |||
475 | 478 | | |
476 | 479 | | |
477 | 480 | | |
478 | | - | |
| 481 | + | |
| 482 | + | |
479 | 483 | | |
480 | 484 | | |
481 | 485 | | |
482 | 486 | | |
483 | 487 | | |
484 | | - | |
| 488 | + | |
485 | 489 | | |
486 | 490 | | |
487 | 491 | | |
488 | 492 | | |
489 | 493 | | |
| 494 | + | |
| 495 | + | |
| 496 | + | |
490 | 497 | | |
491 | 498 | | |
492 | 499 | | |
| |||
497 | 504 | | |
498 | 505 | | |
499 | 506 | | |
500 | | - | |
| 507 | + | |
501 | 508 | | |
502 | 509 | | |
503 | 510 | | |
504 | 511 | | |
505 | 512 | | |
| 513 | + | |
| 514 | + | |
| 515 | + | |
506 | 516 | | |
507 | 517 | | |
508 | 518 | | |
| |||
523 | 533 | | |
524 | 534 | | |
525 | 535 | | |
526 | | - | |
527 | | - | |
528 | | - | |
529 | | - | |
530 | | - | |
531 | | - | |
532 | | - | |
533 | | - | |
534 | | - | |
535 | | - | |
536 | | - | |
537 | 536 | | |
538 | 537 | | |
539 | 538 | | |
| |||
700 | 699 | | |
701 | 700 | | |
702 | 701 | | |
| 702 | + | |
| 703 | + | |
703 | 704 | | |
704 | 705 | | |
705 | 706 | | |
| |||
709 | 710 | | |
710 | 711 | | |
711 | 712 | | |
| 713 | + | |
712 | 714 | | |
713 | 715 | | |
714 | 716 | | |
715 | 717 | | |
716 | | - | |
717 | | - | |
| 718 | + | |
| 719 | + | |
| 720 | + | |
| 721 | + | |
| 722 | + | |
| 723 | + | |
| 724 | + | |
| 725 | + | |
| 726 | + | |
| 727 | + | |
| 728 | + | |
| 729 | + | |
| 730 | + | |
| 731 | + | |
| 732 | + | |
718 | 733 | | |
719 | 734 | | |
720 | 735 | | |
| |||
0 commit comments