diff --git a/Makefile b/Makefile index 0398ccf67..6eb3d4272 100644 --- a/Makefile +++ b/Makefile @@ -677,7 +677,9 @@ ifdef ASSERT_STATUS_CHECKED compaction_iterator_test \ compaction_job_test \ compaction_job_stats_test \ - io_tracer_test \ + io_tracer_test \ + io_tracer_parser_test \ + prefetch_test \ merge_helper_test \ memtable_list_test \ flush_job_test \ diff --git a/file/prefetch_test.cc b/file/prefetch_test.cc index 8ebf5ea13..9cd7d1949 100644 --- a/file/prefetch_test.cc +++ b/file/prefetch_test.cc @@ -109,21 +109,21 @@ TEST_P(PrefetchTest, Basic) { // create first key range WriteBatch batch; for (int i = 0; i < kNumKeys; i++) { - batch.Put(BuildKey(i), "value for range 1 key"); + ASSERT_OK(batch.Put(BuildKey(i), "value for range 1 key")); } ASSERT_OK(db_->Write(WriteOptions(), &batch)); // create second key range batch.Clear(); for (int i = 0; i < kNumKeys; i++) { - batch.Put(BuildKey(i, "key2"), "value for range 2 key"); + ASSERT_OK(batch.Put(BuildKey(i, "key2"), "value for range 2 key")); } ASSERT_OK(db_->Write(WriteOptions(), &batch)); // delete second key range batch.Clear(); for (int i = 0; i < kNumKeys; i++) { - batch.Delete(BuildKey(i, "key2")); + ASSERT_OK(batch.Delete(BuildKey(i, "key2"))); } ASSERT_OK(db_->Write(WriteOptions(), &batch)); @@ -134,7 +134,7 @@ TEST_P(PrefetchTest, Basic) { Slice greatest(end_key.data(), end_key.size()); // commenting out the line below causes the example to work correctly - db_->CompactRange(CompactRangeOptions(), &least, &greatest); + ASSERT_OK(db_->CompactRange(CompactRangeOptions(), &least, &greatest)); if (support_prefetch && !use_direct_io) { // If underline file system supports prefetch, and directIO is not enabled diff --git a/trace_replay/io_tracer.cc b/trace_replay/io_tracer.cc index b1ae8f222..ae45b1f59 100644 --- a/trace_replay/io_tracer.cc +++ b/trace_replay/io_tracer.cc @@ -215,14 +215,15 @@ void IOTracer::EndIOTrace() { tracing_enabled = false; } -Status IOTracer::WriteIOOp(const IOTraceRecord& record) { +// TODO: Return status and handle that in file_system_tracer.h +void IOTracer::WriteIOOp(const IOTraceRecord& record) { if (!writer_.load()) { - return Status::OK(); + return; } InstrumentedMutexLock lock_guard(&trace_writer_mutex_); if (!writer_.load()) { - return Status::OK(); + return; } - return writer_.load()->WriteIOOp(record); + writer_.load()->WriteIOOp(record).PermitUncheckedError(); } } // namespace ROCKSDB_NAMESPACE diff --git a/trace_replay/io_tracer.h b/trace_replay/io_tracer.h index 36be4c602..cc6d491a6 100644 --- a/trace_replay/io_tracer.h +++ b/trace_replay/io_tracer.h @@ -158,7 +158,7 @@ class IOTracer { TSAN_SUPPRESSION bool is_tracing_enabled() const { return tracing_enabled; } - Status WriteIOOp(const IOTraceRecord& record); + void WriteIOOp(const IOTraceRecord& record); private: TraceOptions trace_options_; diff --git a/trace_replay/io_tracer_test.cc b/trace_replay/io_tracer_test.cc index 3e1602ea1..cefc83899 100644 --- a/trace_replay/io_tracer_test.cc +++ b/trace_replay/io_tracer_test.cc @@ -58,7 +58,7 @@ class IOTracerTest : public testing::Test { record.file_name = kDummyFile + std::to_string(i); record.len = i; record.offset = i + 20; - ASSERT_OK(writer->WriteIOOp(record)); + EXPECT_OK(writer->WriteIOOp(record)); } } @@ -91,7 +91,7 @@ TEST_F(IOTracerTest, AtomicWrite) { &trace_writer)); IOTracer writer; ASSERT_OK(writer.StartIOTrace(env_, trace_opt, std::move(trace_writer))); - ASSERT_OK(writer.WriteIOOp(record)); + writer.WriteIOOp(record); ASSERT_OK(env_->FileExists(trace_file_path_)); } { @@ -124,7 +124,7 @@ TEST_F(IOTracerTest, AtomicWriteBeforeStartTrace) { IOTracer writer; // The record should not be written to the trace_file since StartIOTrace is // not called. - ASSERT_OK(writer.WriteIOOp(record)); + writer.WriteIOOp(record); ASSERT_OK(env_->FileExists(trace_file_path_)); } { @@ -149,11 +149,11 @@ TEST_F(IOTracerTest, AtomicNoWriteAfterEndTrace) { &trace_writer)); IOTracer writer; ASSERT_OK(writer.StartIOTrace(env_, trace_opt, std::move(trace_writer))); - ASSERT_OK(writer.WriteIOOp(record)); + writer.WriteIOOp(record); writer.EndIOTrace(); // Write the record again. This time the record should not be written since // EndIOTrace is called. - ASSERT_OK(writer.WriteIOOp(record)); + writer.WriteIOOp(record); ASSERT_OK(env_->FileExists(trace_file_path_)); } {