Utility to dump manifest contents.

Summary:
./manifest_dump --file=/tmp/dbbench/MANIFEST-000002

Output looks like

manifest_file_number 30 next_file_number 31 last_sequence 388082 log_number 28  prev_log_number 0
--- level 0 ---
--- level 1 ---
--- level 2 ---
 5:3244155['0000000000000000' @ 1 : 1 .. '0000000000028220' @ 28221 : 1]
 7:3244177['0000000000028221' @ 28222 : 1 .. '0000000000056441' @ 56442 : 1]
 9:3244156['0000000000056442' @ 56443 : 1 .. '0000000000084662' @ 84663 : 1]
 11:3244178['0000000000084663' @ 84664 : 1 .. '0000000000112883' @ 112884 : 1]
 13:3244158['0000000000112884' @ 112885 : 1 .. '0000000000141104' @ 141105 : 1]
 15:3244176['0000000000141105' @ 141106 : 1 .. '0000000000169325' @ 169326 : 1]
 17:3244156['0000000000169326' @ 169327 : 1 .. '0000000000197546' @ 197547 : 1]
 19:3244178['0000000000197547' @ 197548 : 1 .. '0000000000225767' @ 225768 : 1]
 21:3244155['0000000000225768' @ 225769 : 1 .. '0000000000253988' @ 253989 : 1]
 23:3244179['0000000000253989' @ 253990 : 1 .. '0000000000282209' @ 282210 : 1]
 25:3244157['0000000000282210' @ 282211 : 1 .. '0000000000310430' @ 310431 : 1]
 27:3244176['0000000000310431' @ 310432 : 1 .. '0000000000338651' @ 338652 : 1]
 29:3244156['0000000000338652' @ 338653 : 1 .. '0000000000366872' @ 366873 : 1]
--- level 3 ---
--- level 4 ---
--- level 5 ---
--- level 6 ---

Test Plan: run on test directory created by dbbench

Reviewers: heyongqiang

Reviewed By: heyongqiang

CC: hustliubo

Differential Revision: https://reviews.facebook.net/D4743
main
Dhruba Borthakur 12 years ago committed by heyongqiang
parent e3bf8f0a96
commit f3ee54526f
  1. 6
      Makefile
  2. 6
      db/version_set.cc
  3. 4
      tools/manifest_dump.cc

@ -59,7 +59,8 @@ TESTS = \
TOOLS = \
manifest_dump \
leveldb_shell
leveldb_shell \
sst_dump
PROGRAMS = db_bench $(TESTS) $(TOOLS)
BENCHMARKS = db_bench_sqlite3 db_bench_tree_db
@ -190,6 +191,9 @@ manifest_dump: tools/manifest_dump.o $(LIBOBJECTS)
filelock_test: util/filelock_test.o $(LIBOBJECTS) $(TESTHARNESS)
$(CXX) util/filelock_test.o $(LIBOBJECTS) $(TESTHARNESS) -o $@ $(LDFLAGS)
sst_dump: tools/sst_dump.o $(LIBOBJECTS)
$(CXX) tools/sst_dump.o $(LIBOBJECTS) -o $@ $(LDFLAGS)
# recreate the version file with the latest git revision
$(VERSIONFILE): build_detect_version
$(shell ./build_detect_platform build_config.mk)

@ -1042,13 +1042,13 @@ Status VersionSet::DumpManifest(Options& options, std::string& dscname) {
last_sequence_ = last_sequence;
log_number_ = log_number;
prev_log_number_ = prev_log_number;
printf("manifest_file_number %d next_file_number %d last_sequence %d log_number %d prev_log_number %d\n",
manifest_file_number_, next_file_number_,
manifest_file_number_, next_file_number_,
last_sequence, log_number, prev_log_number);
printf("%s \n", v->DebugString().c_str());
}
return s;
}

@ -29,7 +29,7 @@ int main(int argc, char** argv) {
// parse command line options
int n;
char junk;
char junk;
int foundfile = 0;
std::string manifestfile;
for (int i = 1; i < argc; i++) {
@ -58,7 +58,7 @@ int main(int argc, char** argv) {
TableCache* tc = new TableCache(dbname, &options, 10);
const InternalKeyComparator* cmp = new InternalKeyComparator(options.comparator);
VersionSet* versions = new VersionSet(dbname, &options,
VersionSet* versions = new VersionSet(dbname, &options,
tc, cmp);
Status s = versions->DumpManifest(options, file);
if (!s.ok()) {

Loading…
Cancel
Save