diff options
author | David Grogan <dgrogan@chromium.org> | 2013-09-19 13:42:22 -0700 |
---|---|---|
committer | David Grogan <dgrogan@chromium.org> | 2013-09-19 13:49:19 -0700 |
commit | 0b9a89f40efdd143fa1426e7d5cd997f67ba6361 (patch) | |
tree | 3513ea54d2152319766576a2953fcb53d5089753 /db/db_test.cc | |
parent | 748539c183453bdeaff1eb0da8ccf5adacb796e7 (diff) | |
download | leveldb-0b9a89f40efdd143fa1426e7d5cd997f67ba6361.tar.gz |
Release LevelDB 1.14v1.14
Fix issues 200, 201
Also,
* Fix link to bigtable paper in docs.
* New sstables will have the file extension .ldb. .sst files will
continue to be recognized.
* When building for iOS, use xcrun to execute the compiler. This may
affect issue 177.
Diffstat (limited to 'db/db_test.cc')
-rw-r--r-- | db/db_test.cc | 36 |
1 files changed, 35 insertions, 1 deletions
diff --git a/db/db_test.cc b/db/db_test.cc index 49aae04..848a038 100644 --- a/db/db_test.cc +++ b/db/db_test.cc @@ -147,7 +147,7 @@ class SpecialEnv : public EnvWrapper { Status s = target()->NewWritableFile(f, r); if (s.ok()) { - if (strstr(f.c_str(), ".sst") != NULL) { + if (strstr(f.c_str(), ".ldb") != NULL) { *r = new SSTableFile(this, *r); } else if (strstr(f.c_str(), "MANIFEST") != NULL) { *r = new ManifestFile(this, *r); @@ -484,6 +484,24 @@ class DBTest { } return false; } + + // Returns number of files renamed. + int RenameLDBToSST() { + std::vector<std::string> filenames; + ASSERT_OK(env_->GetChildren(dbname_, &filenames)); + uint64_t number; + FileType type; + int files_renamed = 0; + for (size_t i = 0; i < filenames.size(); i++) { + if (ParseFileName(filenames[i], &number, &type) && type == kTableFile) { + const std::string from = TableFileName(dbname_, number); + const std::string to = SSTTableFileName(dbname_, number); + ASSERT_OK(env_->RenameFile(from, to)); + files_renamed++; + } + } + return files_renamed; + } }; TEST(DBTest, Empty) { @@ -1632,6 +1650,22 @@ TEST(DBTest, MissingSSTFile) { << s.ToString(); } +TEST(DBTest, StillReadSST) { + ASSERT_OK(Put("foo", "bar")); + ASSERT_EQ("bar", Get("foo")); + + // Dump the memtable to disk. + dbfull()->TEST_CompactMemTable(); + ASSERT_EQ("bar", Get("foo")); + Close(); + ASSERT_GT(RenameLDBToSST(), 0); + Options options = CurrentOptions(); + options.paranoid_checks = true; + Status s = TryReopen(&options); + ASSERT_TRUE(s.ok()); + ASSERT_EQ("bar", Get("foo")); +} + TEST(DBTest, FilesDeletedAfterCompaction) { ASSERT_OK(Put("foo", "v2")); Compact("a", "z"); |