diff --git a/db/db_impl.cc b/db/db_impl.cc index d806b2749..4c7488fa9 100644 --- a/db/db_impl.cc +++ b/db/db_impl.cc @@ -3042,8 +3042,7 @@ Status DBImpl::DeleteFile(std::string name) { return status; } -void DBImpl::GetLiveFilesMetaData( - std::vector *metadata) { +void DBImpl::GetLiveFilesMetaData(std::vector *metadata) { MutexLock l(&mutex_); return versions_->GetLiveFilesMetaData(metadata); } diff --git a/db/deletefile_test.cc b/db/deletefile_test.cc index 7845b9433..158baf065 100644 --- a/db/deletefile_test.cc +++ b/db/deletefile_test.cc @@ -167,7 +167,7 @@ TEST(DeleteFileTest, DeleteFileWithIterator) { } Status status = db_->DeleteFile(level2file); - fprintf(stderr, "Deletion status %s: %s\n", + fprintf(stdout, "Deletion status %s: %s\n", level2file.c_str(), status.ToString().c_str()); ASSERT_TRUE(status.ok()); it->SeekToFirst(); diff --git a/db/filename.cc b/db/filename.cc index f47855289..626a27107 100644 --- a/db/filename.cc +++ b/db/filename.cc @@ -130,10 +130,14 @@ std::string MetaDatabaseName(const std::string& dbname, uint64_t number) { // dbname/MANIFEST-[0-9]+ // dbname/[0-9]+.(log|sst) // dbname/METADB-[0-9]+ +// Disregards / at the beginning bool ParseFileName(const std::string& fname, uint64_t* number, FileType* type) { Slice rest(fname); + if (fname.length() > 1 && fname[0] == '/') { + rest.remove_prefix(1); + } if (rest == "CURRENT") { *number = 0; *type = kCurrentFile; diff --git a/db/version_set.cc b/db/version_set.cc index 531a0b391..4f02176e4 100644 --- a/db/version_set.cc +++ b/db/version_set.cc @@ -2674,9 +2674,9 @@ void VersionSet::SetupOtherInputs(Compaction* c) { } Status VersionSet::GetMetadataForFile( - uint64_t number, - int *filelevel, - FileMetaData *meta) { + uint64_t number, + int *filelevel, + FileMetaData *meta) { for (int level = 0; level < NumberLevels(); level++) { const std::vector& files = current_->files_[level]; for (size_t i = 0; i < files.size(); i++) { @@ -2691,7 +2691,7 @@ Status VersionSet::GetMetadataForFile( } void VersionSet::GetLiveFilesMetaData( - std::vector * metadata) { + std::vector * metadata) { for (int level = 0; level < NumberLevels(); level++) { const std::vector& files = current_->files_[level]; for (size_t i = 0; i < files.size(); i++) {