Commit d671d7b
[BugFix] Null-safe SparseRangeIterator::has_more() to fix physical-split empty-tablet CN crash (#75203)
PhysicalSplitMorselQueue::_try_get_split_from_single_tablet() evaluates
_segment_range_iter.has_more() in its scan loop. On empty/edge tablets the iterator
can still be default-constructed (_range == nullptr) when has_more() is reached;
has_more() did an unconditional `_index < _range->_ranges.size()`, dereferencing the
null _range -> std::vector::size() at address 0 -> CN SIGSEGV @0x0. This is exactly
the reported crash stack (has_more() inlined into _try_get_split_from_single_tablet(),
per the addr2line in #75203). #70281 hardened _cur_rowset()/_cur_segment() but not
this iterator deref.
A default-constructed iterator has no ranges, so has_more() reports false instead of
dereferencing null. Verified under ASAN with a storage_primitive_test case: without
the guard it SEGVs at range.h in std::vector<Range>::size() (matching the issue's
addr2line); with the guard the test passes.
Co-Authored-By: Claude Opus 4.8 (1M context) <noreply@anthropic.com>
Signed-off-by: Srihith Garlapati <srihith.garlapati@gmail.com>1 parent e5536d1 commit d671d7b
2 files changed
Lines changed: 24 additions & 1 deletion
| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
| |||
392 | 392 | | |
393 | 393 | | |
394 | 394 | | |
395 | | - | |
| 395 | + | |
| 396 | + | |
| 397 | + | |
| 398 | + | |
| 399 | + | |
| 400 | + | |
396 | 401 | | |
397 | 402 | | |
398 | 403 | | |
| |||
| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
| |||
204 | 204 | | |
205 | 205 | | |
206 | 206 | | |
| 207 | + | |
| 208 | + | |
| 209 | + | |
| 210 | + | |
| 211 | + | |
| 212 | + | |
| 213 | + | |
| 214 | + | |
| 215 | + | |
| 216 | + | |
| 217 | + | |
| 218 | + | |
| 219 | + | |
| 220 | + | |
| 221 | + | |
| 222 | + | |
| 223 | + | |
| 224 | + | |
207 | 225 | | |
0 commit comments