Table of Contents

Enum CompactionReason

Namespace
RocksDbNet
Assembly
RocksDb.Net.dll

Why RocksDb ran a compaction, mapped from rocksdb::CompactionReason in listener.h.

public enum CompactionReason

Fields

BottommostFiles = 11

Level: an automatic compaction inside the bottommost level to clean up duplicate versions of the same user key, usually after a snapshot was released.

ChangeTemperature = 16

Compacting in order to move files to a different temperature.

ExternalSstIngestion = 14

Internal only. External SST file ingestion, accounted for as a compaction so that it takes part in conflict checking.

FifoMaxSize = 6

FIFO: the total size exceeded the maximum table file size.

FifoReduceNumFiles = 7

FIFO: compacting to reduce the number of files.

FifoTtl = 8

FIFO: files older than the configured interval.

FilesMarkedForCompaction = 10

Files marked for compaction, which is what SuggestCompactRange(ReadOnlySpan<byte>, ReadOnlySpan<byte>) does.

Flush = 13

A flush, which RocksDb accounts for as a level-0 compaction.

ForcedBlobGC = 17

Scheduled to force garbage collection of blob files.

LevelL0FilesNum = 1

Level: the number of level-0 files exceeded Level0FileNumCompactionTrigger.

LevelMaxLevelSize = 2

Level: the total size of a level exceeded its maximum.

ManualCompaction = 9

A manual compaction, such as CompactRange(CompactRangeOptions, ReadOnlySpan<byte>, ReadOnlySpan<byte>).

PeriodicCompaction = 15

An SST file was older than the periodic compaction interval.

ReadTriggered = 20

Triggered by a high read frequency on SST files.

RefitLevel = 19

Internal only. A level refit, accounted for as a compaction so that it takes part in conflict checking.

RoundRobinTtl = 18

The round-robin policy's time-to-live compaction. Behaves like LevelMaxLevelSize but targets expired files.

Ttl = 12

Compaction driven by time to live.

UniversalSizeAmplification = 3

Universal: compacting to reduce size amplification.

UniversalSizeRatio = 4

Universal: compacting to satisfy the size ratio.

UniversalSortedRunNum = 5

Universal: the number of sorted runs exceeded Level0FileNumCompactionTrigger.

Unknown = 0

No reason recorded.

Remarks

The values are positional in the native header, so they must match it exactly. They are written out here rather than left implicit, and asserted in the tests, because a shifted value silently mislabels every compaction an application observes.