Skip to content

Commit b743906

Browse files
Revision created by MOE tool push_codebase. MOE_MIGRATION= git-svn-id: https://leveldb.googlecode.com/svn/trunk@22 62dab493-f737-651d-591e-8d6aee1b9529
1 parent b409afe commit b743906

Some content is hidden

Large Commits have some content hidden by default. Use the searchbox below for content that may be hidden.

118 files changed

+253
-1628
lines changed

db/filename_test.cc

-156
This file was deleted.

AUTHORS leveldb/AUTHORS

File renamed without changes.

LICENSE leveldb/LICENSE

File renamed without changes.

Makefile leveldb/Makefile

-5
Original file line numberDiff line numberDiff line change
@@ -27,7 +27,6 @@ LIBOBJECTS = \
2727
./db/version_set.o \
2828
./db/write_batch.o \
2929
./port/port_posix.o \
30-
./port/sha1_portable.o \
3130
./table/block.o \
3231
./table/block_builder.o \
3332
./table/format.o \
@@ -63,7 +62,6 @@ TESTS = \
6362
env_test \
6463
filename_test \
6564
log_test \
66-
sha1_test \
6765
skiplist_test \
6866
table_test \
6967
version_edit_test \
@@ -115,9 +113,6 @@ log_test: db/log_test.o $(LIBOBJECTS) $(TESTHARNESS)
115113
table_test: table/table_test.o $(LIBOBJECTS) $(TESTHARNESS)
116114
$(CC) $(LDFLAGS) table/table_test.o $(LIBOBJECTS) $(TESTHARNESS) -o $@
117115

118-
sha1_test: port/sha1_test.o $(LIBOBJECTS) $(TESTHARNESS)
119-
$(CC) $(LDFLAGS) port/sha1_test.o $(LIBOBJECTS) $(TESTHARNESS) -o $@
120-
121116
skiplist_test: db/skiplist_test.o $(LIBOBJECTS) $(TESTHARNESS)
122117
$(CC) $(LDFLAGS) db/skiplist_test.o $(LIBOBJECTS) $(TESTHARNESS) -o $@
123118

README leveldb/README

+2-2
Original file line numberDiff line numberDiff line change
@@ -2,10 +2,10 @@ leveldb: A key-value store
22
Authors: Sanjay Ghemawat ([email protected]) and Jeff Dean ([email protected])
33

44
The code under this directory implements a system for maintaining a
5-
persistent key/value store.
5+
persistent key/value store.
66

77
See doc/index.html for more explanation.
8-
See doc/db_layout.txt for a brief overview of the implementation.
8+
See doc/impl.html for a brief overview of the implementation.
99

1010
The public interface is in include/*.h. Callers should not include or
1111
rely on the details of any other header files in this package. Those

TODO leveldb/TODO

+2-2
Original file line numberDiff line numberDiff line change
@@ -8,7 +8,7 @@ db
88
object stores, etc. can be done in the background anyway, so
99
probably not that important.
1010

11-
api changes?
12-
- Efficient large value reading and writing
11+
api changes:
12+
- Make it wrappable
1313

1414
Faster Get implementation

db/builder.cc leveldb/db/builder.cc

-9
Original file line numberDiff line numberDiff line change
@@ -38,15 +38,6 @@ Status BuildTable(const std::string& dbname,
3838
for (; iter->Valid(); iter->Next()) {
3939
Slice key = iter->key();
4040
meta->largest.DecodeFrom(key);
41-
if (ExtractValueType(key) == kTypeLargeValueRef) {
42-
if (iter->value().size() != LargeValueRef::ByteSize()) {
43-
s = Status::Corruption("invalid indirect reference hash value (L0)");
44-
break;
45-
}
46-
edit->AddLargeValueRef(LargeValueRef::FromRef(iter->value()),
47-
meta->number,
48-
iter->key());
49-
}
5041
builder->Add(key, iter->value());
5142
}
5243

db/builder.h leveldb/db/builder.h

+3-3
Original file line numberDiff line numberDiff line change
@@ -20,9 +20,9 @@ class VersionEdit;
2020
// Build a Table file from the contents of *iter. The generated file
2121
// will be named according to meta->number. On success, the rest of
2222
// *meta will be filled with metadata about the generated table, and
23-
// large value refs and the added file information will be added to
24-
// *edit. If no data is present in *iter, meta->file_size will be set
25-
// to zero, and no Table file will be produced.
23+
// the file information will be added to *edit. If no data is present
24+
// in *iter, meta->file_size will be set to zero, and no Table file
25+
// will be produced.
2626
extern Status BuildTable(const std::string& dbname,
2727
Env* env,
2828
const Options& options,

db/corruption_test.cc leveldb/db/corruption_test.cc

+1-25
Original file line numberDiff line numberDiff line change
@@ -121,11 +121,10 @@ class CorruptionTest {
121121
std::vector<std::string> filenames;
122122
ASSERT_OK(env_.GetChildren(dbname_, &filenames));
123123
uint64_t number;
124-
LargeValueRef large_ref;
125124
FileType type;
126125
std::vector<std::string> candidates;
127126
for (int i = 0; i < filenames.size(); i++) {
128-
if (ParseFileName(filenames[i], &number, &large_ref, &type) &&
127+
if (ParseFileName(filenames[i], &number, &type) &&
129128
type == filetype) {
130129
candidates.push_back(dbname_ + "/" + filenames[i]);
131130
}
@@ -276,29 +275,6 @@ TEST(CorruptionTest, SequenceNumberRecovery) {
276275
ASSERT_EQ("v6", v);
277276
}
278277

279-
TEST(CorruptionTest, LargeValueRecovery) {
280-
Options options;
281-
options.large_value_threshold = 10000;
282-
Reopen(&options);
283-
284-
Random rnd(301);
285-
std::string big;
286-
ASSERT_OK(db_->Put(WriteOptions(),
287-
"foo", test::RandomString(&rnd, 100000, &big)));
288-
std::string v;
289-
ASSERT_OK(db_->Get(ReadOptions(), "foo", &v));
290-
ASSERT_EQ(big, v);
291-
292-
RepairDB();
293-
Reopen();
294-
ASSERT_OK(db_->Get(ReadOptions(), "foo", &v));
295-
ASSERT_EQ(big, v);
296-
297-
Reopen();
298-
ASSERT_OK(db_->Get(ReadOptions(), "foo", &v));
299-
ASSERT_EQ(big, v);
300-
}
301-
302278
TEST(CorruptionTest, CorruptedDescriptor) {
303279
ASSERT_OK(db_->Put(WriteOptions(), "foo", "hello"));
304280
DBImpl* dbi = reinterpret_cast<DBImpl*>(db_);

db/db_bench.cc leveldb/db/db_bench.cc

-22
Original file line numberDiff line numberDiff line change
@@ -28,7 +28,6 @@
2828
// readreverse -- read N values in reverse order
2929
// readrandom -- read N values in random order
3030
// crc32c -- repeated crc32c of 4K of data
31-
// sha1 -- repeated SHA1 computation over 4K of data
3231
// Meta operations:
3332
// compact -- Compact the entire DB
3433
// stats -- Print DB stats
@@ -48,7 +47,6 @@ static const char* FLAGS_benchmarks =
4847
"readreverse,"
4948
"fill100K,"
5049
"crc32c,"
51-
"sha1,"
5250
"snappycomp,"
5351
"snappyuncomp,"
5452
;
@@ -366,8 +364,6 @@ class Benchmark {
366364
Compact();
367365
} else if (name == Slice("crc32c")) {
368366
Crc32c(4096, "(4K per op)");
369-
} else if (name == Slice("sha1")) {
370-
SHA1(4096, "(4K per op)");
371367
} else if (name == Slice("snappycomp")) {
372368
SnappyCompress();
373369
} else if (name == Slice("snappyuncomp")) {
@@ -406,24 +402,6 @@ class Benchmark {
406402
message_ = label;
407403
}
408404

409-
void SHA1(int size, const char* label) {
410-
// SHA1 about 100MB of data total
411-
std::string data(size, 'x');
412-
int64_t bytes = 0;
413-
char sha1[20];
414-
while (bytes < 100 * 1048576) {
415-
port::SHA1_Hash(data.data(), size, sha1);
416-
FinishedSingleOp();
417-
bytes += size;
418-
}
419-
420-
// Print so result is not dead
421-
fprintf(stderr, "... sha1=%02x...\r", static_cast<unsigned int>(sha1[0]));
422-
423-
bytes_ = bytes;
424-
message_ = label;
425-
}
426-
427405
void SnappyCompress() {
428406
Slice input = gen_.Generate(Options().block_size);
429407
int64_t bytes = 0;

0 commit comments

Comments
 (0)