From 4463b11cad36b2d8216e7ddb887a5fde07587828 Mon Sep 17 00:00:00 2001 From: Dhruba Borthakur Date: Fri, 4 Oct 2013 22:32:05 -0700 Subject: [PATCH] Migrate names of properties from 'leveldb' prefix to 'rocksdb' prefix. Summary: Migrate names of properties from 'leveldb' prefix to 'rocksdb' prefix. Test Plan: make check Reviewers: emayanke, haobo Reviewed By: haobo CC: leveldb Differential Revision: https://reviews.facebook.net/D13311 --- build_tools/build_detect_version | 10 +-- build_tools/build_java.sh | 86 ------------------- db/builder.h | 7 +- db/c_test.c | 2 +- db/corruption_test.cc | 4 +- db/db_bench.cc | 8 +- db/db_impl.cc | 10 +-- db/db_impl.h | 9 +- db/db_impl_readonly.h | 6 +- db/db_iter.h | 6 +- db/db_statistics.h | 6 +- db/db_test.cc | 8 +- db/dbformat.h | 8 +- db/filename.h | 8 +- db/log_format.h | 6 +- db/log_reader.h | 6 +- db/log_writer.h | 6 +- db/memtable.h | 6 +- db/memtablelist.h | 6 +- db/merge_test.cc | 6 +- db/perf_context_test.cc | 2 +- db/prefix_filter_iterator.h | 6 +- db/repair.cc | 2 +- db/skiplist.h | 6 +- db/snapshot.h | 6 +- db/table_cache.h | 6 +- db/transaction_log_impl.h | 8 +- db/version_edit.h | 6 +- db/version_set.h | 6 +- db/write_batch_internal.h | 7 +- hdfs/README | 8 +- hdfs/env_hdfs.h | 10 +-- include/rocksdb/comparator.h | 4 +- include/rocksdb/db.h | 6 +- include/rocksdb/env.h | 4 +- include/rocksdb/filter_policy.h | 4 +- include/rocksdb/ldb_tool.h | 3 - include/rocksdb/memtablerep.h | 4 +- include/rocksdb/options.h | 4 +- include/rocksdb/slice.h | 2 +- include/rocksdb/statistics.h | 2 +- include/utilities/stackable_db.h | 6 +- include/utilities/utility_db.h | 8 +- table/block.h | 6 +- table/block_builder.h | 6 +- table/filter_block.h | 6 +- table/format.h | 6 +- table/iter_heap.h | 5 +- table/iterator_wrapper.h | 6 +- table/merger.h | 5 +- table/table.h | 6 +- table/table_test.cc | 4 +- table/two_level_iterator.h | 6 +- tools/db_crashtest2.py | 2 +- tools/db_stress.cc | 4 +- tools/reduce_levels_test.cc | 2 +- tools/shell/DBClientProxy.h | 2 +- tools/shell/ShellState.h | 2 +- util/arena_impl.h | 6 +- util/auto_roll_logger.h | 6 +- util/auto_roll_logger_test.cc | 2 +- util/bit_set.h | 6 +- util/bloom.cc | 2 +- util/build_version.h | 13 +-- util/coding.h | 6 +- util/comparator.cc | 2 +- util/crc32c.h | 6 +- util/env_hdfs.cc | 10 +-- util/env_posix.cc | 66 +++++++------- util/hash.h | 6 +- util/histogram.h | 6 +- util/ldb_cmd.cc | 8 +- util/ldb_cmd.h | 5 +- util/ldb_cmd_execute_result.h | 5 +- util/logging.h | 6 +- util/manual_compaction_test.cc | 2 +- util/murmurhash.h | 6 +- util/mutexlock.h | 7 +- util/perf_context_imp.h | 6 +- util/posix_logger.h | 6 +- util/random.h | 6 +- util/stack_trace.h | 6 +- util/stats_logger.h | 5 +- util/stl_wrappers.h | 5 +- util/stop_watch.h | 5 +- util/string_util.h | 6 +- util/testharness.cc | 2 +- util/testharness.h | 15 ++-- util/testutil.h | 6 +- .../string_append/stringappend.cc | 2 +- .../string_append/stringappend.h | 2 +- .../string_append/stringappend2.h | 2 +- .../string_append/stringappend_test.cc | 2 +- utilities/redis/redis_list_exception.h | 6 +- utilities/ttl/db_ttl.h | 5 +- 95 files changed, 175 insertions(+), 490 deletions(-) delete mode 100755 build_tools/build_java.sh diff --git a/build_tools/build_detect_version b/build_tools/build_detect_version index 513d89a71..ae9e39174 100755 --- a/build_tools/build_detect_version +++ b/build_tools/build_detect_version @@ -20,7 +20,7 @@ if [ "$?" = 0 ]; then BEGIN { print "#include \"build_version.h\"\n" } - { print "const char* leveldb_build_git_sha = \"leveldb_build_git_sha:" $0"\";" } + { print "const char* rocksdb_build_git_sha = \"rocksdb_build_git_sha:" $0"\";" } ' > ${VFILE} else echo "git not found" | @@ -28,13 +28,13 @@ else BEGIN { print "#include \"build_version.h\"" } - { print "const char* leveldb_build_git_sha = \"leveldb_build_git_sha:git not found\";" } + { print "const char* rocksdb_build_git_sha = \"rocksdb_build_git_sha:git not found\";" } ' > ${VFILE} fi -echo "const char* leveldb_build_git_datetime = \"leveldb_build_git_datetime:$(date)\";" >> ${VFILE} -echo "const char* leveldb_build_compile_date = __DATE__;" >> ${VFILE} -echo "const char* leveldb_build_compile_time = __TIME__;" >> ${VFILE} +echo "const char* rocksdb_build_git_datetime = \"rocksdb_build_git_datetime:$(date)\";" >> ${VFILE} +echo "const char* rocksdb_build_compile_date = __DATE__;" >> ${VFILE} +echo "const char* rocksdb_build_compile_time = __TIME__;" >> ${VFILE} OUTFILE=$ROCKSDB_ROOT/util/build_version.cc if [ ! -e $OUTFILE ] || ! cmp -s $VFILE $OUTFILE; then diff --git a/build_tools/build_java.sh b/build_tools/build_java.sh deleted file mode 100755 index b0e1442fc..000000000 --- a/build_tools/build_java.sh +++ /dev/null @@ -1,86 +0,0 @@ -#!/bin/bash -e -function print_usage { - echo "Usage: $0 [build | release | bump_version version ]" -} - -function check_env { - if [ -z $LEVELDB_HOME ] ; then - echo "Expect LEVELDB_HOME to be SET" - exit 1 - fi - if [ -z $JAVA_HOME ] ; then - export JAVA_HOME=/usr/local/jdk-6u14-64/ - echo "JAVA_HOME not set. Assuming JAVA_HOME=$JAVA_HOME" - fi - if [ -z $LEVELDBJNI_HOME ] ; then - export LEVELDBJNI_HOME=$LEVELDB_HOME/java/leveldbjni/ - echo "LEVELDBJNI_HOME not set. Assuming LEVELDBJNI_HOME=$LEVELDBJNI_HOME" - fi - if [ -z $SNAPPY_HOME ] ; then - export SNAPPY_HOME="/home/dhruba/snappy-1.0.5" - echo "SNAPPY_HOME not set. Assuming SNAPPY_HOME=$SNAPPY_HOME" - fi - if [ -z $LEVELDB_PATCH ] ; then - LEVELDB_PATCH=$LEVELDB_HOME/java/leveldbjni/db.h.patch - echo "LEVELDB_PATCH not set. Assuming LEVELDB_PATCH=$LEVELDB_PATCH" - fi -} - -function build { - cd $LEVELDB_HOME - git apply $LEVELDB_PATCH - make clean libleveldb.a - cd $LEVELDB_HOME/java/leveldb/leveldb-api - mvn clean package - cd $LEVELDBJNI_HOME - mvn clean install -P linux64 - cd $LEVELDB_HOME - git checkout $LEVELDB_HOME/include/leveldb/db.h -} - -function release { - cd $LEVELDB_HOME - git apply $LEVELDB_PATCH - make clean libleveldb.a - cd $LEVELDB_HOME/java/leveldb/leveldb-api - mvn clean package - cd $LEVELDBJNI_HOME - mvn deploy -P linux64 -DskipTests - cd $LEVELDB_HOME - git checkout $LEVELDB_HOME/include/leveldb/db.h -} - -CMD=$1 -if [ -z $CMD ]; then - print_usage - exit 1 -fi - -case "$CMD" in - build) - check_env - build - ;; - bump_version) - if [ -z $2 ] ; then - echo "bump_version requires a version.no parameter at the end" - exit 1 - fi - check_env - VERSION=$2 - pushd $LEVELDBJNI_HOME - mvn versions:set -DnewVersion="$VERSION" - popd - echo "VERSION SET TO $VERSION" - ;; - release) - check_env - pushd $LEVELDBJNI_HOME - release - popd - ;; - *) - print_usage - exit 1 - ;; -esac diff --git a/db/builder.h b/db/builder.h index bce91e568..2b512af7d 100644 --- a/db/builder.h +++ b/db/builder.h @@ -1,10 +1,7 @@ // Copyright (c) 2011 The LevelDB Authors. All rights reserved. // Use of this source code is governed by a BSD-style license that can be // found in the LICENSE file. See the AUTHORS file for names of contributors. - -#ifndef STORAGE_LEVELDB_DB_BUILDER_H_ -#define STORAGE_LEVELDB_DB_BUILDER_H_ - +#pragma once #include "rocksdb/comparator.h" #include "rocksdb/status.h" #include "rocksdb/types.h" @@ -37,5 +34,3 @@ extern Status BuildTable(const std::string& dbname, const SequenceNumber earliest_seqno_in_memtable); } // namespace rocksdb - -#endif // STORAGE_LEVELDB_DB_BUILDER_H_ diff --git a/db/c_test.c b/db/c_test.c index 095c455a9..abbe1ddd5 100644 --- a/db/c_test.c +++ b/db/c_test.c @@ -296,7 +296,7 @@ int main(int argc, char** argv) { { char* prop = leveldb_property_value(db, "nosuchprop"); CheckCondition(prop == NULL); - prop = leveldb_property_value(db, "leveldb.stats"); + prop = leveldb_property_value(db, "rocksdb.stats"); CheckCondition(prop != NULL); Free(&prop); } diff --git a/db/corruption_test.cc b/db/corruption_test.cc index c8c7b048e..ecd5b5344 100644 --- a/db/corruption_test.cc +++ b/db/corruption_test.cc @@ -298,7 +298,7 @@ TEST(CorruptionTest, CompactionInputError) { DBImpl* dbi = reinterpret_cast(db_); dbi->TEST_CompactMemTable(); const int last = dbi->MaxMemCompactionLevel(); - ASSERT_EQ(1, Property("leveldb.num-files-at-level" + NumberToString(last))); + ASSERT_EQ(1, Property("rocksdb.num-files-at-level" + NumberToString(last))); Corrupt(kTableFile, 100, 1); Check(9, 9); @@ -324,7 +324,7 @@ TEST(CorruptionTest, CompactionInputErrorParanoid) { Build(10); dbi->TEST_CompactMemTable(); - ASSERT_EQ(1, Property("leveldb.num-files-at-level0")); + ASSERT_EQ(1, Property("rocksdb.num-files-at-level0")); Corrupt(kTableFile, 100, 1); Check(9, 9); diff --git a/db/db_bench.cc b/db/db_bench.cc index cacec5aeb..523fc7220 100644 --- a/db/db_bench.cc +++ b/db/db_bench.cc @@ -546,7 +546,7 @@ class Stats { if (FLAGS_stats_per_interval) { std::string stats; - if (db && db->GetProperty("leveldb.stats", &stats)) + if (db && db->GetProperty("rocksdb.stats", &stats)) fprintf(stderr, "%s\n", stats.c_str()); } @@ -985,11 +985,11 @@ class Benchmark { } else if (name == Slice("heapprofile")) { HeapProfile(); } else if (name == Slice("stats")) { - PrintStats("leveldb.stats"); + PrintStats("rocksdb.stats"); } else if (name == Slice("levelstats")) { - PrintStats("leveldb.levelstats"); + PrintStats("rocksdb.levelstats"); } else if (name == Slice("sstables")) { - PrintStats("leveldb.sstables"); + PrintStats("rocksdb.sstables"); } else { if (name != Slice()) { // No error message for empty name fprintf(stderr, "unknown benchmark '%s'\n", name.ToString().c_str()); diff --git a/db/db_impl.cc b/db/db_impl.cc index 6760963f4..1a1a5d405 100644 --- a/db/db_impl.cc +++ b/db/db_impl.cc @@ -382,7 +382,7 @@ void DBImpl::MaybeDumpStats() { // period in rare cases. last_stats_dump_time_microsec_ = now_micros; std::string stats; - GetProperty("leveldb.stats", &stats); + GetProperty("rocksdb.stats", &stats); Log(options_.info_log, "%s", stats.c_str()); PrintStatistics(); } @@ -630,7 +630,7 @@ Status DBImpl::Recover(VersionEdit* edit, MemTable* external_table, // // Note that PrevLogNumber() is no longer used, but we pay // attention to it in case we are recovering a database - // produced by an older version of leveldb. + // produced by an older version of rocksdb. const uint64_t min_log = versions_->LogNumber(); const uint64_t prev_log = versions_->PrevLogNumber(); std::vector filenames; @@ -2846,7 +2846,7 @@ bool DBImpl::GetProperty(const Slice& property, std::string* value) { MutexLock l(&mutex_); Slice in = property; - Slice prefix("leveldb."); + Slice prefix("rocksdb."); if (!in.starts_with(prefix)) return false; in.remove_prefix(prefix.size()); @@ -3288,9 +3288,9 @@ Status DestroyDB(const std::string& dbname, const Options& options) { // // A global method that can dump out the build version void dumpLeveldbBuildVersion(Logger * log) { - Log(log, "Git sha %s", leveldb_build_git_sha); + Log(log, "Git sha %s", rocksdb_build_git_sha); Log(log, "Compile time %s %s", - leveldb_build_compile_time, leveldb_build_compile_date); + rocksdb_build_compile_time, rocksdb_build_compile_date); } } // namespace rocksdb diff --git a/db/db_impl.h b/db/db_impl.h index 232c06051..efc59d253 100644 --- a/db/db_impl.h +++ b/db/db_impl.h @@ -1,10 +1,7 @@ // Copyright (c) 2011 The LevelDB Authors. All rights reserved. // Use of this source code is governed by a BSD-style license that can be // found in the LICENSE file. See the AUTHORS file for names of contributors. - -#ifndef STORAGE_LEVELDB_DB_DB_IMPL_H_ -#define STORAGE_LEVELDB_DB_DB_IMPL_H_ - +#pragma once #include #include #include @@ -236,7 +233,7 @@ class DBImpl : public DB { void PrintStatistics(); - // dump leveldb.stats to LOG + // dump rocksdb.stats to LOG void MaybeDumpStats(); // Return the minimum empty level that could hold the total data in the @@ -441,5 +438,3 @@ extern Options SanitizeOptions(const std::string& db, const Options& src); } // namespace rocksdb - -#endif // STORAGE_LEVELDB_DB_DB_IMPL_H_ diff --git a/db/db_impl_readonly.h b/db/db_impl_readonly.h index 8723b7e26..f6d621410 100644 --- a/db/db_impl_readonly.h +++ b/db/db_impl_readonly.h @@ -2,9 +2,7 @@ // Use of this source code is governed by a BSD-style license that can be // found in the LICENSE file. -#ifndef STORAGE_LEVELDB_DB_DB_IMPL_READONLY_H_ -#define STORAGE_LEVELDB_DB_DB_IMPL_READONLY_H_ - +#pragma once #include "db/db_impl.h" #include @@ -73,5 +71,3 @@ private: }; } - -#endif diff --git a/db/db_iter.h b/db/db_iter.h index 7293e0651..547f72f1d 100644 --- a/db/db_iter.h +++ b/db/db_iter.h @@ -2,9 +2,7 @@ // Use of this source code is governed by a BSD-style license that can be // found in the LICENSE file. See the AUTHORS file for names of contributors. -#ifndef STORAGE_LEVELDB_DB_DB_ITER_H_ -#define STORAGE_LEVELDB_DB_DB_ITER_H_ - +#pragma once #include #include "rocksdb/db.h" #include "db/dbformat.h" @@ -23,5 +21,3 @@ extern Iterator* NewDBIterator( const SequenceNumber& sequence); } // namespace rocksdb - -#endif // STORAGE_LEVELDB_DB_DB_ITER_H_ diff --git a/db/db_statistics.h b/db/db_statistics.h index 561d47e8b..20d745fbe 100644 --- a/db/db_statistics.h +++ b/db/db_statistics.h @@ -2,9 +2,7 @@ // Use of this source code is governed by a BSD-style license that can be // found in the LICENSE file. See the AUTHORS file for names of contributors. -#ifndef LEVELDB_STORAGE_DB_DB_STATISTICS_H_ -#define LEVELDB_STORAGE_DB_DB_STATISTICS_H_ - +#pragma once #include #include #include @@ -60,5 +58,3 @@ std::shared_ptr CreateDBStatistics() { } } // namespace rocksdb - -#endif // LEVELDB_STORAGE_DB_DB_STATISTICS_H_ diff --git a/db/db_test.cc b/db/db_test.cc index 34b3f3a58..9158693f1 100644 --- a/db/db_test.cc +++ b/db/db_test.cc @@ -489,7 +489,7 @@ class DBTest { int NumTableFilesAtLevel(int level) { std::string property; ASSERT_TRUE( - db_->GetProperty("leveldb.num-files-at-level" + NumberToString(level), + db_->GetProperty("rocksdb.num-files-at-level" + NumberToString(level), &property)); return atoi(property.c_str()); } @@ -574,7 +574,7 @@ class DBTest { std::string DumpSSTableList() { std::string property; - db_->GetProperty("leveldb.sstables", &property); + db_->GetProperty("rocksdb.sstables", &property); return property; } @@ -2802,7 +2802,7 @@ TEST(DBTest, L0_CompactionBug_Issue44_b) { TEST(DBTest, ComparatorCheck) { class NewComparator : public Comparator { public: - virtual const char* Name() const { return "leveldb.NewComparator"; } + virtual const char* Name() const { return "rocksdb.NewComparator"; } virtual int Compare(const Slice& a, const Slice& b) const { return BytewiseComparator()->Compare(a, b); } @@ -4283,7 +4283,7 @@ std::string MakeKey(unsigned int num) { } void BM_LogAndApply(int iters, int num_base_files) { - std::string dbname = test::TmpDir() + "/leveldb_test_benchmark"; + std::string dbname = test::TmpDir() + "/rocksdb_test_benchmark"; DestroyDB(dbname, Options()); DB* db = nullptr; diff --git a/db/dbformat.h b/db/dbformat.h index ccc4fc5ae..0a2cc2ff8 100644 --- a/db/dbformat.h +++ b/db/dbformat.h @@ -2,9 +2,7 @@ // Use of this source code is governed by a BSD-style license that can be // found in the LICENSE file. See the AUTHORS file for names of contributors. -#ifndef STORAGE_LEVELDB_DB_FORMAT_H_ -#define STORAGE_LEVELDB_DB_FORMAT_H_ - +#pragma once #include #include "rocksdb/comparator.h" #include "rocksdb/db.h" @@ -90,7 +88,7 @@ class InternalKeyComparator : public Comparator { std::string name_; public: explicit InternalKeyComparator(const Comparator* c) : user_comparator_(c), - name_("leveldb.InternalKeyComparator:" + + name_("rocksdb.InternalKeyComparator:" + std::string(user_comparator_->Name())) { } @@ -224,5 +222,3 @@ inline LookupKey::~LookupKey() { } } // namespace rocksdb - -#endif // STORAGE_LEVELDB_DB_FORMAT_H_ diff --git a/db/filename.h b/db/filename.h index fcfc372f5..ddf14df29 100644 --- a/db/filename.h +++ b/db/filename.h @@ -4,9 +4,7 @@ // // File names used by DB code -#ifndef STORAGE_LEVELDB_DB_FILENAME_H_ -#define STORAGE_LEVELDB_DB_FILENAME_H_ - +#pragma once #include #include #include "rocksdb/slice.h" @@ -79,7 +77,7 @@ extern std::string OldInfoLogFileName(const std::string& dbname, uint64_t ts, extern std::string MetaDatabaseName(const std::string& dbname, uint64_t number); -// If filename is a leveldb file, store the type of the file in *type. +// If filename is a rocksdb file, store the type of the file in *type. // The number encoded in the filename is stored in *number. If the // filename was successfully parsed, returns true. Else return false. extern bool ParseFileName(const std::string& filename, @@ -93,5 +91,3 @@ extern Status SetCurrentFile(Env* env, const std::string& dbname, } // namespace rocksdb - -#endif // STORAGE_LEVELDB_DB_FILENAME_H_ diff --git a/db/log_format.h b/db/log_format.h index dbf94bc94..f5d3a3ae9 100644 --- a/db/log_format.h +++ b/db/log_format.h @@ -5,9 +5,7 @@ // Log format information shared by reader and writer. // See ../doc/log_format.txt for more detail. -#ifndef STORAGE_LEVELDB_DB_LOG_FORMAT_H_ -#define STORAGE_LEVELDB_DB_LOG_FORMAT_H_ - +#pragma once namespace rocksdb { namespace log { @@ -31,5 +29,3 @@ static const int kHeaderSize = 4 + 1 + 2; } // namespace log } // namespace rocksdb - -#endif // STORAGE_LEVELDB_DB_LOG_FORMAT_H_ diff --git a/db/log_reader.h b/db/log_reader.h index 89deccfaa..cc202d3ab 100644 --- a/db/log_reader.h +++ b/db/log_reader.h @@ -2,9 +2,7 @@ // Use of this source code is governed by a BSD-style license that can be // found in the LICENSE file. See the AUTHORS file for names of contributors. -#ifndef STORAGE_LEVELDB_DB_LOG_READER_H_ -#define STORAGE_LEVELDB_DB_LOG_READER_H_ - +#pragma once #include #include @@ -119,5 +117,3 @@ class Reader { } // namespace log } // namespace rocksdb - -#endif // STORAGE_LEVELDB_DB_LOG_READER_H_ diff --git a/db/log_writer.h b/db/log_writer.h index 636eca8f2..c00a3bdb6 100644 --- a/db/log_writer.h +++ b/db/log_writer.h @@ -2,9 +2,7 @@ // Use of this source code is governed by a BSD-style license that can be // found in the LICENSE file. See the AUTHORS file for names of contributors. -#ifndef STORAGE_LEVELDB_DB_LOG_WRITER_H_ -#define STORAGE_LEVELDB_DB_LOG_WRITER_H_ - +#pragma once #include #include #include "db/log_format.h" @@ -50,5 +48,3 @@ class Writer { } // namespace log } // namespace rocksdb - -#endif // STORAGE_LEVELDB_DB_LOG_WRITER_H_ diff --git a/db/memtable.h b/db/memtable.h index 5315a416a..0fdb410da 100644 --- a/db/memtable.h +++ b/db/memtable.h @@ -2,9 +2,7 @@ // Use of this source code is governed by a BSD-style license that can be // found in the LICENSE file. See the AUTHORS file for names of contributors. -#ifndef STORAGE_LEVELDB_DB_MEMTABLE_H_ -#define STORAGE_LEVELDB_DB_MEMTABLE_H_ - +#pragma once #include #include #include @@ -147,5 +145,3 @@ class MemTable { }; } // namespace rocksdb - -#endif // STORAGE_LEVELDB_DB_MEMTABLE_H_ diff --git a/db/memtablelist.h b/db/memtablelist.h index 628e39d6d..ba9aea144 100644 --- a/db/memtablelist.h +++ b/db/memtablelist.h @@ -1,8 +1,6 @@ // Copyright (c) 2012 Facebook. -#ifndef STORAGE_LEVELDB_DB_MEMTABLELIST_H_ -#define STORAGE_LEVELDB_DB_MEMTABLELIST_H_ - +#pragma once #include #include #include @@ -100,5 +98,3 @@ class MemTableList { }; } // namespace rocksdb - -#endif // STORAGE_LEVELDB_DB_MEMTABLELIST_H_ diff --git a/db/merge_test.cc b/db/merge_test.cc index 8cb00a01f..dcba13a55 100644 --- a/db/merge_test.cc +++ b/db/merge_test.cc @@ -85,7 +85,7 @@ class Counters { } } - // mapped to a leveldb Delete + // mapped to a rocksdb Delete bool remove(const string& key) { auto s = db_->Delete(delete_option_, key); @@ -97,7 +97,7 @@ class Counters { } } - // mapped to a leveldb Get + // mapped to a rocksdb Get bool get(const string& key, uint64_t *value) { string str; auto s = db_->Get(get_option_, key, &str); @@ -159,7 +159,7 @@ class MergeBasedCounters : public Counters { merge_option_() { } - // mapped to a leveldb Merge operation + // mapped to a rocksdb Merge operation virtual bool add(const string& key, uint64_t value) override { char encoded[sizeof(uint64_t)]; EncodeFixed64(encoded, value); diff --git a/db/perf_context_test.cc b/db/perf_context_test.cc index 2a9a1f485..09c865567 100644 --- a/db/perf_context_test.cc +++ b/db/perf_context_test.cc @@ -224,7 +224,7 @@ TEST(PerfContextTest, KeyComparisonCount) { } // make perf_context_test -// export LEVELDB_TESTS=PerfContextTest.SeekKeyComparison +// export ROCKSDB_TESTS=PerfContextTest.SeekKeyComparison // For one memtable: // ./perf_context_test --write_buffer_size=500000 --total_keys=10000 // For two memtables: diff --git a/db/prefix_filter_iterator.h b/db/prefix_filter_iterator.h index 8be7dea56..d847121a1 100644 --- a/db/prefix_filter_iterator.h +++ b/db/prefix_filter_iterator.h @@ -9,9 +9,7 @@ // underlying iterator would if there happened to be no non-matching // keys in the dataset. -#ifndef STORAGE_LEVELDB_DB_PREFIX_FILTER_ITERATOR_H_ -#define STORAGE_LEVELDB_DB_PREFIX_FILTER_ITERATOR_H_ - +#pragma once #include "rocksdb/iterator.h" namespace rocksdb { @@ -72,5 +70,3 @@ class PrefixFilterIterator : public Iterator { }; } // namespace rocksdb - -#endif diff --git a/db/repair.cc b/db/repair.cc index bc9cdd586..9ef84c5aa 100644 --- a/db/repair.cc +++ b/db/repair.cc @@ -74,7 +74,7 @@ class Repairer { bytes += tables_[i].meta.file_size; } Log(options_.info_log, - "**** Repaired leveldb %s; " + "**** Repaired rocksdb %s; " "recovered %d files; %llu bytes. " "Some data may have been lost. " "****", diff --git a/db/skiplist.h b/db/skiplist.h index 97f1b9b3e..a8d9cb2dc 100644 --- a/db/skiplist.h +++ b/db/skiplist.h @@ -25,9 +25,7 @@ // ... prev vs. next pointer ordering ... // -#ifndef STORAGE_LEVELDB_DB_SKIPLIST_H_ -#define STORAGE_LEVELDB_DB_SKIPLIST_H_ - +#pragma once #include #include #include "port/port.h" @@ -401,5 +399,3 @@ bool SkipList::Contains(const Key& key) const { } } // namespace rocksdb - -#endif // STORAGE_LEVELDB_DB_SKIPLIST_H_ diff --git a/db/snapshot.h b/db/snapshot.h index a3c725a38..e6731db80 100644 --- a/db/snapshot.h +++ b/db/snapshot.h @@ -2,9 +2,7 @@ // Use of this source code is governed by a BSD-style license that can be // found in the LICENSE file. See the AUTHORS file for names of contributors. -#ifndef STORAGE_LEVELDB_DB_SNAPSHOT_H_ -#define STORAGE_LEVELDB_DB_SNAPSHOT_H_ - +#pragma once #include "rocksdb/db.h" namespace rocksdb { @@ -81,5 +79,3 @@ class SnapshotList { }; } // namespace rocksdb - -#endif // STORAGE_LEVELDB_DB_SNAPSHOT_H_ diff --git a/db/table_cache.h b/db/table_cache.h index 86afd0ea0..405978044 100644 --- a/db/table_cache.h +++ b/db/table_cache.h @@ -4,9 +4,7 @@ // // Thread-safe (provides internal synchronization) -#ifndef STORAGE_LEVELDB_DB_TABLE_CACHE_H_ -#define STORAGE_LEVELDB_DB_TABLE_CACHE_H_ - +#pragma once #include #include #include "db/dbformat.h" @@ -73,5 +71,3 @@ class TableCache { }; } // namespace rocksdb - -#endif // STORAGE_LEVELDB_DB_TABLE_CACHE_H_ diff --git a/db/transaction_log_impl.h b/db/transaction_log_impl.h index a26f854d6..a8d155126 100644 --- a/db/transaction_log_impl.h +++ b/db/transaction_log_impl.h @@ -1,7 +1,5 @@ // Copyright 2008-present Facebook. All Rights Reserved. -#ifndef STORAGE_LEVELDB_INCLUDE_WRITES_ITERATOR_IMPL_H_ -#define STORAGE_LEVELDB_INCLUDE_WRITES_ITERATOR_IMPL_H_ - +#pragma once #include #include "rocksdb/env.h" @@ -96,8 +94,4 @@ class TransactionLogIteratorImpl : public TransactionLogIterator { void UpdateCurrentWriteBatch(const Slice& record); Status OpenLogReader(const LogFile* file); }; - - - } // namespace rocksdb -#endif // STORAGE_LEVELDB_INCLUDE_WRITES_ITERATOR_IMPL_H_ diff --git a/db/version_edit.h b/db/version_edit.h index 2ea8da522..2122f99d0 100644 --- a/db/version_edit.h +++ b/db/version_edit.h @@ -2,9 +2,7 @@ // Use of this source code is governed by a BSD-style license that can be // found in the LICENSE file. See the AUTHORS file for names of contributors. -#ifndef STORAGE_LEVELDB_DB_VERSION_EDIT_H_ -#define STORAGE_LEVELDB_DB_VERSION_EDIT_H_ - +#pragma once #include #include #include @@ -123,5 +121,3 @@ class VersionEdit { }; } // namespace rocksdb - -#endif // STORAGE_LEVELDB_DB_VERSION_EDIT_H_ diff --git a/db/version_set.h b/db/version_set.h index 42de376f3..3907d9971 100644 --- a/db/version_set.h +++ b/db/version_set.h @@ -12,9 +12,7 @@ // Version,VersionSet are thread-compatible, but require external // synchronization on all accesses. -#ifndef STORAGE_LEVELDB_DB_VERSION_SET_H_ -#define STORAGE_LEVELDB_DB_VERSION_SET_H_ - +#pragma once #include #include #include @@ -628,5 +626,3 @@ class Compaction { }; } // namespace rocksdb - -#endif // STORAGE_LEVELDB_DB_VERSION_SET_H_ diff --git a/db/write_batch_internal.h b/db/write_batch_internal.h index f532844c5..46b1c9728 100644 --- a/db/write_batch_internal.h +++ b/db/write_batch_internal.h @@ -2,9 +2,7 @@ // Use of this source code is governed by a BSD-style license that can be // found in the LICENSE file. See the AUTHORS file for names of contributors. -#ifndef STORAGE_LEVELDB_DB_WRITE_BATCH_INTERNAL_H_ -#define STORAGE_LEVELDB_DB_WRITE_BATCH_INTERNAL_H_ - +#pragma once #include "rocksdb/types.h" #include "rocksdb/write_batch.h" #include "rocksdb/db.h" @@ -52,6 +50,3 @@ class WriteBatchInternal { }; } // namespace rocksdb - - -#endif // STORAGE_LEVELDB_DB_WRITE_BATCH_INTERNAL_H_ diff --git a/hdfs/README b/hdfs/README index 2d4da29dc..9b7d0a64d 100644 --- a/hdfs/README +++ b/hdfs/README @@ -1,4 +1,4 @@ -This directory contains the hdfs extensions needed to make leveldb store +This directory contains the hdfs extensions needed to make rocksdb store files in HDFS. The hdfs.h file is copied from the Apache Hadoop 1.0 source code. @@ -7,12 +7,12 @@ It defines the libhdfs library data in HDFS. The libhdfs.a is copied from the Apache Hadoop 1.0 build. It implements the API defined in hdfs.h. If your hadoop cluster is running a different hadoop release, then install these two files manually from your -hadoop distribution and then recompile leveldb. +hadoop distribution and then recompile rocksdb. -The env_hdfs.h file defines the leveldb objects that are needed to talk to an +The env_hdfs.h file defines the rocksdb objects that are needed to talk to an underlying filesystem. -If you want to compile leveldb with hdfs support, please set the following +If you want to compile rocksdb with hdfs support, please set the following enviroment variables appropriately: USE_HDFS=1 JAVA_HOME=/usr/local/jdk-6u22-64 diff --git a/hdfs/env_hdfs.h b/hdfs/env_hdfs.h index 0098c0d32..7062fe34f 100644 --- a/hdfs/env_hdfs.h +++ b/hdfs/env_hdfs.h @@ -17,9 +17,7 @@ */ // Copyright (c) 2012 Facebook. All rights reserved. -#ifndef LEVELDB_HDFS_FILE_H -#define LEVELDB_HDFS_FILE_H - +#pragma once #include #include #include @@ -55,7 +53,7 @@ private: }; // -// The HDFS environment for leveldb. This class overrides all the +// The HDFS environment for rocksdb. This class overrides all the // file/dir access methods and delegates the thread-mgmt methods to the // default posix environment. // @@ -227,7 +225,7 @@ class HdfsEnv : public Env { public: HdfsEnv(const std::string& fsname) { - fprintf(stderr, "You have not build leveldb with HDFS support\n"); + fprintf(stderr, "You have not build rocksdb with HDFS support\n"); fprintf(stderr, "Please see hdfs/README for details\n"); throw new std::exception(); } @@ -305,5 +303,3 @@ class HdfsEnv : public Env { } #endif // USE_HDFS - -#endif // LEVELDB_HDFS_FILE_H diff --git a/include/rocksdb/comparator.h b/include/rocksdb/comparator.h index a13e6520d..b60493418 100644 --- a/include/rocksdb/comparator.h +++ b/include/rocksdb/comparator.h @@ -13,7 +13,7 @@ class Slice; // A Comparator object provides a total order across slices that are // used as keys in an sstable or a database. A Comparator implementation -// must be thread-safe since leveldb may invoke its methods concurrently +// must be thread-safe since rocksdb may invoke its methods concurrently // from multiple threads. class Comparator { public: @@ -33,7 +33,7 @@ class Comparator { // the comparator implementation changes in a way that will cause // the relative ordering of any two keys to change. // - // Names starting with "leveldb." are reserved and should not be used + // Names starting with "rocksdb." are reserved and should not be used // by any clients of this package. virtual const char* Name() const = 0; diff --git a/include/rocksdb/db.h b/include/rocksdb/db.h index 5e3e98960..1c5b1f394 100644 --- a/include/rocksdb/db.h +++ b/include/rocksdb/db.h @@ -175,11 +175,11 @@ class DB { // // Valid property names include: // - // "leveldb.num-files-at-level" - return the number of files at level , + // "rocksdb.num-files-at-level" - return the number of files at level , // where is an ASCII representation of a level number (e.g. "0"). - // "leveldb.stats" - returns a multi-line string that describes statistics + // "rocksdb.stats" - returns a multi-line string that describes statistics // about the internal operation of the DB. - // "leveldb.sstables" - returns a multi-line string that describes all + // "rocksdb.sstables" - returns a multi-line string that describes all // of the sstables that make up the db contents. virtual bool GetProperty(const Slice& property, std::string* value) = 0; diff --git a/include/rocksdb/env.h b/include/rocksdb/env.h index be42428f3..ee4628123 100644 --- a/include/rocksdb/env.h +++ b/include/rocksdb/env.h @@ -2,7 +2,7 @@ // Use of this source code is governed by a BSD-style license that can be // found in the LICENSE file. See the AUTHORS file for names of contributors. // -// An Env is an interface used by the leveldb implementation to access +// An Env is an interface used by the rocksdb implementation to access // operating system functionality like the filesystem etc. Callers // may wish to provide a custom Env object when opening a database to // get fine gain control; e.g., to rate limit file system operations. @@ -72,7 +72,7 @@ class Env { // system. Sophisticated users may wish to provide their own Env // implementation instead of relying on this default environment. // - // The result of Default() belongs to leveldb and must never be deleted. + // The result of Default() belongs to rocksdb and must never be deleted. static Env* Default(); // Create a brand new sequentially-readable file with the specified name. diff --git a/include/rocksdb/filter_policy.h b/include/rocksdb/filter_policy.h index aa2fd12f6..3cafa579d 100644 --- a/include/rocksdb/filter_policy.h +++ b/include/rocksdb/filter_policy.h @@ -4,8 +4,8 @@ // // A database can be configured with a custom FilterPolicy object. // This object is responsible for creating a small filter from a set -// of keys. These filters are stored in leveldb and are consulted -// automatically by leveldb to decide whether or not to read some +// of keys. These filters are stored in rocksdb and are consulted +// automatically by rocksdb to decide whether or not to read some // information from disk. In many cases, a filter can cut down the // number of disk seeks form a handful to a single disk seek per // DB::Get() call. diff --git a/include/rocksdb/ldb_tool.h b/include/rocksdb/ldb_tool.h index 99c522bee..738fb9536 100644 --- a/include/rocksdb/ldb_tool.h +++ b/include/rocksdb/ldb_tool.h @@ -10,9 +10,6 @@ class LDBTool { void Run(int argc, char** argv, Options = Options()); }; -namespace leveldb = rocksdb; - - } // namespace rocksdb #include "rocksdb/rocksdb_to_leveldb.h" diff --git a/include/rocksdb/memtablerep.h b/include/rocksdb/memtablerep.h index 70419294d..4bed4b315 100644 --- a/include/rocksdb/memtablerep.h +++ b/include/rocksdb/memtablerep.h @@ -10,7 +10,7 @@ // The liberal use of assertions is encouraged to enforce (1). // // The factory will be passed an Arena object when a new MemTableRep is -// requested. The API for this object is in leveldb/arena.h. +// requested. The API for this object is in rocksdb/arena.h. // // Users can implement their own memtable representations. We include four // types built in: @@ -177,7 +177,7 @@ public: // TransformReps are backed by an unordered map of buffers to buckets. When // looking up a key, the user key is extracted and a user-supplied transform -// function (see leveldb/slice_transform.h) is applied to get the key into the +// function (see rocksdb/slice_transform.h) is applied to get the key into the // unordered map. This allows the user to bin user keys based on arbitrary // criteria. Two example implementations are UnsortedRepFactory and // PrefixHashRepFactory. diff --git a/include/rocksdb/options.h b/include/rocksdb/options.h index e11445f72..75d0775cd 100644 --- a/include/rocksdb/options.h +++ b/include/rocksdb/options.h @@ -165,7 +165,7 @@ struct Options { // a block is the unit of reading from disk). // If non-NULL use the specified cache for blocks. - // If NULL, leveldb will automatically create and use an 8MB internal cache. + // If NULL, rocksdb will automatically create and use an 8MB internal cache. // Default: nullptr shared_ptr block_cache; @@ -497,7 +497,7 @@ struct Options { // Default: false bool skip_log_error_on_recovery; - // if not zero, dump leveldb.stats to LOG every stats_dump_period_sec + // if not zero, dump rocksdb.stats to LOG every stats_dump_period_sec // Default: 3600 (1 hour) unsigned int stats_dump_period_sec; diff --git a/include/rocksdb/slice.h b/include/rocksdb/slice.h index 24d7004c2..bb6440271 100644 --- a/include/rocksdb/slice.h +++ b/include/rocksdb/slice.h @@ -91,7 +91,7 @@ class Slice { (memcmp(data_, x.data_, x.size_) == 0)); } - // private: make these public for leveldbjni access + // private: make these public for rocksdbjni access const char* data_; size_t size_; diff --git a/include/rocksdb/statistics.h b/include/rocksdb/statistics.h index 097b55b10..e0baf11c8 100644 --- a/include/rocksdb/statistics.h +++ b/include/rocksdb/statistics.h @@ -198,7 +198,7 @@ class Histogram { /** * A dumb ticker which keeps incrementing through its life time. - * Not thread safe. Locking is currently managed by external leveldb lock + * Thread safe. Locking managed by implementation of this interface. */ class Ticker { public: diff --git a/include/utilities/stackable_db.h b/include/utilities/stackable_db.h index eb5a98b30..334935556 100644 --- a/include/utilities/stackable_db.h +++ b/include/utilities/stackable_db.h @@ -2,9 +2,7 @@ // Use of this source code is governed by a BSD-style license that can be // found in the LICENSE file. See the AUTHORS file for names of contributors. -#ifndef LEVELDB_INCLUDE_UTILITIES_STACKABLE_DB_H_ -#define LEVELDB_INCLUDE_UTILITIES_STACKABLE_DB_H_ - +#pragma once #include "rocksdb/db.h" namespace rocksdb { @@ -161,5 +159,3 @@ class StackableDB : public DB { }; } // namespace rocksdb - -#endif // LEVELDB_INCLUDE_UTILITIES_STACKABLE_DB_H_ diff --git a/include/utilities/utility_db.h b/include/utilities/utility_db.h index 11249a25a..1a7a269d1 100644 --- a/include/utilities/utility_db.h +++ b/include/utilities/utility_db.h @@ -2,14 +2,12 @@ // Use of this source code is governed by a BSD-style license that can be // found in the LICENSE file. See the AUTHORS file for names of contributors. -#ifndef LEVELDB_INCLUDE_UTILITIES_UTILITY_DB_H_ -#define LEVELDB_INCLUDE_UTILITIES_UTILITY_DB_H_ - +#pragma once #include "stackable_db.h" namespace rocksdb { -// This class contains APIs to open leveldb with specific support eg. TTL +// This class contains APIs to open rocksdb with specific support eg. TTL class UtilityDB { public: @@ -50,5 +48,3 @@ class UtilityDB { }; } // namespace rocksdb - -#endif // LEVELDB_INCLUDE_UTILITIES_UTILITY_DB_H_ diff --git a/table/block.h b/table/block.h index 20b4c4511..156fb7bb2 100644 --- a/table/block.h +++ b/table/block.h @@ -2,9 +2,7 @@ // Use of this source code is governed by a BSD-style license that can be // found in the LICENSE file. See the AUTHORS file for names of contributors. -#ifndef STORAGE_LEVELDB_TABLE_BLOCK_H_ -#define STORAGE_LEVELDB_TABLE_BLOCK_H_ - +#pragma once #include #include #include "rocksdb/iterator.h" @@ -42,5 +40,3 @@ class Block { }; } // namespace rocksdb - -#endif // STORAGE_LEVELDB_TABLE_BLOCK_H_ diff --git a/table/block_builder.h b/table/block_builder.h index c635e2d3e..5e86a50ae 100644 --- a/table/block_builder.h +++ b/table/block_builder.h @@ -2,9 +2,7 @@ // Use of this source code is governed by a BSD-style license that can be // found in the LICENSE file. See the AUTHORS file for names of contributors. -#ifndef STORAGE_LEVELDB_TABLE_BLOCK_BUILDER_H_ -#define STORAGE_LEVELDB_TABLE_BLOCK_BUILDER_H_ - +#pragma once #include #include @@ -56,5 +54,3 @@ class BlockBuilder { }; } // namespace rocksdb - -#endif // STORAGE_LEVELDB_TABLE_BLOCK_BUILDER_H_ diff --git a/table/filter_block.h b/table/filter_block.h index c477fb3a9..b6e68655d 100644 --- a/table/filter_block.h +++ b/table/filter_block.h @@ -6,9 +6,7 @@ // filters (e.g., bloom filters) for all data blocks in the table combined // into a single filter block. -#ifndef STORAGE_LEVELDB_TABLE_FILTER_BLOCK_H_ -#define STORAGE_LEVELDB_TABLE_FILTER_BLOCK_H_ - +#pragma once #include #include #include @@ -76,5 +74,3 @@ class FilterBlockReader { }; } - -#endif // STORAGE_LEVELDB_TABLE_FILTER_BLOCK_H_ diff --git a/table/format.h b/table/format.h index 23a668002..25d0e4342 100644 --- a/table/format.h +++ b/table/format.h @@ -2,9 +2,7 @@ // Use of this source code is governed by a BSD-style license that can be // found in the LICENSE file. See the AUTHORS file for names of contributors. -#ifndef STORAGE_LEVELDB_TABLE_FORMAT_H_ -#define STORAGE_LEVELDB_TABLE_FORMAT_H_ - +#pragma once #include #include #include "rocksdb/slice.h" @@ -105,5 +103,3 @@ inline BlockHandle::BlockHandle() } } // namespace rocksdb - -#endif // STORAGE_LEVELDB_TABLE_FORMAT_H_ diff --git a/table/iter_heap.h b/table/iter_heap.h index 3dce5dd55..7255226af 100644 --- a/table/iter_heap.h +++ b/table/iter_heap.h @@ -1,7 +1,6 @@ // Copyright 2008-present Facebook. All Rights Reserved. -#ifndef STORAGE_LEVELDB_ITER_HEAP_H_ -#define STORAGE_LEVELDB_ITER_HEAP_H_ +#pragma once #include #include "rocksdb/comparator.h" @@ -59,5 +58,3 @@ MinIterHeap NewMinIterHeap(const Comparator* comparator) { } } // namespace rocksdb - -#endif // STORAGE_LEVELDB_ITER_HEAP_H_ diff --git a/table/iterator_wrapper.h b/table/iterator_wrapper.h index a0214e58a..7c1d8981d 100644 --- a/table/iterator_wrapper.h +++ b/table/iterator_wrapper.h @@ -2,9 +2,7 @@ // Use of this source code is governed by a BSD-style license that can be // found in the LICENSE file. See the AUTHORS file for names of contributors. -#ifndef STORAGE_LEVELDB_TABLE_ITERATOR_WRAPPER_H_ -#define STORAGE_LEVELDB_TABLE_ITERATOR_WRAPPER_H_ - +#pragma once namespace rocksdb { // A internal wrapper class with an interface similar to Iterator that @@ -59,5 +57,3 @@ class IteratorWrapper { }; } // namespace rocksdb - -#endif // STORAGE_LEVELDB_TABLE_ITERATOR_WRAPPER_H_ diff --git a/table/merger.h b/table/merger.h index 27b81dbe7..e81d26646 100644 --- a/table/merger.h +++ b/table/merger.h @@ -2,8 +2,7 @@ // Use of this source code is governed by a BSD-style license that can be // found in the LICENSE file. See the AUTHORS file for names of contributors. -#ifndef STORAGE_LEVELDB_TABLE_MERGER_H_ -#define STORAGE_LEVELDB_TABLE_MERGER_H_ +#pragma once namespace rocksdb { @@ -22,5 +21,3 @@ extern Iterator* NewMergingIterator( const Comparator* comparator, Iterator** children, int n); } // namespace rocksdb - -#endif // STORAGE_LEVELDB_TABLE_MERGER_H_ diff --git a/table/table.h b/table/table.h index 6007d441f..6300dbd16 100644 --- a/table/table.h +++ b/table/table.h @@ -2,9 +2,7 @@ // Use of this source code is governed by a BSD-style license that can be // found in the LICENSE file. See the AUTHORS file for names of contributors. -#ifndef STORAGE_LEVELDB_INCLUDE_TABLE_H_ -#define STORAGE_LEVELDB_INCLUDE_TABLE_H_ - +#pragma once #include #include #include "rocksdb/iterator.h" @@ -103,5 +101,3 @@ class Table { }; } // namespace rocksdb - -#endif // STORAGE_LEVELDB_INCLUDE_TABLE_H_ diff --git a/table/table_test.cc b/table/table_test.cc index 92093e498..1d24e9228 100644 --- a/table/table_test.cc +++ b/table/table_test.cc @@ -38,7 +38,7 @@ namespace { class ReverseKeyComparator : public Comparator { public: virtual const char* Name() const { - return "leveldb.ReverseBytewiseComparator"; + return "rocksdb.ReverseBytewiseComparator"; } virtual int Compare(const Slice& a, const Slice& b) const { @@ -798,7 +798,7 @@ TEST(Harness, RandomizedLongDB) { for (int level = 0; level < db()->NumberLevels(); level++) { std::string value; char name[100]; - snprintf(name, sizeof(name), "leveldb.num-files-at-level%d", level); + snprintf(name, sizeof(name), "rocksdb.num-files-at-level%d", level); ASSERT_TRUE(db()->GetProperty(name, &value)); files += atoi(value.c_str()); } diff --git a/table/two_level_iterator.h b/table/two_level_iterator.h index ebe287801..b1feea314 100644 --- a/table/two_level_iterator.h +++ b/table/two_level_iterator.h @@ -2,9 +2,7 @@ // Use of this source code is governed by a BSD-style license that can be // found in the LICENSE file. See the AUTHORS file for names of contributors. -#ifndef STORAGE_LEVELDB_TABLE_TWO_LEVEL_ITERATOR_H_ -#define STORAGE_LEVELDB_TABLE_TWO_LEVEL_ITERATOR_H_ - +#pragma once #include "rocksdb/iterator.h" #include "rocksdb/env.h" @@ -35,5 +33,3 @@ extern Iterator* NewTwoLevelIterator( bool for_compaction = false); } // namespace rocksdb - -#endif // STORAGE_LEVELDB_TABLE_TWO_LEVEL_ITERATOR_H_ diff --git a/tools/db_crashtest2.py b/tools/db_crashtest2.py index 0942b5e4a..a5c66498d 100644 --- a/tools/db_crashtest2.py +++ b/tools/db_crashtest2.py @@ -10,7 +10,7 @@ import tempfile import subprocess # This python script runs db_stress multiple times. Some runs with -# kill_random_test that causes leveldb to crash at various points in code. +# kill_random_test that causes rocksdb to crash at various points in code. def main(argv): try: diff --git a/tools/db_stress.cc b/tools/db_stress.cc index 786a12e2c..2d9370bd2 100644 --- a/tools/db_stress.cc +++ b/tools/db_stress.cc @@ -156,7 +156,7 @@ static bool FLAGS_use_fsync = false; // If non-zero, kill at various points in source code with probability 1/this static int FLAGS_kill_random_test = 0; -extern int leveldb_kill_odds; +extern int rocksdb_kill_odds; // If true, do not write WAL for write. static bool FLAGS_disable_wal = false; @@ -1262,7 +1262,7 @@ class StressTest { options.disableDataSync = FLAGS_disable_data_sync; options.use_fsync = FLAGS_use_fsync; options.allow_mmap_reads = FLAGS_use_mmap_reads; - leveldb_kill_odds = FLAGS_kill_random_test; + rocksdb_kill_odds = FLAGS_kill_random_test; options.target_file_size_base = FLAGS_target_file_size_base; options.target_file_size_multiplier = FLAGS_target_file_size_multiplier; options.max_bytes_for_level_base = FLAGS_max_bytes_for_level_base; diff --git a/tools/reduce_levels_test.cc b/tools/reduce_levels_test.cc index 9eb381ef0..154e7929c 100644 --- a/tools/reduce_levels_test.cc +++ b/tools/reduce_levels_test.cc @@ -60,7 +60,7 @@ public: int FilesOnLevel(int level) { std::string property; ASSERT_TRUE( - db_->GetProperty("leveldb.num-files-at-level" + NumberToString(level), + db_->GetProperty("rocksdb.num-files-at-level" + NumberToString(level), &property)); return atoi(property.c_str()); } diff --git a/tools/shell/DBClientProxy.h b/tools/shell/DBClientProxy.h index 86669eed2..fba228b99 100644 --- a/tools/shell/DBClientProxy.h +++ b/tools/shell/DBClientProxy.h @@ -12,7 +12,7 @@ /* * class DBClientProxy maintains: - * 1. a connection to leveldb service + * 1. a connection to rocksdb service * 2. a map from db names to opened db handles * * it's client codes' responsibility to catch all possible exceptions. diff --git a/tools/shell/ShellState.h b/tools/shell/ShellState.h index 6167d55b6..ce3f6769c 100644 --- a/tools/shell/ShellState.h +++ b/tools/shell/ShellState.h @@ -7,7 +7,7 @@ class ShellContext; /* * Currently, there are four types of state in total * 1. start state: the first state the program enters - * 2. connecting state: the program try to connnect to a leveldb server, whose + * 2. connecting state: the program try to connnect to a rocksdb server, whose * previous states could be "start" or "connected" states * 3. connected states: the program has already connected to a server, and is * processing user commands diff --git a/util/arena_impl.h b/util/arena_impl.h index 9b95c6fc3..f4fac603e 100644 --- a/util/arena_impl.h +++ b/util/arena_impl.h @@ -6,9 +6,7 @@ // it allocates a block with pre-defined block size. For a request of big // size, it uses malloc to directly get the requested size. -#ifndef STORAGE_LEVELDB_UTIL_ARENA_IMPL_H_ -#define STORAGE_LEVELDB_UTIL_ARENA_IMPL_H_ - +#pragma once #include #include #include @@ -79,5 +77,3 @@ inline char* ArenaImpl::Allocate(size_t bytes) { } } // namespace rocksdb - -#endif // STORAGE_LEVELDB_UTIL_ARENA_IMPL_H_ diff --git a/util/auto_roll_logger.h b/util/auto_roll_logger.h index bd0ad68fb..4ff2fa904 100644 --- a/util/auto_roll_logger.h +++ b/util/auto_roll_logger.h @@ -5,9 +5,7 @@ // Logger implementation that can be shared by all environments // where enough posix functionality is available. -#ifndef STORAGE_LEVELDB_UTIL_AUTO_ROLL_LOGGER_H -#define STORAGE_LEVELDB_UTIL_AUTO_ROLL_LOGGER_H - +#pragma once #include "db/filename.h" #include "port/port.h" #include "util/posix_logger.h" @@ -89,5 +87,3 @@ Status CreateLoggerFromOptions( std::shared_ptr* logger); } // namespace rocksdb - -#endif // STORAGE_LEVELDB_UTIL_AUTO_ROLL_LOGGER_H diff --git a/util/auto_roll_logger_test.cc b/util/auto_roll_logger_test.cc index d46285759..858199554 100755 --- a/util/auto_roll_logger_test.cc +++ b/util/auto_roll_logger_test.cc @@ -149,7 +149,7 @@ TEST(AutoRollLoggerTest, RollLogFileByTime) { TEST(AutoRollLoggerTest, OpenLogFilesMultipleTimesWithOptionLog_max_size) { // If only 'log_max_size' options is specified, then every time - // when leveldb is restarted, a new empty log file will be created. + // when rocksdb is restarted, a new empty log file will be created. InitTestDb(); // WORKAROUND: // avoid complier's complaint of "comparison between signed diff --git a/util/bit_set.h b/util/bit_set.h index f64e38225..6b20e34f1 100644 --- a/util/bit_set.h +++ b/util/bit_set.h @@ -3,9 +3,7 @@ * @author Tudor Bosman (tudorb@facebook.com) */ -#ifndef STORAGE_LEVELDB_UTIL_BIT_SET_H_ -#define STORAGE_LEVELDB_UTIL_BIT_SET_H_ - +#pragma once #include namespace rocksdb { @@ -71,5 +69,3 @@ class BitSet { }; } // namespace facebook - -#endif // STORAGE_LEVELDB_UTIL_BIT_SET_H_ diff --git a/util/bloom.cc b/util/bloom.cc index 85f983af5..7be9fadc1 100644 --- a/util/bloom.cc +++ b/util/bloom.cc @@ -40,7 +40,7 @@ class BloomFilterPolicy : public FilterPolicy { } virtual const char* Name() const { - return "leveldb.BuiltinBloomFilter"; + return "rocksdb.BuiltinBloomFilter"; } virtual void CreateFilter(const Slice* keys, int n, std::string* dst) const { diff --git a/util/build_version.h b/util/build_version.h index 516c6404b..bf8147dcb 100644 --- a/util/build_version.h +++ b/util/build_version.h @@ -1,13 +1,8 @@ -/*version.h*/ -#ifndef VERSION_H_ -#define VERSION_H_ - +#pragma once // these variables tell us about the git config and time -extern const char* leveldb_build_git_sha; +extern const char* rocksdb_build_git_sha; // these variables tell us when the compilation occured -extern const char* leveldb_build_compile_time; -extern const char* leveldb_build_compile_date; - +extern const char* rocksdb_build_compile_time; +extern const char* rocksdb_build_compile_date; -#endif /* VERSION_H_ */ diff --git a/util/coding.h b/util/coding.h index ddd652904..0966d0b12 100644 --- a/util/coding.h +++ b/util/coding.h @@ -7,9 +7,7 @@ // * In addition we support variable length "varint" encoding // * Strings are encoded prefixed by their length in varint format -#ifndef STORAGE_LEVELDB_UTIL_CODING_H_ -#define STORAGE_LEVELDB_UTIL_CODING_H_ - +#pragma once #include #include #include @@ -130,5 +128,3 @@ extern uint64_t BitStreamGetInt(const Slice* src, size_t offset, uint32_t bits); } // namespace rocksdb - -#endif // STORAGE_LEVELDB_UTIL_CODING_H_ diff --git a/util/comparator.cc b/util/comparator.cc index 6ba1cacfd..93b4ffafb 100644 --- a/util/comparator.cc +++ b/util/comparator.cc @@ -19,7 +19,7 @@ class BytewiseComparatorImpl : public Comparator { BytewiseComparatorImpl() { } virtual const char* Name() const { - return "leveldb.BytewiseComparator"; + return "rocksdb.BytewiseComparator"; } virtual int Compare(const Slice& a, const Slice& b) const { diff --git a/util/crc32c.h b/util/crc32c.h index e7d420da7..6d33f3afb 100644 --- a/util/crc32c.h +++ b/util/crc32c.h @@ -2,9 +2,7 @@ // Use of this source code is governed by a BSD-style license that can be // found in the LICENSE file. See the AUTHORS file for names of contributors. -#ifndef STORAGE_LEVELDB_UTIL_CRC32C_H_ -#define STORAGE_LEVELDB_UTIL_CRC32C_H_ - +#pragma once #include #include @@ -41,5 +39,3 @@ inline uint32_t Unmask(uint32_t masked_crc) { } // namespace crc32c } // namespace rocksdb - -#endif // STORAGE_LEVELDB_UTIL_CRC32C_H_ diff --git a/util/env_hdfs.cc b/util/env_hdfs.cc index dfd5c7225..323ca04c0 100644 --- a/util/env_hdfs.cc +++ b/util/env_hdfs.cc @@ -18,8 +18,8 @@ // Copyright (c) 2012 Facebook. All rights reserved. #ifdef USE_HDFS -#ifndef LEVELDB_HDFS_FILE_C -#define LEVELDB_HDFS_FILE_C +#ifndef ROCKSDB_HDFS_FILE_C +#define ROCKSDB_HDFS_FILE_C #include #include @@ -33,8 +33,8 @@ #include "hdfs/env_hdfs.h" // -// This file defines an HDFS environment for leveldb. It uses the libhdfs -// api to access HDFS. All HDFS files created by one instance of leveldb +// This file defines an HDFS environment for rocksdb. It uses the libhdfs +// api to access HDFS. All HDFS files created by one instance of rocksdb // will reside on the same HDFS cluster. // @@ -507,7 +507,7 @@ Status HdfsEnv::NewLogger(const std::string& fname, } // namespace rocksdb -#endif // LEVELDB_HDFS_FILE_C +#endif // ROCKSDB_HDFS_FILE_C #else // USE_HDFS diff --git a/util/env_posix.cc b/util/env_posix.cc index 8f9d88133..068d75190 100644 --- a/util/env_posix.cc +++ b/util/env_posix.cc @@ -48,7 +48,7 @@ // This is only set from db_stress.cc and for testing only. // If non-zero, kill at various points in source code with probability 1/this -int leveldb_kill_odds = 0; +int rocksdb_kill_odds = 0; namespace rocksdb { @@ -65,7 +65,7 @@ static Status IOError(const std::string& context, int err_number) { #ifdef NDEBUG // empty in release build -#define TEST_KILL_RANDOM(leveldb_kill_odds) +#define TEST_KILL_RANDOM(rocksdb_kill_odds) #else // Kill the process with probablity 1/odds for testing. @@ -88,9 +88,9 @@ static void TestKillRandom(int odds, const std::string& srcfile, #define REDUCE_ODDS 2 #define REDUCE_ODDS2 4 -#define TEST_KILL_RANDOM(leveldb_kill_odds) { \ - if (leveldb_kill_odds > 0) { \ - TestKillRandom(leveldb_kill_odds, __FILE__, __LINE__); \ +#define TEST_KILL_RANDOM(rocksdb_kill_odds) { \ + if (rocksdb_kill_odds > 0) { \ + TestKillRandom(rocksdb_kill_odds, __FILE__, __LINE__); \ } \ } @@ -314,7 +314,7 @@ class PosixMmapFile : public WritableFile { bool UnmapCurrentRegion() { bool result = true; - TEST_KILL_RANDOM(leveldb_kill_odds); + TEST_KILL_RANDOM(rocksdb_kill_odds); if (base_ != nullptr) { if (last_sync_ < limit_) { // Defer syncing this data until next Sync() call, if any @@ -340,21 +340,21 @@ class PosixMmapFile : public WritableFile { Status MapNewRegion() { assert(base_ == nullptr); - TEST_KILL_RANDOM(leveldb_kill_odds); + TEST_KILL_RANDOM(rocksdb_kill_odds); int alloc_status = posix_fallocate(fd_, file_offset_, map_size_); if (alloc_status != 0) { return Status::IOError("Error allocating space to file : " + filename_ + "Error : " + strerror(alloc_status)); } - TEST_KILL_RANDOM(leveldb_kill_odds); + TEST_KILL_RANDOM(rocksdb_kill_odds); void* ptr = mmap(nullptr, map_size_, PROT_READ | PROT_WRITE, MAP_SHARED, fd_, file_offset_); if (ptr == MAP_FAILED) { return Status::IOError("MMap failed on " + filename_); } - TEST_KILL_RANDOM(leveldb_kill_odds); + TEST_KILL_RANDOM(rocksdb_kill_odds); base_ = reinterpret_cast(ptr); limit_ = base_ + map_size_; @@ -390,7 +390,7 @@ class PosixMmapFile : public WritableFile { virtual Status Append(const Slice& data) { const char* src = data.data(); size_t left = data.size(); - TEST_KILL_RANDOM(leveldb_kill_odds * REDUCE_ODDS); + TEST_KILL_RANDOM(rocksdb_kill_odds * REDUCE_ODDS); PrepareWrite(GetFileSize(), left); while (left > 0) { assert(base_ <= dst_); @@ -402,7 +402,7 @@ class PosixMmapFile : public WritableFile { if (!s.ok()) { return s; } - TEST_KILL_RANDOM(leveldb_kill_odds); + TEST_KILL_RANDOM(rocksdb_kill_odds); } } @@ -412,7 +412,7 @@ class PosixMmapFile : public WritableFile { src += n; left -= n; } - TEST_KILL_RANDOM(leveldb_kill_odds); + TEST_KILL_RANDOM(rocksdb_kill_odds); return Status::OK(); } @@ -420,7 +420,7 @@ class PosixMmapFile : public WritableFile { Status s; size_t unused = limit_ - dst_; - TEST_KILL_RANDOM(leveldb_kill_odds); + TEST_KILL_RANDOM(rocksdb_kill_odds); if (!UnmapCurrentRegion()) { s = IOError(filename_, errno); @@ -431,7 +431,7 @@ class PosixMmapFile : public WritableFile { } } - TEST_KILL_RANDOM(leveldb_kill_odds); + TEST_KILL_RANDOM(rocksdb_kill_odds); if (close(fd_) < 0) { if (s.ok()) { @@ -446,7 +446,7 @@ class PosixMmapFile : public WritableFile { } virtual Status Flush() { - TEST_KILL_RANDOM(leveldb_kill_odds); + TEST_KILL_RANDOM(rocksdb_kill_odds); return Status::OK(); } @@ -455,12 +455,12 @@ class PosixMmapFile : public WritableFile { if (pending_sync_) { // Some unmapped data was not synced - TEST_KILL_RANDOM(leveldb_kill_odds); + TEST_KILL_RANDOM(rocksdb_kill_odds); pending_sync_ = false; if (fdatasync(fd_) < 0) { s = IOError(filename_, errno); } - TEST_KILL_RANDOM(leveldb_kill_odds * REDUCE_ODDS); + TEST_KILL_RANDOM(rocksdb_kill_odds * REDUCE_ODDS); } if (dst_ > last_sync_) { @@ -469,11 +469,11 @@ class PosixMmapFile : public WritableFile { size_t p1 = TruncateToPageBoundary(last_sync_ - base_); size_t p2 = TruncateToPageBoundary(dst_ - base_ - 1); last_sync_ = dst_; - TEST_KILL_RANDOM(leveldb_kill_odds); + TEST_KILL_RANDOM(rocksdb_kill_odds); if (msync(base_ + p1, p2 - p1 + page_size_, MS_SYNC) < 0) { s = IOError(filename_, errno); } - TEST_KILL_RANDOM(leveldb_kill_odds); + TEST_KILL_RANDOM(rocksdb_kill_odds); } return s; @@ -485,12 +485,12 @@ class PosixMmapFile : public WritableFile { virtual Status Fsync() { if (pending_sync_) { // Some unmapped data was not synced - TEST_KILL_RANDOM(leveldb_kill_odds); + TEST_KILL_RANDOM(rocksdb_kill_odds); pending_sync_ = false; if (fsync(fd_) < 0) { return IOError(filename_, errno); } - TEST_KILL_RANDOM(leveldb_kill_odds); + TEST_KILL_RANDOM(rocksdb_kill_odds); } // This invocation to Sync will not issue the call to // fdatasync because pending_sync_ has already been cleared. @@ -518,7 +518,7 @@ class PosixMmapFile : public WritableFile { #ifdef OS_LINUX virtual Status Allocate(off_t offset, off_t len) { - TEST_KILL_RANDOM(leveldb_kill_odds); + TEST_KILL_RANDOM(rocksdb_kill_odds); if (!fallocate(fd_, FALLOC_FL_KEEP_SIZE, offset, len)) { return Status::OK(); } else { @@ -571,7 +571,7 @@ class PosixWritableFile : public WritableFile { pending_sync_ = true; pending_fsync_ = true; - TEST_KILL_RANDOM(leveldb_kill_odds * REDUCE_ODDS2); + TEST_KILL_RANDOM(rocksdb_kill_odds * REDUCE_ODDS2); PrepareWrite(GetFileSize(), left); // if there is no space in the cache, then flush @@ -599,7 +599,7 @@ class PosixWritableFile : public WritableFile { if (done < 0) { return IOError(filename_, errno); } - TEST_KILL_RANDOM(leveldb_kill_odds); + TEST_KILL_RANDOM(rocksdb_kill_odds); left -= done; src += done; @@ -615,7 +615,7 @@ class PosixWritableFile : public WritableFile { if (!s.ok()) { } - TEST_KILL_RANDOM(leveldb_kill_odds); + TEST_KILL_RANDOM(rocksdb_kill_odds); if (close(fd_) < 0) { if (s.ok()) { @@ -628,7 +628,7 @@ class PosixWritableFile : public WritableFile { // write out the cached data to the OS cache virtual Status Flush() { - TEST_KILL_RANDOM(leveldb_kill_odds * REDUCE_ODDS2); + TEST_KILL_RANDOM(rocksdb_kill_odds * REDUCE_ODDS2); size_t left = cursize_; char* src = buf_.get(); while (left != 0) { @@ -636,7 +636,7 @@ class PosixWritableFile : public WritableFile { if (done < 0) { return IOError(filename_, errno); } - TEST_KILL_RANDOM(leveldb_kill_odds * REDUCE_ODDS2); + TEST_KILL_RANDOM(rocksdb_kill_odds * REDUCE_ODDS2); left -= done; src += done; } @@ -656,21 +656,21 @@ class PosixWritableFile : public WritableFile { } virtual Status Sync() { - TEST_KILL_RANDOM(leveldb_kill_odds); + TEST_KILL_RANDOM(rocksdb_kill_odds); if (pending_sync_ && fdatasync(fd_) < 0) { return IOError(filename_, errno); } - TEST_KILL_RANDOM(leveldb_kill_odds); + TEST_KILL_RANDOM(rocksdb_kill_odds); pending_sync_ = false; return Status::OK(); } virtual Status Fsync() { - TEST_KILL_RANDOM(leveldb_kill_odds); + TEST_KILL_RANDOM(rocksdb_kill_odds); if (pending_fsync_ && fsync(fd_) < 0) { return IOError(filename_, errno); } - TEST_KILL_RANDOM(leveldb_kill_odds); + TEST_KILL_RANDOM(rocksdb_kill_odds); pending_fsync_ = false; pending_sync_ = false; return Status::OK(); @@ -691,7 +691,7 @@ class PosixWritableFile : public WritableFile { #ifdef OS_LINUX virtual Status Allocate(off_t offset, off_t len) { - TEST_KILL_RANDOM(leveldb_kill_odds); + TEST_KILL_RANDOM(rocksdb_kill_odds); if (!fallocate(fd_, FALLOC_FL_KEEP_SIZE, offset, len)) { return Status::OK(); } else { @@ -981,7 +981,7 @@ class PosixEnv : public Env { *result = env; } else { char buf[100]; - snprintf(buf, sizeof(buf), "/tmp/leveldbtest-%d", int(geteuid())); + snprintf(buf, sizeof(buf), "/tmp/rocksdbtest-%d", int(geteuid())); *result = buf; } // Directory may already exist diff --git a/util/hash.h b/util/hash.h index 806c55bfa..e51a883ac 100644 --- a/util/hash.h +++ b/util/hash.h @@ -4,9 +4,7 @@ // // Simple hash function used for internal data structures -#ifndef STORAGE_LEVELDB_UTIL_HASH_H_ -#define STORAGE_LEVELDB_UTIL_HASH_H_ - +#pragma once #include #include @@ -15,5 +13,3 @@ namespace rocksdb { extern uint32_t Hash(const char* data, size_t n, uint32_t seed); } - -#endif // STORAGE_LEVELDB_UTIL_HASH_H_ diff --git a/util/histogram.h b/util/histogram.h index b945a19ff..f70eaf1be 100644 --- a/util/histogram.h +++ b/util/histogram.h @@ -2,9 +2,7 @@ // Use of this source code is governed by a BSD-style license that can be // found in the LICENSE file. See the AUTHORS file for names of contributors. -#ifndef STORAGE_LEVELDB_UTIL_HISTOGRAM_H_ -#define STORAGE_LEVELDB_UTIL_HISTOGRAM_H_ - +#pragma once #include "rocksdb/statistics.h" #include @@ -74,5 +72,3 @@ class HistogramImpl { }; } // namespace rocksdb - -#endif // STORAGE_LEVELDB_UTIL_HISTOGRAM_H_ diff --git a/util/ldb_cmd.cc b/util/ldb_cmd.cc index 3117e713d..de5c357ee 100644 --- a/util/ldb_cmd.cc +++ b/util/ldb_cmd.cc @@ -634,7 +634,7 @@ void InternalDumpCommand::DoCommand() { if (print_stats_) { string stats; - if (db_->GetProperty("leveldb.stats", &stats)) { + if (db_->GetProperty("rocksdb.stats", &stats)) { fprintf(stdout, "%s\n", stats.c_str()); } } @@ -771,7 +771,7 @@ void DBDumperCommand::DoCommand() { uint64_t count = 0; if (print_stats_) { string stats; - if (db_->GetProperty("leveldb.stats", &stats)) { + if (db_->GetProperty("rocksdb.stats", &stats)) { fprintf(stdout, "%s\n", stats.c_str()); } } @@ -1080,7 +1080,7 @@ void ChangeCompactionStyleCommand::DoCommand() { std::string property; std::string files_per_level; for (int i = 0; i < db_->NumberLevels(); i++) { - db_->GetProperty("leveldb.num-files-at-level" + NumberToString(i), + db_->GetProperty("rocksdb.num-files-at-level" + NumberToString(i), &property); // format print string @@ -1100,7 +1100,7 @@ void ChangeCompactionStyleCommand::DoCommand() { files_per_level = ""; int num_files = 0; for (int i = 0; i < db_->NumberLevels(); i++) { - db_->GetProperty("leveldb.num-files-at-level" + NumberToString(i), + db_->GetProperty("rocksdb.num-files-at-level" + NumberToString(i), &property); // format print string diff --git a/util/ldb_cmd.h b/util/ldb_cmd.h index 45a3d707c..fe9457063 100644 --- a/util/ldb_cmd.h +++ b/util/ldb_cmd.h @@ -2,9 +2,7 @@ // Use of this source code is governed by a BSD-style license that can be // found in the LICENSE file. -#ifndef STORAGE_LEVELDB_UTIL_LDB_CMD_H_ -#define STORAGE_LEVELDB_UTIL_LDB_CMD_H_ - +#pragma once #include #include #include @@ -681,4 +679,3 @@ private: }; } // namespace rocksdb -#endif // STORAGE_LEVELDB_UTIL_LDB_CMD_H_ diff --git a/util/ldb_cmd_execute_result.h b/util/ldb_cmd_execute_result.h index 3e28e9639..b3d54b489 100644 --- a/util/ldb_cmd_execute_result.h +++ b/util/ldb_cmd_execute_result.h @@ -1,5 +1,4 @@ -#ifndef LEVELDB_UTIL_LDB_CMD_EXECUTE_RESULT_H_ -#define LEVELDB_UTIL_LDB_CMD_EXECUTE_RESULT_H_ +#pragma once namespace rocksdb { @@ -70,5 +69,3 @@ private: }; } - -#endif diff --git a/util/logging.h b/util/logging.h index a90ae5dd2..c962f5945 100644 --- a/util/logging.h +++ b/util/logging.h @@ -5,9 +5,7 @@ // Must not be included from any .h files to avoid polluting the namespace // with macros. -#ifndef STORAGE_LEVELDB_UTIL_LOGGING_H_ -#define STORAGE_LEVELDB_UTIL_LOGGING_H_ - +#pragma once #include #include #include @@ -43,5 +41,3 @@ extern bool ConsumeChar(Slice* in, char c); extern bool ConsumeDecimalNumber(Slice* in, uint64_t* val); } // namespace rocksdb - -#endif // STORAGE_LEVELDB_UTIL_LOGGING_H_ diff --git a/util/manual_compaction_test.cc b/util/manual_compaction_test.cc index d2e8823f3..abe10f50e 100644 --- a/util/manual_compaction_test.cc +++ b/util/manual_compaction_test.cc @@ -25,7 +25,7 @@ class ManualCompactionTest { }; TEST(ManualCompactionTest, Test) { // Get rid of any state from an old run. - std::string dbpath = rocksdb::test::TmpDir() + "/leveldb_cbug_test"; + std::string dbpath = rocksdb::test::TmpDir() + "/rocksdb_cbug_test"; DestroyDB(dbpath, rocksdb::Options()); // Open database. Disable compression since it affects the creation diff --git a/util/murmurhash.h b/util/murmurhash.h index 1f476b664..2e8d54aa5 100644 --- a/util/murmurhash.h +++ b/util/murmurhash.h @@ -4,9 +4,7 @@ All code is released to the public domain. For business purposes, Murmurhash is under the MIT license. */ -#ifndef MURMURHASH_H -#define MURMURHASH_H - +#pragma once #include #if defined(__x86_64__) @@ -28,5 +26,3 @@ unsigned int MurmurHashNeutral2 ( const void * key, int len, unsigned int seed ) typedef unsigned int murmur_t; #endif - -#endif /* MURMURHASH_H */ diff --git a/util/mutexlock.h b/util/mutexlock.h index 4bd7f7fc6..1dc583849 100644 --- a/util/mutexlock.h +++ b/util/mutexlock.h @@ -2,9 +2,7 @@ // Use of this source code is governed by a BSD-style license that can be // found in the LICENSE file. See the AUTHORS file for names of contributors. -#ifndef STORAGE_LEVELDB_UTIL_MUTEXLOCK_H_ -#define STORAGE_LEVELDB_UTIL_MUTEXLOCK_H_ - +#pragma once #include "port/port.h" namespace rocksdb { @@ -73,6 +71,3 @@ class WriteLock { }; } // namespace rocksdb - - -#endif // STORAGE_LEVELDB_UTIL_MUTEXLOCK_H_ diff --git a/util/perf_context_imp.h b/util/perf_context_imp.h index 5c768cebb..4d6c90cd8 100644 --- a/util/perf_context_imp.h +++ b/util/perf_context_imp.h @@ -1,6 +1,4 @@ -#ifndef PERF_CONTEXT_IMP_H -#define PERF_CONTEXT_IMP_H - +#pragma once #include "rocksdb/perf_context.h" #include "util/stop_watch.h" @@ -29,5 +27,3 @@ inline void BumpPerfTime(uint64_t* time, } } - -#endif diff --git a/util/posix_logger.h b/util/posix_logger.h index e09e185fc..f3107520d 100644 --- a/util/posix_logger.h +++ b/util/posix_logger.h @@ -5,9 +5,7 @@ // Logger implementation that can be shared by all environments // where enough posix functionality is available. -#ifndef STORAGE_LEVELDB_UTIL_POSIX_LOGGER_H_ -#define STORAGE_LEVELDB_UTIL_POSIX_LOGGER_H_ - +#pragma once #include #include #include @@ -130,5 +128,3 @@ class PosixLogger : public Logger { }; } // namespace rocksdb - -#endif // STORAGE_LEVELDB_UTIL_POSIX_LOGGER_H_ diff --git a/util/random.h b/util/random.h index 6f36cd6d0..45cc89e41 100644 --- a/util/random.h +++ b/util/random.h @@ -2,9 +2,7 @@ // Use of this source code is governed by a BSD-style license that can be // found in the LICENSE file. See the AUTHORS file for names of contributors. -#ifndef STORAGE_LEVELDB_UTIL_RANDOM_H_ -#define STORAGE_LEVELDB_UTIL_RANDOM_H_ - +#pragma once #include #include @@ -85,5 +83,3 @@ class Random64 { }; } // namespace rocksdb - -#endif // STORAGE_LEVELDB_UTIL_RANDOM_H_ diff --git a/util/stack_trace.h b/util/stack_trace.h index bc29a3866..402030272 100644 --- a/util/stack_trace.h +++ b/util/stack_trace.h @@ -1,6 +1,4 @@ -#ifndef STACK_TRACE_H -#define STACK_TRACE_H - +#pragma once namespace rocksdb { // Install a signal handler to print callstack on the following signals: @@ -9,5 +7,3 @@ namespace rocksdb { void InstallStackTraceHandler(); } // namespace rocksdb - -#endif diff --git a/util/stats_logger.h b/util/stats_logger.h index 0fac03038..3ed2320c2 100644 --- a/util/stats_logger.h +++ b/util/stats_logger.h @@ -1,5 +1,4 @@ -#ifndef STATS_LOGGER_H_ -#define STATS_LOGGER_H_ +#pragma once namespace rocksdb { @@ -20,5 +19,3 @@ class StatsLogger { }; } - -#endif diff --git a/util/stl_wrappers.h b/util/stl_wrappers.h index 512932301..ac280a06c 100644 --- a/util/stl_wrappers.h +++ b/util/stl_wrappers.h @@ -1,5 +1,4 @@ -#ifndef LEVELDB_UTIL_STL_WRAPPERS_H_ -#define LEVELDB_UTIL_STL_WRAPPERS_H_ +#pragma once #include "util/murmurhash.h" #include "util/coding.h" @@ -45,5 +44,3 @@ namespace stl_wrappers { }; } } - -#endif // LEVELDB_UTIL_STL_WRAPPERS_H_ diff --git a/util/stop_watch.h b/util/stop_watch.h index e70579c8b..990c3cb59 100644 --- a/util/stop_watch.h +++ b/util/stop_watch.h @@ -1,6 +1,4 @@ -#ifndef STORAGE_LEVELDB_UTIL_STOP_WATCH_H_ -#define STORAGE_LEVELDB_UTIL_STOP_WATCH_H_ - +#pragma once #include "rocksdb/env.h" #include "rocksdb/statistics.h" @@ -65,4 +63,3 @@ class StopWatchNano { }; } // namespace rocksdb -#endif // STORAGE_LEVELDB_UTIL_STOP_WATCH_H_ diff --git a/util/string_util.h b/util/string_util.h index f682d321a..da7a4273b 100644 --- a/util/string_util.h +++ b/util/string_util.h @@ -1,12 +1,8 @@ // Copyright (c) 2013 Facebook. -#ifndef STORAGE_LEVELDB_UTIL_STRINGUTIL_H_ -#define STORAGE_LEVELDB_UTIL_STRINGUTIL_H_ - +#pragma once namespace rocksdb { extern std::vector stringSplit(std::string arg, char delim); } - -#endif // STORAGE_LEVELDB_UTIL_STRINGUTIL_H_ diff --git a/util/testharness.cc b/util/testharness.cc index b8eeca81e..48e26cc80 100644 --- a/util/testharness.cc +++ b/util/testharness.cc @@ -34,7 +34,7 @@ bool RegisterTest(const char* base, const char* name, void (*func)()) { } int RunAllTests() { - const char* matcher = getenv("LEVELDB_TESTS"); + const char* matcher = getenv("ROCKSDB_TESTS"); int num = 0; if (tests != nullptr) { diff --git a/util/testharness.h b/util/testharness.h index 0adf63277..f45fc70dc 100644 --- a/util/testharness.h +++ b/util/testharness.h @@ -2,8 +2,7 @@ // Use of this source code is governed by a BSD-style license that can be // found in the LICENSE file. See the AUTHORS file for names of contributors. -#ifndef STORAGE_LEVELDB_UTIL_TESTHARNESS_H_ -#define STORAGE_LEVELDB_UTIL_TESTHARNESS_H_ +#pragma once #include #include @@ -16,14 +15,14 @@ namespace rocksdb { namespace test { // Run some of the tests registered by the TEST() macro. If the -// environment variable "LEVELDB_TESTS" is not set, runs all tests. +// environment variable "ROCKSDB_TESTS" is not set, runs all tests. // Otherwise, runs only the tests whose name contains the value of -// "LEVELDB_TESTS" as a substring. E.g., suppose the tests are: +// "ROCKSDB_TESTS" as a substring. E.g., suppose the tests are: // TEST(Foo, Hello) { ... } // TEST(Foo, World) { ... } -// LEVELDB_TESTS=Hello will run the first test -// LEVELDB_TESTS=o will run both tests -// LEVELDB_TESTS=Junk will run no tests +// ROCKSDB_TESTS=Hello will run the first test +// ROCKSDB_TESTS=o will run both tests +// ROCKSDB_TESTS=Junk will run no tests // // Returns 0 if all tests pass. // Dies or returns a non-zero value if some test fails. @@ -134,5 +133,3 @@ extern bool RegisterTest(const char* base, const char* name, void (*func)()); } // namespace test } // namespace rocksdb - -#endif // STORAGE_LEVELDB_UTIL_TESTHARNESS_H_ diff --git a/util/testutil.h b/util/testutil.h index 7e9563bfb..eb3b99796 100644 --- a/util/testutil.h +++ b/util/testutil.h @@ -2,9 +2,7 @@ // Use of this source code is governed by a BSD-style license that can be // found in the LICENSE file. See the AUTHORS file for names of contributors. -#ifndef STORAGE_LEVELDB_UTIL_TESTUTIL_H_ -#define STORAGE_LEVELDB_UTIL_TESTUTIL_H_ - +#pragma once #include "rocksdb/env.h" #include "rocksdb/slice.h" #include "util/random.h" @@ -50,5 +48,3 @@ class ErrorEnv : public EnvWrapper { } // namespace test } // namespace rocksdb - -#endif // STORAGE_LEVELDB_UTIL_TESTUTIL_H_ diff --git a/utilities/merge_operators/string_append/stringappend.cc b/utilities/merge_operators/string_append/stringappend.cc index b36708c7b..38cd22eb4 100644 --- a/utilities/merge_operators/string_append/stringappend.cc +++ b/utilities/merge_operators/string_append/stringappend.cc @@ -1,5 +1,5 @@ /** - * A MergeOperator for rocksdb/leveldb that implements string append. + * A MergeOperator for rocksdb that implements string append. * @author Deon Nicholas (dnicholas@fb.com) * Copyright 2013 Facebook */ diff --git a/utilities/merge_operators/string_append/stringappend.h b/utilities/merge_operators/string_append/stringappend.h index 40edb9f9f..ca5b97ec9 100644 --- a/utilities/merge_operators/string_append/stringappend.h +++ b/utilities/merge_operators/string_append/stringappend.h @@ -1,5 +1,5 @@ /** - * A MergeOperator for rocksdb/leveldb that implements string append. + * A MergeOperator for rocksdb that implements string append. * @author Deon Nicholas (dnicholas@fb.com) * Copyright 2013 Facebook */ diff --git a/utilities/merge_operators/string_append/stringappend2.h b/utilities/merge_operators/string_append/stringappend2.h index 734c7581a..01a4be4db 100644 --- a/utilities/merge_operators/string_append/stringappend2.h +++ b/utilities/merge_operators/string_append/stringappend2.h @@ -1,5 +1,5 @@ /** - * A TEST MergeOperator for rocksdb/leveldb that implements string append. + * A TEST MergeOperator for rocksdb that implements string append. * It is built using the MergeOperator interface rather than the simpler * AssociativeMergeOperator interface. This is useful for testing/benchmarking. * While the two operators are semantically the same, all production code diff --git a/utilities/merge_operators/string_append/stringappend_test.cc b/utilities/merge_operators/string_append/stringappend_test.cc index a4dc596c0..57386da0f 100644 --- a/utilities/merge_operators/string_append/stringappend_test.cc +++ b/utilities/merge_operators/string_append/stringappend_test.cc @@ -568,7 +568,7 @@ TEST(StringAppendOperatorTest, SimpleTestNullDelimiter) { checker[5] = '\0'; assert(checker.size() == 8); // Verify it is still the correct size - // Check that the leveldb result string matches the desired string + // Check that the rocksdb result string matches the desired string assert(res.size() == checker.size()); ASSERT_EQ(res, checker); } diff --git a/utilities/redis/redis_list_exception.h b/utilities/redis/redis_list_exception.h index ec349072d..d409095a6 100644 --- a/utilities/redis/redis_list_exception.h +++ b/utilities/redis/redis_list_exception.h @@ -5,9 +5,7 @@ * Copyright 2013 Facebook */ -#ifndef LEVELDB_REDIS_LIST_EXCEPTION_H -#define LEVELDB_REDIS_LIST_EXCEPTION_H - +#pragma once #include namespace rocksdb { @@ -20,5 +18,3 @@ class RedisListException: public std::exception { }; } // namespace rocksdb - -#endif // LEVELDB_REDIS_LIST_EXCEPTION_H diff --git a/utilities/ttl/db_ttl.h b/utilities/ttl/db_ttl.h index fbee46528..e88cc34b3 100644 --- a/utilities/ttl/db_ttl.h +++ b/utilities/ttl/db_ttl.h @@ -2,9 +2,7 @@ // Use of this source code is governed by a BSD-style license that can be // found in the LICENSE file. See the AUTHORS file for names of contributors. -#ifndef LEVELDB_UTILITIES_TTL_DB_TTL_H_ -#define LEVELDB_UTILITIES_TTL_DB_TTL_H_ - +#pragma once #include "rocksdb/db.h" #include "rocksdb/env.h" #include "rocksdb/compaction_filter.h" @@ -360,4 +358,3 @@ class TtlMergeOperator : public MergeOperator { }; } -#endif // LEVELDB_UTILITIES_TTL_DB_TTL_H_