fix memtable_factory crash

This commit is contained in:
twmht 2017-06-19 13:58:37 +08:00
parent 2e517bbaa2
commit 8382523ac4
3 changed files with 26 additions and 0 deletions

View file

@ -1094,6 +1094,18 @@ cdef class Options(object):
# def __set__(self, value):
# self.opts.allow_os_buffer = 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

View file

@ -130,6 +130,8 @@ cdef extern from "rocksdb/options.h" namespace "rocksdb":
# TODO: remove options source_compaction_factor, max_grandparent_overlap_bytes and expanded_compaction_factor from document
uint64_t max_compaction_bytes
CompressionOptions compression_opts
cpp_bool allow_concurrent_memtable_write
cpp_bool enable_write_thread_adaptive_yield
cdef cppclass WriteOptions:
cpp_bool sync

View file

@ -46,6 +46,18 @@ class TestOptions(unittest.TestCase):
opts.compaction_pri = rocksdb.CompactionPri.min_overlapping_ratio
self.assertEqual(opts.compaction_pri, rocksdb.CompactionPri.min_overlapping_ratio)
def test_enable_write_thread_adaptive_yield(self):
opts = rocksdb.Options()
self.assertEqual(opts.enable_write_thread_adaptive_yield, True)
opts.enable_write_thread_adaptive_yield = False
self.assertEqual(opts.enable_write_thread_adaptive_yield, False)
def test_allow_concurrent_memtable_write(self):
opts = rocksdb.Options()
self.assertEqual(opts.allow_concurrent_memtable_write, True)
opts.allow_concurrent_memtable_write = False
self.assertEqual(opts.allow_concurrent_memtable_write, False)
def test_compression_opts(self):
opts = rocksdb.Options()
compression_opts = opts.compression_opts