From 6673af860d3fd1181c1714da412af52a465120d5 Mon Sep 17 00:00:00 2001
From: Martina Ferrari <tina@debian.org>
Date: Thu, 28 Jan 2021 19:16:50 +0000
Subject: [PATCH] Modify new arguments to default to None.

---
 rocksdb/_rocksdb.pyx | 34 ++++++++++++++++++++--------------
 1 file changed, 20 insertions(+), 14 deletions(-)

diff --git a/rocksdb/_rocksdb.pyx b/rocksdb/_rocksdb.pyx
index 996ae9c..7a6c61a 100644
--- a/rocksdb/_rocksdb.pyx
+++ b/rocksdb/_rocksdb.pyx
@@ -590,9 +590,9 @@ cdef class BlockBasedTableFactory(PyTableFactory):
             block_size_deviation=None,
             block_restart_interval=None,
             whole_key_filtering=None,
-            enable_index_compression=False,
-            cache_index_and_filter_blocks=False,
-            format_version=2,
+            enable_index_compression=None,
+            cache_index_and_filter_blocks=None,
+            format_version=None,
         ):
 
         cdef table_factory.BlockBasedTableOptions table_options
@@ -609,11 +609,6 @@ cdef class BlockBasedTableFactory(PyTableFactory):
         else:
             table_options.hash_index_allow_collision = False
 
-        if enable_index_compression:
-            table_options.enable_index_compression = True
-        else:
-            table_options.enable_index_compression = False
-
         if checksum == 'crc32':
             table_options.checksum = table_factory.kCRC32c
         elif checksum == 'xxhash':
@@ -621,6 +616,12 @@ cdef class BlockBasedTableFactory(PyTableFactory):
         else:
             raise ValueError("Unknown checksum: %s" % checksum)
 
+        if block_cache is not None:
+            table_options.block_cache = block_cache.get_cache()
+
+        if block_cache_compressed is not None:
+            table_options.block_cache_compressed = block_cache_compressed.get_cache()
+
         if no_block_cache:
             table_options.no_block_cache = True
         else:
@@ -642,18 +643,18 @@ cdef class BlockBasedTableFactory(PyTableFactory):
             else:
                 table_options.whole_key_filtering = False
 
+        if enable_index_compression is not None:
+            if enable_index_compression:
+                table_options.enable_index_compression = True
+            else:
+                table_options.enable_index_compression = False
+
         if cache_index_and_filter_blocks is not None:
             if cache_index_and_filter_blocks:
                 table_options.cache_index_and_filter_blocks = True
             else:
                 table_options.cache_index_and_filter_blocks = False
 
-        if block_cache is not None:
-            table_options.block_cache = block_cache.get_cache()
-
-        if block_cache_compressed is not None:
-            table_options.block_cache_compressed = block_cache_compressed.get_cache()
-
         if format_version is not None:
             table_options.format_version = format_version
 
@@ -911,6 +912,7 @@ cdef class ColumnFamilyOptions(object):
             self.copts.min_write_buffer_number_to_merge = value
 
     property compression_opts:
+        # FIXME: add missing fields.
         def __get__(self):
             cdef dict ret_ob = {}
 
@@ -934,6 +936,8 @@ cdef class ColumnFamilyOptions(object):
             if 'max_dict_bytes' in value:
                 copts.max_dict_bytes = value['max_dict_bytes']
 
+    # FIXME: add bottommost_compression_opts
+
     property compaction_pri:
         def __get__(self):
             if self.copts.compaction_pri == options.kByCompensatedSize:
@@ -1003,6 +1007,8 @@ cdef class ColumnFamilyOptions(object):
             else:
                 raise TypeError("Unknown compression: %s" % value)
 
+    # FIXME: add bottommost_compression
+
     property max_compaction_bytes:
         def __get__(self):
             return self.copts.max_compaction_bytes
-- 
GitLab