util: fix log_write_bench (#5335)

Summary:
log_write_bench doesn't compile due to some recent API changes.
This patch fixes the compile by adding the missing params for
OptimizeForLogWrite() and WritableFileWriter().

Signed-off-by: Yuan Zhou <yuan.zhou@intel.com>
Pull Request resolved: https://github.com/facebook/rocksdb/pull/5335

Differential Revision: D15588875

Pulled By: miasantreble

fbshipit-source-id: 726ff4dc227733e915c3b796df25bd3ab0b431ac
main
Yuan Zhou 6 years ago committed by Facebook Github Bot
parent d7d8605f56
commit 79edf0a7a8
  1. 7
      util/log_write_bench.cc

@ -32,13 +32,16 @@ DEFINE_bool(enable_sync, false, "sync after each write.");
namespace rocksdb { namespace rocksdb {
void RunBenchmark() { void RunBenchmark() {
std::string file_name = test::PerThreadDBPath("log_write_benchmark.log"); std::string file_name = test::PerThreadDBPath("log_write_benchmark.log");
DBOptions options;
Env* env = Env::Default(); Env* env = Env::Default();
EnvOptions env_options = env->OptimizeForLogWrite(EnvOptions()); EnvOptions env_options = env->OptimizeForLogWrite(EnvOptions(), options);
env_options.bytes_per_sync = FLAGS_bytes_per_sync; env_options.bytes_per_sync = FLAGS_bytes_per_sync;
std::unique_ptr<WritableFile> file; std::unique_ptr<WritableFile> file;
env->NewWritableFile(file_name, &file, env_options); env->NewWritableFile(file_name, &file, env_options);
std::unique_ptr<WritableFileWriter> writer; std::unique_ptr<WritableFileWriter> writer;
writer.reset(new WritableFileWriter(std::move(file), env_options)); writer.reset(new WritableFileWriter(std::move(file), file_name, env_options,
env, nullptr /* stats */,
options.listeners));
std::string record; std::string record;
record.assign(FLAGS_record_size, 'X'); record.assign(FLAGS_record_size, 'X');

Loading…
Cancel
Save