Skip to content

Commit abc1365

Browse files
authored
Merge pull request #43 from DataDog/dylan.forciea/redres-1186-add-point-lookup-opts
[REDRES-1186] add gorocks point lookup options
2 parents 30d6130 + 5ddc348 commit abc1365

File tree

2 files changed

+34
-0
lines changed

2 files changed

+34
-0
lines changed

v8/options.go

Lines changed: 11 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1043,6 +1043,17 @@ func (opts *Options) SetDumpMallocStats(value bool) {
10431043
C.rocksdb_options_set_dump_malloc_stats(opts.c, boolToChar(value))
10441044
}
10451045

1046+
// SetMemtableWholeKeyFiltering enable whole key bloom filter in memtable. Note this will only take effect
1047+
// if memtable_prefix_bloom_size_ratio is not 0. Enabling whole key filtering
1048+
// can potentially reduce CPU usage for point-look-ups.
1049+
//
1050+
// Default: false (disable)
1051+
//
1052+
// Dynamically changeable through SetOptions() API
1053+
func (opts *Options) SetMemtableWholeKeyFiltering(value bool) {
1054+
C.rocksdb_options_set_memtable_whole_key_filtering(opts.c, boolToChar(value))
1055+
}
1056+
10461057
// EnableStatistics enable statistics.
10471058
func (opts *Options) EnableStatistics() {
10481059
C.rocksdb_options_enable_statistics(opts.c)

v8/options_block_based_table.go

Lines changed: 23 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -18,6 +18,16 @@ const (
1818
KTwoLevelIndexSearchIndexType = 2
1919
)
2020

21+
// DataBlockIndexType specifies index type that will be used for the data block.
22+
type DataBlockIndexType uint
23+
24+
const (
25+
// KDataBlockIndexTypeBinarySearch is traditional block type
26+
KDataBlockIndexTypeBinarySearch DataBlockIndexType = 0
27+
// KDataBlockIndexTypeBinarySearchAndHash additional hash index
28+
KDataBlockIndexTypeBinarySearchAndHash DataBlockIndexType = 1
29+
)
30+
2131
// BlockBasedTableOptions represents block-based table options.
2232
type BlockBasedTableOptions struct {
2333
c *C.rocksdb_block_based_table_options_t
@@ -222,3 +232,16 @@ func (opts *BlockBasedTableOptions) SetFormatVersion(version int) {
222232
func (opts *BlockBasedTableOptions) SetIndexType(value IndexType) {
223233
C.rocksdb_block_based_options_set_index_type(opts.c, C.int(value))
224234
}
235+
236+
// SetDataBlockIndexType sets data block index type
237+
func (opts *BlockBasedTableOptions) SetDataBlockIndexType(value DataBlockIndexType) {
238+
C.rocksdb_block_based_options_set_data_block_index_type(opts.c, C.int(value))
239+
}
240+
241+
// SetDataBlockHashRatio is valid only when data_block_hash_index_type is
242+
// KDataBlockIndexTypeBinarySearchAndHash.
243+
//
244+
// Default value: 0.75
245+
func (opts *BlockBasedTableOptions) SetDataBlockHashRatio(value float64) {
246+
C.rocksdb_block_based_options_set_data_block_hash_ratio(opts.c, C.double(value))
247+
}

0 commit comments

Comments
 (0)