]> git.proxmox.com Git - ceph.git/blobdiff - ceph/src/rocksdb/tools/write_stress.cc
update sources to ceph Nautilus 14.2.1
[ceph.git] / ceph / src / rocksdb / tools / write_stress.cc
index ddf6243b83631686084c420b2f4787035feb7d71..ddb1d0aed036a9d5323bea809091e8242eaef358 100644 (file)
@@ -1,7 +1,7 @@
 // Copyright (c) 2011-present, Facebook, Inc.  All rights reserved.
-// This source code is licensed under the BSD-style license found in the
-// LICENSE file in the root directory of this source tree. An additional grant
-// of patent rights can be found in the PATENTS file in the same directory.
+//  This source code is licensed under both the GPLv2 (found in the
+//  COPYING file in the root directory) and Apache 2.0 License
+//  (found in the LICENSE.Apache file in the root directory).
 //
 //
 // The goal of this tool is to be a simple stress test with focus on catching:
@@ -56,9 +56,10 @@ int main() {
 }
 #else
 
-#include <gflags/gflags.h>
-
+#ifndef __STDC_FORMAT_MACROS
 #define __STDC_FORMAT_MACROS
+#endif // __STDC_FORMAT_MACROS
+
 #include <inttypes.h>
 #include <atomic>
 #include <random>
@@ -72,16 +73,17 @@ int main() {
 #include "rocksdb/options.h"
 #include "rocksdb/slice.h"
 #include "util/filename.h"
+#include "util/gflags_compat.h"
 
-using GFLAGS::ParseCommandLineFlags;
-using GFLAGS::RegisterFlagValidator;
-using GFLAGS::SetUsageMessage;
+using GFLAGS_NAMESPACE::ParseCommandLineFlags;
+using GFLAGS_NAMESPACE::RegisterFlagValidator;
+using GFLAGS_NAMESPACE::SetUsageMessage;
 
 DEFINE_int32(key_size, 10, "Key size");
 DEFINE_int32(value_size, 100, "Value size");
 DEFINE_string(db, "", "Use the db with the following name.");
 DEFINE_bool(destroy_db, true,
-            "Destory the existing DB before running the test");
+            "Destroy the existing DB before running the test");
 
 DEFINE_int32(runtime_sec, 10 * 60, "How long are we running for, in seconds");
 DEFINE_int32(seed, 139, "Random seed");
@@ -135,8 +137,8 @@ class WriteStress {
     // compactions
     options.create_if_missing = true;
     options.write_buffer_size = 256 * 1024;              // 256k
-    options.max_bytes_for_level_base = 1 * 1024 * 1204;  // 1MB
-    options.target_file_size_base = 100 * 1204;          // 100k
+    options.max_bytes_for_level_base = 1 * 1024 * 1024;  // 1MB
+    options.target_file_size_base = 100 * 1024;          // 100k
     options.max_write_buffer_number = 16;
     options.max_background_compactions = 16;
     options.max_background_flushes = 16;
@@ -163,7 +165,7 @@ class WriteStress {
       std::uniform_int_distribution<int> char_dist('a', 'z');
       std::string ret;
       for (int i = 0; i < len; ++i) {
-        ret += char_dist(r);
+        ret += static_cast<char>(char_dist(r));
       }
       return ret;
     };
@@ -210,13 +212,13 @@ class WriteStress {
                                            FLAGS_prefix_mutate_period_sec *
                                            1000 * 1000LL));
       if (dist(rng) < FLAGS_first_char_mutate_probability) {
-        key_prefix_[0].store(char_dist(rng), std::memory_order_relaxed);
+        key_prefix_[0].store(static_cast<char>(char_dist(rng)), std::memory_order_relaxed);
       }
       if (dist(rng) < FLAGS_second_char_mutate_probability) {
-        key_prefix_[1].store(char_dist(rng), std::memory_order_relaxed);
+        key_prefix_[1].store(static_cast<char>(char_dist(rng)), std::memory_order_relaxed);
       }
       if (dist(rng) < FLAGS_third_char_mutate_probability) {
-        key_prefix_[2].store(char_dist(rng), std::memory_order_relaxed);
+        key_prefix_[2].store(static_cast<char>(char_dist(rng)), std::memory_order_relaxed);
       }
     }
   }