Skip to content

Commit

Permalink
[REDRES-1186] add gorocks point lookup options
Browse files Browse the repository at this point in the history
  • Loading branch information
dforciea committed Jun 11, 2024
1 parent 30d6130 commit 5ddc348
Show file tree
Hide file tree
Showing 2 changed files with 34 additions and 0 deletions.
11 changes: 11 additions & 0 deletions v8/options.go
Original file line number Diff line number Diff line change
Expand Up @@ -1043,6 +1043,17 @@ func (opts *Options) SetDumpMallocStats(value bool) {
C.rocksdb_options_set_dump_malloc_stats(opts.c, boolToChar(value))
}

// SetMemtableWholeKeyFiltering enable whole key bloom filter in memtable. Note this will only take effect
// if memtable_prefix_bloom_size_ratio is not 0. Enabling whole key filtering
// can potentially reduce CPU usage for point-look-ups.
//
// Default: false (disable)
//
// Dynamically changeable through SetOptions() API
func (opts *Options) SetMemtableWholeKeyFiltering(value bool) {
C.rocksdb_options_set_memtable_whole_key_filtering(opts.c, boolToChar(value))
}

// EnableStatistics enable statistics.
func (opts *Options) EnableStatistics() {
C.rocksdb_options_enable_statistics(opts.c)
Expand Down
23 changes: 23 additions & 0 deletions v8/options_block_based_table.go
Original file line number Diff line number Diff line change
Expand Up @@ -18,6 +18,16 @@ const (
KTwoLevelIndexSearchIndexType = 2
)

// DataBlockIndexType specifies index type that will be used for the data block.
type DataBlockIndexType uint

const (
// KDataBlockIndexTypeBinarySearch is traditional block type
KDataBlockIndexTypeBinarySearch DataBlockIndexType = 0
// KDataBlockIndexTypeBinarySearchAndHash additional hash index
KDataBlockIndexTypeBinarySearchAndHash DataBlockIndexType = 1
)

// BlockBasedTableOptions represents block-based table options.
type BlockBasedTableOptions struct {
c *C.rocksdb_block_based_table_options_t
Expand Down Expand Up @@ -222,3 +232,16 @@ func (opts *BlockBasedTableOptions) SetFormatVersion(version int) {
func (opts *BlockBasedTableOptions) SetIndexType(value IndexType) {
C.rocksdb_block_based_options_set_index_type(opts.c, C.int(value))
}

// SetDataBlockIndexType sets data block index type
func (opts *BlockBasedTableOptions) SetDataBlockIndexType(value DataBlockIndexType) {
C.rocksdb_block_based_options_set_data_block_index_type(opts.c, C.int(value))
}

// SetDataBlockHashRatio is valid only when data_block_hash_index_type is
// KDataBlockIndexTypeBinarySearchAndHash.
//
// Default value: 0.75
func (opts *BlockBasedTableOptions) SetDataBlockHashRatio(value float64) {
C.rocksdb_block_based_options_set_data_block_hash_ratio(opts.c, C.double(value))
}

0 comments on commit 5ddc348

Please sign in to comment.