WritePrepared Txn: sort indexes before batch collapse

Summary:
The collapse of duplicate keys in write batch needs to sort the indexes of duplicate keys since it only checks the index in the batch with the head of the list of duplicate keys.
Closes https://github.com/facebook/rocksdb/pull/3093

Differential Revision: D6186800

Pulled By: maysamyabandeh

fbshipit-source-id: abc9ae8c2f1840445a5584f925cf86ecc6f37154
main
Maysam Yabandeh 7 years ago committed by Facebook Github Bot
parent f6082d1944
commit c1cf94c787
  1. 2
      utilities/write_batch_with_index/write_batch_with_index.cc

@ -583,6 +583,7 @@ void WriteBatchWithIndex::Rep::AddNewEntry(uint32_t column_family_id) {
if (rep->obsolete_offsets.size() == 0) {
return false;
}
std::sort(rep->obsolete_offsets.begin(), rep->obsolete_offsets.end());
WriteBatch& write_batch = rep->write_batch;
assert(write_batch.Count() != 0);
size_t offset = WriteBatchInternal::GetFirstOffset(&write_batch);
@ -953,6 +954,7 @@ Status WriteBatchWithIndex::RollbackToSavePoint() {
if (s.ok()) {
s = rep->ReBuildIndex();
rep->obsolete_offsets.clear();
}
return s;

Loading…
Cancel
Save