]> git-server-git.apps.pok.os.sepia.ceph.com Git - rocksdb.git/commit
Fix the sorting of KeyContexts for batched MultiGet (#8633)
authorLevi Tamasi <ltamasi@fb.com>
Fri, 6 Aug 2021 23:26:04 +0000 (16:26 -0700)
committerLevi Tamasi <ltamasi@fb.com>
Mon, 9 Aug 2021 17:59:11 +0000 (10:59 -0700)
commit37c499628217daddf90b033293af5682f52a5faf
tree94a8b95cbe23604028a784f87590039922d8924d
parent53da6045805f188ec9a48e289d49a8343e9ac9ac
Fix the sorting of KeyContexts for batched MultiGet (#8633)

Summary:
`CompareKeyContext::operator()` on the trunk has a bug: when comparing
column family IDs, `lhs` is used for both sides of the comparison. This
results in the `KeyContext`s getting sorted solely based on key, which
in turn means that keys with the same column family do not necessarily
form a single range in the sorted list. This violates an assumption of the
batched `MultiGet` logic, leading to the same column family
showing up multiple times in the list of `MultiGetColumnFamilyData`.
The end result is the code attempting to check out the thread-local
`SuperVersion` for the same CF multiple times, causing an
assertion violation in debug builds and memory corruption/crash in
release builds.

Pull Request resolved: https://github.com/facebook/rocksdb/pull/8633

Test Plan: `make check`

Reviewed By: riversand963

Differential Revision: D30169182

Pulled By: ltamasi

fbshipit-source-id: a47710652df7e95b14b40fb710924c11a8478023
HISTORY.md
db/db_basic_test.cc
db/db_impl/db_impl.cc