Move db_bench flags out of unnamed namespace

Summary:
I want to be able to, e.g., DECLARE_string(statistics_string); in my application such that I can override the default value of statistics_string. For this to work, we need to remove the unnamed namespace containing all the flags, and make sure all variables/functions covered by that namespace are static.

Replaces #1828 due to internal tool issues.
Closes https://github.com/facebook/rocksdb/pull/1844

Differential Revision: D4515124

Pulled By: ajkr

fbshipit-source-id: 23b695e
This commit is contained in:
Andrew Kryczka 2017-02-07 11:34:14 -08:00 committed by Facebook Github Bot
parent 186c7eedb0
commit d70ce7ee0b

View File

@ -72,7 +72,6 @@
#include <io.h> // open/close #include <io.h> // open/close
#endif #endif
namespace {
using GFLAGS::ParseCommandLineFlags; using GFLAGS::ParseCommandLineFlags;
using GFLAGS::RegisterFlagValidator; using GFLAGS::RegisterFlagValidator;
using GFLAGS::SetUsageMessage; using GFLAGS::SetUsageMessage;
@ -604,7 +603,7 @@ DEFINE_bool(use_stderr_info_logger, false,
DEFINE_bool(use_blob_db, false, "Whether to use BlobDB. "); DEFINE_bool(use_blob_db, false, "Whether to use BlobDB. ");
enum rocksdb::CompressionType StringToCompressionType(const char* ctype) { static enum rocksdb::CompressionType StringToCompressionType(const char* ctype) {
assert(ctype); assert(ctype);
if (!strcasecmp(ctype, "none")) if (!strcasecmp(ctype, "none"))
@ -628,7 +627,7 @@ enum rocksdb::CompressionType StringToCompressionType(const char* ctype) {
return rocksdb::kSnappyCompression; // default value return rocksdb::kSnappyCompression; // default value
} }
std::string ColumnFamilyName(size_t i) { static std::string ColumnFamilyName(size_t i) {
if (i == 0) { if (i == 0) {
return rocksdb::kDefaultColumnFamilyName; return rocksdb::kDefaultColumnFamilyName;
} else { } else {
@ -872,7 +871,7 @@ enum RepFactory {
kCuckoo kCuckoo
}; };
enum RepFactory StringToRepFactory(const char* ctype) { static enum RepFactory StringToRepFactory(const char* ctype) {
assert(ctype); assert(ctype);
if (!strcasecmp(ctype, "skip_list")) if (!strcasecmp(ctype, "skip_list"))
@ -940,7 +939,6 @@ static const bool FLAGS_deletepercent_dummy __attribute__((unused)) =
static const bool FLAGS_table_cache_numshardbits_dummy __attribute__((unused)) = static const bool FLAGS_table_cache_numshardbits_dummy __attribute__((unused)) =
RegisterFlagValidator(&FLAGS_table_cache_numshardbits, RegisterFlagValidator(&FLAGS_table_cache_numshardbits,
&ValidateTableCacheNumshardbits); &ValidateTableCacheNumshardbits);
} // namespace
namespace rocksdb { namespace rocksdb {