Fix build for msvc (#9230)

Summary:
Test plan

With Visual Studio 2017.
```
cd rocksdb
mkdir build && cd build
cmake -G "Visual Studio 15 Win64" -DWITH_GFLAGS=1 ..
MSBuild rocksdb.sln /m /TARGET:cache_bench /TARGET:db_bench /TARGET:db_stress
```

Pull Request resolved: https://github.com/facebook/rocksdb/pull/9230

Reviewed By: akankshamahajan15

Differential Revision: D32705095

Pulled By: riversand963

fbshipit-source-id: 101e3533f5178b24c0535ddc47a39347ccfcf92c
main
Yanqin Jin 3 years ago committed by Facebook GitHub Bot
parent fc3a6eb74a
commit 42fef0224f
  1. 5
      cache/cache_bench_tool.cc
  2. 3
      db_stress_tool/db_stress_test_base.cc
  3. 4
      tools/db_bench_tool.cc

@ -220,7 +220,7 @@ class CacheBench {
if (skewed_) { if (skewed_) {
uint64_t max_key = max_key_; uint64_t max_key = max_key_;
while (max_key >>= 1) max_log_++; while (max_key >>= 1) max_log_++;
if (max_key > (1u << max_log_)) max_log_++; if (max_key > (static_cast<uint64_t>(1) << max_log_)) max_log_++;
} }
if (FLAGS_use_clock_cache) { if (FLAGS_use_clock_cache) {
@ -380,7 +380,8 @@ class CacheBench {
<< "Average key size: " << "Average key size: "
<< (1.0 * total_key_size / total_entry_count) << "\n" << (1.0 * total_key_size / total_entry_count) << "\n"
<< "Average charge: " << "Average charge: "
<< BytesToHumanString(1.0 * total_charge / total_entry_count) << BytesToHumanString(static_cast<uint64_t>(
1.0 * total_charge / total_entry_count))
<< "\n" << "\n"
<< "Unique deleters: " << deleters.size() << "\n"; << "Unique deleters: " << deleters.size() << "\n";
*stats_report = ostr.str(); *stats_report = ostr.str();

@ -151,7 +151,8 @@ std::shared_ptr<Cache> StressTest::NewCache(size_t capacity,
} }
if (FLAGS_secondary_cache_fault_one_in > 0) { if (FLAGS_secondary_cache_fault_one_in > 0) {
secondary_cache = std::make_shared<FaultInjectionSecondaryCache>( secondary_cache = std::make_shared<FaultInjectionSecondaryCache>(
secondary_cache, FLAGS_seed, FLAGS_secondary_cache_fault_one_in); secondary_cache, static_cast<uint32_t>(FLAGS_seed),
FLAGS_secondary_cache_fault_one_in);
} }
opts.secondary_cache = secondary_cache; opts.secondary_cache = secondary_cache;
} }

@ -236,9 +236,9 @@ IF_ROCKSDB_LITE("",
"\tmemstats -- Print memtable stats\n" "\tmemstats -- Print memtable stats\n"
"\tsstables -- Print sstable info\n" "\tsstables -- Print sstable info\n"
"\theapprofile -- Dump a heap profile (if supported by this port)\n" "\theapprofile -- Dump a heap profile (if supported by this port)\n"
#ifndef ROCKSDB_LITE IF_ROCKSDB_LITE("",
"\treplay -- replay the trace file specified with trace_file\n" "\treplay -- replay the trace file specified with trace_file\n"
#endif // ROCKSDB_LITE )
"\tgetmergeoperands -- Insert lots of merge records which are a list of " "\tgetmergeoperands -- Insert lots of merge records which are a list of "
"sorted ints for a key and then compare performance of lookup for another " "sorted ints for a key and then compare performance of lookup for another "
"key " "key "

Loading…
Cancel
Save