Table of Contents

Class DbOptions

Namespace
RocksDbNet
Assembly
RocksDb.Net.dll

Options used when opening a RocksDb instance. Maps to rocksdb_options_t.

public sealed class DbOptions : RocksDbHandle, IDisposable
Inheritance
DbOptions
Implements
Inherited Members

Constructors

DbOptions()

public DbOptions()

Properties

AdviseRandomOnOpen

Whether to hint the operating system that reads will be random when the database opens. Default is true.

public bool AdviseRandomOnOpen { get; set; }

Property Value

bool

Allow2Pc

If true, two-phase commit is allowed, which is required for transactions that prepare before committing.

public bool Allow2Pc { get; set; }

Property Value

bool

AllowConcurrentMemtableWrite

Allow concurrent inserts into the memtable from multiple threads.

public bool AllowConcurrentMemtableWrite { get; set; }

Property Value

bool

AllowDataInErrors

If true, error messages may include key and value data, which is useful for debugging but may leak sensitive content into logs.

public bool AllowDataInErrors { get; set; }

Property Value

bool

AllowFallocate

If true, RocksDb preallocates file space with fallocate. Disable on filesystems where preallocation is expensive.

public bool AllowFallocate { get; set; }

Property Value

bool

AllowIngestBehind

If true, allow ingesting files below the existing data. Deprecated by RocksDb; prefer CfAllowIngestBehind.

public bool AllowIngestBehind { get; set; }

Property Value

bool

Remarks

This is the old database-wide form. RocksDb has deprecated it in favour of the per-column-family setting, so use CfAllowIngestBehind for new code.

AllowMmapReads

Allow memory-mapped reads.

public bool AllowMmapReads { get; set; }

Property Value

bool

AllowMmapWrites

Allow memory-mapped writes.

public bool AllowMmapWrites { get; set; }

Property Value

bool

ArenaBlockSize

Block size the memtable allocates in, in bytes. Zero, the default, lets RocksDb derive it from WriteBufferSize.

public ulong ArenaBlockSize { get; set; }

Property Value

ulong

Remarks

RocksDb keeps this in a size_t. Every size option on this library is ulong regardless, so the same concept has one type everywhere rather than ulong on some members and nuint on others. On a 32-bit process a value above MaxValue cannot be represented and the setter throws OverflowException rather than truncating to something smaller than asked for.

AsyncWalPrecreate

If true, the next WAL file is created in the background before it is needed, smoothing out write latency at WAL rotation.

public bool AsyncWalPrecreate { get; set; }

Property Value

bool

AtomicFlush

If true, flush all column families atomically.

public bool AtomicFlush { get; set; }

Property Value

bool

AvoidFlushDuringRecovery

If true, data recovered from the WAL is not flushed to SST files during open, which speeds up recovery at the cost of replaying more WAL next time.

public bool AvoidFlushDuringRecovery { get; set; }

Property Value

bool

AvoidFlushDuringShutdown

If true, memtables are not flushed when the database is closed. Data is still durable if the WAL is enabled, but the next open replays more WAL.

public bool AvoidFlushDuringShutdown { get; set; }

Property Value

bool

AvoidUnnecessaryBlockingIo

Whether background threads should defer slow work such as deleting obsolete files, rather than doing it inline. Default is false.

public bool AvoidUnnecessaryBlockingIo { get; set; }

Property Value

bool

Remarks

For latency-sensitive callers. When enabled it overrides BackgroundPurgeOnIteratorCleanup.

BackgroundCloseInactiveWals

If true, WAL files that are no longer being written are closed on a background thread rather than on the write path.

public bool BackgroundCloseInactiveWals { get; set; }

Property Value

bool

BestEffortsRecovery

If true, open recovers as much data as it can rather than failing on corruption. Data may be silently lost, so use this only to salvage a damaged database.

public bool BestEffortsRecovery { get; set; }

Property Value

bool

BgErrorResumeRetryInterval

Interval in microseconds between attempts to recover from a background error.

public ulong BgErrorResumeRetryInterval { get; set; }

Property Value

ulong

BlobCache

A cache for blob values, separate from the block cache.

public Cache BlobCache { set; }

Property Value

Cache

Remarks

Only meaningful with EnableBlobFiles. Blobs live outside the SST files, so the block cache never holds them and a blob read goes to the file system every time until one of these exists. Giving blobs their own cache also keeps them from evicting index and filter blocks, which is the reason it is a separate cache rather than a share of the block cache.

PrepopulateBlobCache does nothing without this. There is no cache to prepopulate, so a flush has nowhere to put the blobs it just wrote.

RocksDb copies the shared pointer, so the cache may be shared with other options objects and with the block cache, and reused by a database opened later. Assigning registers no hold, exactly as SetBlockCache(Cache?) does not: destroying the handle only drops this library's reference, and RocksDb's own copy keeps the cache alive for as long as it needs it. Disposing the cache under a live database is therefore safe and immediate, verified over two hundred reads and a compaction after the fact.

Exceptions

ArgumentNullException

The value is null. Unlike SetBlockCache(Cache?), which the C API lets through as a no-op, the blob-cache setter dereferences what it is given without checking, so a null would be an access violation rather than nothing happening.

BlobCompactionReadaheadSize

Readahead size used when a compaction reads blob files, in bytes.

public ulong BlobCompactionReadaheadSize { get; set; }

Property Value

ulong

BlobCompression

Compression applied to blob files.

public Compression BlobCompression { get; set; }

Property Value

Compression

BlobDirectWritePartitions

Number of partitions used when writing blob files directly. Requires EnableBlobDirectWrite.

public uint BlobDirectWritePartitions { get; set; }

Property Value

uint

Remarks

Without direct blob writing enabled this setting does nothing, so set both or neither.

BlobFileSize

Size of a single blob file in bytes.

public ulong BlobFileSize { get; set; }

Property Value

ulong

BlobFileStartingLevel

The lowest level at which values are written to blob files rather than inline. Default is zero, meaning every level.

public int BlobFileStartingLevel { get; set; }

Property Value

int

Remarks

Raising this keeps the hot upper levels inline, where the extra indirection of a blob read costs most.

BlobGarbageCollectionAgeCutoff

The fraction of the oldest blob files that garbage collection considers, between 0 and 1.

public double BlobGarbageCollectionAgeCutoff { get; set; }

Property Value

double

BlobGarbageCollectionForceThreshold

The garbage fraction at which a blob file is collected regardless of its age, between 0 and 1.

public double BlobGarbageCollectionForceThreshold { get; set; }

Property Value

double

BlockBasedTableFactory

Configures block-based table options.

public BlockBasedTableOptions BlockBasedTableFactory { set; }

Property Value

BlockBasedTableOptions

BlockProtectionBytesPerKey

Per-key checksum bytes added to block data to detect in-memory corruption. 0 disables it. Larger values catch more corruption at the cost of memory.

public byte BlockProtectionBytesPerKey { get; set; }

Property Value

byte

BloomLocality

How many cache lines a Bloom filter probe is confined to. Zero, the default, spreads probes across the filter.

public uint BloomLocality { get; set; }

Property Value

uint

Remarks

A non-zero value trades a slightly higher false-positive rate for fewer cache misses per lookup.

BottommostCompression

Compression algorithm for the bottommost level.

public Compression BottommostCompression { get; set; }

Property Value

Compression

BottommostCompressionOptionsUseZstdDictTrainer

Whether the bottommost level's zstd dictionary is trained rather than sampled.

public bool BottommostCompressionOptionsUseZstdDictTrainer { get; }

Property Value

bool

Remarks

Read-only because the native setter takes a second argument that this getter cannot report. Use SetBottommostCompressionOptionsUseZstdDictTrainer(bool, bool).

BottommostFileCompactionDelay

Seconds to wait before compacting a bottommost file that has become eligible. 0 compacts without delay.

public uint BottommostFileCompactionDelay { get; set; }

Property Value

uint

BytesPerSync

Asks the operating system to sync this many bytes of an SST file incrementally while it is being written. Zero turns incremental syncing off, which is the default.

public ulong BytesPerSync { get; set; }

Property Value

ulong

Remarks

Zero means off, not "sync everything". The point of the setting is to spread write-back over time so a large file does not arrive at the disk in one burst at the end. Enabling a rate limiter raises this to 1 MB on its own. Does not apply to write-ahead log files; see WalBytesPerSync for those.

CalculateSstWriteLifetimeHintCount

The number of compaction styles the write lifetime hint is calculated for.

public int CalculateSstWriteLifetimeHintCount { get; }

Property Value

int

CfAllowIngestBehind

If true, this column family permits ingesting files below the existing data, which is required by IngestBehind. This is the setting to use, in preference to AllowIngestBehind.

public bool CfAllowIngestBehind { get; set; }

Property Value

bool

Remarks

It has to be set from the moment the column family is created, or at least before anything is written to it. Turning it on for a family that already holds data does not make ingest-behind work for that family.

ChecksumHandoffFileTypeCount

The number of file kinds checksum handoff is enabled for.

public int ChecksumHandoffFileTypeCount { get; }

Property Value

int

CompactionFilter

Attaches a compaction filter. The filter is invoked for every key-value pair during table-file creation (compaction and flush).

public CompactionFilter CompactionFilter { set; }

Property Value

CompactionFilter

Remarks

Disposing the filter is safe at any point. Attaching it registers a hold, so a using block that ends while the database is still open defers the release rather than performing it, and the native object goes when the last holder lets go. See the ownership guide.

CompactionFilterFactory

Attaches a compaction filter factory. RocksDb calls CreateFilter(CompactionFilterContext) at the start of each compaction or flush job and owns the returned filter.

public CompactionFilterFactory CompactionFilterFactory { set; }

Property Value

CompactionFilterFactory

Remarks

The C++ options object takes ownership of the factory via shared_ptr. Do not dispose value before the database and its options have been closed.

CompactionPri

How RocksDb chooses the next file to compact within a level. Default is MinOverlappingRatio.

public CompactionPri CompactionPri { get; set; }

Property Value

CompactionPri

CompactionReadaheadSize

Size of the readahead buffer used for compaction, in bytes.

public ulong CompactionReadaheadSize { get; set; }

Property Value

ulong

CompactionStyle

Compaction algorithm.

public CompactionStyle CompactionStyle { get; set; }

Property Value

CompactionStyle

CompactionVerifyRecordCount

If true, compaction verifies that the number of records written matches the number read, catching silent data loss.

public bool CompactionVerifyRecordCount { get; set; }

Property Value

bool

Comparator

Attaches a custom comparator for key ordering.

public Comparator Comparator { set; }

Property Value

Comparator

Compression

Compression algorithm for all levels.

public Compression Compression { get; set; }

Property Value

Compression

CompressionOptionsMaxDictBufferBytes

Maximum bytes buffered while building a compression dictionary. Zero disables the limit.

public ulong CompressionOptionsMaxDictBufferBytes { get; set; }

Property Value

ulong

CompressionOptionsParallelThreads

Threads a single block's compression may use.

public int CompressionOptionsParallelThreads { get; set; }

Property Value

int

CompressionOptionsUseZstdDictTrainer

Whether the zstd dictionary is trained rather than sampled. Training costs more to build and usually compresses better.

public bool CompressionOptionsUseZstdDictTrainer { get; set; }

Property Value

bool

CompressionOptionsZstdMaxTrainBytes

Bytes of sample data used to train a zstd dictionary.

public int CompressionOptionsZstdMaxTrainBytes { get; set; }

Property Value

int

CreateIfMissing

If true, create the database directory if it does not exist.

public bool CreateIfMissing { get; set; }

Property Value

bool

CreateMissingColumnFamilies

If true, create missing column families on open.

public bool CreateMissingColumnFamilies { get; set; }

Property Value

bool

DailyOffpeakTimeUtc

Daily window in which RocksDb may schedule extra background work, as "HH:mm-HH:mm" in UTC. An empty string disables it.

public string DailyOffpeakTimeUtc { get; set; }

Property Value

string

DbHostId

Host identifier recorded in SST files and the manifest. Useful for tracing which machine produced a file.

public string DbHostId { get; set; }

Property Value

string

DbLogDir

The directory where RocksDb writes log files. An empty string means the database path is used.

public string DbLogDir { get; set; }

Property Value

string

DbWriteBufferSize

DB-level write buffer size cap (across all column families).

public ulong DbWriteBufferSize { get; set; }

Property Value

ulong

DefaultTemperature

Storage temperature applied to files with no more specific temperature setting.

public Temperature DefaultTemperature { get; set; }

Property Value

Temperature

DefaultWriteTemperature

Storage temperature for newly written files.

public Temperature DefaultWriteTemperature { get; set; }

Property Value

Temperature

DelayedWriteRate

Rate in bytes per second that writes are throttled to when RocksDb needs to slow the writer down. 0 lets RocksDb choose.

public ulong DelayedWriteRate { get; set; }

Property Value

ulong

DeleteObsoleteFilesPeriodMicros

How often obsolete files are swept, in microseconds. Zero disables the periodic sweep, leaving deletion to happen alongside compaction.

public ulong DeleteObsoleteFilesPeriodMicros { get; set; }

Property Value

ulong

DisableAutoCompactions

Disables automatic compactions.

public bool DisableAutoCompactions { get; set; }

Property Value

bool

DisallowMemtableWrites

If true, writes to this column family's memtable are rejected, which guards a family that is only ever populated by file ingestion. Not supported on the default column family.

public bool DisallowMemtableWrites { get; set; }

Property Value

bool

Remarks

RocksDb rejects this setting on the "default" column family because of the error-handling difficulties it creates there, so it is only usable on a family you created yourself.

DumpMallocStats

If true, memory allocator statistics are included in the log when statistics are dumped.

public bool DumpMallocStats { get; set; }

Property Value

bool

EnableBlobDirectWrite

If true, blob files are written directly rather than through the regular write path.

public bool EnableBlobDirectWrite { get; set; }

Property Value

bool

EnableBlobFiles

Enable storing large values in separate blob files.

public bool EnableBlobFiles { get; set; }

Property Value

bool

EnableBlobGarbageCollection

Enable garbage collection for blob files during compaction.

public bool EnableBlobGarbageCollection { get; set; }

Property Value

bool

EnablePipelinedWrite

Whether the write-ahead log write and the memtable insert run on separate threads. Default is false.

public bool EnablePipelinedWrite { get; set; }

Property Value

bool

Remarks

Raises write throughput under concurrency at the cost of some latency on an individual write.

EnableThreadTracking

If true, RocksDb tracks per-thread operation status, which is visible through its thread-status API. Adds a small overhead.

public bool EnableThreadTracking { get; set; }

Property Value

bool

EnableWriteThreadAdaptiveYield

Whether writer threads spin briefly before yielding. Default is true.

public bool EnableWriteThreadAdaptiveYield { get; set; }

Property Value

bool

EnforceSingleDelContracts

If true, RocksDb enforces the rule that a single delete matches at most one put. Violations become errors rather than undefined behaviour.

public bool EnforceSingleDelContracts { get; set; }

Property Value

bool

EnforceWriteBufferManagerDuringRecovery

If true, the write buffer manager memory limit is enforced while recovering from the WAL, not only during normal operation.

public bool EnforceWriteBufferManagerDuringRecovery { get; set; }

Property Value

bool

Env

Sets the environment for the database options.

public Env Env { set; }

Property Value

Env

ErrorIfExists

If true, return an error if the database already exists.

public bool ErrorIfExists { get; set; }

Property Value

bool

ExperimentalMempurgeThreshold

Threshold for the experimental memtable purge, as a multiple of the write buffer size. Zero disables it.

public double ExperimentalMempurgeThreshold { get; set; }

Property Value

double

Remarks

RocksDb marks this experimental. It discards memtable entries that later writes have already superseded, avoiding a flush.

FastSstOpen

If true, file system metadata for SST files is recorded in the manifest and reused to speed up reopening them. Experimental.

public bool FastSstOpen { get; set; }

Property Value

bool

Remarks

No validation is skipped, and nothing is traded away for the speed. The saving comes from not having to ask the file system again for metadata already known at write time, which matters most on remote storage where those calls are slow. Requires file system support; without it the setting simply does nothing.

FifoCompactionOptions

Attaches tuning for FIFO compaction.

public FifoCompactionOptions FifoCompactionOptions { set; }

Property Value

FifoCompactionOptions

Remarks

Only used when CompactionStyle is Fifo. RocksDb copies the values, so the instance may be disposed immediately afterwards.

FlushVerifyMemtableCount

If true, flush verifies that the number of entries written matches the memtable count, catching silent data loss.

public bool FlushVerifyMemtableCount { get; set; }

Property Value

bool

FollowerCatchupRetryCount

Number of times a follower instance retries catching up to the leader before giving up.

public ulong FollowerCatchupRetryCount { get; set; }

Property Value

ulong

FollowerCatchupRetryWaitMs

Milliseconds a follower waits between catch-up attempts.

public ulong FollowerCatchupRetryWaitMs { get; set; }

Property Value

ulong

FollowerRefreshCatchupPeriodMs

Milliseconds between a follower refreshing its view of the leader.

public ulong FollowerRefreshCatchupPeriodMs { get; set; }

Property Value

ulong

ForceConsistencyChecks

If true, RocksDb checks LSM structure consistency and fails the operation on a violation rather than continuing with a corrupt view. On by default in recent versions.

public bool ForceConsistencyChecks { get; set; }

Property Value

bool

HardPendingCompactionBytesLimit

Pending compaction bytes at which writes are stopped outright, rather than slowed. Zero disables the limit.

public ulong HardPendingCompactionBytesLimit { get; set; }

Property Value

ulong

Remarks

The harder counterpart to SoftPendingCompactionBytesLimit. Reaching this means compaction has fallen far enough behind that RocksDb would rather block writers than let the backlog grow.

InfoLog

Attaches a custom info logger.

public Logger InfoLog { set; }

Property Value

Logger

InfoLogLevel

Info log verbosity level.

public InfoLogLevel InfoLogLevel { get; set; }

Property Value

InfoLogLevel

Remarks

Applies to the logger RocksDb creates for itself. It does not filter a logger supplied through InfoLog: measured over a database open, write and flush, setting this to Warn changed neither the number of messages a custom logger received nor their levels. The level such a logger is constructed with is the only one that has any effect on it, and even that lets through messages RocksDb logs without a level. See issue #129.

InplaceUpdateNumLocks

How many locks guard in-place memtable updates. Only used when InplaceUpdateSupport is enabled.

public ulong InplaceUpdateNumLocks { get; set; }

Property Value

ulong

InplaceUpdateSupport

Whether a write may overwrite an existing memtable entry in place rather than appending a new version. Default is false.

public bool InplaceUpdateSupport { get; set; }

Property Value

bool

Remarks

Saves memory for workloads that overwrite the same keys repeatedly, but it is incompatible with snapshots and merge operators, because the superseded version is gone.

IsFdCloseOnExec

Whether file descriptors are closed in child processes. Default is true.

public bool IsFdCloseOnExec { get; set; }

Property Value

bool

KeepLogFileNum

Maximum number of info log files to keep.

public ulong KeepLogFileNum { get; set; }

Property Value

ulong

LastLevelTemperature

Storage temperature for files in the last level, which typically hold the coldest data.

public Temperature LastLevelTemperature { get; set; }

Property Value

Temperature

Level0FileNumCompactionTrigger

Number of files at level-0 that triggers compaction.

public int Level0FileNumCompactionTrigger { get; set; }

Property Value

int

Level0SlowdownWritesTrigger

Number of level-0 files that triggers write slowdown.

public int Level0SlowdownWritesTrigger { get; set; }

Property Value

int

Level0StopWritesTrigger

Number of level-0 files that triggers a full write stop.

public int Level0StopWritesTrigger { get; set; }

Property Value

int

LevelCompactionDynamicLevelBytes

If true, RocksDb dynamically adjusts the files sizes in each level.

public bool LevelCompactionDynamicLevelBytes { get; set; }

Property Value

bool

LogFileTimeToRoll

How often the info log is rolled, in seconds. Zero disables time-based rolling, leaving only the size limit.

public ulong LogFileTimeToRoll { get; set; }

Property Value

ulong

LogReadaheadSize

Readahead size in bytes used when reading the WAL. 0 lets RocksDb choose.

public ulong LogReadaheadSize { get; set; }

Property Value

ulong

LowestUsedCacheTier

The lowest cache tier reads are allowed to use. Restricting this keeps reads out of slower tiers.

public CacheTier LowestUsedCacheTier { get; set; }

Property Value

CacheTier

ManifestPreallocationSize

Bytes preallocated for the manifest file.

public ulong ManifestPreallocationSize { get; set; }

Property Value

ulong

ManualWalFlush

If true, WAL is flushed only when explicitly requested.

public bool ManualWalFlush { get; set; }

Property Value

bool

MaxBackgroundCompactions

Maximum number of concurrent background compaction jobs.

public int MaxBackgroundCompactions { get; set; }

Property Value

int

MaxBackgroundFlushes

Maximum number of concurrent background flush jobs.

public int MaxBackgroundFlushes { get; set; }

Property Value

int

MaxBackgroundJobs

Total count of background jobs (compactions + flushes).

public int MaxBackgroundJobs { get; set; }

Property Value

int

MaxBgErrorResumeCount

Maximum number of automatic attempts to recover from a background error. 0 disables automatic recovery.

public int MaxBgErrorResumeCount { get; set; }

Property Value

int

MaxBytesForLevelBase

Maximum total size of level-1 data in bytes.

public ulong MaxBytesForLevelBase { get; set; }

Property Value

ulong

MaxBytesForLevelMultiplier

Multiplier for computing max bytes at each subsequent level.

public double MaxBytesForLevelMultiplier { get; set; }

Property Value

double

MaxCompactionBytes

Maximum size of a single compaction, in bytes.

public ulong MaxCompactionBytes { get; set; }

Property Value

ulong

MaxCompactionTriggerWakeupSeconds

Maximum seconds RocksDb sleeps before re-checking whether a compaction should start.

public ulong MaxCompactionTriggerWakeupSeconds { get; set; }

Property Value

ulong

MaxFileOpeningThreads

Threads used to open files when the database starts.

public int MaxFileOpeningThreads { get; set; }

Property Value

int

MaxLogFileSize

Maximum size of a single info log file before rotation, in bytes.

public ulong MaxLogFileSize { get; set; }

Property Value

ulong

MaxManifestFileSize

Size at which the manifest is rolled, in bytes.

public ulong MaxManifestFileSize { get; set; }

Property Value

ulong

Remarks

The manifest records every change to the file set, so it grows with activity rather than with data. Left unbounded it can become the largest thing in the directory.

MaxManifestSpaceAmpPct

Manifest space amplification limit as a percentage, above which the manifest is rewritten.

public int MaxManifestSpaceAmpPct { get; set; }

Property Value

int

MaxOpenFiles

Maximum number of open files. -1 = unlimited.

public int MaxOpenFiles { get; set; }

Property Value

int

MaxSequentialSkipInIterations

How many superseded versions of a key an iterator skips before it reseeks rather than stepping.

public ulong MaxSequentialSkipInIterations { get; set; }

Property Value

ulong

MaxSubcompactions

Maximum number of subcompactions per compaction job.

public uint MaxSubcompactions { get; set; }

Property Value

uint

MaxSuccessiveMerges

How many merge operands for one key accumulate in the memtable before they are combined eagerly. Zero, the default, never combines early.

public ulong MaxSuccessiveMerges { get; set; }

Property Value

ulong

Remarks

Bounds the cost of reading a key that has been merged many times, at the price of doing merge work on the write path.

MaxTotalWalSize

Total WAL size limit (bytes) before a column-family flush is triggered.

public ulong MaxTotalWalSize { get; set; }

Property Value

ulong

MaxWriteBatchGroupSizeBytes

Maximum combined size in bytes of write batches grouped into a single write.

public ulong MaxWriteBatchGroupSizeBytes { get; set; }

Property Value

ulong

MaxWriteBufferNumber

Maximum number of write buffers that are built up in memory.

public int MaxWriteBufferNumber { get; set; }

Property Value

int

MaxWriteBufferSizeToMaintain

Maximum size of the write buffer to maintain, in bytes.

public long MaxWriteBufferSizeToMaintain { get; set; }

Property Value

long

MemtableAvgOpScanFlushTrigger

Average operations scanned per memtable entry above which a flush is triggered. Zero disables it.

public uint MemtableAvgOpScanFlushTrigger { get; set; }

Property Value

uint

MemtableBatchLookupOptimization

If true, multi-key lookups against the memtable use a batched path.

public bool MemtableBatchLookupOptimization { get; set; }

Property Value

bool

MemtableHugePageSize

Huge page size to allocate the memtable with, in bytes. Zero, the default, uses ordinary pages.

public ulong MemtableHugePageSize { get; set; }

Property Value

ulong

MemtableMaxRangeDeletions

Number of range deletions in a memtable that triggers a flush. 0 means no limit.

public uint MemtableMaxRangeDeletions { get; set; }

Property Value

uint

MemtableOpScanFlushTrigger

Operations scanned in the memtable above which a flush is triggered. Zero disables it.

public uint MemtableOpScanFlushTrigger { get; set; }

Property Value

uint

MemtablePrefixBloomSizeRatio

Fraction of memtable size allocated to the prefix bloom filter (0.0 to 1.0).

public double MemtablePrefixBloomSizeRatio { get; set; }

Property Value

double

MemtableProtectionBytesPerKey

Per-key checksum bytes added to memtable entries to detect in-memory corruption. 0 disables it.

public uint MemtableProtectionBytesPerKey { get; set; }

Property Value

uint

MemtableVerifyPerKeyChecksumOnSeek

If true, memtable per-key checksums are verified on seek as well as on read.

public bool MemtableVerifyPerKeyChecksumOnSeek { get; set; }

Property Value

bool

MemtableWholeKeyFiltering

If true, the memtable keeps a whole-key bloom filter, which speeds up point lookups that miss.

public bool MemtableWholeKeyFiltering { get; set; }

Property Value

bool

MergeOperator

Attaches a custom merge operator.

public MergeOperator MergeOperator { set; }

Property Value

MergeOperator

MetadataWriteTemperature

Storage temperature for newly written metadata files such as the manifest.

public Temperature MetadataWriteTemperature { get; set; }

Property Value

Temperature

MinBlobSize

Minimum value size (in bytes) to be stored in a blob file.

public ulong MinBlobSize { get; set; }

Property Value

ulong

MinTombstonesForRangeConversion

Number of adjacent tombstones before RocksDb converts them into a range deletion.

public uint MinTombstonesForRangeConversion { get; set; }

Property Value

uint

MinWriteBufferNumberToMerge

Minimum number of write buffers to merge before flushing to storage.

public int MinWriteBufferNumberToMerge { get; set; }

Property Value

int

NumLevels

Number of levels used for level-style compaction.

public int NumLevels { get; set; }

Property Value

int

OpenFilesAsync

Whether files are opened asynchronously when the database starts. Default is false.

public bool OpenFilesAsync { get; set; }

Property Value

bool

OptimizeFiltersForHits

Whether Bloom filters are omitted from the bottommost level. Default is false.

public bool OptimizeFiltersForHits { get; set; }

Property Value

bool

Remarks

Worth enabling when almost every read finds its key. The bottommost level holds most of the data, so its filters are most of the filter memory, and a filter only pays for itself on lookups that miss.

The native setter takes an int while its getter returns a byte. Both are treated as a boolean here, which is what RocksDb means by them.

OptimizeManifestForRecovery

If true, the manifest is written in a form that makes recovery faster.

public bool OptimizeManifestForRecovery { get; set; }

Property Value

bool

ParanoidChecks

If true, perform extra checks on data to detect corruption.

public bool ParanoidChecks { get; set; }

Property Value

bool

ParanoidFileChecks

If true, RocksDb re-reads and validates each file it writes. Catches storage problems early at a significant cost in write throughput.

public bool ParanoidFileChecks { get; set; }

Property Value

bool

ParanoidMemoryChecks

If true, RocksDb performs extra validation of in-memory structures.

public bool ParanoidMemoryChecks { get; set; }

Property Value

bool

PeriodicCompactionSeconds

Interval (in seconds) for periodic compaction of all files.

public ulong PeriodicCompactionSeconds { get; set; }

Property Value

ulong

PersistStatsToDisk

If true, statistics are persisted to a hidden column family so they survive a restart.

public bool PersistStatsToDisk { get; set; }

Property Value

bool

PersistUserDefinedTimestamps

If true, user-defined timestamps are written to SST files. Setting this false discards them during compaction.

public bool PersistUserDefinedTimestamps { get; set; }

Property Value

bool

PrecludeLastLevelDataSeconds

Data written within this many seconds is kept out of the last level, so recent data stays on faster storage. 0 disables it.

public ulong PrecludeLastLevelDataSeconds { get; set; }

Property Value

ulong

PrefixExtractor

Attaches a prefix extractor (slice transform).

public SliceTransform PrefixExtractor { set; }

Property Value

SliceTransform

PrefixSeekOptInOnly

If true, prefix seek behaviour applies only when a read explicitly opts in, rather than being inferred from the prefix extractor.

public bool PrefixSeekOptInOnly { get; set; }

Property Value

bool

PrepopulateBlobCache

Whether newly written blobs are put straight into the blob cache. Default is Disable.

public PrepopulateBlobCache PrepopulateBlobCache { get; set; }

Property Value

PrepopulateBlobCache

PreserveInternalTimeSeconds

How many seconds of write-time information RocksDb retains, which enables time-aware features such as temperature placement. 0 disables it.

public ulong PreserveInternalTimeSeconds { get; set; }

Property Value

ulong

RateLimiter

Attaches a rate limiter.

public RateLimiter RateLimiter { set; }

Property Value

RateLimiter

Remarks

RocksDb copies the shared pointer, so the limiter may be shared between options objects and reused by a database opened later. Assigning registers no hold, exactly as a cache does not: destroying the handle only drops this library's reference, and RocksDb's own copy keeps the limiter alive for as long as it needs it.

ReadIoExecutorThreads

Number of threads used by the read I/O executor. 0 lets RocksDb choose.

public int ReadIoExecutorThreads { get; set; }

Property Value

int

ReadTriggeredCompactionThreshold

How much of a file has to be read, relative to its size, before reads alone mark it for compaction.

public double ReadTriggeredCompactionThreshold { get; set; }

Property Value

double

Remarks

The numerator is the bytes read through collapsible reads rather than bytes read once: repeatedly reading the same part of a file counts each time. So this is not a fraction of the file bounded by one, and a value above one is meaningful.

RecycleLogFileNum

How many write-ahead log files are kept and reused rather than deleted and recreated. Zero, the default, recreates them.

public ulong RecycleLogFileNum { get; set; }

Property Value

ulong

Remarks

Reusing a file avoids the filesystem metadata work of creating one, which shows up on write-heavy workloads with frequent log rolls.

ReportBgIoStats

Whether background I/O is accounted per operation. Default is false.

public bool ReportBgIoStats { get; set; }

Property Value

bool

Remarks

As with OptimizeFiltersForHits, the native setter takes an int and its getter returns a byte; both mean a boolean.

ReuseManifestOnOpen

If true, an existing manifest is appended to rather than rewritten at open, making open faster.

public bool ReuseManifestOnOpen { get; set; }

Property Value

bool

RowCache

Attaches a row cache.

public Cache RowCache { set; }

Property Value

Cache

SampleForCompression

Sample one in this many blocks to measure how well they compress. 0 disables sampling.

public ulong SampleForCompression { get; set; }

Property Value

ulong

SkipStatsUpdateOnDbOpen

Whether opening the database skips gathering file statistics. Default is false.

public bool SkipStatsUpdateOnDbOpen { get; set; }

Property Value

bool

Remarks

Speeds up opening a database with many files, at the cost of compaction making worse decisions until the statistics are rebuilt.

SoftPendingCompactionBytesLimit

Pending compaction bytes at which writes start being slowed down. Zero disables the limit.

public ulong SoftPendingCompactionBytesLimit { get; set; }

Property Value

ulong

Remarks

The gentler counterpart to HardPendingCompactionBytesLimit: writers are throttled so that compaction can catch up, rather than stopped.

SstFileManager

Attaches a disk-space governor, capping how much space the database may use and how fast it may delete files.

public SstFileManager SstFileManager { set; }

Property Value

SstFileManager

Remarks

RocksDb takes a shared reference rather than ownership, so the instance may be disposed once assigned, and the same one may be given to several databases to place them under a common budget. That is why it is not added to the owned handles.

SstPartitionerFactory

Aligns SST file boundaries with key prefixes.

public SstPartitionerFactory SstPartitionerFactory { set; }

Property Value

SstPartitionerFactory

Remarks

Without one, a compaction splits files wherever the size target falls, so a prefix's data can straddle several files and each file can hold several prefixes. That blunts prefix-scoped work: a range delete cannot drop whole files and a prefix scan reads more of them than it needs. RocksDb takes a shared reference, so the factory may be disposed once assigned.

StatisticsLevel

How much detail statistics collect.

public StatsLevel StatisticsLevel { get; set; }

Property Value

StatsLevel

Remarks

Call EnableStatistics() first. RocksDb keeps the level on the statistics object rather than on the options, so both the setter and the getter here are silent no-ops until one exists: setting does nothing and reading returns DisableAll whatever was assigned.

Values outside the enum are clamped natively rather than rejected.

StatsDumpPeriodSec

Period (in seconds) between statistics dumps to the info log.

public uint StatsDumpPeriodSec { get; set; }

Property Value

uint

StatsHistoryBufferSize

Bytes of in-memory statistics history to retain.

public ulong StatsHistoryBufferSize { get; set; }

Property Value

ulong

StatsPersistPeriodSec

How often statistics are persisted to the in-memory history buffer, in seconds. Zero disables it. Defaults to 600.

public uint StatsPersistPeriodSec { get; set; }

Property Value

uint

Remarks

Not the info-log dump, which is StatsDumpPeriodSec. This one feeds the statistics history RocksDb keeps in memory.

StrictBytesPerSync

If true, BytesPerSync and WalBytesPerSync are treated as hard limits rather than hints, giving more predictable I/O at some cost in throughput.

public bool StrictBytesPerSync { get; set; }

Property Value

bool

StrictMaxSuccessiveMerges

If true, MaxSuccessiveMerges is enforced strictly, even when doing so requires extra work on the read path.

public bool StrictMaxSuccessiveMerges { get; set; }

Property Value

bool

TableCacheNumShardBits

Base-2 logarithm of the number of shards in the table cache. Negative lets RocksDb choose.

public int TableCacheNumShardBits { get; set; }

Property Value

int

TargetFileSizeBase

Target file size for SST files at level-1, in bytes.

public ulong TargetFileSizeBase { get; set; }

Property Value

ulong

TargetFileSizeIsUpperBound

If true, TargetFileSizeBase is an upper bound rather than a target, so files never exceed it.

public bool TargetFileSizeIsUpperBound { get; set; }

Property Value

bool

TargetFileSizeMultiplier

Factor by which the target file size grows with each level. Default is 1, meaning every level uses the same file size.

public int TargetFileSizeMultiplier { get; set; }

Property Value

int

TrackAndVerifyWals

If true, WAL files are tracked in the manifest and verified at open, so a missing or truncated WAL is detected rather than silently ignored.

public bool TrackAndVerifyWals { get; set; }

Property Value

bool

TrackAndVerifyWalsInManifest

Whether write-ahead log files are recorded in the manifest and verified on recovery. Default is false.

public bool TrackAndVerifyWalsInManifest { get; set; }

Property Value

bool

Remarks

Catches a log file that has gone missing, which would otherwise be indistinguishable from one that never existed.

Ttl

Time-to-live for data in seconds.

public ulong Ttl { get; set; }

Property Value

ulong

Remarks

What expiry means depends on the compaction style, and only one of them deletes anything. Under FIFO compaction, files older than this are dropped. Under level and universal compaction, reaching this age only schedules the file to be rewritten, which refreshes it rather than removing its entries. Use a CompactionFilter if you need entries themselves to expire.

TwoWriteQueues

If true, WAL writes and memtable writes use separate queues, which improves throughput for two-phase commit workloads.

public bool TwoWriteQueues { get; set; }

Property Value

bool

UncacheAggressiveness

How aggressively blocks belonging to deleted files are evicted from the block cache. 0 leaves them to age out normally.

public uint UncacheAggressiveness { get; set; }

Property Value

uint

UniversalCompactionOptions

Attaches tuning for universal compaction.

public UniversalCompactionOptions UniversalCompactionOptions { set; }

Property Value

UniversalCompactionOptions

Remarks

Only used when CompactionStyle is Universal. RocksDb copies the values, so the instance may be disposed immediately afterwards.

UnorderedWrite

Whether writes may be applied out of order. Default is false.

public bool UnorderedWrite { get; set; }

Property Value

bool

Remarks

Raises write throughput but weakens the guarantees: snapshots and read-your-own-writes no longer hold as they otherwise would. Read RocksDb's own notes before enabling it.

UseAdaptiveMutex

Whether mutexes spin before sleeping. Default is false.

public bool UseAdaptiveMutex { get; set; }

Property Value

bool

UseDirectIoForCompactionReads

If true, compaction reads its input SST files with O_DIRECT, bypassing the OS page cache, while ordinary user reads stay buffered.

public bool UseDirectIoForCompactionReads { get; set; }

Property Value

bool

Remarks

A database-level option, not a column-family one. It exists so that the long sequential reads a compaction performs do not evict the working set that user reads depend on. It is the read-side counterpart to UseDirectIoForFlushAndCompaction, and the two are often set together.

UseDirectIoForFlushAndCompaction

Enable direct I/O for flush and compaction writes.

public bool UseDirectIoForFlushAndCompaction { get; set; }

Property Value

bool

UseDirectReads

Enable direct I/O for reads, bypassing the OS page cache.

public bool UseDirectReads { get; set; }

Property Value

bool

UseFsync

Use fsync instead of fdatasync for syncing data to disk.

public bool UseFsync { get; set; }

Property Value

bool

VerifyManifestContentOnClose

If true, the manifest is read back and verified when the database is closed.

public bool VerifyManifestContentOnClose { get; set; }

Property Value

bool

VerifyOutputFlags

Which verifications RocksDb runs over the files a compaction produces.

public VerifyOutputFlags VerifyOutputFlags { get; set; }

Property Value

VerifyOutputFlags

Remarks

Needs a bit from each of the two groups in VerifyOutputFlags to have any effect. Unchecked on the way out because All is every bit set, which the C API takes as -1.

VerifySstUniqueIdInManifest

If true, each SST file unique identifier is checked against the manifest at open, detecting a file that has been swapped or truncated.

public bool VerifySstUniqueIdInManifest { get; set; }

Property Value

bool

WalBytesPerSync

Same as BytesPerSync but for write-ahead log files. Zero turns incremental syncing off, which is the default.

public ulong WalBytesPerSync { get; set; }

Property Value

ulong

Remarks

Zero means off, not "sync after every write". For durability per write, use Sync instead.

WalCompression

Compression type for WAL files.

public Compression WalCompression { get; set; }

Property Value

Compression

WalDir

The directory where WAL files are stored. An empty string means the database path is used.

public string WalDir { get; set; }

Property Value

string

WalRecoveryMode

WAL recovery mode used when opening the database.

public WalRecoveryMode WalRecoveryMode { get; set; }

Property Value

WalRecoveryMode

WalSizeLimitMb

Size cap in MB on the archive of obsolete write-ahead logs. Once the archive exceeds it, the oldest archived logs are deleted until it fits.

public ulong WalSizeLimitMb { get; set; }

Property Value

ulong

Remarks

This governs deletion, not archiving. Archiving is what happens when either this or WalTtlSeconds is non-zero: while both are zero, an obsolete log is deleted immediately and never archived at all.

WalTtlSeconds

Time-to-live for WAL files in seconds (0 = no TTL).

public ulong WalTtlSeconds { get; set; }

Property Value

ulong

WalWriteTemperature

Storage temperature for newly written WAL files.

public Temperature WalWriteTemperature { get; set; }

Property Value

Temperature

WritableFileMaxBufferSize

Largest buffer used when writing a file, in bytes.

public ulong WritableFileMaxBufferSize { get; set; }

Property Value

ulong

WriteBufferManager

Attaches a memtable memory budget shared across column families, and across databases if the same instance is given to each.

public WriteBufferManager WriteBufferManager { set; }

Property Value

WriteBufferManager

Remarks

WriteBufferSize bounds one memtable; this bounds their total. RocksDb takes a shared reference rather than ownership, so the instance may be disposed once assigned.

WriteBufferSize

Amount of data (in bytes) to build up in memory before writing to disk.

public ulong WriteBufferSize { get; set; }

Property Value

ulong

WriteDbIdToManifest

Whether the database's unique identifier is stored in the manifest. Default is true, which is what RocksDb prefers.

public bool WriteDbIdToManifest { get; set; }

Property Value

bool

WriteIdentityFile

Whether the database's unique identifier is also written to a separate IDENTITY file, which RocksDb keeps for compatibility.

public bool WriteIdentityFile { get; set; }

Property Value

bool

WriteThreadMaxYieldUsec

Microseconds a writer spins yielding to other threads before blocking.

public ulong WriteThreadMaxYieldUsec { get; set; }

Property Value

ulong

WriteThreadSlowYieldUsec

Microseconds above which a yield is considered slow, which makes the writer stop spinning and block instead.

public ulong WriteThreadSlowYieldUsec { get; set; }

Property Value

ulong

Methods

AddCalculateSstWriteLifetimeHint(CompactionStyle)

Asks RocksDb to calculate an SST write lifetime hint for compactionStyle. The hint is passed to the filesystem, which may use it to place data.

public DbOptions AddCalculateSstWriteLifetimeHint(CompactionStyle compactionStyle)

Parameters

compactionStyle CompactionStyle

Returns

DbOptions

AddChecksumHandoffFileType(FileType)

Enables checksum handoff for fileType, asking the filesystem to verify the checksum RocksDb computed. Only takes effect on a filesystem that supports it.

public DbOptions AddChecksumHandoffFileType(FileType fileType)

Parameters

fileType FileType

Returns

DbOptions

AddCompactOnDeletionCollector(ulong, ulong, double, ulong)

Marks an SST file for compaction when it accumulates too many tombstones, so that deleted data is reclaimed sooner than the ordinary compaction schedule would manage.

public DbOptions AddCompactOnDeletionCollector(ulong windowSize, ulong deletionTrigger, double deletionRatio = 0, ulong minFileSize = 0)

Parameters

windowSize ulong

How many consecutive entries the sliding window covers. A file is marked when any window of this many entries holds at least deletionTrigger deletions.

deletionTrigger ulong

How many deletions within a window trigger the mark.

deletionRatio double

An additional whole-file test: a file whose deleted fraction reaches this is marked regardless of how the deletions are distributed. Zero, the default, disables it.

minFileSize ulong

Files smaller than this are exempt from the deletionRatio test. Zero, the default, exempts none.

Returns

DbOptions

Remarks

Aimed at workloads that delete in bursts, such as queues and anything with a time-to-live. Without it, a file full of tombstones sits until compaction reaches it on size grounds, and every read through that key range pays for walking them.

Marking a file makes it eligible; RocksDb still decides when to act, and the reason surfaces as FilesMarkedForCompaction on an EventListener. Only honoured at open, like most options.

Repeated calls add collectors rather than replacing the previous one.

This is the only table properties collector reachable from .NET. RocksDb's C API declares the factory type and how to attach one, but offers no function that creates one, so a user-defined collector cannot be built and ReadableProperties stays empty. This collector does not populate it either; it marks files instead.

AddEventListener(EventListener)

Adds an event listener to receive database event notifications.

public DbOptions AddEventListener(EventListener listener)

Parameters

listener EventListener

The listener to add.

Returns

DbOptions

These options, for chaining.

Remarks

Adds, and never removes or replaces. Call it twice and both listeners receive every event; RocksDb offers no way to take one back off. This was a property setter, which made a call that accumulates look like an assignment that replaces, so options.EventListener = a; followed by options.EventListener = b; left both installed and no way to undo it.

Ownership of the listener transfers to these options.

AddEventListeners(IEnumerable<EventListener>)

Adds several event listeners.

public DbOptions AddEventListeners(IEnumerable<EventListener> listeners)

Parameters

listeners IEnumerable<EventListener>

The listeners to add.

Returns

DbOptions

These options, for chaining.

Remarks

ClearCalculateSstWriteLifetimeHints()

Stops calculating the write lifetime hint for every compaction style.

public DbOptions ClearCalculateSstWriteLifetimeHints()

Returns

DbOptions

ClearChecksumHandoffFileTypes()

Disables checksum handoff for every file kind.

public DbOptions ClearChecksumHandoffFileTypes()

Returns

DbOptions

ClearWalFilter()

Removes any WAL filter previously installed on these options.

public DbOptions ClearWalFilter()

Returns

DbOptions

Clone()

Creates a copy of this options object that shares its attached callback objects.

public DbOptions Clone()

Returns

DbOptions

Remarks

Not a deep copy, which is what this used to claim. The native call behind it copies the options struct, so the comparator, compaction filter, env and WAL filter are copied as pointers and the merge operator, rate limiter, logger and listeners as shared references. Both objects end up pointing at the same callback instances.

The clone therefore registers itself as another holder of each of them, so disposing either options object no longer destroys what the other, or a database opened from it, is still calling. Before that, the clone's owned-handle set was empty and the original's disposal took the comparator and logger with it.

ContainsCalculateSstWriteLifetimeHint(CompactionStyle)

Whether the write lifetime hint is calculated for compactionStyle.

public bool ContainsCalculateSstWriteLifetimeHint(CompactionStyle compactionStyle)

Parameters

compactionStyle CompactionStyle

Returns

bool

ContainsChecksumHandoffFileType(FileType)

Whether checksum handoff is enabled for fileType.

public bool ContainsChecksumHandoffFileType(FileType fileType)

Parameters

fileType FileType

Returns

bool

DisposeHandle()

Releases the native handle. Called during disposal.

protected override void DisposeHandle()

Remarks

Protected rather than public: it destroys the native object without marking this instance disposed or clearing the handle, so calling it from outside and then disposing normally would free the same pointer twice. It was the most Dispose-looking member on the type. Callers want Dispose().

DisposeUnmanagedResources()

Releases unmanaged resources used by the current instance.

protected override void DisposeUnmanagedResources()

Remarks

Protected for the same reason as DisposeHandle().

EnableStatistics()

Enables collection of internal statistics. Call GetStatisticsString() to retrieve them.

public DbOptions EnableStatistics()

Returns

DbOptions

GetHistogramData(Histogram)

Returns histogram data for a statistics histogram type. Returns all-zero data, not null, when no statistics object is attached.

public HistogramData? GetHistogramData(Histogram histogram)

Parameters

histogram Histogram

Which distribution to read.

Returns

HistogramData

Remarks

An all-zero result is therefore ambiguous: it means either "no samples recorded" or "statistics were never enabled". Attach a statistics object with EnableStatistics() before relying on the numbers.

GetStatisticsString()

Returns a string dump of the collected statistics, or null if statistics are not enabled.

public string? GetStatisticsString()

Returns

string

GetTickerCount(Ticker)

Returns the current value of a counter from the statistics subsystem.

public ulong GetTickerCount(Ticker ticker)

Parameters

ticker Ticker

Which counter to read.

Returns

ulong

Remarks

Zero unless EnableStatistics() was called before the database was opened. This took a bare uint, so callers passed the numeric value of a counter they had to look up in RocksDb's header.

IncreaseParallelism(int)

Sets parallelism for background jobs to totalThreads.

public DbOptions IncreaseParallelism(int totalThreads)

Parameters

totalThreads int

Returns

DbOptions

OptimizeForPointLookup(ulong)

Optimizes the options for a point-lookup workload using a block cache of blockCacheSizeMb MB.

public DbOptions OptimizeForPointLookup(ulong blockCacheSizeMb)

Parameters

blockCacheSizeMb ulong

Returns

DbOptions

OptimizeLevelStyleCompaction(ulong)

Optimizes the options for level-style compaction using memtableMemoryBudgetBytes bytes for memtable.

public DbOptions OptimizeLevelStyleCompaction(ulong memtableMemoryBudgetBytes = 536870912)

Parameters

memtableMemoryBudgetBytes ulong

Returns

DbOptions

OptimizeUniversalStyleCompaction(ulong)

Optimizes the options for universal-style compaction.

public DbOptions OptimizeUniversalStyleCompaction(ulong memtableMemoryBudgetBytes = 536870912)

Parameters

memtableMemoryBudgetBytes ulong

Returns

DbOptions

PrepareForBulkLoad()

Prepares options for a bulk-load scenario.

public DbOptions PrepareForBulkLoad()

Returns

DbOptions

RemoveCalculateSstWriteLifetimeHint(CompactionStyle)

Stops calculating the write lifetime hint for compactionStyle.

public DbOptions RemoveCalculateSstWriteLifetimeHint(CompactionStyle compactionStyle)

Parameters

compactionStyle CompactionStyle

Returns

DbOptions

RemoveChecksumHandoffFileType(FileType)

Disables checksum handoff for fileType.

public DbOptions RemoveChecksumHandoffFileType(FileType fileType)

Parameters

fileType FileType

Returns

DbOptions

SetBottommostCompressionOptionsUseZstdDictTrainer(bool, bool)

Sets whether the bottommost level's zstd dictionary is trained, and whether the bottommost compression options apply at all.

public DbOptions SetBottommostCompressionOptionsUseZstdDictTrainer(bool useZstdDictTrainer, bool enabled)

Parameters

useZstdDictTrainer bool

Train the dictionary rather than sampling it.

enabled bool

Whether the bottommost compression options are used. Setting the first argument has no effect while this is false.

Returns

DbOptions

Remarks

A method rather than a property because the native setter writes two fields at once, and the matching getter reports only the first.

SetDbPaths(IReadOnlyList<DbPath>)

Spreads the database across several directories, each with a size target.

public DbOptions SetDbPaths(IReadOnlyList<DbPath> paths)

Parameters

paths IReadOnlyList<DbPath>

The directories, in the order RocksDb should fill them. The last should be the one with room to spare, since data overflows forward.

Returns

DbOptions

Remarks

The usual reason is mixed storage: give a fast device a modest target so the newest levels live there, and let the rest overflow onto slower, larger media. RocksDb copies the values, so the DbPath objects stay yours to dispose.

SetFileChecksumGenFactory(FileChecksumGenFactory)

Sets the generator RocksDb uses to compute a whole-file checksum for each SST file it writes.

public DbOptions SetFileChecksumGenFactory(FileChecksumGenFactory factory)

Parameters

factory FileChecksumGenFactory

Returns

DbOptions

Remarks

Required for VerifyFileChecksums(), which fails outright when no generator is configured. RocksDb copies the underlying shared pointer rather than taking ownership, so the caller keeps responsibility for disposing factory and must keep it alive while the database is open.

SetUInt64AddMergeOperator()

Sets the built-in UInt64Add merge operator, which treats values as little-endian 64-bit integers and adds them.

public DbOptions SetUInt64AddMergeOperator()

Returns

DbOptions

SetWalFilter(WalFilter)

Installs a filter that inspects, rewrites or skips write-ahead log records while the database is being opened.

public DbOptions SetWalFilter(WalFilter filter)

Parameters

filter WalFilter

Returns

DbOptions

Remarks

Unlike EventListener, RocksDb stores only a raw pointer to the filter and never frees it, so these options take responsibility for disposing it. The filter must therefore outlive the database, which happens automatically when the options do.

WithOptionsFromString(string)

Parses RocksDb's own options syntax and applies it on top of these options.

public DbOptions WithOptionsFromString(string optionsString)

Parameters

optionsString string

Settings in RocksDb's name=value;name=value form, as accepted by its own tools.

Returns

DbOptions

A new options object: this one is left unchanged.

Remarks

For configuration-driven callers that would rather carry a string than a list of property assignments. Unknown or malformed settings throw rather than being ignored.