Skip to main content

Overview

The SST Dump Tool (sst_dump) is a specialized utility for examining RocksDB’s SST (Sorted String Table) files. It provides detailed insights into SST file structure, contents, metadata, and compression efficiency.
Use sst_dump to debug data corruption, analyze storage efficiency, evaluate compression algorithms, and understand LSM tree structure.

Building sst_dump

Build the tool:

Basic Usage

The general syntax:
Or simply provide the path as the first argument:

Commands

The --command flag specifies the operation mode:

Check (Default)

Verify SST file integrity by iterating through all entries:
1

Validation performed

  • Iterates over all key-value pairs
  • Compares entry count with metadata
  • Reports corruption if mismatch detected
2

Silent on success

Only prints output if errors are encountered

Scan

Iterate through entries and print them to screen:
With hex output:
Limit number of entries:

Raw

Dump complete table contents to a file:
This creates 000123.sst_dump.txt with:
  • All key-value pairs
  • Block structure details
  • Footer information
  • Index block contents

Verify

Verify checksums for all blocks without printing data:
Use verify to detect corruption without the overhead of decoding keys and values. It’s faster than check for large files.

Recompress

Analyze file size with different compression algorithms:
Output shows estimated file size with each compression type:

Identify

Check if file is a valid SST file:
For a directory, lists all valid SST files:

Filtering and Range Options

Key Range Scanning

1

From key

Start scanning from a specific key:
2

To key

Stop scanning at a specific key:
3

Prefix scan

Scan all keys with a specific prefix:
Cannot be used with --from option

Hex Key Input

When working with binary keys:

Display Options

Show Properties

Display table properties after iteration:
Outputs:
  • Data size
  • Index size
  • Filter size
  • Number of entries
  • Number of data blocks
  • Compression type
  • User-collected properties

Show Sequence Numbers

Display sequence numbers and value types (for raw dumps):

Decode Blob Index

For SST files containing blob references:
This decodes blob index entries and displays them in human-readable format.

List Meta Blocks

Show all metadata blocks in the file:

Compression Analysis

Testing Multiple Compression Types

Custom Block Size

Test recompression with different block sizes:

Compression Levels

Test a range of compression levels:

Index Compression

Enable compression for index blocks:

Dictionary Compression

Configure dictionary-based compression:

Advanced Options

Verify Checksum

Enable checksum verification during scans:

Readahead Size

Optimize I/O with readahead:

Environment and Filesystem URIs

Use custom environments or filesystems:
Or:
--env_uri and --fs_uri are mutually exclusive.

Internal Key Parsing

Parse internal key format on command line:
Outputs:
This is useful for understanding RocksDB’s internal key encoding (user key + sequence number + type).

Practical Examples

Diagnose Corruption

1

Identify corrupted file

2

Locate bad block

3

Extract good data

Optimize Compression

1

Test all compression types

2

Fine-tune best algorithm

3

Test with dictionary

Export Key Range

Extract specific key range from SST file:

Inspect File Properties

Analyze All Files in Directory

Understanding Output

Scan Output Format

Format: key @ sequence_number : type => value Value types:
  • 1 = kTypeValue (regular put)
  • 0 = kTypeDeletion (delete)
  • 2 = kTypeMerge (merge)
  • 7 = kTypeDeletionWithTimestamp

Properties Output

Example output from --show_properties:

Common Options Reference

Performance Tips

For large files, use --read_num to limit output:
Use verify instead of check for faster corruption detection without decoding overhead.

Source Reference

SST Dump Tool implementation:
  • include/rocksdb/sst_dump_tool.h:11-14 - Public API (simple Run interface)
  • tools/sst_dump_tool.cc:167-400 - Command-line parsing and tool implementation
  • table/sst_file_dumper.h and table/sst_file_dumper.cc - Core SST file reading logic
Build command:

Getting Help

Display help message with all options:
The help output includes supported compression types for your build.