RocksDB中sst_dump的编译使用

编译

有可能要先编译rocksdb

 ✘ ⚡ 05/23|19:48:09  rocksdb   6.29.fb ●  make sst_dump
$DEBUG_LEVEL is 1
Makefile:170: Warning: Compiling in debug mode. Don't use the resulting binary in production
  CC       tools/sst_dump.o
  CC       tools/io_tracer_parser_tool.o
  CC       tools/ldb_cmd.o
  CC       tools/ldb_tool.o
  CC       tools/sst_dump_tool.o
  CC       utilities/blob_db/blob_dump_tool.o
  AR       librocksdb_tools_debug.a
/usr/bin/ar: creating librocksdb_tools_debug.a
  CCLD     sst_dump

cmake编译会在 tool 目录下生成,直接 make sst_dump 则是生成在 rocksdb 根目录

使用

 ⚡ 05/24|10:13:22  rocksdb   6.29.fb  ./sst_dump --file=/tmp/rocksdb_tmp --command=raw
options.env is 0x559da26cea00
Process /tmp/rocksdb_tmp/000013.sst
Sst file format: block-based
raw dump written to file /tmp/rocksdb_tmp/000013_dump.txt
Process /tmp/rocksdb_tmp/000007.sst
Sst file format: block-based
raw dump written to file /tmp/rocksdb_tmp/000007_dump.txt
Process /tmp/rocksdb_tmp/000019.sst
Sst file format: block-based
raw dump written to file /tmp/rocksdb_tmp/000019_dump.txt
Process /tmp/rocksdb_tmp/000004.sst
Sst file format: block-based
raw dump written to file /tmp/rocksdb_tmp/000004_dump.txt

 ⚡ 05/24|10:49:58  rocksdb   6.29.fb  cat /tmp/rocksdb_tmp/000019_dump.txt
Footer Details:
--------------------------------------
  metaindex handle: E40620
  index handle: 1E0F
  table_magic_number: 9863518390377041911
  format version: 5

Metaindex Details:
--------------------------------------
  Properties block handle: 32AD06

Table Properties:
--------------------------------------
  # data blocks: 1
  # entries: 1
  # deletions: 0
  # merge operands: 0
  # range deletions: 0
  raw key size: 11
  raw average key size: 11.000000
  raw value size: 3
  raw average value size: 3.000000
  data block size: 30
  index block size (user-key? 1, delta-value? 1): 20
  filter block size: 0
  # entries for filter: 0
  (estimated) table size: 50
  filter policy name: N/A
  prefix extractor name: nullptr
  column family ID: 0
  column family name: default
  comparator name: leveldb.BytewiseComparator
  merge operator name: nullptr
  property collectors names: []
  SST file compression algo: Snappy
  SST file compression options: window_bits=-14; level=32767; strategy=0; max_dict_bytes=0; zstd_max_train_bytes=0; enabled=0; max_dict_buffer_bytes=0;
  creation time: 1681356505
  time stamp of earliest key: 0
  file creation time: 0
  slow compression estimated data size: 0
  fast compression estimated data size: 0
  DB identity: 86751c5f-624e-4582-a4aa-a7078979ab79
  DB session identity: ZRB0TF2BT6GWRTCMNZD4
  DB host id: YF-72166391D1
  original file number: 19
  unique ID: 80345056726F72BF-D677A376A5E0D45C-A2CFA81888233438

Index Details:
--------------------------------------
  Block key hex dump: Data block handle
  Block key ascii

  HEX    666F6F: 0019
  ASCII  f o o
  ------

Data Block # 1 @ 0019
--------------------------------------
  HEX    666F6F: 626172
  ASCII  f o o : b a r
  ------

Data Block Summary:
--------------------------------------
  # data blocks: 1
  min data block size: 25
  max data block size: 25
  avg data block size: 25.000000

参考链接

ARST打卡第212周[212/521]

你可能感兴趣的:(rocksdb,c++)