DB:Open should fail on tmpfs when use_direct_reads=true
Summary: Before: > $ TEST_TMPDIR=/dev/shm ./db_bench -use_direct_reads=true -benchmarks=readrandomwriterandom -num=10000000 -reads=100000 -write_buffer_size=1048576 -target_file_size_base=1048576 -max_bytes_for_level_base=4194304 -max_background_jobs=12 -readwritepercent=50 -key_size=16 -value_size=48 -threads=32 DB path: [/dev/shm/dbbench] put error: IO error: While open a file for random read: /dev/shm/dbbench/000007.sst: Invalid argument put error: IO error: While open a file for random read: /dev/shm/dbbench/000007.sst: Invalid argument put error: IO error: While open a file for random read: /dev/shm/dbbench/000007.sst: Invalid argument put error: IO error: While open a file for random read: /dev/shm/dbbench/000007.sst: Invalid argument put error: IO error: While open a file for random read: /dev/shm/dbbench/000007.sst: Invalid argument put error: IO error: While open a file for random read: /dev/shm/dbbench/000007.sst: Invalid argument put error: IO error: While open a file for random read: /dev/shm/dbbench/000007.sst: Invalid argument put error: IO error: While open a file for random read: /dev/shm/dbbench/000007.sst: Invalid argument put error: IO error: While open a file for random read: /dev/shm/dbbench/000007.sst: Invalid argument db_bench: tpp.c:84: __pthread_tpp_change_priority: Assertion `new_prio == -1 || (new_prio >= fifo_min_prio && new_prio <= fifo_max_prio)' failed. put error: IO error: While open a file for random read: /dev/shm/dbbench/000007.sst: Invalid argument put error: IO error: While open a file for random read: /dev/shm/dbbench/000007.sst: Invalid argument After: > TEST_TMPDIR=/dev/shm ./db_bench -use_direct_reads=true -benchmarks=readrandomwriterandom -num=10000000 -reads=100000 -write_buffer_size=1048576 -target_file_size_base=1048576 -max_bytes_for_level_base=4194304 -max_background_jobs=12 -readwritepercent=50 -key_size=16 -value_size=48 -threads=32 Initializing RocksDB Options from the specified file Initializing RocksDB Options from command-line flags open error: Not implemented: Direct I/O is not supported by the specified DB. Closes https://github.com/facebook/rocksdb/pull/3539 Differential Revision: D7082658 Pulled By: miasantreble fbshipit-source-id: f9d9c6ec3b5e9e049cab52154940ee101ba4d342
This commit is contained in:
parent
7eb292da14
commit
ad05cbb182
@ -356,6 +356,29 @@ Status DBImpl::Recover(
|
|||||||
assert(s.IsIOError());
|
assert(s.IsIOError());
|
||||||
return s;
|
return s;
|
||||||
}
|
}
|
||||||
|
// Verify compatibility of env_options_ and filesystem
|
||||||
|
{
|
||||||
|
unique_ptr<RandomAccessFile> idfile;
|
||||||
|
EnvOptions customized_env(env_options_);
|
||||||
|
customized_env.use_direct_reads |=
|
||||||
|
immutable_db_options_.use_direct_io_for_flush_and_compaction;
|
||||||
|
s = env_->NewRandomAccessFile(IdentityFileName(dbname_), &idfile,
|
||||||
|
customized_env);
|
||||||
|
if (!s.ok()) {
|
||||||
|
const char* error_msg = s.ToString().c_str();
|
||||||
|
// Check if unsupported Direct I/O is the root cause
|
||||||
|
customized_env.use_direct_reads = false;
|
||||||
|
s = env_->NewRandomAccessFile(IdentityFileName(dbname_), &idfile,
|
||||||
|
customized_env);
|
||||||
|
if (s.ok()) {
|
||||||
|
return Status::InvalidArgument(
|
||||||
|
"Direct I/O is not supported by the specified DB.");
|
||||||
|
} else {
|
||||||
|
return Status::InvalidArgument(
|
||||||
|
"Found options incompatible with filesystem", error_msg);
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
Status s = versions_->Recover(column_families, read_only);
|
Status s = versions_->Recover(column_families, read_only);
|
||||||
|
Loading…
Reference in New Issue
Block a user