Skip to content

Commit

Permalink
@20776309
Browse files Browse the repository at this point in the history
* env_chromium.cc should not export symbols.
* Fix MSVC warnings.
* Removed large value support.
* Fix broken reference to documentation file

git-svn-id: http://leveldb.googlecode.com/svn/trunk@24 62dab493-f737-651d-591e-8d6aee1b9529
  • Loading branch information
dgrogan@chromium.org committed Apr 20, 2011
1 parent 80d4a46 commit 1511be6
Show file tree
Hide file tree
Showing 44 changed files with 152 additions and 1,165 deletions.
5 changes: 0 additions & 5 deletions Makefile
Expand Up @@ -27,7 +27,6 @@ LIBOBJECTS = \
./db/version_set.o \
./db/write_batch.o \
./port/port_posix.o \
./port/sha1_portable.o \
./table/block.o \
./table/block_builder.o \
./table/format.o \
Expand Down Expand Up @@ -63,7 +62,6 @@ TESTS = \
env_test \
filename_test \
log_test \
sha1_test \
skiplist_test \
table_test \
version_edit_test \
Expand Down Expand Up @@ -115,9 +113,6 @@ log_test: db/log_test.o $(LIBOBJECTS) $(TESTHARNESS)
table_test: table/table_test.o $(LIBOBJECTS) $(TESTHARNESS)
$(CC) $(LDFLAGS) table/table_test.o $(LIBOBJECTS) $(TESTHARNESS) -o $@

sha1_test: port/sha1_test.o $(LIBOBJECTS) $(TESTHARNESS)
$(CC) $(LDFLAGS) port/sha1_test.o $(LIBOBJECTS) $(TESTHARNESS) -o $@

skiplist_test: db/skiplist_test.o $(LIBOBJECTS) $(TESTHARNESS)
$(CC) $(LDFLAGS) db/skiplist_test.o $(LIBOBJECTS) $(TESTHARNESS) -o $@

Expand Down
4 changes: 2 additions & 2 deletions README
Expand Up @@ -2,10 +2,10 @@ leveldb: A key-value store
Authors: Sanjay Ghemawat (sanjay@google.com) and Jeff Dean (jeff@google.com)

The code under this directory implements a system for maintaining a
persistent key/value store.
persistent key/value store.

See doc/index.html for more explanation.
See doc/db_layout.txt for a brief overview of the implementation.
See doc/impl.html for a brief overview of the implementation.

The public interface is in include/*.h. Callers should not include or
rely on the details of any other header files in this package. Those
Expand Down
4 changes: 2 additions & 2 deletions TODO
Expand Up @@ -8,7 +8,7 @@ db
object stores, etc. can be done in the background anyway, so
probably not that important.

api changes?
- Efficient large value reading and writing
api changes:
- Make it wrappable

Faster Get implementation
9 changes: 0 additions & 9 deletions db/builder.cc
Expand Up @@ -38,15 +38,6 @@ Status BuildTable(const std::string& dbname,
for (; iter->Valid(); iter->Next()) {
Slice key = iter->key();
meta->largest.DecodeFrom(key);
if (ExtractValueType(key) == kTypeLargeValueRef) {
if (iter->value().size() != LargeValueRef::ByteSize()) {
s = Status::Corruption("invalid indirect reference hash value (L0)");
break;
}
edit->AddLargeValueRef(LargeValueRef::FromRef(iter->value()),
meta->number,
iter->key());
}
builder->Add(key, iter->value());
}

Expand Down
6 changes: 3 additions & 3 deletions db/builder.h
Expand Up @@ -20,9 +20,9 @@ class VersionEdit;
// Build a Table file from the contents of *iter. The generated file
// will be named according to meta->number. On success, the rest of
// *meta will be filled with metadata about the generated table, and
// large value refs and the added file information will be added to
// *edit. If no data is present in *iter, meta->file_size will be set
// to zero, and no Table file will be produced.
// the file information will be added to *edit. If no data is present
// in *iter, meta->file_size will be set to zero, and no Table file
// will be produced.
extern Status BuildTable(const std::string& dbname,
Env* env,
const Options& options,
Expand Down
26 changes: 1 addition & 25 deletions db/corruption_test.cc
Expand Up @@ -121,11 +121,10 @@ class CorruptionTest {
std::vector<std::string> filenames;
ASSERT_OK(env_.GetChildren(dbname_, &filenames));
uint64_t number;
LargeValueRef large_ref;
FileType type;
std::vector<std::string> candidates;
for (int i = 0; i < filenames.size(); i++) {
if (ParseFileName(filenames[i], &number, &large_ref, &type) &&
if (ParseFileName(filenames[i], &number, &type) &&
type == filetype) {
candidates.push_back(dbname_ + "/" + filenames[i]);
}
Expand Down Expand Up @@ -276,29 +275,6 @@ TEST(CorruptionTest, SequenceNumberRecovery) {
ASSERT_EQ("v6", v);
}

TEST(CorruptionTest, LargeValueRecovery) {
Options options;
options.large_value_threshold = 10000;
Reopen(&options);

Random rnd(301);
std::string big;
ASSERT_OK(db_->Put(WriteOptions(),
"foo", test::RandomString(&rnd, 100000, &big)));
std::string v;
ASSERT_OK(db_->Get(ReadOptions(), "foo", &v));
ASSERT_EQ(big, v);

RepairDB();
Reopen();
ASSERT_OK(db_->Get(ReadOptions(), "foo", &v));
ASSERT_EQ(big, v);

Reopen();
ASSERT_OK(db_->Get(ReadOptions(), "foo", &v));
ASSERT_EQ(big, v);
}

TEST(CorruptionTest, CorruptedDescriptor) {
ASSERT_OK(db_->Put(WriteOptions(), "foo", "hello"));
DBImpl* dbi = reinterpret_cast<DBImpl*>(db_);
Expand Down
22 changes: 0 additions & 22 deletions db/db_bench.cc
Expand Up @@ -28,7 +28,6 @@
// readreverse -- read N values in reverse order
// readrandom -- read N values in random order
// crc32c -- repeated crc32c of 4K of data
// sha1 -- repeated SHA1 computation over 4K of data
// Meta operations:
// compact -- Compact the entire DB
// stats -- Print DB stats
Expand All @@ -48,7 +47,6 @@ static const char* FLAGS_benchmarks =
"readreverse,"
"fill100K,"
"crc32c,"
"sha1,"
"snappycomp,"
"snappyuncomp,"
;
Expand Down Expand Up @@ -366,8 +364,6 @@ class Benchmark {
Compact();
} else if (name == Slice("crc32c")) {
Crc32c(4096, "(4K per op)");
} else if (name == Slice("sha1")) {
SHA1(4096, "(4K per op)");
} else if (name == Slice("snappycomp")) {
SnappyCompress();
} else if (name == Slice("snappyuncomp")) {
Expand Down Expand Up @@ -406,24 +402,6 @@ class Benchmark {
message_ = label;
}

void SHA1(int size, const char* label) {
// SHA1 about 100MB of data total
std::string data(size, 'x');
int64_t bytes = 0;
char sha1[20];
while (bytes < 100 * 1048576) {
port::SHA1_Hash(data.data(), size, sha1);
FinishedSingleOp();
bytes += size;
}

// Print so result is not dead
fprintf(stderr, "... sha1=%02x...\r", static_cast<unsigned int>(sha1[0]));

bytes_ = bytes;
message_ = label;
}

void SnappyCompress() {
Slice input = gen_.Generate(Options().block_size);
int64_t bytes = 0;
Expand Down

0 comments on commit 1511be6

Please sign in to comment.