Summary:
This reverts commit e10553f2a6
.
Pass make asan_check
Pull Request resolved: https://github.com/facebook/rocksdb/pull/6569
Reviewed By: riversand963
Differential Revision: D20574319
Pulled By: zhichao-cao
fbshipit-source-id: ce36981a21596f5f2e14da6a59a2bb3619509a8b
This commit is contained in:
parent
fb09ef05dc
commit
5c6346c420
@ -59,8 +59,6 @@ enum Tag : uint32_t {
|
||||
kDbId,
|
||||
kBlobFileAddition,
|
||||
kBlobFileGarbage,
|
||||
kStateUponManifestSwitch,
|
||||
kManifestSwitched,
|
||||
};
|
||||
|
||||
enum NewFileCustomTag : uint32_t {
|
||||
@ -162,8 +160,6 @@ void VersionEdit::Clear() {
|
||||
column_family_name_.clear();
|
||||
is_in_atomic_group_ = false;
|
||||
remaining_entries_ = 0;
|
||||
state_upon_manifest_switch_ = false;
|
||||
manifest_switched_ = false;
|
||||
}
|
||||
|
||||
bool VersionEdit::EncodeTo(std::string* dst) const {
|
||||
@ -297,14 +293,6 @@ bool VersionEdit::EncodeTo(std::string* dst) const {
|
||||
PutVarint32Varint32(dst, kColumnFamily, column_family_);
|
||||
}
|
||||
|
||||
if (state_upon_manifest_switch_) {
|
||||
PutVarint32(dst, kStateUponManifestSwitch);
|
||||
}
|
||||
|
||||
if (manifest_switched_) {
|
||||
PutVarint32(dst, kManifestSwitched);
|
||||
}
|
||||
|
||||
if (is_column_family_add_) {
|
||||
PutVarint32(dst, kColumnFamilyAdd);
|
||||
PutLengthPrefixedSlice(dst, Slice(column_family_name_));
|
||||
@ -647,14 +635,6 @@ Status VersionEdit::DecodeFrom(const Slice& src) {
|
||||
is_column_family_drop_ = true;
|
||||
break;
|
||||
|
||||
case kStateUponManifestSwitch:
|
||||
state_upon_manifest_switch_ = true;
|
||||
break;
|
||||
|
||||
case kManifestSwitched:
|
||||
manifest_switched_ = true;
|
||||
break;
|
||||
|
||||
case kInAtomicGroup:
|
||||
is_in_atomic_group_ = true;
|
||||
if (!GetVarint32(&input, &remaining_entries_)) {
|
||||
|
@ -423,19 +423,6 @@ class VersionEdit {
|
||||
std::string DebugString(bool hex_key = false) const;
|
||||
std::string DebugJSON(int edit_num, bool hex_key = false) const;
|
||||
|
||||
void SetStateUponManifestSwitch(bool tag) {
|
||||
state_upon_manifest_switch_ = tag;
|
||||
}
|
||||
bool GetStateUponManifestSwitch() const {
|
||||
return state_upon_manifest_switch_;
|
||||
}
|
||||
void SetManifestSwitched(bool tag) {
|
||||
manifest_switched_ = tag;
|
||||
}
|
||||
bool GetManifestSwitched() const {
|
||||
return manifest_switched_;
|
||||
}
|
||||
|
||||
private:
|
||||
friend class ReactiveVersionSet;
|
||||
friend class VersionEditHandler;
|
||||
@ -485,13 +472,6 @@ class VersionEdit {
|
||||
|
||||
bool is_in_atomic_group_ = false;
|
||||
uint32_t remaining_entries_ = 0;
|
||||
// To distinguish the version edit written by WriteCurrentStateToManifest
|
||||
// and other regular writes. Default is false.
|
||||
bool state_upon_manifest_switch_ = false;
|
||||
// To indicate when WriteCurrentStateToManifest is successful. When both
|
||||
// state_upon_manifest_switch and manifest_switch_finished are true, it can
|
||||
// ensure the manifest switch is finished.
|
||||
bool manifest_switched_ = false;
|
||||
};
|
||||
|
||||
} // namespace ROCKSDB_NAMESPACE
|
||||
|
@ -46,7 +46,6 @@ TEST_F(VersionEditTest, EncodeDecode) {
|
||||
edit.SetLogNumber(kBig + 100);
|
||||
edit.SetNextFile(kBig + 200);
|
||||
edit.SetLastSequence(kBig + 1000);
|
||||
edit.SetStateUponManifestSwitch(true);
|
||||
TestEncodeDecode(edit);
|
||||
}
|
||||
|
||||
@ -81,7 +80,6 @@ TEST_F(VersionEditTest, EncodeDecodeNewFile4) {
|
||||
edit.SetLogNumber(kBig + 100);
|
||||
edit.SetNextFile(kBig + 200);
|
||||
edit.SetLastSequence(kBig + 1000);
|
||||
edit.SetStateUponManifestSwitch(true);
|
||||
TestEncodeDecode(edit);
|
||||
|
||||
std::string encoded, encoded2;
|
||||
@ -105,7 +103,6 @@ TEST_F(VersionEditTest, EncodeDecodeNewFile4) {
|
||||
ASSERT_EQ(kInvalidBlobFileNumber,
|
||||
new_files[2].second.oldest_blob_file_number);
|
||||
ASSERT_EQ(1001, new_files[3].second.oldest_blob_file_number);
|
||||
ASSERT_TRUE(parsed.GetStateUponManifestSwitch());
|
||||
}
|
||||
|
||||
TEST_F(VersionEditTest, ForwardCompatibleNewFile4) {
|
||||
@ -282,38 +279,6 @@ TEST_F(VersionEditTest, DbId) {
|
||||
TestEncodeDecode(edit);
|
||||
}
|
||||
|
||||
TEST_F(VersionEditTest, ManifestSwitchTag) {
|
||||
VersionEdit edit1, decode1;
|
||||
edit1.SetStateUponManifestSwitch(true);
|
||||
TestEncodeDecode(edit1);
|
||||
std::string encoded1;
|
||||
edit1.EncodeTo(&encoded1);
|
||||
ASSERT_OK(decode1.DecodeFrom(encoded1));
|
||||
ASSERT_TRUE(decode1.GetStateUponManifestSwitch());
|
||||
ASSERT_TRUE(!decode1.GetManifestSwitched());
|
||||
|
||||
VersionEdit edit2, decode2;
|
||||
edit2.SetManifestSwitched(true);
|
||||
TestEncodeDecode(edit2);
|
||||
std::string encoded2;
|
||||
edit2.EncodeTo(&encoded2);
|
||||
ASSERT_OK(decode2.DecodeFrom(encoded2));
|
||||
ASSERT_TRUE(!decode2.GetStateUponManifestSwitch());
|
||||
ASSERT_TRUE(decode2.GetManifestSwitched());
|
||||
|
||||
VersionEdit edit3, decode3;
|
||||
edit3.SetStateUponManifestSwitch(true);
|
||||
edit3.SetManifestSwitched(true);
|
||||
TestEncodeDecode(edit3);
|
||||
std::string encoded3;
|
||||
edit3.EncodeTo(&encoded3);
|
||||
ASSERT_OK(decode3.DecodeFrom(encoded3));
|
||||
ASSERT_TRUE(decode3.GetStateUponManifestSwitch());
|
||||
ASSERT_TRUE(decode3.GetManifestSwitched());
|
||||
|
||||
|
||||
}
|
||||
|
||||
TEST_F(VersionEditTest, BlobFileAdditionAndGarbage) {
|
||||
VersionEdit edit;
|
||||
|
||||
|
@ -5160,7 +5160,6 @@ Status VersionSet::WriteCurrentStateToManifest(
|
||||
VersionEdit edit_for_db_id;
|
||||
assert(!db_id_.empty());
|
||||
edit_for_db_id.SetDBId(db_id_);
|
||||
edit_for_db_id.SetStateUponManifestSwitch(true);
|
||||
std::string db_id_record;
|
||||
if (!edit_for_db_id.EncodeTo(&db_id_record)) {
|
||||
return Status::Corruption("Unable to Encode VersionEdit:" +
|
||||
@ -5186,7 +5185,6 @@ Status VersionSet::WriteCurrentStateToManifest(
|
||||
edit.AddColumnFamily(cfd->GetName());
|
||||
edit.SetColumnFamily(cfd->GetID());
|
||||
}
|
||||
edit.SetStateUponManifestSwitch(true);
|
||||
edit.SetComparatorName(
|
||||
cfd->internal_comparator().user_comparator()->Name());
|
||||
std::string record;
|
||||
@ -5204,7 +5202,6 @@ Status VersionSet::WriteCurrentStateToManifest(
|
||||
// Save files
|
||||
VersionEdit edit;
|
||||
edit.SetColumnFamily(cfd->GetID());
|
||||
edit.SetStateUponManifestSwitch(true);
|
||||
|
||||
for (int level = 0; level < cfd->NumberLevels(); level++) {
|
||||
for (const auto& f :
|
||||
@ -5232,16 +5229,7 @@ Status VersionSet::WriteCurrentStateToManifest(
|
||||
}
|
||||
}
|
||||
}
|
||||
VersionEdit end_flag;
|
||||
end_flag.SetStateUponManifestSwitch(true);
|
||||
end_flag.SetManifestSwitched(true);
|
||||
std::string end_record;
|
||||
if (!end_flag.EncodeTo(&end_record)) {
|
||||
return Status::Corruption("Unable to Encode VersionEdit:" +
|
||||
end_flag.DebugString(true));
|
||||
}
|
||||
Status s_end_record = log->AddRecord(end_record);
|
||||
return s_end_record;
|
||||
return Status::OK();
|
||||
}
|
||||
|
||||
// TODO(aekmekji): in CompactionJob::GenSubcompactionBoundaries(), this
|
||||
|
Loading…
Reference in New Issue
Block a user