d5e805ab8d
seeker: add a real-world test case
...
This seek_backward failed in bees because an extent appeared during
the search:
fetch(probe_pos = 6821971036, target_pos = 6821971036)
= 6822575316..6822575316
probe_pos 6821971004 = probe_pos - have_delta 32 (want_delta 32)
fetch(probe_pos = 6821971004, target_pos = 6821971036)
= 6822575316..6822575316
probe_pos 6821970972 = probe_pos - have_delta 32 (want_delta 32)
fetch(probe_pos = 6821970972, target_pos = 6821971036)
= 6822575316..6822575316
probe_pos 6821970908 = probe_pos - have_delta 64 (want_delta 64)
fetch(probe_pos = 6821970908, target_pos = 6821971036)
= 6822575316..6822575316
probe_pos 6821970780 = probe_pos - have_delta 128 (want_delta 128)
fetch(probe_pos = 6821970780, target_pos = 6821971036)
= 6822575316..6822575316
probe_pos 6821970524 = probe_pos - have_delta 256 (want_delta 256)
fetch(probe_pos = 6821970524, target_pos = 6821971036)
= 6822575316..6822575316
probe_pos 6821970012 = probe_pos - have_delta 512 (want_delta 512)
fetch(probe_pos = 6821970012, target_pos = 6821971036)
= 6822575316..6822575316
probe_pos 6821968988 = probe_pos - have_delta 1024 (want_delta 1024)
fetch(probe_pos = 6821968988, target_pos = 6821971036)
= 6822575316..6822575316
probe_pos 6821966940 = probe_pos - have_delta 2048 (want_delta 2048)
fetch(probe_pos = 6821966940, target_pos = 6821971036)
= 6822575316..6822575316
probe_pos 6821962844 = probe_pos - have_delta 4096 (want_delta 4096)
fetch(probe_pos = 6821962844, target_pos = 6821971036)
= 6821962845..6821962848
found_low = true, lower_bound = 6821962845
lower_bound = high_pos 6821962848
loop: lower_bound 6821962848, probe_pos 6821966942, upper_bound 6821971036
fetch(probe_pos = 6821966942, target_pos = 6821971036)
= 6822575316..6822575316
upper_bound = probe_pos 6821966942
loop: lower_bound 6821962848, probe_pos 6821964895, upper_bound 6821966942
fetch(probe_pos = 6821964895, target_pos = 6821971036)
= 6822575316..6822575316
upper_bound = probe_pos 6821964895
loop: lower_bound 6821962848, probe_pos 6821963871, upper_bound 6821964895
fetch(probe_pos = 6821963871, target_pos = 6821971036)
= 6822575316..6822575316
upper_bound = probe_pos 6821963871
loop: lower_bound 6821962848, probe_pos 6821963359, upper_bound 6821963871
fetch(probe_pos = 6821963359, target_pos = 6821971036)
= 6821963411..6821963422
lower_bound = high_pos 6821963422
loop: lower_bound 6821963422, probe_pos 6821963646, upper_bound 6821963871
fetch(probe_pos = 6821963646, target_pos = 6821971036)
= 6822575316..6822575316
Here, we found nothing between 6821963646 and 6822575316, so upper_bound is reduced
to 6821963646...
upper_bound = probe_pos 6821963646
loop: lower_bound 6821963422, probe_pos 6821963534, upper_bound 6821963646
fetch(probe_pos = 6821963534, target_pos = 6821971036)
= 6821963536..6821963539
lower_bound = high_pos 6821963539
loop: lower_bound 6821963539, probe_pos 6821963592, upper_bound 6821963646
fetch(probe_pos = 6821963592, target_pos = 6821971036)
= 6821963835..6821963841
...but here, we found 6821963835 and 6821963841, which are between
6821963646 and 6822575316. They were not there before, so the binary
search result is now invalid because new extent items were added while
it was running. This results in an exception:
lower_bound = high_pos 6821963841
--- BEGIN TRACE --- exception ---
objectid = 27942759813120, adjusted to 27942793363456 at bees-roots.cc:1103
Crawling extent BeesCrawlState 250:0 offset 0x0 transid 1311734..1311735 at bees-roots.cc:991
get_state_end at bees-roots.cc:988
find_next_extent 250 at bees-roots.cc:929
--- END TRACE --- exception ---
*** EXCEPTION ***
exception type std::out_of_range: lower_bound = 6821963841, upper_bound = 6821963646 failed constraint check (lower_bound <= upper_bound) at ../include/crucible/seeker.h:139
The exception prevents the result of seek_backward from returning a value,
which prevents a nonsense result from a consumer of that value.
Copy the details of this search into a test case. Note that the test
case won't reproduce the exception because the simulation of fetch()
is not changing the results part way through.
Signed-off-by: Zygo Blaxell <bees@furryterror.org >
2025-06-18 21:17:48 -04:00