From a5a5be4b4cbfbf75396d58e7465c8b307d434ff3 Mon Sep 17 00:00:00 2001 From: anand76 Date: Thu, 19 Nov 2020 22:37:55 -0800 Subject: [PATCH] Fix initialization order of DBOptions and kHostnameForDbHostId (#7702) Summary: Fix initialization order of DBOptions and kHostnameForDbHostId by making the initialization of the latter static rather than dynamic. Pull Request resolved: https://github.com/facebook/rocksdb/pull/7702 Reviewed By: ajkr Differential Revision: D25111633 Pulled By: anand1976 fbshipit-source-id: 7afad834a66e40bcd8694a43b40d378695212224 --- include/rocksdb/options.h | 2 +- table/format.cc | 1 + 2 files changed, 2 insertions(+), 1 deletion(-) diff --git a/include/rocksdb/options.h b/include/rocksdb/options.h index c62ecb09c..79ab8af54 100644 --- a/include/rocksdb/options.h +++ b/include/rocksdb/options.h @@ -349,7 +349,7 @@ struct DbPath { DbPath(const std::string& p, uint64_t t) : path(p), target_size(t) {} }; -static const std::string kHostnameForDbHostId = "__hostname__"; +extern const char* kHostnameForDbHostId; struct DBOptions { // The function recovers options to the option as in version 4.6. diff --git a/table/format.cc b/table/format.cc index 8af4d35e5..8fb66f8a1 100644 --- a/table/format.cc +++ b/table/format.cc @@ -41,6 +41,7 @@ extern const uint64_t kPlainTableMagicNumber; const uint64_t kLegacyPlainTableMagicNumber = 0; const uint64_t kPlainTableMagicNumber = 0; #endif +const char* kHostnameForDbHostId = "__hostname__"; bool ShouldReportDetailedTime(Env* env, Statistics* stats) { return env != nullptr && stats != nullptr &&