Commit 8e27fd3
Fix GetNext hang: use cached SafeTailAddress with fallback to scan
GetNext was using only the cached SafeTailAddress, which could remain stale
when no consumer-side RefreshSafeTailAddress had run yet. This caused the
iterator to return false prematurely, and since no scan happened in GetNext,
replication consumers would hang waiting for records that were already safe
to read.
Fix: check the cached value first (O(1)). Only call RefreshSafeTailAddress
when the current address has caught up to the cached boundary. This preserves
the fast path (no scan while the cache is ahead) while ensuring correctness
when the cache is stale.
Also restore RefreshSafeTailAddress in WaitAsync's fast path for the same
reason — the cache-only check could miss records and enter SlowWait
unnecessarily.
Co-authored-by: Copilot <223556219+Copilot@users.noreply.github.com>1 parent 2ed4dce commit 8e27fd3
1 file changed
Lines changed: 14 additions & 10 deletions
Lines changed: 14 additions & 10 deletions
| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
| |||
144 | 144 | | |
145 | 145 | | |
146 | 146 | | |
147 | | - | |
148 | | - | |
149 | | - | |
150 | | - | |
| 147 | + | |
151 | 148 | | |
152 | 149 | | |
153 | 150 | | |
| |||
752 | 749 | | |
753 | 750 | | |
754 | 751 | | |
755 | | - | |
756 | | - | |
757 | | - | |
| 752 | + | |
| 753 | + | |
| 754 | + | |
| 755 | + | |
| 756 | + | |
| 757 | + | |
| 758 | + | |
758 | 759 | | |
759 | 760 | | |
760 | 761 | | |
| |||
872 | 873 | | |
873 | 874 | | |
874 | 875 | | |
875 | | - | |
876 | | - | |
877 | | - | |
| 876 | + | |
| 877 | + | |
| 878 | + | |
| 879 | + | |
| 880 | + | |
| 881 | + | |
878 | 882 | | |
879 | 883 | | |
880 | 884 | | |
| |||
0 commit comments