Skip to content

Commit

Permalink
Augment nimble_dump info subcommand by listing all metadata sections …
Browse files Browse the repository at this point in the history
…by size (#129)

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
  • Loading branch information
Chongfeng Hu authored and facebook-github-bot committed Jan 10, 2025
1 parent 2d18cf7 commit 6953ce4
Showing 1 changed file with 32 additions and 2 deletions.
34 changes: 32 additions & 2 deletions dwio/nimble/tools/NimbleDumpLib.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -14,6 +14,7 @@
* limitations under the License.
*/
#include <algorithm>
#include <functional>
#include <locale>
#include <numeric>
#include <ostream>
Expand Down Expand Up @@ -263,9 +264,38 @@ void NimbleDumpLib::emitInfo() {
ostream_ << "File Size: " << commaSeparated(tablet->fileSize()) << std::endl;
ostream_ << "Checksum: " << tablet->checksum() << " ["
<< nimble::toString(tablet->checksumType()) << "]" << std::endl;
ostream_ << "Footer Compression: " << tablet->footerCompressionType()
ostream_ << "Postscript Size: " << commaSeparated(kPostscriptSize)
<< std::endl;
ostream_ << "Footer Size: " << commaSeparated(tablet->footerSize())
ostream_ << "Footer Size: " << commaSeparated(tablet->footerSize()) << " ("
<< tablet->footerCompressionType() << ")" << std::endl;
ostream_ << "Stripes Metadata Size: ";
auto stripesMetadata = tablet->stripesMetadata();
if (!stripesMetadata) {
ostream_ << "0" << std::endl;
} else {
ostream_ << commaSeparated(stripesMetadata.value().size()) << " ("
<< stripesMetadata.value().compressionType() << ")" << std::endl;
}
auto stripeGroupsMetadata = tablet->stripeGroupsMetadata();
ostream_ << "Stripe Groups Metadata Size: "
<< commaSeparated(std::transform_reduce(
stripeGroupsMetadata.begin(),
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<std::string, MetadataSection>& entry) {
return entry.second.size();
}))
<< std::endl;
ostream_ << "Stripe Count: " << commaSeparated(tablet->stripeCount())
<< std::endl;
Expand Down

0 comments on commit 6953ce4

Please sign in to comment.