mirror of
https://github.com/facebook/rocksdb.git
synced 2024-11-25 22:44:05 +00:00
b7a2369fb2
Summary:
This patch reverts "Replace std::priority_queue in MergingIterator
with custom heap" (commit commit b6655a679d
)
as it causes db_stress failure.
Test Plan: ./db_stress --test_batches_snapshots=1 --threads=32 --write_buffer_size=4194304 --destroy_db_initially=0 --reopen=20 --readpercent=45 --prefixpercent=5 --writepercent=35 --delpercent=5 --iterpercent=10 --db=/tmp/rocksdb_crashtest_KdCI5F --max_key=100000000 --mmap_read=0 --block_size=16384 --cache_size=1048576 --open_files=500000 --verify_checksum=1 --sync=0 --progress_reports=0 --disable_wal=0 --disable_data_sync=1 --target_file_size_base=2097152 --target_file_size_multiplier=2 --max_write_buffer_number=3 --max_background_compactions=20 --max_bytes_for_level_base=10485760 --filter_deletes=0 --memtablerep=prefix_hash --prefix_size=7 --ops_per_thread=200 --kill_random_test=97
Reviewers: igor, anthony, lovro, sdong
Reviewed By: sdong
Subscribers: dhruba, leveldb
Differential Revision: https://reviews.facebook.net/D41343
45 lines
1.2 KiB
C++
45 lines
1.2 KiB
C++
// Copyright (c) 2013, Facebook, Inc. All rights reserved.
|
|
// This source code is licensed under the BSD-style license found in the
|
|
// LICENSE file in the root directory of this source tree. An additional grant
|
|
// of patent rights can be found in the PATENTS file in the same directory.
|
|
//
|
|
|
|
#pragma once
|
|
#include <queue>
|
|
|
|
#include "rocksdb/comparator.h"
|
|
#include "table/iterator_wrapper.h"
|
|
|
|
namespace rocksdb {
|
|
|
|
// Return the max of two keys.
|
|
class MaxIteratorComparator {
|
|
public:
|
|
MaxIteratorComparator(const Comparator* comparator) :
|
|
comparator_(comparator) {}
|
|
|
|
bool operator()(IteratorWrapper* a, IteratorWrapper* b) {
|
|
return comparator_->Compare(a->key(), b->key()) <= 0;
|
|
}
|
|
private:
|
|
const Comparator* comparator_;
|
|
};
|
|
|
|
// Return the max of two keys.
|
|
class MinIteratorComparator {
|
|
public:
|
|
// if maxHeap is set comparator returns the max value.
|
|
// else returns the min Value.
|
|
// Can use to create a minHeap or a maxHeap.
|
|
MinIteratorComparator(const Comparator* comparator) :
|
|
comparator_(comparator) {}
|
|
|
|
bool operator()(IteratorWrapper* a, IteratorWrapper* b) {
|
|
return comparator_->Compare(a->key(), b->key()) > 0;
|
|
}
|
|
private:
|
|
const Comparator* comparator_;
|
|
};
|
|
|
|
} // namespace rocksdb
|