From 5d7e40af99caa8eaceb466608bd0bcbfd19cae49 Mon Sep 17 00:00:00 2001 From: Tomasz Grabiec Date: Fri, 14 Oct 2022 17:55:49 +0200 Subject: [PATCH] mvcc: Add snapshot details to the printout of partition_entry Useful for debugging. Closes #11788 --- partition_version.cc | 14 ++++++++++++-- partition_version.hh | 4 +++- 2 files changed, 15 insertions(+), 3 deletions(-) diff --git a/partition_version.cc b/partition_version.cc index d5eef6e8b3..30c01f14fe 100644 --- a/partition_version.cc +++ b/partition_version.cc @@ -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; } diff --git a/partition_version.hh b/partition_version.hh index c60727f321..ba0247b560 100644 --- a/partition_version.hh +++ b/partition_version.hh @@ -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 {