mirror of https://github.com/facebook/rocksdb.git
Expose compaction pri through C API (#12604)
Summary: Pull Request resolved: https://github.com/facebook/rocksdb/pull/12604 Reviewed By: cbi42 Differential Revision: D56914066 Pulled By: ajkr fbshipit-source-id: 64b51ab2b7b5ec0b5fde5a5f61d076bac1c3a8ad
This commit is contained in:
parent
e2ef349f56
commit
ed01babd07
8
db/c.cc
8
db/c.cc
|
@ -3930,6 +3930,14 @@ void rocksdb_options_set_fifo_compaction_options(
|
|||
opt->rep.compaction_options_fifo = fifo->rep;
|
||||
}
|
||||
|
||||
void rocksdb_options_set_compaction_pri(rocksdb_options_t* opt, int pri) {
|
||||
opt->rep.compaction_pri = static_cast<ROCKSDB_NAMESPACE::CompactionPri>(pri);
|
||||
}
|
||||
|
||||
int rocksdb_options_get_compaction_pri(rocksdb_options_t* opt) {
|
||||
return opt->rep.compaction_pri;
|
||||
}
|
||||
|
||||
char* rocksdb_options_statistics_get_string(rocksdb_options_t* opt) {
|
||||
ROCKSDB_NAMESPACE::Statistics* statistics = opt->rep.statistics.get();
|
||||
if (statistics) {
|
||||
|
|
|
@ -2041,7 +2041,6 @@ int main(int argc, char** argv) {
|
|||
rocksdb_options_set_advise_random_on_open(o, 1);
|
||||
CheckCondition(1 == rocksdb_options_get_advise_random_on_open(o));
|
||||
|
||||
|
||||
rocksdb_options_set_use_adaptive_mutex(o, 1);
|
||||
CheckCondition(1 == rocksdb_options_get_use_adaptive_mutex(o));
|
||||
|
||||
|
@ -2112,6 +2111,9 @@ int main(int argc, char** argv) {
|
|||
rocksdb_options_set_compaction_style(o, 2);
|
||||
CheckCondition(2 == rocksdb_options_get_compaction_style(o));
|
||||
|
||||
rocksdb_options_set_compaction_pri(o, 4);
|
||||
CheckCondition(4 == rocksdb_options_get_compaction_pri(o));
|
||||
|
||||
rocksdb_options_set_atomic_flush(o, 1);
|
||||
CheckCondition(1 == rocksdb_options_get_atomic_flush(o));
|
||||
|
||||
|
@ -2616,6 +2618,10 @@ int main(int argc, char** argv) {
|
|||
CheckCondition(1 == rocksdb_options_get_compaction_style(copy));
|
||||
CheckCondition(2 == rocksdb_options_get_compaction_style(o));
|
||||
|
||||
rocksdb_options_set_compaction_pri(copy, 1);
|
||||
CheckCondition(1 == rocksdb_options_get_compaction_pri(copy));
|
||||
CheckCondition(4 == rocksdb_options_get_compaction_pri(o));
|
||||
|
||||
rocksdb_options_set_atomic_flush(copy, 0);
|
||||
CheckCondition(0 == rocksdb_options_get_atomic_flush(copy));
|
||||
CheckCondition(1 == rocksdb_options_get_atomic_flush(o));
|
||||
|
|
|
@ -1682,6 +1682,18 @@ extern ROCKSDB_LIBRARY_API void rocksdb_options_set_wal_compression(
|
|||
extern ROCKSDB_LIBRARY_API int rocksdb_options_get_wal_compression(
|
||||
rocksdb_options_t* opt);
|
||||
|
||||
enum {
|
||||
rocksdb_k_by_compensated_size_compaction_pri = 0,
|
||||
rocksdb_k_oldest_largest_seq_first_compaction_pri = 1,
|
||||
rocksdb_k_oldest_smallest_seq_first_compaction_pri = 2,
|
||||
rocksdb_k_min_overlapping_ratio_compaction_pri = 3,
|
||||
rocksdb_k_round_robin_compaction_pri = 4
|
||||
};
|
||||
extern ROCKSDB_LIBRARY_API void rocksdb_options_set_compaction_pri(
|
||||
rocksdb_options_t*, int);
|
||||
extern ROCKSDB_LIBRARY_API int rocksdb_options_get_compaction_pri(
|
||||
rocksdb_options_t*);
|
||||
|
||||
/* RateLimiter */
|
||||
extern ROCKSDB_LIBRARY_API rocksdb_ratelimiter_t* rocksdb_ratelimiter_create(
|
||||
int64_t rate_bytes_per_sec, int64_t refill_period_us, int32_t fairness);
|
||||
|
|
|
@ -0,0 +1 @@
|
|||
Exposed compaction pri via c api.
|
Loading…
Reference in New Issue