Repository navigation
Fix ART iterator re-seeding root after remove - #706
hardikkaurani wants to merge 1 commit into
Conversation
|
Hi @jesperpedersen, Cross-ported the
Please let me know if any adjustments are needed. |
Pranav-error
left a comment
There was a problem hiding this comment.
The test passes with and without the art.c change, so it doesn't catch the bug: iterator_next() stops at count == size, and the re-pushed root is at the end of the queue, so it's never reached. Same as pgagroal/pgagroal#1117 and the test in pgmoneta #1705. The change is fine as hardening, but either add a test that reaches the duplicate visit / use-after-free, or drop that part of the description.
The two failing Debug jobs fail on main too.
|
Good catch, @Pranav-error — you're right that I've updated the PR description to drop the duplicate-visit / use-after-free claim and describe |
|
Adding the same check as pgagroal/pgagroal#1117 makes the test catch it here too: with |
9dcd42a to
45ba588
Compare
|
@Pranav-error Updated |
|
Checked at 45ba588: the art module passes 5/5, and with |
|
@Pranav-error Thanks for verifying! |
45ba588 to
7de8bc0
Compare
|
@Pranav-error Rebased onto |
Signed-off-by: Hardik Kaurani <[email protected]>
Summary
Cross-port of pgmoneta/pgmoneta#1705.
pgexporter_art_iterator_next()previously seeded the BFS queue fromtree->rootwheneveriter->count == 0. Becausepgexporter_art_iterator_remove()decrementsiter->count, removing the first yielded key resetsiter->countto0and causespgexporter_art_iterator_next()to pushtree->rootontoiter->queagain mid-traversal.bool startedonstruct art_iteratorsotree->rootis only queued once.test_art_iterator_remove_collapseintest/testcases/test_art.cto cover removing entries during iteration when the root collapses.Verification
clang-format.format-check,contrib-check,build-macos,build-linuxRelease builds, andbuild-rpmpass; the two Linux Debug failures are pre-existing onmain).