4848#include " rocksdb/table_properties.h"
4949#include " rocksdb/types.h"
5050#include " rocksdb/universal_compaction.h"
51- #include " rocksdb/utilities/backupable_db .h"
51+ #include " rocksdb/utilities/backup_engine .h"
5252#include " rocksdb/utilities/checkpoint.h"
5353#include " rocksdb/utilities/db_ttl.h"
5454#include " rocksdb/utilities/debug.h"
7575#endif
7676
7777using rocksdb::BackgroundErrorReason;
78- using rocksdb::BackupableDBOptions;
7978using rocksdb::BackupEngine;
79+ using rocksdb::BackupEngineOptions;
8080using rocksdb::BackupInfo;
8181using rocksdb::BlockBasedTableOptions;
8282using rocksdb::BlockCipher;
@@ -524,41 +524,10 @@ struct crocksdb_filterpolicy_t : public FilterPolicy {
524524 void * state_;
525525 void (*destructor_)(void *);
526526 const char * (*name_)(void *);
527- char * (*create_)(void *, const char * const * key_array,
528- const size_t * key_length_array, int num_keys,
529- size_t * filter_length);
530- unsigned char (*key_match_)(void *, const char * key, size_t length,
531- const char * filter, size_t filter_length);
532- void (*delete_filter_)(void *, const char * filter, size_t filter_length);
533527
534528 virtual ~crocksdb_filterpolicy_t () { (*destructor_)(state_); }
535529
536530 virtual const char * Name () const override { return (*name_)(state_); }
537-
538- virtual void CreateFilter (const Slice* keys, int n,
539- std::string* dst) const override {
540- std::vector<const char *> key_pointers (n);
541- std::vector<size_t > key_sizes (n);
542- for (int i = 0 ; i < n; i++) {
543- key_pointers[i] = keys[i].data ();
544- key_sizes[i] = keys[i].size ();
545- }
546- size_t len;
547- char * filter = (*create_)(state_, &key_pointers[0 ], &key_sizes[0 ], n, &len);
548- dst->append (filter, len);
549-
550- if (delete_filter_ != nullptr ) {
551- (*delete_filter_)(state_, filter, len);
552- } else {
553- free (filter);
554- }
555- }
556-
557- virtual bool KeyMayMatch (const Slice& key,
558- const Slice& filter) const override {
559- return (*key_match_)(state_, key.data (), key.size (), filter.data (),
560- filter.size ());
561- }
562531};
563532
564533struct crocksdb_mergeoperator_t : public MergeOperator {
@@ -853,7 +822,7 @@ crocksdb_backup_engine_t* crocksdb_backup_engine_open(
853822 const crocksdb_options_t * options, const char * path, char ** errptr) {
854823 BackupEngine* be;
855824 if (SaveError (errptr, BackupEngine::Open (options->rep .env ,
856- BackupableDBOptions (path), &be))) {
825+ BackupEngineOptions (path), &be))) {
857826 return nullptr ;
858827 }
859828 crocksdb_backup_engine_t * result = new crocksdb_backup_engine_t ;
@@ -1189,7 +1158,8 @@ void crocksdb_write_multi_batch(crocksdb_t* db,
11891158 for (size_t i = 0 ; i < batch_size; i++) {
11901159 ws.push_back (&batches[i]->rep );
11911160 }
1192- SaveError (errptr, db->rep ->MultiBatchWrite (options->rep , std::move (ws)));
1161+ SaveError (errptr,
1162+ db->rep ->MultiBatchWrite (options->rep , std::move (ws), nullptr ));
11931163}
11941164
11951165void crocksdb_write_multi_batch_callback (
@@ -2097,14 +2067,6 @@ void crocksdb_block_based_options_set_block_cache(
20972067 }
20982068}
20992069
2100- void crocksdb_block_based_options_set_block_cache_compressed (
2101- crocksdb_block_based_table_options_t * options,
2102- crocksdb_cache_t * block_cache_compressed) {
2103- if (block_cache_compressed) {
2104- options->rep .block_cache_compressed = block_cache_compressed->rep ;
2105- }
2106- }
2107-
21082070void crocksdb_block_based_options_set_whole_key_filtering (
21092071 crocksdb_block_based_table_options_t * options, unsigned char v) {
21102072 options->rep .whole_key_filtering = v;
@@ -2120,11 +2082,6 @@ void crocksdb_block_based_options_set_index_type(
21202082 options->rep .index_type = static_cast <BlockBasedTableOptions::IndexType>(v);
21212083}
21222084
2123- void crocksdb_block_based_options_set_hash_index_allow_collision (
2124- crocksdb_block_based_table_options_t * options, unsigned char v) {
2125- options->rep .hash_index_allow_collision = v;
2126- }
2127-
21282085void crocksdb_block_based_options_set_optimize_filters_for_memory (
21292086 crocksdb_block_based_table_options_t * options, unsigned char v) {
21302087 options->rep .optimize_filters_for_memory = v;
@@ -3068,11 +3025,6 @@ void crocksdb_options_set_is_fd_close_on_exec(crocksdb_options_t* opt,
30683025 opt->rep .is_fd_close_on_exec = v;
30693026}
30703027
3071- void crocksdb_options_set_skip_log_error_on_recovery (crocksdb_options_t * opt,
3072- unsigned char v) {
3073- opt->rep .skip_log_error_on_recovery = v;
3074- }
3075-
30763028void crocksdb_options_set_stats_dump_period_sec (crocksdb_options_t * opt,
30773029 unsigned int v) {
30783030 opt->rep .stats_dump_period_sec = v;
@@ -3197,16 +3149,6 @@ int crocksdb_options_get_max_background_compactions(
31973149 return opt->rep .max_background_compactions ;
31983150}
31993151
3200- void crocksdb_options_set_base_background_compactions (crocksdb_options_t * opt,
3201- int n) {
3202- opt->rep .base_background_compactions = n;
3203- }
3204-
3205- int crocksdb_options_get_base_background_compactions (
3206- const crocksdb_options_t * opt) {
3207- return opt->rep .base_background_compactions ;
3208- }
3209-
32103152void crocksdb_options_set_max_background_flushes (crocksdb_options_t * opt,
32113153 int n) {
32123154 opt->rep .max_background_flushes = n;
@@ -3234,14 +3176,6 @@ void crocksdb_options_set_recycle_log_file_num(crocksdb_options_t* opt,
32343176 opt->rep .recycle_log_file_num = v;
32353177}
32363178
3237- void crocksdb_options_set_soft_rate_limit (crocksdb_options_t * opt, double v) {
3238- opt->rep .soft_rate_limit = v;
3239- }
3240-
3241- void crocksdb_options_set_hard_rate_limit (crocksdb_options_t * opt, double v) {
3242- opt->rep .hard_rate_limit = v;
3243- }
3244-
32453179void crocksdb_options_set_soft_pending_compaction_bytes_limit (
32463180 crocksdb_options_t * opt, size_t v) {
32473181 opt->rep .soft_pending_compaction_bytes_limit = v;
@@ -3262,11 +3196,6 @@ size_t crocksdb_options_get_hard_pending_compaction_bytes_limit(
32623196 return opt->rep .hard_pending_compaction_bytes_limit ;
32633197}
32643198
3265- void crocksdb_options_set_rate_limit_delay_max_milliseconds (
3266- crocksdb_options_t * opt, unsigned int v) {
3267- opt->rep .rate_limit_delay_max_milliseconds = v;
3268- }
3269-
32703199void crocksdb_options_set_max_manifest_file_size (crocksdb_options_t * opt,
32713200 size_t v) {
32723201 opt->rep .max_manifest_file_size = v;
@@ -3609,12 +3538,14 @@ void crocksdb_options_set_track_and_verify_wals_in_manifest(
36093538}
36103539
36113540unsigned char crocksdb_load_latest_options (
3612- const char * dbpath, crocksdb_env_t * env, crocksdb_options_t * db_options,
3541+ const char * dbpath, crocksdb_options_t * db_options,
36133542 crocksdb_column_family_descriptor*** cf_descs, size_t * cf_descs_len,
36143543 unsigned char ignore_unknown_options, char ** errptr) {
36153544 std::vector<ColumnFamilyDescriptor> tmp_cf_descs;
3616- Status s = rocksdb::LoadLatestOptions (dbpath, env->rep , &db_options->rep ,
3617- &tmp_cf_descs, ignore_unknown_options);
3545+ rocksdb::ConfigOptions config_options;
3546+ config_options.ignore_unknown_options = ignore_unknown_options;
3547+ Status s = rocksdb::LoadLatestOptions (rocksdb::ConfigOptions (), dbpath,
3548+ &db_options->rep , &tmp_cf_descs);
36183549
36193550 *errptr = nullptr ;
36203551 if (s.IsNotFound ()) return false ;
@@ -3810,17 +3741,12 @@ unsigned char crocksdb_compactionfiltercontext_is_bottommost_level(
38103741 return context->rep .is_bottommost_level ;
38113742}
38123743
3813- void crocksdb_compactionfiltercontext_file_numbers (
3814- crocksdb_compactionfiltercontext_t * context, const uint64_t ** buffer,
3815- size_t * len) {
3816- *buffer = context->rep .file_numbers .data ();
3817- *len = context->rep .file_numbers .size ();
3818- }
3819-
3820- crocksdb_table_properties_t * crocksdb_compactionfiltercontext_table_properties (
3821- crocksdb_compactionfiltercontext_t * context, size_t offset) {
3822- return (crocksdb_table_properties_t *)context->rep .table_properties [offset]
3823- .get ();
3744+ crocksdb_table_properties_collection_t *
3745+ crocksdb_compactionfiltercontext_input_table_properties (
3746+ crocksdb_compactionfiltercontext_t * context) {
3747+ return (
3748+ crocksdb_table_properties_collection_t *)(&context->rep
3749+ .input_table_properties );
38243750}
38253751
38263752const char * crocksdb_compactionfiltercontext_start_key (
@@ -3879,25 +3805,6 @@ crocksdb_comparator_t* crocksdb_comparator_create(
38793805
38803806void crocksdb_comparator_destroy (crocksdb_comparator_t * cmp) { delete cmp; }
38813807
3882- crocksdb_filterpolicy_t * crocksdb_filterpolicy_create (
3883- void * state, void (*destructor)(void *),
3884- char* (*create_filter)(void *, const char * const * key_array,
3885- const size_t * key_length_array, int num_keys,
3886- size_t * filter_length),
3887- unsigned char (*key_may_match)(void *, const char * key, size_t length,
3888- const char * filter, size_t filter_length),
3889- void (*delete_filter)(void *, const char * filter, size_t filter_length),
3890- const char* (*name)(void *)) {
3891- crocksdb_filterpolicy_t * result = new crocksdb_filterpolicy_t ;
3892- result->state_ = state;
3893- result->destructor_ = destructor;
3894- result->create_ = create_filter;
3895- result->key_match_ = key_may_match;
3896- result->delete_filter_ = delete_filter;
3897- result->name_ = name;
3898- return result;
3899- }
3900-
39013808void crocksdb_filterpolicy_destroy (crocksdb_filterpolicy_t * filter) {
39023809 delete filter;
39033810}
@@ -3910,11 +3817,8 @@ struct FilterPolicyWrapper : public crocksdb_filterpolicy_t {
39103817 std::string full_name_;
39113818 ~FilterPolicyWrapper () override { delete rep_; }
39123819 const char * Name () const override { return full_name_.c_str (); }
3913- void CreateFilter (const Slice* keys, int n, std::string* dst) const override {
3914- return rep_->CreateFilter (keys, n, dst);
3915- }
3916- bool KeyMayMatch (const Slice& key, const Slice& filter) const override {
3917- return rep_->KeyMayMatch (key, filter);
3820+ const char * CompatibilityName () const override {
3821+ return rep_->CompatibilityName ();
39183822 }
39193823 // No need to override GetFilterBitsBuilder if this one is overridden
39203824 FilterBitsBuilder* GetBuilderWithContext (
@@ -3938,7 +3842,6 @@ crocksdb_filterpolicy_t* crocksdb_filterpolicy_create_bloom_format(
39383842 wrapper->full_name_ += " .FullBloom" ;
39393843 }
39403844 wrapper->state_ = nullptr ;
3941- wrapper->delete_filter_ = nullptr ;
39423845 wrapper->destructor_ = &FilterPolicyWrapper::DoNothing;
39433846 return wrapper;
39443847}
@@ -3961,7 +3864,6 @@ crocksdb_filterpolicy_t* crocksdb_filterpolicy_create_ribbon(
39613864 wrapper->full_name_ = wrapper->rep_ ->Name ();
39623865 wrapper->full_name_ += " .Ribbon" ;
39633866 wrapper->state_ = nullptr ;
3964- wrapper->delete_filter_ = nullptr ;
39653867 wrapper->destructor_ = &FilterPolicyWrapper::DoNothing;
39663868 return wrapper;
39673869}
@@ -5821,7 +5723,7 @@ struct ExternalSstFileModifier {
58215723 auto ioptions = *cfd->ioptions ();
58225724 auto table_opt =
58235725 TableReaderOptions (ioptions, desc.options .prefix_extractor ,
5824- env_options_, cfd->internal_comparator ());
5726+ env_options_, cfd->internal_comparator (), 0 );
58255727 // Get around global seqno check.
58265728 table_opt.largest_seqno = kMaxSequenceNumber ;
58275729 status = ioptions.table_factory ->NewTableReader (
0 commit comments