提交 57de697c 编写于 作者: 赵明 提交者: 郭宽宽

Fix makefile test check

上级 b1d6de25
此差异已折叠。
......@@ -200,8 +200,8 @@ Status BuildTable(
&make_compaction_iterator));
builder->SetSecondPassIterator(second_pass_iter.get());
c_iter.SeekToFirst();
for (; c_iter.Valid(); c_iter.Next()) {
builder->Add(c_iter.key(), c_iter.value());
for (; s.ok() && c_iter.Valid(); c_iter.Next()) {
s = builder->Add(c_iter.key(), c_iter.value());
meta->UpdateBoundaries(c_iter.key(), c_iter.ikey().sequence);
// TODO(noetzli): Update stats after flush, too.
......@@ -213,11 +213,11 @@ Status BuildTable(
}
auto range_del_it = range_del_agg->NewIterator();
for (range_del_it->SeekToFirst(); range_del_it->Valid();
for (range_del_it->SeekToFirst(); s.ok() && range_del_it->Valid();
range_del_it->Next()) {
auto tombstone = range_del_it->Tombstone();
auto kv = tombstone.Serialize();
builder->Add(kv.first.Encode(), LazyBuffer(kv.second));
s = builder->Add(kv.first.Encode(), LazyBuffer(kv.second));
meta->UpdateBoundariesForRange(kv.first, tombstone.SerializeEndKey(),
tombstone.seq_, internal_comparator);
}
......@@ -225,7 +225,9 @@ Status BuildTable(
// Finish and check for builder errors
tp = builder->GetTableProperties();
bool empty = builder->NumEntries() == 0 && tp.num_range_deletions == 0;
s = c_iter.status();
if (s.ok()) {
s = c_iter.status();
}
if (!s.ok() || empty) {
builder->Abandon();
} else {
......
......@@ -755,7 +755,7 @@ void CompactionIterator::PrepareOutput() {
(snapshot_checker_ == nullptr ||
LIKELY(snapshot_checker_->IsInSnapshot(ikey_.sequence,
earliest_snapshot_))) &&
ikey_.type != kTypeMerge && value_.file_number() != uint64_t(-1)) {
ikey_.type != kTypeMerge) {
assert(ikey_.type != kTypeDeletion && ikey_.type != kTypeSingleDeletion);
ikey_.sequence = 0;
current_key_.UpdateInternalKey(0, ikey_.type);
......
......@@ -143,7 +143,7 @@ class LoggingForwardVectorIterator : public InternalIterator {
}
virtual LazyBuffer value() const override {
assert(Valid());
return LazyBuffer(values_[current_]);
return LazyBuffer(values_[current_], false, 1);
}
virtual Status status() const override { return Status::OK(); }
......@@ -255,7 +255,7 @@ class CompactionIteratorTest : public testing::TestWithParam<bool> {
iter_.get(), nullptr, nullptr, cmp_, merge_helper_.get(), last_sequence,
&snapshots_, earliest_write_conflict_snapshot, snapshot_checker_.get(),
Env::Default(), false /* report_detailed_time */, false,
range_del_agg_.get(), std::move(compaction), size_t(-1), nullptr,
range_del_agg_.get(), std::move(compaction), size_t(-1), filter,
&shutting_down_));
}
......
......@@ -1085,7 +1085,7 @@ TEST_F(DBBloomFilterTest, OptimizeFiltersForHits) {
for (int i = 0; i < numkeys; i += 2) {
keys.push_back(i);
}
std::random_shuffle(std::begin(keys), std::end(keys));
std::shuffle(std::begin(keys), std::end(keys), std::mt19937_64());
int num_inserted = 0;
for (int key : keys) {
......
......@@ -50,7 +50,7 @@ TEST_F(DBTestDynamicLevel, DynamicLevelMaxBytesBase) {
keys[i] = i;
}
if (ordered_insert == 0) {
std::random_shuffle(std::begin(keys), std::end(keys));
std::shuffle(std::begin(keys), std::end(keys), std::mt19937_64());
}
for (int max_background_compactions = 1; max_background_compactions < 4;
max_background_compactions += 2) {
......
......@@ -1310,7 +1310,7 @@ TEST_F(DBTest, ApproximateSizesMemTable) {
keys[i * 3 + 1] = i * 5 + 1;
keys[i * 3 + 2] = i * 5 + 2;
}
std::random_shuffle(std::begin(keys), std::end(keys));
std::shuffle(std::begin(keys), std::end(keys), std::mt19937_64());
for (int i = 0; i < N * 3; i++) {
ASSERT_OK(Put(Key(keys[i] + 1000), RandomString(&rnd, 1024)));
......@@ -4223,7 +4223,7 @@ TEST_F(DBTest, DynamicLevelCompressionPerLevel) {
for (int i = 0; i < kNKeys; i++) {
keys[i] = i;
}
std::random_shuffle(std::begin(keys), std::end(keys));
std::shuffle(std::begin(keys), std::end(keys), std::mt19937_64());
Random rnd(301);
Options options;
......@@ -4306,7 +4306,7 @@ TEST_F(DBTest, DynamicLevelCompressionPerLevel2) {
for (int i = 0; i < kNKeys; i++) {
keys[i] = i;
}
std::random_shuffle(std::begin(keys), std::end(keys));
std::shuffle(std::begin(keys), std::end(keys), std::mt19937_64());
Random rnd(301);
Options options;
......
......@@ -839,7 +839,8 @@ void MemTable::Update(SequenceNumber seq,
SequenceNumber unused;
UnPackSequenceAndType(tag, &unused, &type);
LazyBuffer old_value = iter->value();
if (type == kTypeValue && old_value.valid()) {
if (type == kTypeValue && old_value.fetch().ok()) {
assert(old_value.valid());
uint32_t old_size = static_cast<uint32_t>(old_value.size());
uint32_t new_size = static_cast<uint32_t>(value.size());
......@@ -886,7 +887,8 @@ bool MemTable::UpdateCallback(SequenceNumber seq,
uint64_t unused;
UnPackSequenceAndType(tag, &unused, &type);
LazyBuffer old_value = iter->value();
if(type == kTypeValue && old_value.valid()) {
if(type == kTypeValue && old_value.fetch().ok()) {
assert(old_value.valid());
uint32_t old_size = static_cast<uint32_t>(old_value.size());
char* old_buffer = const_cast<char*>(old_value.data());
......
......@@ -31,7 +31,7 @@ class MergeHelperTest : public testing::Test {
merge_op_.get(), filter_.get(), nullptr,
false, latest_snapshot));
user_key_ = ExtractUserKey(iter_->key()).ToString();
CombinedInternalIterator iter(&iter_, nullptr);
CombinedInternalIterator iter(iter_.get(), nullptr);
auto merge_result = merge_helper_->MergeUntil(user_key_, &iter,
nullptr /* range_del_agg */,
stop_before, at_bottom);
......
......@@ -249,7 +249,7 @@ void ProfileQueries(bool enabled_time = false) {
}
if (FLAGS_random_key) {
std::random_shuffle(keys.begin(), keys.end());
std::shuffle(keys.begin(), keys.end(), std::mt19937_64());
}
#ifndef NDEBUG
ThreadStatusUtil::TEST_SetStateDelay(ThreadStatus::STATE_MUTEX_WAIT, 1U);
......@@ -522,7 +522,7 @@ TEST_F(PerfContextTest, SeekKeyComparison) {
}
if (FLAGS_random_key) {
std::random_shuffle(keys.begin(), keys.end());
std::shuffle(keys.begin(), keys.end(), std::mt19937_64());
}
HistogramImpl hist_put_time;
......
......@@ -592,7 +592,7 @@ TEST_F(PrefixTest, DynamicPrefixIterator) {
}
if (FLAGS_random_prefix) {
std::random_shuffle(prefixes.begin(), prefixes.end());
std::shuffle(prefixes.begin(), prefixes.end(), std::mt19937_64());
}
HistogramImpl hist_put_time;
......
......@@ -138,7 +138,7 @@ struct TombstoneStartKeyComparator {
const Comparator* cmp;
};
std::unique_ptr<InternalIterator> MakeRangeDelIterator(
std::unique_ptr<InternalIteratorBase<Slice>> MakeRangeDelIterator(
const std::vector<PersistentRangeTombstone>& range_dels) {
std::vector<std::string> keys, values;
for (const auto& range_del : range_dels) {
......@@ -146,8 +146,8 @@ std::unique_ptr<InternalIterator> MakeRangeDelIterator(
keys.push_back(key_and_value.first.Encode().ToString());
values.push_back(key_and_value.second.ToString());
}
return std::unique_ptr<test::VectorIterator>(
new test::VectorIterator(keys, values));
return std::unique_ptr<test::VectorIteratorBase<Slice>>(
new test::VectorIteratorBase<Slice>(keys, values));
}
// convert long to a big-endian slice key
......
......@@ -476,6 +476,9 @@ inline void LazyBuffer::pin() {
inline Status LazyBuffer::dump(LazyBuffer& _target) && {
assert(state_ != nullptr);
assert(this != &_target);
if (_target.state_ == nullptr) {
_target.state_ = LazyBufferState::light_state();
}
return state_->dump_buffer(this, &_target);
}
......
......@@ -307,7 +307,7 @@ class ReadBenchmarkThread : public BenchmarkThread {
num_ops, read_hits) {}
static bool callback(void* arg, const Slice& internal_key,
LazyBuffer&& value) {
LazyBuffer&& /*value*/) {
CallbackVerifyArgs* callback_args = static_cast<CallbackVerifyArgs*>(arg);
assert(callback_args != nullptr);
if ((callback_args->comparator)
......
......@@ -482,7 +482,7 @@ Status BlockBasedTableBuilder::Add(const Slice& key,
} else {
assert(false);
}
return Status::OK();
return r->status;
}
void BlockBasedTableBuilder::Flush() {
......
......@@ -103,7 +103,7 @@ void TableReaderBenchmark(Options& opts, EnvOptions& env_options,
CompressionType::kNoCompression, CompressionOptions(),
nullptr /* compression_dict */, false /* skip_filters */,
false /* ignore_key_tyoe */, kDefaultColumnFamilyName,
unknown_level),
unknown_level, 0 /* compaction_load */),
0 /* column_family_id */, file_writer.get());
} else {
s = DB::Open(opts, dbname, &db);
......@@ -115,14 +115,14 @@ void TableReaderBenchmark(Options& opts, EnvOptions& env_options,
for (int j = 0; j < num_keys2; j++) {
std::string key = MakeKey(i * 2, j, through_db);
if (!through_db) {
tb->Add(key, key);
tb->Add(key, LazyBuffer(key));
} else {
db->Put(wo, key, key);
}
}
}
if (!through_db) {
tb->Finish();
tb->Finish(nullptr);
file_writer->Close();
} else {
db->Flush(FlushOptions());
......@@ -169,14 +169,14 @@ void TableReaderBenchmark(Options& opts, EnvOptions& env_options,
std::string key = MakeKey(r1, r2, through_db);
uint64_t start_time = Now(env, measured_by_nanosecond);
if (!through_db) {
PinnableSlice value;
LazyBuffer value;
MergeContext merge_context;
SequenceNumber max_covering_tombstone_seq = 0;
GetContext get_context(ioptions.user_comparator,
ioptions.merge_operator, ioptions.info_log,
ioptions.statistics, GetContext::kNotFound,
Slice(key), &value, nullptr, &merge_context,
&max_covering_tombstone_seq, env);
nullptr, &max_covering_tombstone_seq, env);
s = table_reader->Get(read_options, key, &get_context, nullptr);
} else {
s = db->Get(read_options, key, &result);
......
......@@ -3417,7 +3417,7 @@ void VerifyDBFromDB(std::string& truth_db_name) {
options.disable_auto_compactions = FLAGS_disable_auto_compactions;
options.enable_lazy_compaction = FLAGS_enable_lazy_compaction;
options.blob_size = FLAGS_blob_size;
options.blob_gc_tario = FLOAGS_blob_gc_ratio;
options.blob_gc_ratio = FLAGS_blob_gc_ratio;
options.optimize_filters_for_hits = FLAGS_optimize_filters_for_hits;
// fill storage options
......@@ -4369,7 +4369,7 @@ void VerifyDBFromDB(std::string& truth_db_name) {
ReadOptions options(FLAGS_verify_checksum, true);
std::unique_ptr<const char[]> key_guard;
Slice key = AllocateKey(&key_guard);
PinnableSlice pinnable_val;
LazyBuffer lazy_val;
Duration duration(FLAGS_duration, reads_);
while (!duration.Done(1)) {
......@@ -4383,16 +4383,16 @@ void VerifyDBFromDB(std::string& truth_db_name) {
Status s;
if (FLAGS_num_column_families > 1) {
s = db_with_cfh->db->Get(options, db_with_cfh->GetCfh(key_rand), key,
&pinnable_val);
&lazy_val);
} else {
pinnable_val.Reset();
lazy_val.clear();
s = db_with_cfh->db->Get(options,
db_with_cfh->db->DefaultColumnFamily(), key,
&pinnable_val);
&lazy_val);
}
if (s.ok()) {
found++;
bytes += key.size() + pinnable_val.size();
bytes += key.size() + lazy_val.size();
} else if (!s.IsNotFound()) {
fprintf(stderr, "Get returned an error: %s\n", s.ToString().c_str());
abort();
......
......@@ -1716,9 +1716,8 @@ class StressTest {
}
ReadOptions ropt;
ropt.snapshot = snap_state.snapshot;
PinnableSlice exp_v(&snap_state.value);
exp_v.PinSelf();
PinnableSlice v;
LazyBuffer exp_v(&snap_state.value);
LazyBuffer v;
s = db->Get(ropt, cf, snap_state.key, &v);
if (!s.ok() && !s.IsNotFound()) {
return s;
......@@ -1731,7 +1730,7 @@ class StressTest {
") vs. (" + s.ToString() + ")");
}
if (s.ok()) {
if (exp_v != v) {
if (exp_v.slice() != v.slice()) {
return Status::Corruption("The snapshot gave inconsistent values: (" +
exp_v.ToString() + ") vs. (" + v.ToString() +
")");
......
......@@ -770,7 +770,7 @@ TEST_P(WritePreparedTransactionTest, DoubleSnapshot) {
s = wp_db->Get(ropt, wp_db->DefaultColumnFamily(), "key", &lazy_val);
ASSERT_OK(s);
ASSERT_TRUE(lazy_val.slice() == "value1");
lazy_val.clear();
lazy_val.reset();
wp_db->ReleaseSnapshot(snapshot1);
......@@ -778,7 +778,7 @@ TEST_P(WritePreparedTransactionTest, DoubleSnapshot) {
s = wp_db->Get(ropt, wp_db->DefaultColumnFamily(), "key", &lazy_val);
ASSERT_OK(s);
ASSERT_TRUE(lazy_val.slice() == "value1");
lazy_val.clear();
lazy_val.reset();
// Cause an eviction to advance max evicted seq number and trigger updating
// the snapshot list
......@@ -789,7 +789,7 @@ TEST_P(WritePreparedTransactionTest, DoubleSnapshot) {
s = wp_db->Get(ropt, wp_db->DefaultColumnFamily(), "key", &lazy_val);
ASSERT_OK(s);
ASSERT_TRUE(lazy_val.slice() == "value1");
lazy_val.clear();
lazy_val.reset();
wp_db->ReleaseSnapshot(snapshot0);
wp_db->ReleaseSnapshot(snapshot2);
......@@ -1325,7 +1325,7 @@ TEST_P(WritePreparedTransactionTest, BasicRecoveryTest) {
// Check the value is not committed before restart
s = db->Get(ropt, db->DefaultColumnFamily(), "foo0" + istr0, &lazy_val);
ASSERT_TRUE(s.IsNotFound());
lazy_val.clear();
lazy_val.reset();
delete txn0;
delete txn1;
......@@ -1352,7 +1352,7 @@ TEST_P(WritePreparedTransactionTest, BasicRecoveryTest) {
// Check the value is still not committed after restart
s = db->Get(ropt, db->DefaultColumnFamily(), "foo0" + istr0, &lazy_val);
ASSERT_TRUE(s.IsNotFound());
lazy_val.clear();
lazy_val.reset();
txn_t3(0);
......@@ -1406,7 +1406,7 @@ TEST_P(WritePreparedTransactionTest, BasicRecoveryTest) {
s = db->Get(ropt, db->DefaultColumnFamily(), "foo0" + istr0, &lazy_val);
ASSERT_TRUE(s.ok());
ASSERT_TRUE(lazy_val.slice() == ("bar0" + istr0));
lazy_val.clear();
lazy_val.reset();
delete txn0;
delete txn2;
......@@ -1421,7 +1421,7 @@ TEST_P(WritePreparedTransactionTest, BasicRecoveryTest) {
s = db->Get(ropt, db->DefaultColumnFamily(), "foo0" + istr0, &lazy_val);
ASSERT_TRUE(s.ok());
ASSERT_TRUE(lazy_val.slice() == ("bar0" + istr0));
lazy_val.clear();
lazy_val.reset();
}
// After recovery the commit map is empty while the max is set. The code would
......
Markdown is supported
0% .
You are about to add 0 people to the discussion. Proceed with caution.
先完成此消息的编辑!
想要评论请 注册