MCPcopy Create free account
hub / github.com/apple/foundationdb / toString

Method toString

fdbserver/VersionedBTree.actor.cpp:4735–4792  ·  view source on GitHub ↗

Source from the content-addressed store, hash-verified

4733 bool isLeaf() const { return height == 1; }
4734
4735 std::string toString(const char* context,
4736 BTreeNodeLinkRef id,
4737 Version ver,
4738 const RedwoodRecordRef& lowerBound,
4739 const RedwoodRecordRef& upperBound) const {
4740 std::string r;
4741 r += format("BTreePage op=%s %s @%" PRId64
4742 " ptr=%p height=%d count=%d kvBytes=%d\n lowerBound: %s\n upperBound: %s\n",
4743 context,
4744 ::toString(id).c_str(),
4745 ver,
4746 this,
4747 height,
4748 (int)tree()->numItems,
4749 (int)kvBytes,
4750 lowerBound.toString(false).c_str(),
4751 upperBound.toString(false).c_str());
4752 try {
4753 if (tree()->numItems > 0) {
4754 // This doesn't use the cached reader for the page because it is only for debugging purposes,
4755 // a cached reader may not exist
4756 BinaryTree::Cursor c(makeReference<BinaryTree::DecodeCache>(lowerBound, upperBound), tree());
4757
4758 c.moveFirst();
4759 ASSERT(c.valid());
4760
4761 do {
4762 r += " ";
4763 r += c.get().toString(height == 1);
4764
4765 // Out of range entries are annotated but can actually be valid, as they can be the result of
4766 // subtree deletion followed by incremental insertions of records in the deleted range being added
4767 // to an adjacent subtree which is logically expanded encompass the deleted range but still is using
4768 // the original subtree boundaries as DeltaTree2 boundaries.
4769 bool tooLow = c.get().withoutValue() < lowerBound.withoutValue();
4770 bool tooHigh = c.get().withoutValue() >= upperBound.withoutValue();
4771 if (tooLow || tooHigh) {
4772 if (tooLow) {
4773 r += " (below decode lower bound)";
4774 }
4775 if (tooHigh) {
4776 r += " (at or above decode upper bound)";
4777 }
4778 }
4779 r += "\n";
4780
4781 } while (c.moveNext());
4782 }
4783 } catch (Error& e) {
4784 debug_printf("BTreePage::toString ERROR: %s\n", e.what());
4785 debug_printf("BTreePage::toString partial result: %s\n", r.c_str());
4786 throw;
4787 }
4788
4789 // All appends to r end in a linefeed, remove the final one.
4790 r.resize(r.size() - 1);
4791 return r;
4792 }

Callers

nothing calls this directly

Calls 12

withoutValueMethod · 0.80
toStringFunction · 0.70
getMethod · 0.65
formatFunction · 0.50
c_strMethod · 0.45
toStringMethod · 0.45
moveFirstMethod · 0.45
validMethod · 0.45
moveNextMethod · 0.45
whatMethod · 0.45
resizeMethod · 0.45
sizeMethod · 0.45

Tested by

no test coverage detected