Skip to content

Fix SeekForPrev key pinning regression in FindValueForCurrentKeyUsingSeek#14746

Closed
mszeszko-meta wants to merge 1 commit into
facebook:mainfrom
mszeszko-meta:fix_seek_for_prev_m_versions
Closed

Fix SeekForPrev key pinning regression in FindValueForCurrentKeyUsingSeek#14746
mszeszko-meta wants to merge 1 commit into
facebook:mainfrom
mszeszko-meta:fix_seek_for_prev_m_versions

Conversation

@mszeszko-meta

Copy link
Copy Markdown
Contributor

Summary

In PR #13531, we added a saved_key_.SetUserKey(ikey.user_key) call in FindValueForCurrentKeyUsingSeek to fix unprepared-value reverse iteration. The default copy=true parameter unconditionally copies the key into the internal buffer, breaking is-key-pinned when pin_data=true. This path triggers only when a key has more versions than max_sequential_skip_in_iterations (default 8), making the bug rare and hard to repro deterministically.

Fix: pass !pin_thru_lifetime_ || !iter_.iter()->IsKeyPinned() as the copy parameter, matching every other SetUserKey call site in DBIter.

Test Plan

New test SeekForPrevKeyPinnedWithManyVersions: writes 20 versions of the same key, confirms FindValueForCurrentKeyUsingSeek is taken via NUMBER_OF_RESEEKS_IN_ITERATION, asserts is-key-pinned == "1" after SeekForPrev. Fails without fix, passes with.

@github-actions

Copy link
Copy Markdown

✅ clang-tidy: No findings on changed lines

Completed in 326.4s.

@meta-codesync

meta-codesync Bot commented May 16, 2026

Copy link
Copy Markdown

@mszeszko-meta has imported this pull request. If you are a Meta employee, you can view this in D105397906.

@meta-codesync

meta-codesync Bot commented May 16, 2026

Copy link
Copy Markdown

@mszeszko-meta merged this pull request in 3daabe2.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

2 participants