Summary: as title

Test Plan: ./c_test

Reviewers: igor

Reviewed By: igor

Subscribers: dhruba, leveldb

Differential Revision: https://reviews.facebook.net/D28119
main
Lei Jin 10 years ago
parent bc9f36fd5e
commit 82e3ae5403
  1. 28
      db/c_test.c

@ -576,33 +576,39 @@ int main(int argc, char** argv) {
StartPhase("compaction_filter"); StartPhase("compaction_filter");
{ {
rocksdb_options_set_create_if_missing(options, 1); rocksdb_options_t* options_with_filter = rocksdb_options_create();
rocksdb_options_set_create_if_missing(options_with_filter, 1);
rocksdb_compactionfilter_t* cfilter; rocksdb_compactionfilter_t* cfilter;
cfilter = rocksdb_compactionfilter_create(NULL, CFilterDestroy, cfilter = rocksdb_compactionfilter_create(NULL, CFilterDestroy,
CFilterFilter, CFilterName); CFilterFilter, CFilterName);
// Create new database // Create new database
rocksdb_close(db); rocksdb_close(db);
rocksdb_destroy_db(options, dbname, &err); rocksdb_destroy_db(options_with_filter, dbname, &err);
rocksdb_options_set_compaction_filter(options, cfilter); rocksdb_options_set_compaction_filter(options_with_filter, cfilter);
db = CheckCompaction(db, options, roptions, woptions); db = CheckCompaction(db, options_with_filter, roptions, woptions);
rocksdb_options_set_compaction_filter(options, NULL); rocksdb_options_set_compaction_filter(options_with_filter, NULL);
rocksdb_compactionfilter_destroy(cfilter); rocksdb_compactionfilter_destroy(cfilter);
rocksdb_options_destroy(options_with_filter);
} }
StartPhase("compaction_filter_factory"); StartPhase("compaction_filter_factory");
{ {
rocksdb_options_set_create_if_missing(options, 1); rocksdb_options_t* options_with_filter_factory = rocksdb_options_create();
rocksdb_options_set_create_if_missing(options_with_filter_factory, 1);
rocksdb_compactionfilterfactory_t* factory; rocksdb_compactionfilterfactory_t* factory;
factory = rocksdb_compactionfilterfactory_create( factory = rocksdb_compactionfilterfactory_create(
NULL, CFilterFactoryDestroy, CFilterCreate, CFilterFactoryName); NULL, CFilterFactoryDestroy, CFilterCreate, CFilterFactoryName);
// Create new database // Create new database
rocksdb_close(db); rocksdb_close(db);
rocksdb_destroy_db(options, dbname, &err); rocksdb_destroy_db(options_with_filter_factory, dbname, &err);
rocksdb_options_set_compaction_filter_factory(options, factory); rocksdb_options_set_compaction_filter_factory(options_with_filter_factory,
db = CheckCompaction(db, options, roptions, woptions); factory);
db = CheckCompaction(db, options_with_filter_factory, roptions, woptions);
rocksdb_options_set_compaction_filter_factory(options, NULL);
rocksdb_options_set_compaction_filter_factory(
options_with_filter_factory, NULL);
rocksdb_options_destroy(options_with_filter_factory);
} }
StartPhase("compaction_filter_v2"); StartPhase("compaction_filter_v2");

Loading…
Cancel
Save