Skip to content

Commit

Permalink
Add options for rocksdb (#57)
Browse files Browse the repository at this point in the history
  • Loading branch information
DorianZheng authored and siddontang committed Aug 13, 2018
1 parent 5e98191 commit dfabd85
Show file tree
Hide file tree
Showing 448 changed files with 28,545 additions and 31,688 deletions.
152 changes: 81 additions & 71 deletions Gopkg.lock

Large diffs are not rendered by default.

1 change: 1 addition & 0 deletions Gopkg.toml
Original file line number Diff line number Diff line change
Expand Up @@ -78,6 +78,7 @@
[[constraint]]
branch = "master"
name = "github.com/tecbot/gorocksdb"
source = "https://github.com/DorianZheng/gorocksdb.git"

[prune]
go-tests = true
Expand Down
8 changes: 5 additions & 3 deletions Makefile
Original file line number Diff line number Diff line change
Expand Up @@ -9,15 +9,17 @@ endif

ifeq ($(ROCKSDB_CHECK), 0)
TAGS += rocksdb
endif
CGO_CXXFLAGS := "${CGO_CXXFLAGS} -std=c++11"
CGO_FLAGS += CGO_CXXFLAGS=$(CGO_CXXFLAGS)
endif

default: build

build:
ifeq ($(TAGS),)
go build -o bin/go-ycsb cmd/go-ycsb/*
$(CGO_FLAGS) go build -o bin/go-ycsb cmd/go-ycsb/*
else
go build -tags "$(TAGS)" -o bin/go-ycsb cmd/go-ycsb/*
$(CGO_FLAGS) go build -tags "$(TAGS)" -o bin/go-ycsb cmd/go-ycsb/*
endif

check:
Expand Down
3 changes: 3 additions & 0 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -166,6 +166,8 @@ You can pass the database configuraitons through `-p field=value` in the command
|rocksdb.use_direct_reads|false|Enable/Disable direct I/O mode (O_DIRECT) for reads|
|rocksdb.use_fsync|false|Enable/Disable fsync|
|rocksdb.write_buffer_size|64MB|Sets the amount of data to build up in memory (backed by an unsorted log on disk) before converting to a sorted on-disk file|
|rocksdb.max_write_buffer_number|2|Sets the maximum number of write buffers that are built up in memory|
|rocksdb.max_background_jobs|2|Sets maximum number of concurrent background jobs (compactions and flushes)|
|rocksdb.block_size|4KB|Sets the approximate size of user data packed per block. Note that the block size specified here corresponds opts uncompressed data. The actual size of the unit read from disk may be smaller if compression is enabled|
|rocksdb.block_size_deviation|10|Sets the block size deviation. This is used opts close a block before it reaches the configured 'block_size'. If the percentage of free space in the current block is less than this specified number and adding a new record opts the block will exceed the configured block size, then this block will be closed and the new record will be written opts the next block|
|rocksdb.cache_index_and_filter_blocks|false|Indicating if we'd put index/filter blocks to the block cache. If not specified, each "table reader" object will pre-load index/filter block during table initialization|
Expand All @@ -175,6 +177,7 @@ You can pass the database configuraitons through `-p field=value` in the command
|rocksdb.block_restart_interval|16|Sets the number of keys between restart points for delta encoding of keys. This parameter can be changed dynamically|
|rocksdb.filter_policy|nil|Sets the filter policy opts reduce disk reads. Many applications will benefit from passing the result of NewBloomFilterPolicy() here|
|rocksdb.index_type|kBinarySearch|Sets the index type used for this table. __kBinarySearch__: A space efficient index block that is optimized for binary-search-based index. __kHashSearch__: The hash index, if enabled, will do the hash lookup when `Options.prefix_extractor` is provided. __kTwoLevelIndexSearch__: A two-level index implementation. Both levels are binary search indexes|
|rocksdb.block_align|false|Enable/Disable align data blocks on lesser of page size and block size|

## TODO

Expand Down
7 changes: 6 additions & 1 deletion db/rocksdb/db.go
Original file line number Diff line number Diff line change
Expand Up @@ -40,7 +40,6 @@ const (
rocksdbLevel0FileNumCompactionTrigger = "rocksdb.level0_file_num_compaction_trigger"
rocksdbLevel0SlowdownWritesTrigger = "rocksdb.level0_slowdown_writes_trigger"
rocksdbLevel0StopWritesTrigger = "rocksdb.level0_stop_writes_trigger"
rocksdbMaxBackgroundFlushes = "rocksdb.max_background_flushes"
rocksdbMaxBytesForLevelBase = "rocksdb.max_bytes_for_level_base"
rocksdbMaxBytesForLevelMultiplier = "rocksdb.max_bytes_for_level_multiplier"
rocksdbMaxTotalWalSize = "rocksdb.max_total_wal_size"
Expand All @@ -49,6 +48,8 @@ const (
rocksdbUseDirectReads = "rocksdb.use_direct_reads"
rocksdbUseFsync = "rocksdb.use_fsync"
rocksdbWriteBufferSize = "rocksdb.write_buffer_size"
rocksdbMaxBackgroundJobs = "rocksdb.max_background_jobs"
rocksdbMaxWriteBufferNumber = "rocksdb.max_write_buffer_number"
// TableOptions/BlockBasedTable
rocksdbBlockSize = "rocksdb.block_size"
rocksdbBlockSizeDeviation = "rocksdb.block_size_deviation"
Expand All @@ -59,6 +60,7 @@ const (
rocksdbBlockRestartInterval = "rocksdb.block_restart_interval"
rocksdbFilterPolicy = "rocksdb.filter_policy"
rocksdbIndexType = "rocksdb.index_type"
rocksdbBlockAlign = "rocksdb.block_align"
// TODO: add more configurations
)

Expand Down Expand Up @@ -113,6 +115,7 @@ func getTableOptions(p *properties.Properties) *gorocksdb.BlockBasedTableOptions
tblOpts.SetPinL0FilterAndIndexBlocksInCache(p.GetBool(rocksdbPinL0FilterAndIndexBlocksInCache, false))
tblOpts.SetWholeKeyFiltering(p.GetBool(rocksdbWholeKeyFiltering, true))
tblOpts.SetBlockRestartInterval(p.GetInt(rocksdbBlockRestartInterval, 16))
tblOpts.SetBlockAlign(p.GetBool(rocksdbBlockAlign, false))

if b := p.GetString(rocksdbFilterPolicy, ""); len(b) > 0 {
if b == "rocksdb.BuiltinBloomFilter" {
Expand Down Expand Up @@ -154,6 +157,8 @@ func getOptions(p *properties.Properties) *gorocksdb.Options {
opts.SetUseDirectReads(p.GetBool(rocksdbUseDirectReads, false))
opts.SetUseFsync(p.GetBool(rocksdbUseFsync, false))
opts.SetWriteBufferSize(p.GetInt(rocksdbWriteBufferSize, 64<<20))
opts.SetMaxWriteBufferNumber(p.GetInt(rocksdbMaxWriteBufferNumber, 2))
opts.SetMaxBackgroundJobs(p.GetInt(rocksdbMaxBackgroundJobs, 2))

opts.SetBlockBasedTableFactory(getTableOptions(p))

Expand Down
21 changes: 21 additions & 0 deletions vendor/github.com/BurntSushi/toml/COPYING

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

14 changes: 14 additions & 0 deletions vendor/github.com/BurntSushi/toml/cmd/tomlv/COPYING

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

124 changes: 0 additions & 124 deletions vendor/github.com/aerospike/aerospike-client-go/client.go

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

Loading

0 comments on commit dfabd85

Please sign in to comment.