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
main
Dhruba Borthakur 11 years ago
parent bf89edf78b
commit 4463b11cad
  1. 10
      build_tools/build_detect_version
  2. 86
      build_tools/build_java.sh
  3. 7
      db/builder.h
  4. 2
      db/c_test.c
  5. 4
      db/corruption_test.cc
  6. 8
      db/db_bench.cc
  7. 10
      db/db_impl.cc
  8. 9
      db/db_impl.h
  9. 6
      db/db_impl_readonly.h
  10. 6
      db/db_iter.h
  11. 6
      db/db_statistics.h
  12. 8
      db/db_test.cc
  13. 8
      db/dbformat.h
  14. 8
      db/filename.h
  15. 6
      db/log_format.h
  16. 6
      db/log_reader.h
  17. 6
      db/log_writer.h
  18. 6
      db/memtable.h
  19. 6
      db/memtablelist.h
  20. 6
      db/merge_test.cc
  21. 2
      db/perf_context_test.cc
  22. 6
      db/prefix_filter_iterator.h
  23. 2
      db/repair.cc
  24. 6
      db/skiplist.h
  25. 6
      db/snapshot.h
  26. 6
      db/table_cache.h
  27. 8
      db/transaction_log_impl.h
  28. 6
      db/version_edit.h
  29. 6
      db/version_set.h
  30. 7
      db/write_batch_internal.h
  31. 8
      hdfs/README
  32. 10
      hdfs/env_hdfs.h
  33. 4
      include/rocksdb/comparator.h
  34. 6
      include/rocksdb/db.h
  35. 4
      include/rocksdb/env.h
  36. 4
      include/rocksdb/filter_policy.h
  37. 3
      include/rocksdb/ldb_tool.h
  38. 4
      include/rocksdb/memtablerep.h
  39. 4
      include/rocksdb/options.h
  40. 2
      include/rocksdb/slice.h
  41. 2
      include/rocksdb/statistics.h
  42. 6
      include/utilities/stackable_db.h
  43. 8
      include/utilities/utility_db.h
  44. 6
      table/block.h
  45. 6
      table/block_builder.h
  46. 6
      table/filter_block.h
  47. 6
      table/format.h
  48. 5
      table/iter_heap.h
  49. 6
      table/iterator_wrapper.h
  50. 5
      table/merger.h
  51. 6
      table/table.h
  52. 4
      table/table_test.cc
  53. 6
      table/two_level_iterator.h
  54. 2
      tools/db_crashtest2.py
  55. 4
      tools/db_stress.cc
  56. 2
      tools/reduce_levels_test.cc
  57. 2
      tools/shell/DBClientProxy.h
  58. 2
      tools/shell/ShellState.h
  59. 6
      util/arena_impl.h
  60. 6
      util/auto_roll_logger.h
  61. 2
      util/auto_roll_logger_test.cc
  62. 6
      util/bit_set.h
  63. 2
      util/bloom.cc
  64. 13
      util/build_version.h
  65. 6
      util/coding.h
  66. 2
      util/comparator.cc
  67. 6
      util/crc32c.h
  68. 10
      util/env_hdfs.cc
  69. 66
      util/env_posix.cc
  70. 6
      util/hash.h
  71. 6
      util/histogram.h
  72. 8
      util/ldb_cmd.cc
  73. 5
      util/ldb_cmd.h
  74. 5
      util/ldb_cmd_execute_result.h
  75. 6
      util/logging.h
  76. 2
      util/manual_compaction_test.cc
  77. 6
      util/murmurhash.h
  78. 7
      util/mutexlock.h
  79. 6
      util/perf_context_imp.h
  80. 6
      util/posix_logger.h
  81. 6
      util/random.h
  82. 6
      util/stack_trace.h
  83. 5
      util/stats_logger.h
  84. 5
      util/stl_wrappers.h
  85. 5
      util/stop_watch.h
  86. 6
      util/string_util.h
  87. 2
      util/testharness.cc
  88. 15
      util/testharness.h
  89. 6
      util/testutil.h
  90. 2
      utilities/merge_operators/string_append/stringappend.cc
  91. 2
      utilities/merge_operators/string_append/stringappend.h
  92. 2
      utilities/merge_operators/string_append/stringappend2.h
  93. 2
      utilities/merge_operators/string_append/stringappend_test.cc
  94. 6
      utilities/redis/redis_list_exception.h
  95. 5
      utilities/ttl/db_ttl.h

@ -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

@ -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

@ -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_

@ -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);
}

@ -298,7 +298,7 @@ TEST(CorruptionTest, CompactionInputError) {
DBImpl* dbi = reinterpret_cast<DBImpl*>(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);

@ -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());

@ -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<std::string> 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

@ -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 <atomic>
#include <deque>
#include <set>
@ -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_

@ -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 <deque>
@ -73,5 +71,3 @@ private:
};
}
#endif

@ -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 <stdint.h>
#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_

@ -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 <cassert>
#include <stdlib.h>
#include <vector>
@ -60,5 +58,3 @@ std::shared_ptr<Statistics> CreateDBStatistics() {
}
} // namespace rocksdb
#endif // LEVELDB_STORAGE_DB_DB_STATISTICS_H_

@ -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;

@ -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 <stdio.h>
#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_

@ -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 <stdint.h>
#include <string>
#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_

@ -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_

@ -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 <memory>
#include <stdint.h>
@ -119,5 +117,3 @@ class Reader {
} // namespace log
} // namespace rocksdb
#endif // STORAGE_LEVELDB_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_WRITER_H_
#define STORAGE_LEVELDB_DB_LOG_WRITER_H_
#pragma once
#include <memory>
#include <stdint.h>
#include "db/log_format.h"
@ -50,5 +48,3 @@ class Writer {
} // namespace log
} // namespace rocksdb
#endif // STORAGE_LEVELDB_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_MEMTABLE_H_
#define STORAGE_LEVELDB_DB_MEMTABLE_H_
#pragma once
#include <string>
#include <memory>
#include <deque>
@ -147,5 +145,3 @@ class MemTable {
};
} // namespace rocksdb
#endif // STORAGE_LEVELDB_DB_MEMTABLE_H_

@ -1,8 +1,6 @@
// Copyright (c) 2012 Facebook.
#ifndef STORAGE_LEVELDB_DB_MEMTABLELIST_H_
#define STORAGE_LEVELDB_DB_MEMTABLELIST_H_
#pragma once
#include <string>
#include <list>
#include <deque>
@ -100,5 +98,3 @@ class MemTableList {
};
} // namespace rocksdb
#endif // STORAGE_LEVELDB_DB_MEMTABLELIST_H_

@ -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);

@ -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:

@ -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

@ -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. "
"****",

@ -25,9 +25,7 @@
// ... prev vs. next pointer ordering ...
//
#ifndef STORAGE_LEVELDB_DB_SKIPLIST_H_
#define STORAGE_LEVELDB_DB_SKIPLIST_H_
#pragma once
#include <assert.h>
#include <stdlib.h>
#include "port/port.h"
@ -401,5 +399,3 @@ bool SkipList<Key,Comparator>::Contains(const Key& key) const {
}
} // namespace rocksdb
#endif // STORAGE_LEVELDB_DB_SKIPLIST_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_

@ -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 <string>
#include <stdint.h>
#include "db/dbformat.h"
@ -73,5 +71,3 @@ class TableCache {
};
} // namespace rocksdb
#endif // STORAGE_LEVELDB_DB_TABLE_CACHE_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 <vector>
#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_

@ -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 <set>
#include <utility>
#include <vector>
@ -123,5 +121,3 @@ class VersionEdit {
};
} // namespace rocksdb
#endif // STORAGE_LEVELDB_DB_VERSION_EDIT_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 <map>
#include <memory>
#include <set>
@ -628,5 +626,3 @@ class Compaction {
};
} // namespace rocksdb
#endif // STORAGE_LEVELDB_DB_VERSION_SET_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_

@ -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

@ -17,9 +17,7 @@
*/
// Copyright (c) 2012 Facebook. All rights reserved.
#ifndef LEVELDB_HDFS_FILE_H
#define LEVELDB_HDFS_FILE_H
#pragma once
#include <algorithm>
#include <stdio.h>
#include <sys/time.h>
@ -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

@ -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;

@ -175,11 +175,11 @@ class DB {
//
// Valid property names include:
//
// "leveldb.num-files-at-level<N>" - return the number of files at level <N>,
// "rocksdb.num-files-at-level<N>" - return the number of files at level <N>,
// where <N> 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;

@ -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.

@ -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.

@ -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"

@ -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.

@ -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<Cache> 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;

@ -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_;

@ -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:

@ -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_

@ -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_

@ -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 <stddef.h>
#include <stdint.h>
#include "rocksdb/iterator.h"
@ -42,5 +40,3 @@ class Block {
};
} // namespace rocksdb
#endif // STORAGE_LEVELDB_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_BUILDER_H_
#define STORAGE_LEVELDB_TABLE_BLOCK_BUILDER_H_
#pragma once
#include <vector>
#include <stdint.h>
@ -56,5 +54,3 @@ class BlockBuilder {
};
} // namespace rocksdb
#endif // STORAGE_LEVELDB_TABLE_BLOCK_BUILDER_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 <stddef.h>
#include <stdint.h>
#include <string>
@ -76,5 +74,3 @@ class FilterBlockReader {
};
}
#endif // STORAGE_LEVELDB_TABLE_FILTER_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_FORMAT_H_
#define STORAGE_LEVELDB_TABLE_FORMAT_H_
#pragma once
#include <string>
#include <stdint.h>
#include "rocksdb/slice.h"
@ -105,5 +103,3 @@ inline BlockHandle::BlockHandle()
}
} // namespace rocksdb
#endif // STORAGE_LEVELDB_TABLE_FORMAT_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 <queue>
#include "rocksdb/comparator.h"
@ -59,5 +58,3 @@ MinIterHeap NewMinIterHeap(const Comparator* comparator) {
}
} // namespace rocksdb
#endif // STORAGE_LEVELDB_ITER_HEAP_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_

@ -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_

@ -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 <memory>
#include <stdint.h>
#include "rocksdb/iterator.h"
@ -103,5 +101,3 @@ class Table {
};
} // namespace rocksdb
#endif // STORAGE_LEVELDB_INCLUDE_TABLE_H_

@ -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());
}

@ -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_

@ -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:

@ -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;

@ -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());
}

@ -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.

@ -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

@ -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 <cstddef>
#include <vector>
#include <assert.h>
@ -79,5 +77,3 @@ inline char* ArenaImpl::Allocate(size_t bytes) {
}
} // namespace rocksdb
#endif // STORAGE_LEVELDB_UTIL_ARENA_IMPL_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>* logger);
} // namespace rocksdb
#endif // STORAGE_LEVELDB_UTIL_AUTO_ROLL_LOGGER_H

@ -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

@ -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 <cassert>
namespace rocksdb {
@ -71,5 +69,3 @@ class BitSet {
};
} // namespace facebook
#endif // STORAGE_LEVELDB_UTIL_BIT_SET_H_

@ -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 {

@ -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_ */

@ -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 <stdint.h>
#include <string.h>
#include <string>
@ -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_

@ -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 {

@ -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 <stddef.h>
#include <stdint.h>
@ -41,5 +39,3 @@ inline uint32_t Unmask(uint32_t masked_crc) {
} // namespace crc32c
} // namespace rocksdb
#endif // STORAGE_LEVELDB_UTIL_CRC32C_H_

@ -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 <algorithm>
#include <stdio.h>
@ -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

@ -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<char*>(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

@ -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 <stddef.h>
#include <stdint.h>
@ -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_

@ -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 <cassert>
@ -74,5 +72,3 @@ class HistogramImpl {
};
} // namespace rocksdb
#endif // STORAGE_LEVELDB_UTIL_HISTOGRAM_H_

@ -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

@ -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 <string>
#include <iostream>
#include <sstream>
@ -681,4 +679,3 @@ private:
};
} // namespace rocksdb
#endif // STORAGE_LEVELDB_UTIL_LDB_CMD_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

@ -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 <stdio.h>
#include <stdint.h>
#include <string>
@ -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_

@ -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

@ -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 <stdint.h>
#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 */

@ -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_

@ -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

@ -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 <algorithm>
#include <stdio.h>
#include <sys/time.h>
@ -130,5 +128,3 @@ class PosixLogger : public Logger {
};
} // namespace rocksdb
#endif // STORAGE_LEVELDB_UTIL_POSIX_LOGGER_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 <random>
#include <stdint.h>
@ -85,5 +83,3 @@ class Random64 {
};
} // namespace rocksdb
#endif // STORAGE_LEVELDB_UTIL_RANDOM_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

@ -1,5 +1,4 @@
#ifndef STATS_LOGGER_H_
#define STATS_LOGGER_H_
#pragma once
namespace rocksdb {
@ -20,5 +19,3 @@ class StatsLogger {
};
}
#endif

@ -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_

@ -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_

@ -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<std::string> stringSplit(std::string arg, char delim);
}
#endif // STORAGE_LEVELDB_UTIL_STRINGUTIL_H_

@ -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) {

@ -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 <stdio.h>
#include <stdlib.h>
@ -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_

@ -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_

@ -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
*/

@ -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
*/

@ -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

@ -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);
}

@ -5,9 +5,7 @@
* Copyright 2013 Facebook
*/
#ifndef LEVELDB_REDIS_LIST_EXCEPTION_H
#define LEVELDB_REDIS_LIST_EXCEPTION_H
#pragma once
#include <exception>
namespace rocksdb {
@ -20,5 +18,3 @@ class RedisListException: public std::exception {
};
} // namespace rocksdb
#endif // LEVELDB_REDIS_LIST_EXCEPTION_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_

Loading…
Cancel
Save