Skip to content
Merged
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
68 changes: 44 additions & 24 deletions options.go
Original file line number Diff line number Diff line change
Expand Up @@ -234,7 +234,8 @@ func (opts *Options) SetParanoidChecks(value bool) {
//
// For example, you have a flash device with 10GB allocated for the DB,
// as well as a hard drive of 2TB, you should config it to be:
// [{"/flash_path", 10GB}, {"/hard_drive", 2TB}]
//
// [{"/flash_path", 10GB}, {"/hard_drive", 2TB}]
//
// The system will try to guarantee data under each path is close to but
// not larger than the target size. But current and future file sizes used
Expand Down Expand Up @@ -546,11 +547,12 @@ func (opts *Options) SetMaxBytesForLevelMultiplier(value float64) {
// We will pick a base level b >= 1. L0 will be directly merged into level b,
// instead of always into level 1. Level 1 to b-1 need to be empty.
// We try to pick b and its target size so that
// 1. target size is in the range of
// (max_bytes_for_level_base / max_bytes_for_level_multiplier,
// max_bytes_for_level_base]
// 2. target size of the last level (level num_levels-1) equals to extra size
// of the level.
// 1. target size is in the range of
// (max_bytes_for_level_base / max_bytes_for_level_multiplier,
// max_bytes_for_level_base]
// 2. target size of the last level (level num_levels-1) equals to extra size
// of the level.
//
// At the same time max_bytes_for_level_multiplier and
// max_bytes_for_level_multiplier_additional are still satisfied.
//
Expand Down Expand Up @@ -821,17 +823,18 @@ func (opts *Options) SetWALRecoveryMode(mode WALRecoveryMode) {
// SetWALTtlSeconds sets the WAL ttl in seconds.
//
// The following two options affect how archived logs will be deleted.
// 1. If both set to 0, logs will be deleted asap and will not get into
// the archive.
// 2. If wal_ttl_seconds is 0 and wal_size_limit_mb is not 0,
// WAL files will be checked every 10 min and if total size is greater
// then wal_size_limit_mb, they will be deleted starting with the
// earliest until size_limit is met. All empty files will be deleted.
// 3. If wal_ttl_seconds is not 0 and wall_size_limit_mb is 0, then
// WAL files will be checked every wal_ttl_seconds / 2 and those that
// are older than wal_ttl_seconds will be deleted.
// 4. If both are not 0, WAL files will be checked every 10 min and both
// checks will be performed with ttl being first.
// 1. If both set to 0, logs will be deleted asap and will not get into
// the archive.
// 2. If wal_ttl_seconds is 0 and wal_size_limit_mb is not 0,
// WAL files will be checked every 10 min and if total size is greater
// then wal_size_limit_mb, they will be deleted starting with the
// earliest until size_limit is met. All empty files will be deleted.
// 3. If wal_ttl_seconds is not 0 and wall_size_limit_mb is 0, then
// WAL files will be checked every wal_ttl_seconds / 2 and those that
// are older than wal_ttl_seconds will be deleted.
// 4. If both are not 0, WAL files will be checked every 10 min and both
// checks will be performed with ttl being first.
//
// Default: 0
func (opts *Options) SetWALTtlSeconds(value uint64) {
C.rocksdb_options_set_WAL_ttl_seconds(opts.c, C.uint64_t(value))
Expand All @@ -853,6 +856,13 @@ func (opts *Options) SetEnablePipelinedWrite(value bool) {
C.rocksdb_options_set_enable_pipelined_write(opts.c, boolToChar(value))
}

// SetUnorderedWrite enables unordered writes
//
// Default: false
func (opts *Options) SetUnorderedWrite(value bool) {
C.rocksdb_options_set_unordered_write(opts.c, boolToChar(value))
}

// SetManifestPreallocationSize sets the number of bytes
// to preallocate (via fallocate) the manifest files.
//
Expand Down Expand Up @@ -1036,7 +1046,9 @@ func (opts *Options) SetInplaceUpdateNumLocks(value int) {
// If <=0, it won't allocate from huge page but from malloc.
// Users are responsible to reserve huge pages for it to be allocated. For
// example:
// sysctl -w vm.nr_hugepages=20
//
// sysctl -w vm.nr_hugepages=20
//
// See linux doc Documentation/vm/hugetlbpage.txt
// If there isn't enough free huge page available, it will fall back to
// malloc.
Expand Down Expand Up @@ -1104,7 +1116,8 @@ func (opts *Options) SetMemtableVectorRep() {
// bucketCount: number of fixed array buckets
// skiplistHeight: the max height of the skiplist
// skiplistBranchingFactor: probabilistic size ratio between adjacent
// link lists in the skiplist
//
// link lists in the skiplist
func (opts *Options) SetHashSkipListRep(bucketCount int, skiplistHeight, skiplistBranchingFactor int32) {
C.rocksdb_options_set_hash_skip_list_rep(opts.c, C.size_t(bucketCount), C.int32_t(skiplistHeight), C.int32_t(skiplistBranchingFactor))
}
Expand All @@ -1127,14 +1140,21 @@ func (opts *Options) SetHashLinkListRep(bucketCount int) {
// a linear search is used.
//
// keyLen: plain table has optimization for fix-sized keys,
// which can be specified via keyLen.
//
// which can be specified via keyLen.
//
// bloomBitsPerKey: the number of bits used for bloom filer per prefix. You
// may disable it by passing a zero.
//
// may disable it by passing a zero.
//
// hashTableRatio: the desired utilization of the hash table used for prefix
// hashing. hashTableRatio = number of prefixes / #buckets
// in the hash table
//
// hashing. hashTableRatio = number of prefixes / #buckets
// in the hash table
//
// indexSparseness: inside each prefix, need to build one index record for how
// many keys for binary search inside each hash bucket.
//
// many keys for binary search inside each hash bucket.
func (opts *Options) SetPlainTableFactory(keyLen uint32, bloomBitsPerKey int, hashTableRatio float64, indexSparseness int) {
C.rocksdb_options_set_plain_table_factory(opts.c, C.uint32_t(keyLen), C.int(bloomBitsPerKey), C.double(hashTableRatio), C.size_t(indexSparseness))
}
Expand Down