Move the 'simple' block based table options to the block_table_factory.
This commit is contained in:
parent
3358119f22
commit
14dd1c785a
3 changed files with 32 additions and 36 deletions
|
@ -565,7 +565,12 @@ cdef class BlockBasedTableFactory(PyTableFactory):
|
|||
def __init__(self,
|
||||
index_type='binary_search',
|
||||
py_bool hash_index_allow_collision=True,
|
||||
checksum='crc32'):
|
||||
checksum='crc32',
|
||||
no_block_cache=False,
|
||||
block_size=None,
|
||||
block_size_deviation=None,
|
||||
block_restart_interval=None,
|
||||
whole_key_filtering=None):
|
||||
|
||||
cdef table_factory.BlockBasedTableOptions table_options
|
||||
|
||||
|
@ -588,6 +593,27 @@ cdef class BlockBasedTableFactory(PyTableFactory):
|
|||
else:
|
||||
raise ValueError("Unknown checksum: %s" % checksum)
|
||||
|
||||
if no_block_cache:
|
||||
table_options.no_block_cache = True
|
||||
else:
|
||||
table_options.no_block_cache = False
|
||||
|
||||
# If the following options are None use the rocksdb default.
|
||||
if block_size is not None:
|
||||
table_options.block_size = block_size
|
||||
|
||||
if block_size_deviation is not None:
|
||||
table_options.block_size_deviation = block_size_deviation
|
||||
|
||||
if block_restart_interval is not None:
|
||||
table_options.block_restart_interval = block_restart_interval
|
||||
|
||||
if whole_key_filtering is not None:
|
||||
if whole_key_filtering:
|
||||
table_options.whole_key_filtering = True
|
||||
else:
|
||||
table_options.whole_key_filtering = False
|
||||
|
||||
self.factory.reset(table_factory.NewBlockBasedTableFactory(table_options))
|
||||
|
||||
cdef class PlainTableFactory(PyTableFactory):
|
||||
|
@ -741,18 +767,6 @@ cdef class Options(object):
|
|||
def __set__(self, value):
|
||||
self.opts.max_open_files = value
|
||||
|
||||
property block_size:
|
||||
def __get__(self):
|
||||
return self.opts.block_size
|
||||
def __set__(self, value):
|
||||
self.opts.block_size = value
|
||||
|
||||
property block_restart_interval:
|
||||
def __get__(self):
|
||||
return self.opts.block_restart_interval
|
||||
def __set__(self, value):
|
||||
self.opts.block_restart_interval = value
|
||||
|
||||
property compression:
|
||||
def __get__(self):
|
||||
if self.opts.compression == options.kNoCompression:
|
||||
|
@ -778,12 +792,6 @@ cdef class Options(object):
|
|||
else:
|
||||
raise TypeError("Unknown compression: %s" % value)
|
||||
|
||||
property whole_key_filtering:
|
||||
def __get__(self):
|
||||
return self.opts.whole_key_filtering
|
||||
def __set__(self, value):
|
||||
self.opts.whole_key_filtering = value
|
||||
|
||||
property num_levels:
|
||||
def __get__(self):
|
||||
return self.opts.num_levels
|
||||
|
@ -946,12 +954,6 @@ cdef class Options(object):
|
|||
def __set__(self, value):
|
||||
self.opts.max_manifest_file_size = value
|
||||
|
||||
property no_block_cache:
|
||||
def __get__(self):
|
||||
return self.opts.no_block_cache
|
||||
def __set__(self, value):
|
||||
self.opts.no_block_cache = value
|
||||
|
||||
property table_cache_numshardbits:
|
||||
def __get__(self):
|
||||
return self.opts.table_cache_numshardbits
|
||||
|
@ -1036,12 +1038,6 @@ cdef class Options(object):
|
|||
def __set__(self, value):
|
||||
self.opts.stats_dump_period_sec = value
|
||||
|
||||
property block_size_deviation:
|
||||
def __get__(self):
|
||||
return self.opts.block_size_deviation
|
||||
def __set__(self, value):
|
||||
self.opts.block_size_deviation = value
|
||||
|
||||
property advise_random_on_open:
|
||||
def __get__(self):
|
||||
return self.opts.advise_random_on_open
|
||||
|
|
|
@ -47,13 +47,10 @@ cdef extern from "rocksdb/options.h" namespace "rocksdb":
|
|||
int max_open_files
|
||||
shared_ptr[Cache] block_cache
|
||||
shared_ptr[Cache] block_cache_compressed
|
||||
size_t block_size
|
||||
int block_restart_interval
|
||||
CompressionType compression
|
||||
# TODO: compression_per_level
|
||||
# TODO: compression_opts
|
||||
shared_ptr[SliceTransform] prefix_extractor
|
||||
cpp_bool whole_key_filtering
|
||||
int num_levels
|
||||
int level0_file_num_compaction_trigger
|
||||
int level0_slowdown_writes_trigger
|
||||
|
@ -82,7 +79,6 @@ cdef extern from "rocksdb/options.h" namespace "rocksdb":
|
|||
double hard_rate_limit
|
||||
unsigned int rate_limit_delay_max_milliseconds
|
||||
uint64_t max_manifest_file_size
|
||||
cpp_bool no_block_cache
|
||||
int table_cache_numshardbits
|
||||
int table_cache_remove_scan_count_limit
|
||||
size_t arena_block_size
|
||||
|
@ -98,7 +94,6 @@ cdef extern from "rocksdb/options.h" namespace "rocksdb":
|
|||
cpp_bool is_fd_close_on_exec
|
||||
cpp_bool skip_log_error_on_recovery
|
||||
unsigned int stats_dump_period_sec
|
||||
int block_size_deviation
|
||||
cpp_bool advise_random_on_open
|
||||
# TODO: enum { NONE, NORMAL, SEQUENTIAL, WILLNEED } access_hint_on_compaction_start
|
||||
cpp_bool use_adaptive_mutex
|
||||
|
|
|
@ -18,6 +18,11 @@ cdef extern from "rocksdb/table.h" namespace "rocksdb":
|
|||
BlockBasedTableIndexType index_type
|
||||
cpp_bool hash_index_allow_collision
|
||||
ChecksumType checksum
|
||||
cpp_bool no_block_cache
|
||||
size_t block_size
|
||||
int block_size_deviation
|
||||
int block_restart_interval
|
||||
cpp_bool whole_key_filtering
|
||||
|
||||
cdef TableFactory* NewBlockBasedTableFactory(const BlockBasedTableOptions&)
|
||||
|
||||
|
|
Loading…
Add table
Reference in a new issue