Skip to content

Commit

Permalink
Migrate names of properties from 'leveldb' prefix to 'rocksdb' prefix.
Browse files Browse the repository at this point in the history
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
  • Loading branch information
dhruba committed Oct 6, 2013
1 parent bf89edf commit 4463b11
Show file tree
Hide file tree
Showing 95 changed files with 175 additions and 490 deletions.
10 changes: 5 additions & 5 deletions build_tools/build_detect_version
Original file line number Diff line number Diff line change
Expand Up @@ -20,21 +20,21 @@ 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" |
awk '
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
Expand Down
86 changes: 0 additions & 86 deletions build_tools/build_java.sh

This file was deleted.

7 changes: 1 addition & 6 deletions db/builder.h
Original file line number Diff line number Diff line change
@@ -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"
Expand Down Expand Up @@ -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_
2 changes: 1 addition & 1 deletion db/c_test.c
Original file line number Diff line number Diff line change
Expand Up @@ -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);
}
Expand Down
4 changes: 2 additions & 2 deletions db/corruption_test.cc
Original file line number Diff line number Diff line change
Expand Up @@ -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);
Expand All @@ -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);
Expand Down
8 changes: 4 additions & 4 deletions db/db_bench.cc
Original file line number Diff line number Diff line change
Expand Up @@ -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());
}

Expand Down Expand Up @@ -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());
Expand Down
10 changes: 5 additions & 5 deletions db/db_impl.cc
Original file line number Diff line number Diff line change
Expand Up @@ -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();
}
Expand Down Expand Up @@ -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;
Expand Down Expand Up @@ -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());

Expand Down Expand Up @@ -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
9 changes: 2 additions & 7 deletions db/db_impl.h
Original file line number Diff line number Diff line change
@@ -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>
Expand Down Expand Up @@ -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
Expand Down Expand Up @@ -441,5 +438,3 @@ extern Options SanitizeOptions(const std::string& db,
const Options& src);

} // namespace rocksdb

#endif // STORAGE_LEVELDB_DB_DB_IMPL_H_
6 changes: 1 addition & 5 deletions db/db_impl_readonly.h
Original file line number Diff line number Diff line change
Expand Up @@ -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>
Expand Down Expand Up @@ -73,5 +71,3 @@ class DBImplReadOnly : public DBImpl {
};

}

#endif
6 changes: 1 addition & 5 deletions db/db_iter.h
Original file line number Diff line number Diff line change
Expand Up @@ -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"
Expand All @@ -23,5 +21,3 @@ extern Iterator* NewDBIterator(
const SequenceNumber& sequence);

} // namespace rocksdb

#endif // STORAGE_LEVELDB_DB_DB_ITER_H_
6 changes: 1 addition & 5 deletions db/db_statistics.h
Original file line number Diff line number Diff line change
Expand Up @@ -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>
Expand Down Expand Up @@ -60,5 +58,3 @@ std::shared_ptr<Statistics> CreateDBStatistics() {
}

} // namespace rocksdb

#endif // LEVELDB_STORAGE_DB_DB_STATISTICS_H_
8 changes: 4 additions & 4 deletions db/db_test.cc
Original file line number Diff line number Diff line change
Expand Up @@ -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());
}
Expand Down Expand Up @@ -574,7 +574,7 @@ class DBTest {

std::string DumpSSTableList() {
std::string property;
db_->GetProperty("leveldb.sstables", &property);
db_->GetProperty("rocksdb.sstables", &property);
return property;
}

Expand Down Expand Up @@ -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);
}
Expand Down Expand Up @@ -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;
Expand Down
8 changes: 2 additions & 6 deletions db/dbformat.h
Original file line number Diff line number Diff line change
Expand Up @@ -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"
Expand Down Expand Up @@ -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())) {
}

Expand Down Expand Up @@ -224,5 +222,3 @@ inline LookupKey::~LookupKey() {
}

} // namespace rocksdb

#endif // STORAGE_LEVELDB_DB_FORMAT_H_
8 changes: 2 additions & 6 deletions db/filename.h
Original file line number Diff line number Diff line change
Expand Up @@ -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"
Expand Down Expand Up @@ -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,
Expand All @@ -93,5 +91,3 @@ extern Status SetCurrentFile(Env* env, const std::string& dbname,


} // namespace rocksdb

#endif // STORAGE_LEVELDB_DB_FILENAME_H_
Loading

0 comments on commit 4463b11

Please sign in to comment.