|
|
@ -1455,10 +1455,10 @@ extern "C" bool RocksDbIOUringEnable() { return true; } |
|
|
|
namespace { |
|
|
|
namespace { |
|
|
|
#ifndef ROCKSDB_LITE |
|
|
|
#ifndef ROCKSDB_LITE |
|
|
|
#ifdef GFLAGS |
|
|
|
#ifdef GFLAGS |
|
|
|
const int kMaxArgCount = 100; |
|
|
|
const int kMaxArgCount = 100; |
|
|
|
const size_t kArgBufferSize = 100000; |
|
|
|
const size_t kArgBufferSize = 100000; |
|
|
|
|
|
|
|
|
|
|
|
void RunIOTracerParserTool(std::string trace_file) { |
|
|
|
void RunIOTracerParserTool(std::string trace_file) { |
|
|
|
std::vector<std::string> params = {"./io_tracer_parser", |
|
|
|
std::vector<std::string> params = {"./io_tracer_parser", |
|
|
|
"-io_trace_file=" + trace_file}; |
|
|
|
"-io_trace_file=" + trace_file}; |
|
|
|
|
|
|
|
|
|
|
@ -1476,13 +1476,13 @@ namespace { |
|
|
|
cursor += static_cast<int>(arg.size()) + 1; |
|
|
|
cursor += static_cast<int>(arg.size()) + 1; |
|
|
|
} |
|
|
|
} |
|
|
|
ASSERT_EQ(0, ROCKSDB_NAMESPACE::io_tracer_parser(argc, argv)); |
|
|
|
ASSERT_EQ(0, ROCKSDB_NAMESPACE::io_tracer_parser(argc, argv)); |
|
|
|
} |
|
|
|
} |
|
|
|
#endif // GFLAGS
|
|
|
|
#endif // GFLAGS
|
|
|
|
#endif // ROCKSDB_LITE
|
|
|
|
#endif // ROCKSDB_LITE
|
|
|
|
} // namespace
|
|
|
|
} // namespace
|
|
|
|
|
|
|
|
|
|
|
|
// Tests the default implementation of ReadAsync API with PosixFileSystem.
|
|
|
|
// Tests the default implementation of ReadAsync API with PosixFileSystem.
|
|
|
|
TEST_P(PrefetchTest, ReadAsyncWithPosixFS) { |
|
|
|
TEST_P(PrefetchTest, ReadAsyncWithPosixFS) { |
|
|
|
if (mem_env_ || encrypted_env_) { |
|
|
|
if (mem_env_ || encrypted_env_) { |
|
|
|
ROCKSDB_GTEST_SKIP("Test requires non-mem or non-encrypted environment"); |
|
|
|
ROCKSDB_GTEST_SKIP("Test requires non-mem or non-encrypted environment"); |
|
|
|
return; |
|
|
|
return; |
|
|
@ -1619,8 +1619,7 @@ namespace { |
|
|
|
// Check stats to make sure async prefetch is done.
|
|
|
|
// Check stats to make sure async prefetch is done.
|
|
|
|
{ |
|
|
|
{ |
|
|
|
HistogramData async_read_bytes; |
|
|
|
HistogramData async_read_bytes; |
|
|
|
options.statistics->histogramData(ASYNC_READ_BYTES, |
|
|
|
options.statistics->histogramData(ASYNC_READ_BYTES, &async_read_bytes); |
|
|
|
&async_read_bytes); |
|
|
|
|
|
|
|
HistogramData prefetched_bytes_discarded; |
|
|
|
HistogramData prefetched_bytes_discarded; |
|
|
|
options.statistics->histogramData(PREFETCHED_BYTES_DISCARDED, |
|
|
|
options.statistics->histogramData(PREFETCHED_BYTES_DISCARDED, |
|
|
|
&prefetched_bytes_discarded); |
|
|
|
&prefetched_bytes_discarded); |
|
|
@ -1643,9 +1642,9 @@ namespace { |
|
|
|
SyncPoint::GetInstance()->ClearAllCallBacks(); |
|
|
|
SyncPoint::GetInstance()->ClearAllCallBacks(); |
|
|
|
|
|
|
|
|
|
|
|
Close(); |
|
|
|
Close(); |
|
|
|
} |
|
|
|
} |
|
|
|
|
|
|
|
|
|
|
|
TEST_P(PrefetchTest, MultipleSeekWithPosixFS) { |
|
|
|
TEST_P(PrefetchTest, MultipleSeekWithPosixFS) { |
|
|
|
if (mem_env_ || encrypted_env_) { |
|
|
|
if (mem_env_ || encrypted_env_) { |
|
|
|
ROCKSDB_GTEST_SKIP("Test requires non-mem or non-encrypted environment"); |
|
|
|
ROCKSDB_GTEST_SKIP("Test requires non-mem or non-encrypted environment"); |
|
|
|
return; |
|
|
|
return; |
|
|
@ -1761,8 +1760,7 @@ namespace { |
|
|
|
// Check stats to make sure async prefetch is done.
|
|
|
|
// Check stats to make sure async prefetch is done.
|
|
|
|
{ |
|
|
|
{ |
|
|
|
HistogramData async_read_bytes; |
|
|
|
HistogramData async_read_bytes; |
|
|
|
options.statistics->histogramData(ASYNC_READ_BYTES, |
|
|
|
options.statistics->histogramData(ASYNC_READ_BYTES, &async_read_bytes); |
|
|
|
&async_read_bytes); |
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
// Not all platforms support iouring. In that case, ReadAsync in posix
|
|
|
|
// Not all platforms support iouring. In that case, ReadAsync in posix
|
|
|
|
// won't submit async requests.
|
|
|
|
// won't submit async requests.
|
|
|
@ -1796,8 +1794,7 @@ namespace { |
|
|
|
// Check stats to make sure async prefetch is done.
|
|
|
|
// Check stats to make sure async prefetch is done.
|
|
|
|
{ |
|
|
|
{ |
|
|
|
HistogramData async_read_bytes; |
|
|
|
HistogramData async_read_bytes; |
|
|
|
options.statistics->histogramData(ASYNC_READ_BYTES, |
|
|
|
options.statistics->histogramData(ASYNC_READ_BYTES, &async_read_bytes); |
|
|
|
&async_read_bytes); |
|
|
|
|
|
|
|
HistogramData prefetched_bytes_discarded; |
|
|
|
HistogramData prefetched_bytes_discarded; |
|
|
|
options.statistics->histogramData(PREFETCHED_BYTES_DISCARDED, |
|
|
|
options.statistics->histogramData(PREFETCHED_BYTES_DISCARDED, |
|
|
|
&prefetched_bytes_discarded); |
|
|
|
&prefetched_bytes_discarded); |
|
|
@ -1819,9 +1816,9 @@ namespace { |
|
|
|
SyncPoint::GetInstance()->DisableProcessing(); |
|
|
|
SyncPoint::GetInstance()->DisableProcessing(); |
|
|
|
SyncPoint::GetInstance()->ClearAllCallBacks(); |
|
|
|
SyncPoint::GetInstance()->ClearAllCallBacks(); |
|
|
|
Close(); |
|
|
|
Close(); |
|
|
|
} |
|
|
|
} |
|
|
|
|
|
|
|
|
|
|
|
TEST_P(PrefetchTest, SeekParallelizationTest1) { |
|
|
|
TEST_P(PrefetchTest, SeekParallelizationTest1) { |
|
|
|
if (mem_env_ || encrypted_env_) { |
|
|
|
if (mem_env_ || encrypted_env_) { |
|
|
|
ROCKSDB_GTEST_SKIP("Test requires non-mem or non-encrypted environment"); |
|
|
|
ROCKSDB_GTEST_SKIP("Test requires non-mem or non-encrypted environment"); |
|
|
|
return; |
|
|
|
return; |
|
|
@ -1899,8 +1896,7 @@ namespace { |
|
|
|
ASSERT_OK(options.statistics->Reset()); |
|
|
|
ASSERT_OK(options.statistics->Reset()); |
|
|
|
// Each block contains around 4 keys.
|
|
|
|
// Each block contains around 4 keys.
|
|
|
|
auto iter = std::unique_ptr<Iterator>(db_->NewIterator(ro)); |
|
|
|
auto iter = std::unique_ptr<Iterator>(db_->NewIterator(ro)); |
|
|
|
iter->Seek( |
|
|
|
iter->Seek(BuildKey(0)); // Prefetch data because of seek parallelization.
|
|
|
|
BuildKey(0)); // Prefetch data because of seek parallelization.
|
|
|
|
|
|
|
|
ASSERT_TRUE(iter->Valid()); |
|
|
|
ASSERT_TRUE(iter->Valid()); |
|
|
|
iter->Next(); |
|
|
|
iter->Next(); |
|
|
|
ASSERT_TRUE(iter->Valid()); |
|
|
|
ASSERT_TRUE(iter->Valid()); |
|
|
@ -1948,11 +1944,11 @@ namespace { |
|
|
|
buff_prefetch_count = 0; |
|
|
|
buff_prefetch_count = 0; |
|
|
|
} |
|
|
|
} |
|
|
|
Close(); |
|
|
|
Close(); |
|
|
|
} |
|
|
|
} |
|
|
|
|
|
|
|
|
|
|
|
#ifndef ROCKSDB_LITE |
|
|
|
#ifndef ROCKSDB_LITE |
|
|
|
#ifdef GFLAGS |
|
|
|
#ifdef GFLAGS |
|
|
|
TEST_P(PrefetchTest, TraceReadAsyncWithCallbackWrapper) { |
|
|
|
TEST_P(PrefetchTest, TraceReadAsyncWithCallbackWrapper) { |
|
|
|
if (mem_env_ || encrypted_env_) { |
|
|
|
if (mem_env_ || encrypted_env_) { |
|
|
|
ROCKSDB_GTEST_SKIP("Test requires non-mem or non-encrypted environment"); |
|
|
|
ROCKSDB_GTEST_SKIP("Test requires non-mem or non-encrypted environment"); |
|
|
|
return; |
|
|
|
return; |
|
|
@ -2033,8 +2029,8 @@ namespace { |
|
|
|
std::unique_ptr<TraceWriter> trace_writer; |
|
|
|
std::unique_ptr<TraceWriter> trace_writer; |
|
|
|
std::string trace_file_path = dbname_ + "/io_trace_file"; |
|
|
|
std::string trace_file_path = dbname_ + "/io_trace_file"; |
|
|
|
|
|
|
|
|
|
|
|
ASSERT_OK(NewFileTraceWriter(env_, EnvOptions(), trace_file_path, |
|
|
|
ASSERT_OK( |
|
|
|
&trace_writer)); |
|
|
|
NewFileTraceWriter(env_, EnvOptions(), trace_file_path, &trace_writer)); |
|
|
|
ASSERT_OK(db_->StartIOTrace(trace_opt, std::move(trace_writer))); |
|
|
|
ASSERT_OK(db_->StartIOTrace(trace_opt, std::move(trace_writer))); |
|
|
|
ASSERT_OK(options.statistics->Reset()); |
|
|
|
ASSERT_OK(options.statistics->Reset()); |
|
|
|
|
|
|
|
|
|
|
@ -2073,7 +2069,7 @@ namespace { |
|
|
|
SyncPoint::GetInstance()->ClearAllCallBacks(); |
|
|
|
SyncPoint::GetInstance()->ClearAllCallBacks(); |
|
|
|
|
|
|
|
|
|
|
|
Close(); |
|
|
|
Close(); |
|
|
|
} |
|
|
|
} |
|
|
|
#endif // GFLAGS
|
|
|
|
#endif // GFLAGS
|
|
|
|
#endif // ROCKSDB_LITE
|
|
|
|
#endif // ROCKSDB_LITE
|
|
|
|
} // namespace ROCKSDB_NAMESPACE
|
|
|
|
} // namespace ROCKSDB_NAMESPACE
|
|
|
|