mvcc: Add snapshot details to the printout of partition_entry

Useful for debugging.

Closes #11788
This commit is contained in:
Tomasz Grabiec
2022-10-14 17:55:49 +02:00
committed by Avi Kivity
parent d2cd9b71b3
commit 5d7e40af99
2 changed files with 15 additions and 3 deletions

View File

@@ -665,9 +665,19 @@ std::ostream& operator<<(std::ostream& out, const partition_entry::printer& p) {
out << ", ";
}
if (v->is_referenced()) {
out << "(*) ";
partition_snapshot* snp = nullptr;
if (first) {
snp = e._snapshot;
} else {
snp = &partition_snapshot::container_of(&v->back_reference());
}
out << "(*";
if (snp) {
out << " snp=" << snp << ", phase=" << snp->phase();
}
out << ") ";
}
out << mutation_partition::printer(p._schema, v->partition());
out << fmt::ptr(v) << ": " << mutation_partition::printer(p._schema, v->partition());
v = v->next();
first = false;
}

View File

@@ -163,7 +163,7 @@ public:
bool is_referenced() const { return _backref; }
// Returns true iff this version is directly referenced from a partition_entry (is its newset version).
bool is_referenced_from_entry() const;
partition_version_ref& back_reference() { return *_backref; }
partition_version_ref& back_reference() const { return *_backref; }
size_t size_in_allocator(const schema& s, allocation_strategy& allocator) const;
};
@@ -412,6 +412,8 @@ public:
bool reversed = false);
// Returns all range tombstones
range_tombstone_result range_tombstones();
phase_type phase() const { return _phase; }
};
class partition_snapshot_ptr {