Skip to content

Commit

Permalink
Replace namespace name "rocksdb" with ROCKSDB_NAMESPACE (facebook#6433)
Browse files Browse the repository at this point in the history
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
  • Loading branch information
siying authored and facebook-github-bot committed Feb 20, 2020
1 parent 4e33f1e commit fdf882d
Show file tree
Hide file tree
Showing 889 changed files with 9,561 additions and 8,457 deletions.
2 changes: 1 addition & 1 deletion .travis.yml
Original file line number Diff line number Diff line change
Expand Up @@ -103,7 +103,7 @@ script:
OPT=-DTRAVIS V=1 ROCKSDBTESTS_START=db_block_cache_test ROCKSDBTESTS_END=db_iter_test make -j4 check_some
;;
2)
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
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
;;
3)
OPT=-DTRAVIS V=1 ROCKSDBTESTS_START=options_file_test ROCKSDBTESTS_END=write_prepared_transaction_test make -j4 check_some
Expand Down
1 change: 1 addition & 0 deletions HISTORY.md
Original file line number Diff line number Diff line change
Expand Up @@ -23,6 +23,7 @@
### New Features
* 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).
* `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.
* Replace RocksDB namespace "rocksdb" with flag "ROCKSDB_NAMESPACE" which if is not defined, defined as "rocksdb".

## 6.7.0 (01/21/2020)
### Public API Change
Expand Down
8 changes: 4 additions & 4 deletions cache/cache_bench.cc
Original file line number Diff line number Diff line change
Expand Up @@ -45,7 +45,7 @@ DEFINE_int32(erase_percent, 10,

DEFINE_bool(use_clock_cache, false, "");

namespace rocksdb {
namespace ROCKSDB_NAMESPACE {

class CacheBench;
namespace {
Expand Down Expand Up @@ -154,7 +154,7 @@ class CacheBench {
}

bool Run() {
rocksdb::Env* env = rocksdb::Env::Default();
ROCKSDB_NAMESPACE::Env* env = ROCKSDB_NAMESPACE::Env::Default();

PrintEnv();
SharedState shared(this);
Expand Down Expand Up @@ -257,7 +257,7 @@ class CacheBench {
printf("----------------------------\n");
}
};
} // namespace rocksdb
} // namespace ROCKSDB_NAMESPACE

int main(int argc, char** argv) {
ParseCommandLineFlags(&argc, &argv, true);
Expand All @@ -267,7 +267,7 @@ int main(int argc, char** argv) {
exit(1);
}

rocksdb::CacheBench bench;
ROCKSDB_NAMESPACE::CacheBench bench;
if (FLAGS_populate_cache) {
bench.PopulateCache();
}
Expand Down
4 changes: 2 additions & 2 deletions cache/cache_test.cc
Original file line number Diff line number Diff line change
Expand Up @@ -20,7 +20,7 @@
#include "util/coding.h"
#include "util/string_util.h"

namespace rocksdb {
namespace ROCKSDB_NAMESPACE {

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

} // namespace rocksdb
} // namespace ROCKSDB_NAMESPACE

int main(int argc, char** argv) {
::testing::InitGoogleTest(&argc, argv);
Expand Down
8 changes: 4 additions & 4 deletions cache/clock_cache.cc
Original file line number Diff line number Diff line change
Expand Up @@ -11,7 +11,7 @@

#ifndef SUPPORT_CLOCK_CACHE

namespace rocksdb {
namespace ROCKSDB_NAMESPACE {

std::shared_ptr<Cache> NewClockCache(
size_t /*capacity*/, int /*num_shard_bits*/, bool /*strict_capacity_limit*/,
Expand All @@ -20,7 +20,7 @@ std::shared_ptr<Cache> NewClockCache(
return nullptr;
}

} // namespace rocksdb
} // namespace ROCKSDB_NAMESPACE

#else

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

namespace rocksdb {
namespace ROCKSDB_NAMESPACE {

namespace {

Expand Down Expand Up @@ -756,6 +756,6 @@ std::shared_ptr<Cache> NewClockCache(
capacity, num_shard_bits, strict_capacity_limit, metadata_charge_policy);
}

} // namespace rocksdb
} // namespace ROCKSDB_NAMESPACE

#endif // SUPPORT_CLOCK_CACHE
4 changes: 2 additions & 2 deletions cache/lru_cache.cc
Original file line number Diff line number Diff line change
Expand Up @@ -16,7 +16,7 @@

#include "util/mutexlock.h"

namespace rocksdb {
namespace ROCKSDB_NAMESPACE {

LRUHandleTable::LRUHandleTable() : list_(nullptr), length_(0), elems_(0) {
Resize();
Expand Down Expand Up @@ -571,4 +571,4 @@ std::shared_ptr<Cache> NewLRUCache(
std::move(memory_allocator), use_adaptive_mutex, metadata_charge_policy);
}

} // namespace rocksdb
} // namespace ROCKSDB_NAMESPACE
4 changes: 2 additions & 2 deletions cache/lru_cache.h
Original file line number Diff line number Diff line change
Expand Up @@ -16,7 +16,7 @@
#include "port/port.h"
#include "util/autovector.h"

namespace rocksdb {
namespace ROCKSDB_NAMESPACE {

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

Expand Down Expand Up @@ -336,4 +336,4 @@ class LRUCache
int num_shards_ = 0;
};

} // namespace rocksdb
} // namespace ROCKSDB_NAMESPACE
4 changes: 2 additions & 2 deletions cache/lru_cache_test.cc
Original file line number Diff line number Diff line change
Expand Up @@ -10,7 +10,7 @@
#include "port/port.h"
#include "test_util/testharness.h"

namespace rocksdb {
namespace ROCKSDB_NAMESPACE {

class LRUCacheTest : public testing::Test {
public:
Expand Down Expand Up @@ -190,7 +190,7 @@ TEST_F(LRUCacheTest, EntriesWithPriority) {
ValidateLRUList({"e", "f", "g", "Z", "d"}, 2);
}

} // namespace rocksdb
} // namespace ROCKSDB_NAMESPACE

int main(int argc, char** argv) {
::testing::InitGoogleTest(&argc, argv);
Expand Down
4 changes: 2 additions & 2 deletions cache/sharded_cache.cc
Original file line number Diff line number Diff line change
Expand Up @@ -13,7 +13,7 @@

#include "util/mutexlock.h"

namespace rocksdb {
namespace ROCKSDB_NAMESPACE {

ShardedCache::ShardedCache(size_t capacity, int num_shard_bits,
bool strict_capacity_limit,
Expand Down Expand Up @@ -159,4 +159,4 @@ int GetDefaultCacheShardBits(size_t capacity) {
return num_shard_bits;
}

} // namespace rocksdb
} // namespace ROCKSDB_NAMESPACE
4 changes: 2 additions & 2 deletions cache/sharded_cache.h
Original file line number Diff line number Diff line change
Expand Up @@ -16,7 +16,7 @@
#include "rocksdb/cache.h"
#include "util/hash.h"

namespace rocksdb {
namespace ROCKSDB_NAMESPACE {

// Single cache shard interface.
class CacheShard {
Expand Down Expand Up @@ -108,4 +108,4 @@ class ShardedCache : public Cache {

extern int GetDefaultCacheShardBits(size_t capacity);

} // namespace rocksdb
} // namespace ROCKSDB_NAMESPACE
4 changes: 2 additions & 2 deletions db/arena_wrapped_db_iter.cc
Original file line number Diff line number Diff line change
Expand Up @@ -16,7 +16,7 @@
#include "table/iterator_wrapper.h"
#include "util/user_comparator_wrapper.h"

namespace rocksdb {
namespace ROCKSDB_NAMESPACE {

Status ArenaWrappedDBIter::GetProperty(std::string prop_name,
std::string* prop) {
Expand Down Expand Up @@ -103,4 +103,4 @@ ArenaWrappedDBIter* NewArenaWrappedDbIterator(
return iter;
}

} // namespace rocksdb
} // namespace ROCKSDB_NAMESPACE
4 changes: 2 additions & 2 deletions db/arena_wrapped_db_iter.h
Original file line number Diff line number Diff line change
Expand Up @@ -20,7 +20,7 @@
#include "rocksdb/iterator.h"
#include "util/autovector.h"

namespace rocksdb {
namespace ROCKSDB_NAMESPACE {

class Arena;

Expand Down Expand Up @@ -109,4 +109,4 @@ extern ArenaWrappedDBIter* NewArenaWrappedDbIterator(
ReadCallback* read_callback, DBImpl* db_impl = nullptr,
ColumnFamilyData* cfd = nullptr, bool allow_blob = false,
bool allow_refresh = true);
} // namespace rocksdb
} // namespace ROCKSDB_NAMESPACE
4 changes: 2 additions & 2 deletions db/blob_index.h
Original file line number Diff line number Diff line change
Expand Up @@ -12,7 +12,7 @@
#include "util/coding.h"
#include "util/string_util.h"

namespace rocksdb {
namespace ROCKSDB_NAMESPACE {

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

} // namespace rocksdb
} // namespace ROCKSDB_NAMESPACE
#endif // ROCKSDB_LITE
4 changes: 2 additions & 2 deletions db/builder.cc
Original file line number Diff line number Diff line change
Expand Up @@ -37,7 +37,7 @@
#include "test_util/sync_point.h"
#include "util/stop_watch.h"

namespace rocksdb {
namespace ROCKSDB_NAMESPACE {

class TableFactory;

Expand Down Expand Up @@ -260,4 +260,4 @@ Status BuildTable(
return s;
}

} // namespace rocksdb
} // namespace ROCKSDB_NAMESPACE
4 changes: 2 additions & 2 deletions db/builder.h
Original file line number Diff line number Diff line change
Expand Up @@ -22,7 +22,7 @@
#include "rocksdb/types.h"
#include "table/scoped_arena_iterator.h"

namespace rocksdb {
namespace ROCKSDB_NAMESPACE {

struct Options;
struct FileMetaData;
Expand Down Expand Up @@ -85,4 +85,4 @@ extern Status BuildTable(
Env::WriteLifeTimeHint write_hint = Env::WLTH_NOT_SET,
const uint64_t file_creation_time = 0);

} // namespace rocksdb
} // namespace ROCKSDB_NAMESPACE
Loading

0 comments on commit fdf882d

Please sign in to comment.