Skip to content
Snippets Groups Projects
Commit 14dd1c78 authored by hofmockel's avatar hofmockel
Browse files

Move the 'simple' block based table options to the block_table_factory.

parent 3358119f
No related branches found
No related tags found
No related merge requests found
...@@ -565,7 +565,12 @@ cdef class BlockBasedTableFactory(PyTableFactory): ...@@ -565,7 +565,12 @@ cdef class BlockBasedTableFactory(PyTableFactory):
def __init__(self, def __init__(self,
index_type='binary_search', index_type='binary_search',
py_bool hash_index_allow_collision=True, 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 cdef table_factory.BlockBasedTableOptions table_options
...@@ -588,6 +593,27 @@ cdef class BlockBasedTableFactory(PyTableFactory): ...@@ -588,6 +593,27 @@ cdef class BlockBasedTableFactory(PyTableFactory):
else: else:
raise ValueError("Unknown checksum: %s" % checksum) 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)) self.factory.reset(table_factory.NewBlockBasedTableFactory(table_options))
cdef class PlainTableFactory(PyTableFactory): cdef class PlainTableFactory(PyTableFactory):
...@@ -741,18 +767,6 @@ cdef class Options(object): ...@@ -741,18 +767,6 @@ cdef class Options(object):
def __set__(self, value): def __set__(self, value):
self.opts.max_open_files = 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: property compression:
def __get__(self): def __get__(self):
if self.opts.compression == options.kNoCompression: if self.opts.compression == options.kNoCompression:
...@@ -778,12 +792,6 @@ cdef class Options(object): ...@@ -778,12 +792,6 @@ cdef class Options(object):
else: else:
raise TypeError("Unknown compression: %s" % value) 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: property num_levels:
def __get__(self): def __get__(self):
return self.opts.num_levels return self.opts.num_levels
...@@ -946,12 +954,6 @@ cdef class Options(object): ...@@ -946,12 +954,6 @@ cdef class Options(object):
def __set__(self, value): def __set__(self, value):
self.opts.max_manifest_file_size = 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: property table_cache_numshardbits:
def __get__(self): def __get__(self):
return self.opts.table_cache_numshardbits return self.opts.table_cache_numshardbits
...@@ -1036,12 +1038,6 @@ cdef class Options(object): ...@@ -1036,12 +1038,6 @@ cdef class Options(object):
def __set__(self, value): def __set__(self, value):
self.opts.stats_dump_period_sec = 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: property advise_random_on_open:
def __get__(self): def __get__(self):
return self.opts.advise_random_on_open return self.opts.advise_random_on_open
......
...@@ -47,13 +47,10 @@ cdef extern from "rocksdb/options.h" namespace "rocksdb": ...@@ -47,13 +47,10 @@ cdef extern from "rocksdb/options.h" namespace "rocksdb":
int max_open_files int max_open_files
shared_ptr[Cache] block_cache shared_ptr[Cache] block_cache
shared_ptr[Cache] block_cache_compressed shared_ptr[Cache] block_cache_compressed
size_t block_size
int block_restart_interval
CompressionType compression CompressionType compression
# TODO: compression_per_level # TODO: compression_per_level
# TODO: compression_opts # TODO: compression_opts
shared_ptr[SliceTransform] prefix_extractor shared_ptr[SliceTransform] prefix_extractor
cpp_bool whole_key_filtering
int num_levels int num_levels
int level0_file_num_compaction_trigger int level0_file_num_compaction_trigger
int level0_slowdown_writes_trigger int level0_slowdown_writes_trigger
...@@ -82,7 +79,6 @@ cdef extern from "rocksdb/options.h" namespace "rocksdb": ...@@ -82,7 +79,6 @@ cdef extern from "rocksdb/options.h" namespace "rocksdb":
double hard_rate_limit double hard_rate_limit
unsigned int rate_limit_delay_max_milliseconds unsigned int rate_limit_delay_max_milliseconds
uint64_t max_manifest_file_size uint64_t max_manifest_file_size
cpp_bool no_block_cache
int table_cache_numshardbits int table_cache_numshardbits
int table_cache_remove_scan_count_limit int table_cache_remove_scan_count_limit
size_t arena_block_size size_t arena_block_size
...@@ -98,7 +94,6 @@ cdef extern from "rocksdb/options.h" namespace "rocksdb": ...@@ -98,7 +94,6 @@ cdef extern from "rocksdb/options.h" namespace "rocksdb":
cpp_bool is_fd_close_on_exec cpp_bool is_fd_close_on_exec
cpp_bool skip_log_error_on_recovery cpp_bool skip_log_error_on_recovery
unsigned int stats_dump_period_sec unsigned int stats_dump_period_sec
int block_size_deviation
cpp_bool advise_random_on_open cpp_bool advise_random_on_open
# TODO: enum { NONE, NORMAL, SEQUENTIAL, WILLNEED } access_hint_on_compaction_start # TODO: enum { NONE, NORMAL, SEQUENTIAL, WILLNEED } access_hint_on_compaction_start
cpp_bool use_adaptive_mutex cpp_bool use_adaptive_mutex
......
...@@ -18,6 +18,11 @@ cdef extern from "rocksdb/table.h" namespace "rocksdb": ...@@ -18,6 +18,11 @@ cdef extern from "rocksdb/table.h" namespace "rocksdb":
BlockBasedTableIndexType index_type BlockBasedTableIndexType index_type
cpp_bool hash_index_allow_collision cpp_bool hash_index_allow_collision
ChecksumType checksum 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&) cdef TableFactory* NewBlockBasedTableFactory(const BlockBasedTableOptions&)
......
0% Loading or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment