From bec21991121f9ea03bdaf2f6b91dfaecd0d2b275 Mon Sep 17 00:00:00 2001
From: Jan Segre <jan@segre.in>
Date: Tue, 5 Jul 2022 14:18:28 +0200
Subject: [PATCH] Remove `hash_index_allow_collision` to work with rocksdb-7.3

---
 docs/api/options.rst      | 8 +-------
 rocksdb/_rocksdb.pyx      | 6 ------
 rocksdb/table_factory.pxd | 1 -
 3 files changed, 1 insertion(+), 14 deletions(-)

diff --git a/docs/api/options.rst b/docs/api/options.rst
index 6a02751..004718a 100644
--- a/docs/api/options.rst
+++ b/docs/api/options.rst
@@ -909,7 +909,7 @@ https://github.com/facebook/rocksdb/wiki/A-Tutorial-of-RocksDB-SST-formats
 
     Wraps BlockBasedTableFactory of RocksDB.
 
-    .. py:method:: __init__(index_type='binary_search', hash_index_allow_collision=True, checksum='crc32', block_cache, block_cache_compressed, filter_policy=None, no_block_cache=False, block_size=None, block_size_deviation=None, block_restart_interval=None, whole_key_filtering=None, enable_index_compression=None, cache_index_and_filter_blocks=None, format_version=None)
+    .. py:method:: __init__(index_type='binary_search', checksum='crc32', block_cache, block_cache_compressed, filter_policy=None, no_block_cache=False, block_size=None, block_size_deviation=None, block_restart_interval=None, whole_key_filtering=None, enable_index_compression=None, cache_index_and_filter_blocks=None, format_version=None)
 
     :param string index_type:
         * ``binary_search`` a space efficient index block that is optimized
@@ -917,12 +917,6 @@ https://github.com/facebook/rocksdb/wiki/A-Tutorial-of-RocksDB-SST-formats
         * ``hash_search`` the hash index. If enabled, will do hash lookup
           when `Options.prefix_extractor` is provided.
 
-    :param bool hash_index_allow_collision:
-        Influence the behavior when ``hash_search`` is used.
-        If ``False``, stores a precise prefix to block range mapping.
-        If ``True``, does not store prefix and allows prefix hash collision
-        (less memory consumption)
-
     :param string checksum:
         Use the specified checksum type. Newly created table files will be
         protected with this checksum type. Old table files will still be readable,
diff --git a/rocksdb/_rocksdb.pyx b/rocksdb/_rocksdb.pyx
index bfd47ab..b678fc4 100644
--- a/rocksdb/_rocksdb.pyx
+++ b/rocksdb/_rocksdb.pyx
@@ -466,7 +466,6 @@ cdef class PyTableFactory(object):
 cdef class BlockBasedTableFactory(PyTableFactory):
     def __init__(self,
             index_type='binary_search',
-            py_bool hash_index_allow_collision=True,
             checksum='crc32',
             PyCache block_cache=None,
             PyCache block_cache_compressed=None,
@@ -488,11 +487,6 @@ cdef class BlockBasedTableFactory(PyTableFactory):
         else:
             raise ValueError("Unknown index_type: %s" % index_type)
 
-        if hash_index_allow_collision:
-            table_options.hash_index_allow_collision = True
-        else:
-            table_options.hash_index_allow_collision = False
-
         if checksum == 'crc32':
             table_options.checksum = table_factory.kCRC32c
         elif checksum == 'xxhash':
diff --git a/rocksdb/table_factory.pxd b/rocksdb/table_factory.pxd
index 324f3bc..3ec8b7b 100644
--- a/rocksdb/table_factory.pxd
+++ b/rocksdb/table_factory.pxd
@@ -19,7 +19,6 @@ cdef extern from "rocksdb/table.h" namespace "rocksdb":
     cdef cppclass BlockBasedTableOptions:
         BlockBasedTableOptions()
         BlockBasedTableIndexType index_type
-        cpp_bool hash_index_allow_collision
         ChecksumType checksum
         cpp_bool no_block_cache
         size_t block_size
-- 
GitLab