add C api for set wal_recovery_mode (#1327)

* add C api for set wal recovery mode

* add test
main
zhangjinpeng1987 8 years ago committed by yiwu-arbug
parent 1cca091298
commit b06b191362
  1. 5
      db/c.cc
  2. 1
      db/c_test.c
  3. 9
      include/rocksdb/c.h

@ -43,6 +43,7 @@ using rocksdb::CompactionFilterContext;
using rocksdb::CompactionOptionsFIFO; using rocksdb::CompactionOptionsFIFO;
using rocksdb::Comparator; using rocksdb::Comparator;
using rocksdb::CompressionType; using rocksdb::CompressionType;
using rocksdb::WALRecoveryMode;
using rocksdb::DB; using rocksdb::DB;
using rocksdb::DBOptions; using rocksdb::DBOptions;
using rocksdb::Env; using rocksdb::Env;
@ -1554,6 +1555,10 @@ void rocksdb_options_set_level0_stop_writes_trigger(
void rocksdb_options_set_max_mem_compaction_level(rocksdb_options_t* opt, void rocksdb_options_set_max_mem_compaction_level(rocksdb_options_t* opt,
int n) {} int n) {}
void rocksdb_options_set_wal_recovery_mode(rocksdb_options_t* opt,int mode) {
opt->rep.wal_recovery_mode = static_cast<WALRecoveryMode>(mode);
}
void rocksdb_options_set_compression(rocksdb_options_t* opt, int t) { void rocksdb_options_set_compression(rocksdb_options_t* opt, int t) {
opt->rep.compression = static_cast<CompressionType>(t); opt->rep.compression = static_cast<CompressionType>(t);
} }

@ -575,6 +575,7 @@ int main(int argc, char** argv) {
rocksdb_close(db); rocksdb_close(db);
rocksdb_options_set_create_if_missing(options, 0); rocksdb_options_set_create_if_missing(options, 0);
rocksdb_options_set_error_if_exists(options, 0); rocksdb_options_set_error_if_exists(options, 0);
rocksdb_options_set_wal_recovery_mode(options, 2);
rocksdb_repair_db(options, dbname, &err); rocksdb_repair_db(options, dbname, &err);
CheckNoError(err); CheckNoError(err);
db = rocksdb_open(options, dbname, &err); db = rocksdb_open(options, dbname, &err);

@ -690,6 +690,15 @@ extern ROCKSDB_LIBRARY_API void rocksdb_options_set_inplace_update_num_locks(
extern ROCKSDB_LIBRARY_API void rocksdb_options_set_report_bg_io_stats( extern ROCKSDB_LIBRARY_API void rocksdb_options_set_report_bg_io_stats(
rocksdb_options_t*, int); rocksdb_options_t*, int);
enum {
rocksdb_tolerate_corrupted_tail_records_recovery = 0,
rocksdb_absolute_consistency_recovery = 1,
rocksdb_point_in_time_recovery = 2,
rocksdb_skip_any_corrupted_records_recovery = 3
};
extern ROCKSDB_LIBRARY_API void rocksdb_options_set_wal_recovery_mode(
rocksdb_options_t*, int);
enum { enum {
rocksdb_no_compression = 0, rocksdb_no_compression = 0,
rocksdb_snappy_compression = 1, rocksdb_snappy_compression = 1,

Loading…
Cancel
Save