Skip to content
This repository has been archived by the owner on Jul 12, 2023. It is now read-only.

Commit

Permalink
pegasus: remove single cf assert & ignore 0 value decree update (#28)
Browse files Browse the repository at this point in the history
  • Loading branch information
acelyc111 authored Mar 25, 2020
1 parent f0e22c3 commit 52492c3
Show file tree
Hide file tree
Showing 6 changed files with 20 additions and 18 deletions.
10 changes: 5 additions & 5 deletions db/db_filesnapshot.cc
Original file line number Diff line number Diff line change
Expand Up @@ -159,9 +159,6 @@ Status DBImpl::GetLiveFilesQuick(std::vector<std::string>& ret,

mutex_.Lock();

// ATTENTION(qinzuoyan): only use default column family.
assert(versions_->GetColumnFamilySet()->NumberOfColumnFamilies() == 1u);

// Make a set of all of the live *.sst files
std::vector<FileDescriptor> live;
for (auto cfd : *versions_->GetColumnFamilySet()) {
Expand All @@ -174,9 +171,12 @@ Status DBImpl::GetLiveFilesQuick(std::vector<std::string>& ret,
uint64_t d;
cfd->current()->GetLastFlushSeqDecree(&seq, &d);
if (seq > *last_sequence) {
assert(d >= *last_decree);
*last_sequence = seq;
*last_decree = d;
// Pegasus decree is only written on default column family consistently.
if (cfd->GetID() == 0) {
assert(d >= *last_decree);
*last_decree = d;
}
}
}

Expand Down
2 changes: 0 additions & 2 deletions db/db_impl/db_impl.cc
Original file line number Diff line number Diff line change
Expand Up @@ -1275,8 +1275,6 @@ uint64_t DBImpl::GetLastFlushedDecree() const {
uint64_t d;

mutex_.Lock();
// ATTENTION(qinzuoyan): only use default column family.
assert(!pegasus_data_ || versions_->GetColumnFamilySet()->NumberOfColumnFamilies() == 1u);
versions_->GetColumnFamilySet()->GetDefault()->current()->GetLastFlushSeqDecree(&seq, &d);
mutex_.Unlock();

Expand Down
4 changes: 0 additions & 4 deletions db/db_impl/db_impl_write.cc
Original file line number Diff line number Diff line change
Expand Up @@ -100,10 +100,6 @@ Status DBImpl::WriteImpl(const WriteOptions& write_options,
assert(!WriteBatchInternal::IsLatestPersistentState(my_batch) ||
disable_memtable);

// ATTENTION(qinzuoyan): always only use default column family under
// replication framework.
assert(!pegasus_data_ || single_column_family_mode_);

Status status;
if (write_options.low_pri) {
status = ThrottleLowPriWritesIfNeeded(write_options, my_batch);
Expand Down
7 changes: 5 additions & 2 deletions db/memtable.h
Original file line number Diff line number Diff line change
Expand Up @@ -441,9 +441,12 @@ class MemTable {

void UpdateLastSeqDecree(SequenceNumber sequence, uint64_t decree) {
assert(sequence > last_sequence_); // sequence should not be shared
assert(decree >= last_decree_); // decree may be shared
last_sequence_ = sequence;
last_decree_ = decree;
// decree of non-default column family would be 0, don't record it
if (decree != 0) {
assert(decree >= last_decree_); // decree may be shared
last_decree_ = decree;
}
}

private:
Expand Down
7 changes: 5 additions & 2 deletions db/version_edit.h
Original file line number Diff line number Diff line change
Expand Up @@ -311,9 +311,12 @@ class VersionEdit {

void UpdateLastFlushSeqDecree(SequenceNumber sequence, uint64_t decree) {
if (sequence > last_flush_sequence_) {
assert(decree >= last_flush_decree_);
last_flush_sequence_ = sequence;
last_flush_decree_ = decree;
// decree of non-default column family would be 0, don't record it
if (decree != 0) {
assert(decree >= last_flush_decree_);
last_flush_decree_ = decree;
}
has_last_flush_seq_decree_ = true;
}
}
Expand Down
8 changes: 5 additions & 3 deletions db/version_set.h
Original file line number Diff line number Diff line change
Expand Up @@ -689,9 +689,12 @@ class Version {

void UpdateLastFlushSeqDecreeIfNeeded(SequenceNumber sequence, uint64_t decree) {
if (sequence > last_flush_sequence_) {
assert(decree >= last_flush_decree_);
last_flush_sequence_ = sequence;
last_flush_decree_ = decree;
// decree of non-default column family would be 0, don't record it
if (decree != 0) {
assert(decree >= last_flush_decree_);
last_flush_decree_ = decree;
}
}
}

Expand Down Expand Up @@ -964,7 +967,6 @@ class VersionSet {
// Return the last flush sequence number of default column family.
uint64_t LastFlushSequence() const {
assert(db_options_->pegasus_data);
assert(column_family_set_->NumberOfColumnFamilies() == 1u);
SequenceNumber seq;
uint64_t d;
column_family_set_->GetDefault()->current()->GetLastFlushSeqDecree(&seq, &d);
Expand Down

0 comments on commit 52492c3

Please sign in to comment.