From d4782a5dfe3eba0f925f882197633d31f331244a Mon Sep 17 00:00:00 2001 From: Chongfeng Hu Date: Thu, 9 Jan 2025 09:59:25 -0800 Subject: [PATCH] Augment nimble_dump info subcommand by listing all metadata sections by size Summary: This change augments `nimble_dump`'s `info` subcommand. With this change, we will list all metadata sections in the Nimble file, along with their respective sizes. Differential Revision: D67958989 --- dwio/nimble/tools/NimbleDumpLib.cpp | 28 ++++++++++++++++++++++++++++ 1 file changed, 28 insertions(+) diff --git a/dwio/nimble/tools/NimbleDumpLib.cpp b/dwio/nimble/tools/NimbleDumpLib.cpp index 685c31c..953aaef 100644 --- a/dwio/nimble/tools/NimbleDumpLib.cpp +++ b/dwio/nimble/tools/NimbleDumpLib.cpp @@ -14,6 +14,7 @@ * limitations under the License. */ #include +#include #include #include #include @@ -265,8 +266,35 @@ void NimbleDumpLib::emitInfo() { << nimble::toString(tablet->checksumType()) << "]" << std::endl; ostream_ << "Footer Compression: " << tablet->footerCompressionType() << std::endl; + ostream_ << "Postscript Size: " << commaSeparated(kPostscriptSize) + << std::endl; ostream_ << "Footer Size: " << commaSeparated(tablet->footerSize()) << std::endl; + ostream_ << "Stripes Metadata Size: " + << commaSeparated( + tablet->stripesMetadata() ? tablet->stripesMetadata()->size() + : 0) + << std::endl; + ostream_ << "Stripe Groups Metadata Size: " + << commaSeparated(std::transform_reduce( + tablet->stripeGroupsMetadata().begin(), + tablet->stripeGroupsMetadata().end(), + 0, + std::plus{}, + [](const MetadataSection& metadataSection) { + return metadataSection.size(); + })) + << std::endl; + ostream_ << "Optional Sections Size: " + << commaSeparated(std::transform_reduce( + tablet->optionalSections().begin(), + tablet->optionalSections().end(), + 0, + std::plus{}, + [](const std::pair& entry) { + return entry.second.size(); + })) + << std::endl; ostream_ << "Stripe Count: " << commaSeparated(tablet->stripeCount()) << std::endl; ostream_ << "Row Count: " << commaSeparated(tablet->tabletRowCount())