Skip to content

Commit

Permalink
Add all new options to python api with tests
Browse files Browse the repository at this point in the history
  • Loading branch information
mharshe committed Dec 2, 2021
1 parent 179ec32 commit 5dec221
Show file tree
Hide file tree
Showing 2 changed files with 369 additions and 35 deletions.
277 changes: 261 additions & 16 deletions rocksdb/_rocksdb.pyx
Original file line number Diff line number Diff line change
Expand Up @@ -969,7 +969,6 @@ cdef class ColumnFamilyOptions(object):
copts.parallel_threads = value['parallel_threads']
if 'enabled' in value:
copts.enabled = value['enabled']


property compaction_pri:
def __get__(self):
Expand Down Expand Up @@ -1368,6 +1367,18 @@ cdef class Options(ColumnFamilyOptions):
def __set__(self, value):
self.opts.max_open_files = value

property max_file_opening_threads:
def __get__(self):
return self.opts.max_file_opening_threads
def __set__(self, value):
self.opts.max_file_opening_threads = value

property max_total_wal_size:
def __get__(self):
return self.opts.max_total_wal_size
def __set__(self, value):
self.opts.max_total_wal_size = value

property use_fsync:
def __get__(self):
return self.opts.use_fsync
Expand All @@ -1392,17 +1403,29 @@ cdef class Options(ColumnFamilyOptions):
def __set__(self, value):
self.opts.delete_obsolete_files_period_micros = value

property max_background_jobs:
def __get__(self):
return self.opts.max_background_jobs
def __set__(self, value):
self.opts.max_background_jobs = value

property base_background_compactions:
def __get__(self):
return self.opts.base_background_compactions
def __set__(self, value):
self.opts.base_background_compactions = value

property max_background_compactions:
def __get__(self):
return self.opts.max_background_compactions
def __set__(self, value):
self.opts.max_background_compactions = value

property max_background_jobs:
property max_subcompactions:
def __get__(self):
return self.opts.max_background_jobs
return self.opts.max_subcompactions
def __set__(self, value):
self.opts.max_background_jobs = value
self.opts.max_subcompactions = value

property max_background_flushes:
def __get__(self):
Expand All @@ -1428,6 +1451,12 @@ cdef class Options(ColumnFamilyOptions):
def __set__(self, value):
self.opts.keep_log_file_num = value

property recycle_log_file_num:
def __get__(self):
return self.opts.recycle_log_file_num
def __set__(self, value):
self.opts.recycle_log_file_num = value

property max_manifest_file_size:
def __get__(self):
return self.opts.max_manifest_file_size
Expand Down Expand Up @@ -1458,18 +1487,6 @@ cdef class Options(ColumnFamilyOptions):
def __set__(self, value):
self.opts.manifest_preallocation_size = value

property enable_write_thread_adaptive_yield:
def __get__(self):
return self.opts.enable_write_thread_adaptive_yield
def __set__(self, value):
self.opts.enable_write_thread_adaptive_yield = value

property allow_concurrent_memtable_write:
def __get__(self):
return self.opts.allow_concurrent_memtable_write
def __set__(self, value):
self.opts.allow_concurrent_memtable_write = value

property allow_mmap_reads:
def __get__(self):
return self.opts.allow_mmap_reads
Expand All @@ -1482,6 +1499,24 @@ cdef class Options(ColumnFamilyOptions):
def __set__(self, value):
self.opts.allow_mmap_writes = value

property use_direct_reads:
def __get__(self):
return self.opts.use_direct_reads
def __set__(self, value):
self.opts.use_direct_reads = value

property use_direct_io_for_flush_and_compaction:
def __get__(self):
return self.opts.use_direct_io_for_flush_and_compaction
def __set__(self, value):
self.opts.use_direct_io_for_flush_and_compaction = value

property allow_fallocate:
def __get__(self):
return self.opts.allow_fallocate
def __set__(self, value):
self.opts.allow_fallocate = value

property is_fd_close_on_exec:
def __get__(self):
return self.opts.is_fd_close_on_exec
Expand All @@ -1500,19 +1535,67 @@ cdef class Options(ColumnFamilyOptions):
def __set__(self, value):
self.opts.stats_dump_period_sec = value

property stats_persist_period_sec:
def __get__(self):
return self.opts.stats_persist_period_sec
def __set__(self, value):
self.opts.stats_persist_period_sec = value

property persist_stats_to_disk:
def __get__(self):
return self.opts.persist_stats_to_disk
def __set__(self, value):
self.opts.persist_stats_to_disk = value

property stats_history_buffer_size:
def __get__(self):
return self.opts.stats_history_buffer_size
def __set__(self, value):
self.opts.stats_history_buffer_size = value

property advise_random_on_open:
def __get__(self):
return self.opts.advise_random_on_open
def __set__(self, value):
self.opts.advise_random_on_open = value

property db_write_buffer_size:
def __get__(self):
return self.opts.db_write_buffer_size
def __set__(self, value):
self.opts.db_write_buffer_size = value

# TODO: need to remove -Wconversion to make this work
# property access_hint_on_compaction_start:
# def __get__(self):
# return self.opts.access_hint_on_compaction_start
# def __set__(self, AccessHint value):
# self.opts.access_hint_on_compaction_start = value

property new_table_reader_for_compaction_inputs:
def __get__(self):
return self.opts.new_table_reader_for_compaction_inputs
def __set__(self, value):
self.opts.new_table_reader_for_compaction_inputs = value

property compaction_readahead_size:
def __get__(self):
return self.opts.compaction_readahead_size
def __set__(self, value):
self.opts.compaction_readahead_size = value

property random_access_max_buffer_size:
def __get__(self):
return self.opts.random_access_max_buffer_size
def __set__(self, value):
self.opts.random_access_max_buffer_size = value

property writable_file_max_buffer_size:
def __get__(self):
return self.opts.writable_file_max_buffer_size
def __set__(self, value):
self.opts.writable_file_max_buffer_size = value

property use_adaptive_mutex:
def __get__(self):
return self.opts.use_adaptive_mutex
Expand All @@ -1525,6 +1608,90 @@ cdef class Options(ColumnFamilyOptions):
def __set__(self, value):
self.opts.bytes_per_sync = value

property wal_bytes_per_sync:
def __get__(self):
return self.opts.wal_bytes_per_sync
def __set__(self, value):
self.opts.wal_bytes_per_sync = value

property strict_bytes_per_sync:
def __get__(self):
return self.opts.strict_bytes_per_sync
def __set__(self, value):
self.opts.strict_bytes_per_sync = value

property enable_thread_tracking:
def __get__(self):
return self.opts.enable_thread_tracking
def __set__(self, value):
self.opts.enable_thread_tracking = value

property delayed_write_rate:
def __get__(self):
return self.opts.delayed_write_rate
def __set__(self, value):
self.opts.delayed_write_rate = value

property enable_pipelined_write:
def __get__(self):
return self.opts.enable_pipelined_write
def __set__(self, value):
self.opts.enable_pipelined_write = value

property unordered_write:
def __get__(self):
return self.opts.unordered_write
def __set__(self, value):
self.opts.unordered_write = value

property allow_concurrent_memtable_write:
def __get__(self):
return self.opts.allow_concurrent_memtable_write
def __set__(self, value):
self.opts.allow_concurrent_memtable_write = value

property enable_write_thread_adaptive_yield:
def __get__(self):
return self.opts.enable_write_thread_adaptive_yield
def __set__(self, value):
self.opts.enable_write_thread_adaptive_yield = value

property max_write_batch_group_size_bytes:
def __get__(self):
return self.opts.max_write_batch_group_size_bytes
def __set__(self, value):
self.opts.max_write_batch_group_size_bytes = value

property write_thread_max_yield_usec:
def __get__(self):
return self.opts.write_thread_max_yield_usec
def __set__(self, value):
self.opts.write_thread_max_yield_usec = value

property write_thread_slow_yield_usec:
def __get__(self):
return self.opts.write_thread_slow_yield_usec
def __set__(self, value):
self.opts.write_thread_slow_yield_usec = value

property skip_stats_update_on_db_open:
def __get__(self):
return self.opts.skip_stats_update_on_db_open
def __set__(self, value):
self.opts.skip_stats_update_on_db_open = value

property skip_checking_sst_file_sizes_on_db_open:
def __get__(self):
return self.opts.skip_checking_sst_file_sizes_on_db_open
def __set__(self, value):
self.opts.skip_checking_sst_file_sizes_on_db_open = value

property allow_2pc:
def __get__(self):
return self.opts.allow_2pc
def __set__(self, value):
self.opts.allow_2pc = value

property row_cache:
def __get__(self):
return self.py_row_cache
Expand All @@ -1539,6 +1706,84 @@ cdef class Options(ColumnFamilyOptions):
self.py_row_cache = value
self.opts.row_cache = self.py_row_cache.get_cache()

property fail_if_options_file_error:
def __get__(self):
return self.opts.fail_if_options_file_error
def __set__(self, value):
self.opts.fail_if_options_file_error = value

property dump_malloc_stats:
def __get__(self):
return self.opts.dump_malloc_stats
def __set__(self, value):
self.opts.dump_malloc_stats = value

property avoid_flush_during_recovery:
def __get__(self):
return self.opts.avoid_flush_during_recovery
def __set__(self, value):
self.opts.avoid_flush_during_recovery = value

property avoid_flush_during_shutdown:
def __get__(self):
return self.opts.avoid_flush_during_shutdown
def __set__(self, value):
self.opts.avoid_flush_during_shutdown = value

property allow_ingest_behind:
def __get__(self):
return self.opts.allow_ingest_behind
def __set__(self, value):
self.opts.allow_ingest_behind = value

property preserve_deletes:
def __get__(self):
return self.opts.preserve_deletes
def __set__(self, value):
self.opts.preserve_deletes = value

property two_write_queues:
def __get__(self):
return self.opts.two_write_queues
def __set__(self, value):
self.opts.two_write_queues = value

property manual_wal_flush:
def __get__(self):
return self.opts.manual_wal_flush
def __set__(self, value):
self.opts.manual_wal_flush = value

property atomic_flush:
def __get__(self):
return self.opts.atomic_flush
def __set__(self, value):
self.opts.atomic_flush = value

property avoid_unnecessary_blocking_io:
def __get__(self):
return self.opts.avoid_unnecessary_blocking_io
def __set__(self, value):
self.opts.avoid_unnecessary_blocking_io = value

property write_dbid_to_manifest:
def __get__(self):
return self.opts.write_dbid_to_manifest
def __set__(self, value):
self.opts.write_dbid_to_manifest = value

property log_readahead_size:
def __get__(self):
return self.opts.log_readahead_size
def __set__(self, value):
self.opts.log_readahead_size = value

property best_efforts_recovery:
def __get__(self):
return self.opts.best_efforts_recovery
def __set__(self, value):
self.opts.best_efforts_recovery = value


# Forward declaration
cdef class Snapshot
Expand Down
Loading

0 comments on commit 5dec221

Please sign in to comment.