Skip to content

Commit fdf882d

Browse files
siyingfacebook-github-bot
authored andcommitted
Replace namespace name "rocksdb" with ROCKSDB_NAMESPACE (facebook#6433)
Summary: When dynamically linking two binaries together, different builds of RocksDB from two sources might cause errors. To provide a tool for user to solve the problem, the RocksDB namespace is changed to a flag which can be overridden in build time. Pull Request resolved: facebook#6433 Test Plan: Build release, all and jtest. Try to build with ROCKSDB_NAMESPACE with another flag. Differential Revision: D19977691 fbshipit-source-id: aa7f2d0972e1c31d75339ac48478f34f6cfcfb3e
1 parent 4e33f1e commit fdf882d

File tree

889 files changed

+9561
-8457
lines changed

Some content is hidden

Large Commits have some content hidden by default. Use the searchbox below for content that may be hidden.

889 files changed

+9561
-8457
lines changed

.travis.yml

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -103,7 +103,7 @@ script:
103103
OPT=-DTRAVIS V=1 ROCKSDBTESTS_START=db_block_cache_test ROCKSDBTESTS_END=db_iter_test make -j4 check_some
104104
;;
105105
2)
106-
OPT=-DTRAVIS V=1 make -j4 tools && OPT=-DTRAVIS V=1 ROCKSDBTESTS_START=db_iter_test ROCKSDBTESTS_END=options_file_test make -j4 check_some
106+
OPT="-DTRAVIS -DROCKSDB_NAMESPACE=alternative_rocksdb_ns" V=1 make -j4 tools && OPT="-DTRAVIS -DROCKSDB_NAMESPACE=alternative_rocksdb_ns" V=1 ROCKSDBTESTS_START=db_iter_test ROCKSDBTESTS_END=options_file_test make -j4 check_some
107107
;;
108108
3)
109109
OPT=-DTRAVIS V=1 ROCKSDBTESTS_START=options_file_test ROCKSDBTESTS_END=write_prepared_transaction_test make -j4 check_some

HISTORY.md

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -23,6 +23,7 @@
2323
### New Features
2424
* Added the checksum for each SST file generated by Flush or Compaction. Added sst_file_checksum_func to Options such that user can plugin their own SST file checksum function via override the FileChecksumFunc class. If user does not set the sst_file_checksum_func, SST file checksum calculation will not be enabled. The checksum information inlcuding uint32_t checksum value and a checksum function name (string). The checksum information is stored in FileMetadata in version store and also logged to MANIFEST. A new tool is added to LDB such that user can dump out a list of file checksum information from MANIFEST (stored in an unordered_map).
2525
* `db_bench` now supports `value_size_distribution_type`, `value_size_min`, `value_size_max` options for generating random variable sized value. Added `blob_db_compression_type` option for BlobDB to enable blob compression.
26+
* Replace RocksDB namespace "rocksdb" with flag "ROCKSDB_NAMESPACE" which if is not defined, defined as "rocksdb".
2627

2728
## 6.7.0 (01/21/2020)
2829
### Public API Change

cache/cache_bench.cc

Lines changed: 4 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -45,7 +45,7 @@ DEFINE_int32(erase_percent, 10,
4545

4646
DEFINE_bool(use_clock_cache, false, "");
4747

48-
namespace rocksdb {
48+
namespace ROCKSDB_NAMESPACE {
4949

5050
class CacheBench;
5151
namespace {
@@ -154,7 +154,7 @@ class CacheBench {
154154
}
155155

156156
bool Run() {
157-
rocksdb::Env* env = rocksdb::Env::Default();
157+
ROCKSDB_NAMESPACE::Env* env = ROCKSDB_NAMESPACE::Env::Default();
158158

159159
PrintEnv();
160160
SharedState shared(this);
@@ -257,7 +257,7 @@ class CacheBench {
257257
printf("----------------------------\n");
258258
}
259259
};
260-
} // namespace rocksdb
260+
} // namespace ROCKSDB_NAMESPACE
261261

262262
int main(int argc, char** argv) {
263263
ParseCommandLineFlags(&argc, &argv, true);
@@ -267,7 +267,7 @@ int main(int argc, char** argv) {
267267
exit(1);
268268
}
269269

270-
rocksdb::CacheBench bench;
270+
ROCKSDB_NAMESPACE::CacheBench bench;
271271
if (FLAGS_populate_cache) {
272272
bench.PopulateCache();
273273
}

cache/cache_test.cc

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -20,7 +20,7 @@
2020
#include "util/coding.h"
2121
#include "util/string_util.h"
2222

23-
namespace rocksdb {
23+
namespace ROCKSDB_NAMESPACE {
2424

2525
// Conversions between numeric keys/values and the types expected by Cache.
2626
static std::string EncodeKey(int k) {
@@ -765,7 +765,7 @@ INSTANTIATE_TEST_CASE_P(CacheTestInstance, CacheTest, testing::Values(kLRU));
765765
#endif // SUPPORT_CLOCK_CACHE
766766
INSTANTIATE_TEST_CASE_P(CacheTestInstance, LRUCacheTest, testing::Values(kLRU));
767767

768-
} // namespace rocksdb
768+
} // namespace ROCKSDB_NAMESPACE
769769

770770
int main(int argc, char** argv) {
771771
::testing::InitGoogleTest(&argc, argv);

cache/clock_cache.cc

Lines changed: 4 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -11,7 +11,7 @@
1111

1212
#ifndef SUPPORT_CLOCK_CACHE
1313

14-
namespace rocksdb {
14+
namespace ROCKSDB_NAMESPACE {
1515

1616
std::shared_ptr<Cache> NewClockCache(
1717
size_t /*capacity*/, int /*num_shard_bits*/, bool /*strict_capacity_limit*/,
@@ -20,7 +20,7 @@ std::shared_ptr<Cache> NewClockCache(
2020
return nullptr;
2121
}
2222

23-
} // namespace rocksdb
23+
} // namespace ROCKSDB_NAMESPACE
2424

2525
#else
2626

@@ -41,7 +41,7 @@ std::shared_ptr<Cache> NewClockCache(
4141
#include "util/autovector.h"
4242
#include "util/mutexlock.h"
4343

44-
namespace rocksdb {
44+
namespace ROCKSDB_NAMESPACE {
4545

4646
namespace {
4747

@@ -756,6 +756,6 @@ std::shared_ptr<Cache> NewClockCache(
756756
capacity, num_shard_bits, strict_capacity_limit, metadata_charge_policy);
757757
}
758758

759-
} // namespace rocksdb
759+
} // namespace ROCKSDB_NAMESPACE
760760

761761
#endif // SUPPORT_CLOCK_CACHE

cache/lru_cache.cc

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -16,7 +16,7 @@
1616

1717
#include "util/mutexlock.h"
1818

19-
namespace rocksdb {
19+
namespace ROCKSDB_NAMESPACE {
2020

2121
LRUHandleTable::LRUHandleTable() : list_(nullptr), length_(0), elems_(0) {
2222
Resize();
@@ -571,4 +571,4 @@ std::shared_ptr<Cache> NewLRUCache(
571571
std::move(memory_allocator), use_adaptive_mutex, metadata_charge_policy);
572572
}
573573

574-
} // namespace rocksdb
574+
} // namespace ROCKSDB_NAMESPACE

cache/lru_cache.h

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -16,7 +16,7 @@
1616
#include "port/port.h"
1717
#include "util/autovector.h"
1818

19-
namespace rocksdb {
19+
namespace ROCKSDB_NAMESPACE {
2020

2121
// LRU cache implementation. This class is not thread-safe.
2222

@@ -336,4 +336,4 @@ class LRUCache
336336
int num_shards_ = 0;
337337
};
338338

339-
} // namespace rocksdb
339+
} // namespace ROCKSDB_NAMESPACE

cache/lru_cache_test.cc

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -10,7 +10,7 @@
1010
#include "port/port.h"
1111
#include "test_util/testharness.h"
1212

13-
namespace rocksdb {
13+
namespace ROCKSDB_NAMESPACE {
1414

1515
class LRUCacheTest : public testing::Test {
1616
public:
@@ -190,7 +190,7 @@ TEST_F(LRUCacheTest, EntriesWithPriority) {
190190
ValidateLRUList({"e", "f", "g", "Z", "d"}, 2);
191191
}
192192

193-
} // namespace rocksdb
193+
} // namespace ROCKSDB_NAMESPACE
194194

195195
int main(int argc, char** argv) {
196196
::testing::InitGoogleTest(&argc, argv);

cache/sharded_cache.cc

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -13,7 +13,7 @@
1313

1414
#include "util/mutexlock.h"
1515

16-
namespace rocksdb {
16+
namespace ROCKSDB_NAMESPACE {
1717

1818
ShardedCache::ShardedCache(size_t capacity, int num_shard_bits,
1919
bool strict_capacity_limit,
@@ -159,4 +159,4 @@ int GetDefaultCacheShardBits(size_t capacity) {
159159
return num_shard_bits;
160160
}
161161

162-
} // namespace rocksdb
162+
} // namespace ROCKSDB_NAMESPACE

cache/sharded_cache.h

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -16,7 +16,7 @@
1616
#include "rocksdb/cache.h"
1717
#include "util/hash.h"
1818

19-
namespace rocksdb {
19+
namespace ROCKSDB_NAMESPACE {
2020

2121
// Single cache shard interface.
2222
class CacheShard {
@@ -108,4 +108,4 @@ class ShardedCache : public Cache {
108108

109109
extern int GetDefaultCacheShardBits(size_t capacity);
110110

111-
} // namespace rocksdb
111+
} // namespace ROCKSDB_NAMESPACE

db/arena_wrapped_db_iter.cc

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -16,7 +16,7 @@
1616
#include "table/iterator_wrapper.h"
1717
#include "util/user_comparator_wrapper.h"
1818

19-
namespace rocksdb {
19+
namespace ROCKSDB_NAMESPACE {
2020

2121
Status ArenaWrappedDBIter::GetProperty(std::string prop_name,
2222
std::string* prop) {
@@ -103,4 +103,4 @@ ArenaWrappedDBIter* NewArenaWrappedDbIterator(
103103
return iter;
104104
}
105105

106-
} // namespace rocksdb
106+
} // namespace ROCKSDB_NAMESPACE

db/arena_wrapped_db_iter.h

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -20,7 +20,7 @@
2020
#include "rocksdb/iterator.h"
2121
#include "util/autovector.h"
2222

23-
namespace rocksdb {
23+
namespace ROCKSDB_NAMESPACE {
2424

2525
class Arena;
2626

@@ -109,4 +109,4 @@ extern ArenaWrappedDBIter* NewArenaWrappedDbIterator(
109109
ReadCallback* read_callback, DBImpl* db_impl = nullptr,
110110
ColumnFamilyData* cfd = nullptr, bool allow_blob = false,
111111
bool allow_refresh = true);
112-
} // namespace rocksdb
112+
} // namespace ROCKSDB_NAMESPACE

db/blob_index.h

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -12,7 +12,7 @@
1212
#include "util/coding.h"
1313
#include "util/string_util.h"
1414

15-
namespace rocksdb {
15+
namespace ROCKSDB_NAMESPACE {
1616

1717
// BlobIndex is a pointer to the blob and metadata of the blob. The index is
1818
// stored in base DB as ValueType::kTypeBlobIndex.
@@ -175,5 +175,5 @@ class BlobIndex {
175175
CompressionType compression_ = kNoCompression;
176176
};
177177

178-
} // namespace rocksdb
178+
} // namespace ROCKSDB_NAMESPACE
179179
#endif // ROCKSDB_LITE

db/builder.cc

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -37,7 +37,7 @@
3737
#include "test_util/sync_point.h"
3838
#include "util/stop_watch.h"
3939

40-
namespace rocksdb {
40+
namespace ROCKSDB_NAMESPACE {
4141

4242
class TableFactory;
4343

@@ -260,4 +260,4 @@ Status BuildTable(
260260
return s;
261261
}
262262

263-
} // namespace rocksdb
263+
} // namespace ROCKSDB_NAMESPACE

db/builder.h

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -22,7 +22,7 @@
2222
#include "rocksdb/types.h"
2323
#include "table/scoped_arena_iterator.h"
2424

25-
namespace rocksdb {
25+
namespace ROCKSDB_NAMESPACE {
2626

2727
struct Options;
2828
struct FileMetaData;
@@ -85,4 +85,4 @@ extern Status BuildTable(
8585
Env::WriteLifeTimeHint write_hint = Env::WLTH_NOT_SET,
8686
const uint64_t file_creation_time = 0);
8787

88-
} // namespace rocksdb
88+
} // namespace ROCKSDB_NAMESPACE

0 commit comments

Comments
 (0)