rocksdb/db/db_impl
Levi Tamasi 87882736ef 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
2021-08-06 16:27:42 -07:00
..
compacted_db_impl.cc Make backups openable as read-only DBs (#8142) 2021-04-06 14:37:53 -07:00
compacted_db_impl.h Move compacted_db_impl.[c|h] to db/db_impl (#8082) 2021-03-23 13:49:26 -07:00
db_impl_compaction_flush.cc Fix NotifyOnFlushCompleted() for atomic flush (#8585) 2021-08-03 13:31:10 -07:00
db_impl_debug.cc Eliminate compiler complaining, which the return type of the function… (#8498) 2021-07-08 10:09:05 -07:00
db_impl_experimental.cc Replace reinterpret_cast with static_cast_with_check (#7067) 2020-07-02 19:25:41 -07:00
db_impl_files.cc Attempt to deflake ObsoleteFilesTest.DeleteObsoleteOptionsFile (#8624) 2021-08-05 18:36:16 -07:00
db_impl_open.cc Allow WAL dir to change with db dir (#8582) 2021-07-30 12:16:44 -07:00
db_impl_readonly.cc Make backups openable as read-only DBs (#8142) 2021-04-06 14:37:53 -07:00
db_impl_readonly.h RocksJava - Add errorIfLogFileExists parameter to RocksDB.openReadOnly (#7046) 2020-09-17 15:41:25 -07:00
db_impl_secondary.cc Allow WAL dir to change with db dir (#8582) 2021-07-30 12:16:44 -07:00
db_impl_secondary.h Implement missing Handler methods in ColumnFamilyCollector. (#8456) 2021-07-12 09:23:45 -07:00
db_impl_write.cc Several simple local code clean-ups (#8565) 2021-07-30 12:07:49 -07:00
db_impl.cc Fix the sorting of KeyContexts for batched MultiGet (#8633) 2021-08-06 16:27:42 -07:00
db_impl.h Delete legacy code not used any more. (#8508) 2021-07-14 16:04:56 -07:00