File tree Expand file tree Collapse file tree
Expand file tree Collapse file tree Original file line number Diff line number Diff line change @@ -27,6 +27,7 @@ tools/leveldb-import
2727_pack
2828build_config.mk
2929log.txt
30+ repair.log
3031log_slave.txt
3132src /client /demo
3233src /client /hello-ssdb
Original file line number Diff line number Diff line change @@ -65,6 +65,30 @@ int main(int argc, char **argv){
6565 }
6666
6767 printf (" leveldb repaired.\n " );
68+
69+ {
70+ leveldb::DB* db;
71+ leveldb::Options options;
72+ leveldb::Status status;
73+ options.create_if_missing = true ;
74+ options.write_buffer_size = 32 * 1024 * 1024 ;
75+ options.compression = leveldb::kSnappyCompression ;
76+
77+ status = leveldb::DB::Open (options, leveldb_folder.c_str (), &db);
78+ if (!status.ok ()){
79+ fprintf (stderr, " ERROR: open leveldb: %s error!\n " , leveldb_folder.c_str ());
80+ exit (1 );
81+ }
82+ printf (" compacting data...\n " );
83+ db->CompactRange (NULL , NULL );
84+
85+ {
86+ std::string val;
87+ if (db->GetProperty (" leveldb.stats" , &val)){
88+ printf (" %s\n " , val.c_str ());
89+ }
90+ }
91+ }
6892
6993 return 0 ;
7094}
You can’t perform that action at this time.
0 commit comments