Commit 4c60906
committed
keyviz: reuse retired slot on re-registration + test polish
Codex round-12 P2: Re-registering a removed RouteID inside the grace
window allocated a brand-new *routeSlot. Flush then drained both the
new live slot AND the old retired slot in the same column,
producing two rows with the same RouteID and splitting counts
between them. Add reclaimRetiredSlot — when RegisterRoute lands a
real (non-aggregate) routeID and a retired slot with that ID is
queued, pull it off retiredSlots and reuse it. The old counters and
any in-flight late-Observe writes converge with new traffic on the
same slot, and Flush emits a single row.
TestReRegisterIndividualReusesRetiredSlot asserts one row per
RouteID per column with correctly accumulated counts.
Claude bot nits:
- nextVirtualBucketID comment now spells out the atomic.Uint64
wrap-around explicitly instead of the cryptic "MaxUint64+1" form.
- TestRejoinAsIndividualLetsBucketPruneFire was vacuously true —
the bucket had no traffic so it never emitted a row, making the
prune assertion unreachable. Restructure with two virtual members
(so removing one leaves the bucket alive, not orphaned), drive
traffic through the surviving member, and flush twice past grace
so the post-prune MemberRoutes lands in a snapshot row.1 parent 25061d6 commit 4c60906
2 files changed
Lines changed: 112 additions & 21 deletions
| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
| |||
376 | 376 | | |
377 | 377 | | |
378 | 378 | | |
379 | | - | |
380 | | - | |
381 | | - | |
382 | | - | |
| 379 | + | |
| 380 | + | |
| 381 | + | |
| 382 | + | |
| 383 | + | |
| 384 | + | |
| 385 | + | |
| 386 | + | |
| 387 | + | |
| 388 | + | |
| 389 | + | |
| 390 | + | |
| 391 | + | |
| 392 | + | |
| 393 | + | |
| 394 | + | |
| 395 | + | |
| 396 | + | |
| 397 | + | |
383 | 398 | | |
384 | 399 | | |
385 | 400 | | |
| |||
613 | 628 | | |
614 | 629 | | |
615 | 630 | | |
616 | | - | |
| 631 | + | |
| 632 | + | |
| 633 | + | |
| 634 | + | |
| 635 | + | |
| 636 | + | |
| 637 | + | |
| 638 | + | |
| 639 | + | |
| 640 | + | |
| 641 | + | |
| 642 | + | |
| 643 | + | |
| 644 | + | |
| 645 | + | |
| 646 | + | |
| 647 | + | |
| 648 | + | |
| 649 | + | |
| 650 | + | |
| 651 | + | |
| 652 | + | |
| 653 | + | |
| 654 | + | |
| 655 | + | |
| 656 | + | |
| 657 | + | |
| 658 | + | |
| 659 | + | |
| 660 | + | |
617 | 661 | | |
618 | 662 | | |
619 | 663 | | |
| |||
| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
| |||
718 | 718 | | |
719 | 719 | | |
720 | 720 | | |
721 | | - | |
722 | | - | |
723 | | - | |
724 | | - | |
| 721 | + | |
| 722 | + | |
| 723 | + | |
| 724 | + | |
| 725 | + | |
| 726 | + | |
| 727 | + | |
725 | 728 | | |
726 | 729 | | |
727 | 730 | | |
728 | 731 | | |
729 | | - | |
730 | | - | |
| 732 | + | |
| 733 | + | |
731 | 734 | | |
732 | 735 | | |
733 | | - | |
| 736 | + | |
| 737 | + | |
| 738 | + | |
734 | 739 | | |
735 | | - | |
| 740 | + | |
736 | 741 | | |
737 | | - | |
738 | | - | |
739 | | - | |
| 742 | + | |
| 743 | + | |
| 744 | + | |
| 745 | + | |
| 746 | + | |
| 747 | + | |
740 | 748 | | |
741 | | - | |
742 | 749 | | |
743 | | - | |
| 750 | + | |
744 | 751 | | |
745 | 752 | | |
| 753 | + | |
| 754 | + | |
746 | 755 | | |
747 | | - | |
| 756 | + | |
| 757 | + | |
| 758 | + | |
748 | 759 | | |
749 | 760 | | |
750 | 761 | | |
| 762 | + | |
| 763 | + | |
| 764 | + | |
| 765 | + | |
| 766 | + | |
| 767 | + | |
| 768 | + | |
| 769 | + | |
| 770 | + | |
| 771 | + | |
| 772 | + | |
| 773 | + | |
| 774 | + | |
| 775 | + | |
| 776 | + | |
| 777 | + | |
| 778 | + | |
| 779 | + | |
| 780 | + | |
| 781 | + | |
| 782 | + | |
| 783 | + | |
| 784 | + | |
| 785 | + | |
| 786 | + | |
| 787 | + | |
| 788 | + | |
| 789 | + | |
| 790 | + | |
751 | 791 | | |
752 | | - | |
753 | | - | |
| 792 | + | |
| 793 | + | |
| 794 | + | |
754 | 795 | | |
755 | 796 | | |
| 797 | + | |
| 798 | + | |
| 799 | + | |
| 800 | + | |
| 801 | + | |
| 802 | + | |
756 | 803 | | |
757 | 804 | | |
758 | 805 | | |
| |||
0 commit comments