Documentation
¶
Overview ¶
Package NoKV provides the embedded database API and engine wiring.
Index ¶
- type BatchSetItem
- type CacheStatsSnapshot
- type CompactionPolicy
- type CompactionStatsSnapshot
- type DB
- func (db *DB) ApplyInternalEntries(entries []*kv.Entry) error
- func (db *DB) Close() error
- func (db *DB) Del(key []byte) error
- func (db *DB) DeleteRange(start, end []byte) error
- func (db *DB) Get(key []byte) (*kv.Entry, error)
- func (db *DB) GetInternalEntry(cf kv.ColumnFamily, key []byte, version uint64) (*kv.Entry, error)
- func (db *DB) GetValueSeparationPolicyStats() map[string]int64
- func (db *DB) Info() *Stats
- func (db *DB) IsClosed() bool
- func (db *DB) NewInternalIterator(opt *utils.Options) utils.Iterator
- func (db *DB) NewIterator(opt *utils.Options) utils.Iterator
- func (db *DB) RaftLog() RaftLog
- func (db *DB) RunValueLogGC(discardRatio float64) error
- func (db *DB) Set(key, value []byte) error
- func (db *DB) SetBatch(items []BatchSetItem) error
- func (db *DB) SetRegionMetrics(rm *metrics.RegionMetrics)
- func (db *DB) SetWithTTL(key, value []byte, ttl time.Duration) error
- func (db *DB) WAL() *wal.Manager
- func (db *DB) WorkDir() string
- type DBIterator
- type FlushStatsSnapshot
- type HotKeyStat
- type HotStatsSnapshot
- type Item
- type LSMLevelStats
- type LSMStatsSnapshot
- type MVCCStore
- type MemTableEngine
- type Options
- type RaftLog
- type RaftStatsSnapshot
- type RangeFilterStatsSnapshot
- type RegionStatsSnapshot
- type Stats
- type StatsSnapshot
- type ValueLogStatsSnapshot
- type WALStatsSnapshot
- type WriteStatsSnapshot
Constants ¶
This section is empty.
Variables ¶
This section is empty.
Functions ¶
This section is empty.
Types ¶
type BatchSetItem ¶ added in v0.7.1
BatchSetItem represents one non-transactional write in the default CF.
Ownership note: key is copied into the internal-key encoding; value is referenced directly until the write path finishes.
type CacheStatsSnapshot ¶ added in v0.6.0
type CacheStatsSnapshot struct {
BlockL0HitRate float64 `json:"block_l0_hit_rate"`
BlockL1HitRate float64 `json:"block_l1_hit_rate"`
IndexHitRate float64 `json:"index_hit_rate"`
IteratorReused uint64 `json:"iterator_reused"`
}
CacheStatsSnapshot captures block/index/bloom hit-rate indicators.
type CompactionPolicy ¶ added in v0.7.1
type CompactionPolicy string
CompactionPolicy defines compaction priority-arrangement strategy.
const ( CompactionPolicyLeveled CompactionPolicy = "leveled" CompactionPolicyTiered CompactionPolicy = "tiered" CompactionPolicyHybrid CompactionPolicy = "hybrid" )
type CompactionStatsSnapshot ¶ added in v0.6.0
type CompactionStatsSnapshot struct {
Backlog int64 `json:"backlog"`
MaxScore float64 `json:"max_score"`
LastDurationMs float64 `json:"last_duration_ms"`
MaxDurationMs float64 `json:"max_duration_ms"`
Runs uint64 `json:"runs"`
IngestRuns int64 `json:"ingest_runs"`
MergeRuns int64 `json:"ingest_merge_runs"`
IngestMs float64 `json:"ingest_ms"`
MergeMs float64 `json:"ingest_merge_ms"`
IngestTables int64 `json:"ingest_tables"`
MergeTables int64 `json:"ingest_merge_tables"`
ValueWeight float64 `json:"value_weight"`
ValueWeightSuggested float64 `json:"value_weight_suggested,omitempty"`
}
CompactionStatsSnapshot summarizes compaction backlog, runtime, and ingest behavior.
type DB ¶
DB is the global handle for the engine and owns shared resources.
func (*DB) ApplyInternalEntries ¶ added in v0.7.1
ApplyInternalEntries writes pre-built internal-key entries through the regular write pipeline.
The caller must provide entries with internal keys. The entry slices must not be mutated until this call returns.
func (*DB) Close ¶
Close stops background workers and flushes in-memory state before releasing all resources.
func (*DB) DeleteRange ¶ added in v0.7.1
DeleteRange removes all keys in [start, end) from the default column family.
func (*DB) GetInternalEntry ¶ added in v0.7.1
GetInternalEntry retrieves one internal-key record for the provided version.
The returned entry is borrowed from internal pools and returned as-is (no clone/no copy). entry.Key remains in internal encoding (cf+user_key+ts). Callers MUST call DecrRef exactly once when finished.
func (*DB) GetValueSeparationPolicyStats ¶ added in v0.7.1
GetValueSeparationPolicyStats returns the current value separation policy statistics. Returns nil if no policies are configured.
func (*DB) IsClosed ¶
IsClosed reports whether Close has finished and the DB no longer accepts work.
func (*DB) NewInternalIterator ¶ added in v0.5.0
NewInternalIterator returns an iterator over internal keys (CF marker + user key + timestamp). Callers should decode kv.Entry.Key via kv.SplitInternalKey and handle ok=false.
func (*DB) NewIterator ¶
NewIterator creates a DB-level iterator over user keys in the default column family.
func (*DB) RaftLog ¶ added in v0.7.2
RaftLog returns the raft peer-storage capability backed by the DB WAL.
func (*DB) RunValueLogGC ¶
RunValueLogGC triggers a value log garbage collection.
func (*DB) Set ¶
Set writes a key/value pair into the default column family. Use Del for explicit deletion; nil values are rejected.
func (*DB) SetBatch ¶ added in v0.7.1
func (db *DB) SetBatch(items []BatchSetItem) error
SetBatch writes multiple key/value pairs into the default column family.
Semantics:
- Non-transactional API: each entry receives a monotonically increasing internal version.
- The batch is submitted through the regular write pipeline and commit queue.
Validation:
- Empty batch is a no-op.
- Every item must have a non-empty key and non-nil value.
Ownership:
- key bytes are encoded into internal keys.
- value slices are referenced directly until this call returns; callers must keep them immutable for the duration of this call.
func (*DB) SetRegionMetrics ¶
func (db *DB) SetRegionMetrics(rm *metrics.RegionMetrics)
SetRegionMetrics attaches region metrics recorder so Stats snapshot and expvar include region state counts.
func (*DB) SetWithTTL ¶ added in v0.7.0
SetWithTTL writes a key/value pair into the default column family with TTL. Use Del for explicit deletion; nil values are rejected.
Ownership note: key is encoded into a new internal-key buffer, while value is referenced directly (no deep copy). Callers must keep value immutable until this method returns.
type DBIterator ¶
type DBIterator struct {
// contains filtered or unexported fields
}
DBIterator wraps the merged LSM iterators and optionally resolves value-log pointers.
func (*DBIterator) Close ¶
func (iter *DBIterator) Close() error
Close releases underlying iterators and returns pooled iterator context.
func (*DBIterator) Err ¶ added in v0.7.1
func (iter *DBIterator) Err() error
Err returns the error that stopped iteration, if any. Returns nil if iteration completed successfully or is still in progress. This method follows the pattern established by EntryIterator and RecordIterator.
func (*DBIterator) Item ¶
func (iter *DBIterator) Item() utils.Item
Item returns the currently materialized item, or nil when iterator is invalid.
func (*DBIterator) Next ¶
func (iter *DBIterator) Next()
Next advances to the next visible key/value pair.
func (*DBIterator) Rewind ¶
func (iter *DBIterator) Rewind()
Rewind positions the iterator at the first or last key based on scan direction.
func (*DBIterator) Seek ¶
func (iter *DBIterator) Seek(key []byte)
Seek positions the iterator at the first key >= key in default column family order.
func (*DBIterator) Valid ¶
func (iter *DBIterator) Valid() bool
Valid reports whether the iterator currently points at a valid item.
type FlushStatsSnapshot ¶ added in v0.6.0
type FlushStatsSnapshot struct {
Pending int64 `json:"pending"`
QueueLength int64 `json:"queue_length"`
Active int64 `json:"active"`
WaitMs float64 `json:"wait_ms"`
LastWaitMs float64 `json:"last_wait_ms"`
MaxWaitMs float64 `json:"max_wait_ms"`
BuildMs float64 `json:"build_ms"`
LastBuildMs float64 `json:"last_build_ms"`
MaxBuildMs float64 `json:"max_build_ms"`
ReleaseMs float64 `json:"release_ms"`
LastReleaseMs float64 `json:"last_release_ms"`
MaxReleaseMs float64 `json:"max_release_ms"`
Completed int64 `json:"completed"`
}
FlushStatsSnapshot summarizes flush queue depth and stage timing.
type HotKeyStat ¶
HotKeyStat represents one hot key and its observed touch count.
type HotStatsSnapshot ¶ added in v0.6.0
type HotStatsSnapshot struct {
WriteKeys []HotKeyStat `json:"write_keys,omitempty"`
WriteRing *hotring.Stats `json:"write_ring,omitempty"`
}
HotStatsSnapshot contains write-hot keys and optional ring internals.
type Item ¶
type Item struct {
// contains filtered or unexported fields
}
Item is the user-facing iterator item backed by an entry and optional vlog reader.
type LSMLevelStats ¶ added in v0.4.0
type LSMLevelStats struct {
Level int `json:"level"`
TableCount int `json:"tables"`
SizeBytes int64 `json:"size_bytes"`
ValueBytes int64 `json:"value_bytes"`
StaleBytes int64 `json:"stale_bytes"`
IngestTables int `json:"ingest_tables"`
IngestSizeBytes int64 `json:"ingest_size_bytes"`
IngestValueBytes int64 `json:"ingest_value_bytes"`
ValueDensity float64 `json:"value_density"`
IngestValueDensity float64 `json:"ingest_value_density"`
IngestRuns int64 `json:"ingest_runs"`
IngestMs float64 `json:"ingest_ms"`
IngestTablesCount int64 `json:"ingest_tables_compacted"`
MergeRuns int64 `json:"ingest_merge_runs"`
MergeMs float64 `json:"ingest_merge_ms"`
MergeTables int64 `json:"ingest_merge_tables"`
}
LSMLevelStats captures aggregated metrics per LSM level.
type LSMStatsSnapshot ¶ added in v0.6.0
type LSMStatsSnapshot struct {
Levels []LSMLevelStats `json:"levels,omitempty"`
ValueBytesTotal int64 `json:"value_bytes_total"`
ValueDensityMax float64 `json:"value_density_max"`
ValueDensityAlert bool `json:"value_density_alert"`
RangeFilter RangeFilterStatsSnapshot `json:"range_filter"`
}
LSMStatsSnapshot summarizes per-level storage shape and value-density signals.
type MVCCStore ¶ added in v0.7.1
type MVCCStore interface {
ApplyInternalEntries(entries []*kv.Entry) error
// GetInternalEntry returns a borrowed internal entry without cloning/copying.
// entry.Key remains in internal encoding (cf+user_key+ts). Callers must
// DecrRef exactly once.
GetInternalEntry(cf kv.ColumnFamily, key []byte, version uint64) (*kv.Entry, error)
NewInternalIterator(opt *utils.Options) utils.Iterator
}
MVCCStore defines MVCC/internal operations consumed by percolator and raftstore.
type MemTableEngine ¶ added in v0.4.2
type MemTableEngine string
MemTableEngine selects the in-memory index implementation used by memtables.
const ( MemTableEngineSkiplist MemTableEngine = "skiplist" MemTableEngineART MemTableEngine = "art" )
type Options ¶
type Options struct {
// FS provides the filesystem implementation used by DB runtime components.
// Nil defaults to vfs.OSFS.
FS vfs.FS
ValueThreshold int64
WorkDir string
MemTableSize int64
MemTableEngine MemTableEngine
SSTableMaxSz int64
// MaxBatchCount bounds the number of entries grouped into one internal
// write batch. NewDefaultOptions exposes a concrete default; zero is only
// interpreted as a legacy unset value during normalization.
MaxBatchCount int64
// MaxBatchSize bounds the size in bytes of one internal write batch.
// NewDefaultOptions exposes a concrete default; zero is only interpreted as
// a legacy unset value during normalization.
MaxBatchSize int64
ValueLogFileSize int
ValueLogMaxEntries uint32
// ValueLogBucketCount controls how many hash buckets the value log uses.
// Values <= 1 disable bucketization.
ValueLogBucketCount int
ValueSeparationPolicies []*kv.ValueSeparationPolicy
// ValueLogGCInterval specifies how frequently to trigger a check for value
// log garbage collection. Zero or negative values disable automatic GC.
ValueLogGCInterval time.Duration
// ValueLogGCDiscardRatio is the discard ratio for a value log file to be
// considered for garbage collection. It must be in the range (0.0, 1.0).
ValueLogGCDiscardRatio float64
// ValueLogGCParallelism controls how many value-log GC tasks can run in
// parallel. Values <= 0 auto-tune based on compaction workers.
ValueLogGCParallelism int
// ValueLogGCReduceScore lowers GC parallelism when compaction max score meets
// or exceeds this threshold. Values <= 0 use defaults.
ValueLogGCReduceScore float64
// ValueLogGCSkipScore skips GC when compaction max score meets or exceeds this
// threshold. Values <= 0 use defaults.
ValueLogGCSkipScore float64
// ValueLogGCReduceBacklog lowers GC parallelism when compaction backlog meets
// or exceeds this threshold. Values <= 0 use defaults.
ValueLogGCReduceBacklog int
// ValueLogGCSkipBacklog skips GC when compaction backlog meets or exceeds this
// threshold. Values <= 0 use defaults.
ValueLogGCSkipBacklog int
// Value log GC sampling parameters. Ratios <= 0 fall back to defaults.
ValueLogGCSampleSizeRatio float64
ValueLogGCSampleCountRatio float64
ValueLogGCSampleFromHead bool
// ValueLogVerbose enables verbose logging across value-log operations.
ValueLogVerbose bool
// WriteBatchMaxCount bounds how many requests the commit worker coalesces in
// one pass. NewDefaultOptions exposes a concrete default; zero is only
// interpreted as a legacy unset value during normalization.
WriteBatchMaxCount int
// WriteBatchMaxSize bounds the byte size the commit worker coalesces in one
// pass. NewDefaultOptions exposes a concrete default; zero is only
// interpreted as a legacy unset value during normalization.
WriteBatchMaxSize int64
DetectConflicts bool
HotRingEnabled bool
HotRingBits uint8
HotRingTopK int
// HotRingRotationInterval enables dual-ring rotation for hotness tracking.
// Zero disables rotation.
HotRingRotationInterval time.Duration
// HotRingNodeCap caps the number of tracked keys per ring. Zero disables the cap.
HotRingNodeCap uint64
// HotRingNodeSampleBits controls stable sampling once the cap is reached.
// A value of 0 enforces a strict cap; larger values sample 1/2^N keys.
HotRingNodeSampleBits uint8
// HotRingDecayInterval controls how often HotRing halves its global counters.
// Zero disables periodic decay.
HotRingDecayInterval time.Duration
// HotRingDecayShift determines how aggressively counters decay (count >>= shift).
HotRingDecayShift uint32
// HotRingWindowSlots controls the number of sliding-window buckets tracked per key.
// Zero disables the sliding window.
HotRingWindowSlots int
// HotRingWindowSlotDuration sets the duration of each sliding-window bucket.
HotRingWindowSlotDuration time.Duration
SyncWrites bool
// SyncPipeline enables a dedicated sync worker goroutine that decouples
// WAL fsync from the commit pipeline. When false (the default), the commit
// worker performs fsync inline. Only effective when SyncWrites is true.
SyncPipeline bool
ManifestSync bool
// ManifestRewriteThreshold triggers a manifest rewrite when the active
// MANIFEST file grows beyond this size (bytes). Values <= 0 disable rewrites.
ManifestRewriteThreshold int64
// WriteHotKeyLimit caps how many consecutive writes a single key can issue
// before the DB returns utils.ErrHotKeyWriteThrottle. Zero disables write-path
// throttling.
WriteHotKeyLimit int32
// WriteBatchWait adds an optional coalescing delay when the commit queue is
// momentarily empty, letting small bursts share one WAL fsync/apply pass.
// Zero disables the delay.
WriteBatchWait time.Duration
// WriteThrottleMinRate is the target write admission rate in bytes/sec when
// slowdown pressure approaches the stop threshold. NewDefaultOptions
// exposes a concrete default; zero is only interpreted as a legacy unset
// value during normalization.
WriteThrottleMinRate int64
// WriteThrottleMaxRate is the target write admission rate in bytes/sec when
// slowdown first becomes active. NewDefaultOptions exposes a concrete
// default; zero is only interpreted as a legacy unset value during
// normalization.
WriteThrottleMaxRate int64
// BlockCacheBytes bounds the in-memory budget for cached L0/L1 data blocks.
// Deeper levels continue to rely on the OS page cache.
BlockCacheBytes int64
// IndexCacheBytes bounds the in-memory budget for decoded SSTable indexes.
IndexCacheBytes int64
// RaftLagWarnSegments determines how many WAL segments a follower can lag
// behind the active segment before stats surfaces a warning. Zero disables
// the alert.
RaftLagWarnSegments int64
// EnableWALWatchdog enables the background WAL backlog watchdog which
// surfaces typed-record warnings and optionally runs automated segment GC.
EnableWALWatchdog bool
// WALBufferSize controls the size of the in-memory write buffer used by
// the WAL manager. Larger buffers reduce syscall frequency at the cost of
// memory. NewDefaultOptions exposes a concrete default; zero is only
// interpreted as a legacy unset value during normalization.
WALBufferSize int
// WALAutoGCInterval controls how frequently the watchdog evaluates WAL
// backlog for automated garbage collection.
WALAutoGCInterval time.Duration
// WALAutoGCMinRemovable is the minimum number of removable WAL segments
// required before an automated GC pass will run.
WALAutoGCMinRemovable int
// WALAutoGCMaxBatch bounds how many WAL segments are removed during a single
// automated GC pass.
WALAutoGCMaxBatch int
// WALTypedRecordWarnRatio triggers a typed-record warning when raft records
// constitute at least this fraction of WAL writes. Zero disables ratio-based
// warnings.
WALTypedRecordWarnRatio float64
// WALTypedRecordWarnSegments triggers a typed-record warning when the number
// of WAL segments containing raft records exceeds this threshold. Zero
// disables segment-count warnings.
WALTypedRecordWarnSegments int64
// RaftPointerSnapshot returns store-local raft WAL checkpoints used by WAL
// watchdogs, GC policy, and diagnostics. It must return a detached snapshot.
// Nil disables raft-specific backlog accounting.
RaftPointerSnapshot func() map[uint64]raftmeta.RaftLogPointer
// DiscardStatsFlushThreshold controls how many discard-stat updates must be
// accumulated before they are flushed back into the LSM. Zero keeps the
// default threshold.
DiscardStatsFlushThreshold int
// NumCompactors controls how many background compaction workers are spawned.
// Zero uses an auto value derived from the host CPU count.
NumCompactors int
// CompactionPolicy selects how compaction priorities are arranged.
// Supported values: leveled, tiered, hybrid.
CompactionPolicy CompactionPolicy
// NumLevelZeroTables controls when write throttling kicks in and feeds into
// the compaction priority calculation. NewDefaultOptions populates a concrete
// default; normalizeInPlace only backfills zero-valued legacy configs.
NumLevelZeroTables int
// L0SlowdownWritesTrigger starts write pacing when L0 table count reaches
// this threshold. Defaults are populated up front; zero is only interpreted
// as a legacy unset value during normalization.
L0SlowdownWritesTrigger int
// L0StopWritesTrigger blocks writes when L0 table count reaches this
// threshold. Defaults are populated up front; zero is only interpreted as a
// legacy unset value during normalization.
L0StopWritesTrigger int
// L0ResumeWritesTrigger clears throttling only when L0 table count drops to
// this threshold or lower. Defaults are populated up front; zero is only
// interpreted as a legacy unset value during normalization.
L0ResumeWritesTrigger int
// CompactionSlowdownTrigger starts write pacing when max compaction score
// reaches this value. Defaults are populated up front; zero is only
// interpreted as a legacy unset value during normalization.
CompactionSlowdownTrigger float64
// CompactionStopTrigger blocks writes when max compaction score reaches this
// value. Defaults are populated up front; zero is only interpreted as a
// legacy unset value during normalization.
CompactionStopTrigger float64
// CompactionResumeTrigger clears throttling only when max compaction score
// drops to this value or lower. Defaults are populated up front; zero is only
// interpreted as a legacy unset value during normalization.
CompactionResumeTrigger float64
// IngestCompactBatchSize decides how many L0 tables to promote into the
// ingest buffer per compaction cycle. NewDefaultOptions populates a concrete
// default; normalizeInPlace only backfills zero-valued legacy configs.
IngestCompactBatchSize int
// IngestBacklogMergeScore triggers an ingest-merge task when the ingest
// backlog score exceeds this threshold. Defaults are populated up front; zero
// is only interpreted as a legacy unset value during normalization.
IngestBacklogMergeScore float64
// CompactionValueWeight adjusts how aggressively the scheduler prioritises
// levels whose entries reference large value log payloads. Higher values
// make the compaction picker favour levels with high ValuePtr density.
CompactionValueWeight float64
// CompactionValueAlertThreshold triggers stats alerts when a level's
// value-density (value bytes / total bytes) exceeds this ratio.
CompactionValueAlertThreshold float64
// IngestShardParallelism caps how many ingest shards can be compacted in a
// single ingest-only pass. A value <= 0 falls back to 1 (sequential).
IngestShardParallelism int
}
Options holds the top-level database configuration.
func NewDefaultOptions ¶
func NewDefaultOptions() *Options
NewDefaultOptions returns the default option set.
type RaftLog ¶ added in v0.7.2
RaftLog opens raft peer storage without exposing the underlying WAL manager.
type RaftStatsSnapshot ¶ added in v0.6.0
type RaftStatsSnapshot struct {
GroupCount int `json:"group_count"`
LaggingGroups int `json:"lagging_groups"`
MinLogSegment uint32 `json:"min_log_segment"`
MaxLogSegment uint32 `json:"max_log_segment"`
MaxLagSegments int64 `json:"max_lag_segments"`
LagWarnThreshold int64 `json:"lag_warn_threshold"`
LagWarning bool `json:"lag_warning"`
}
RaftStatsSnapshot summarizes raft log lag across tracked groups.
type RangeFilterStatsSnapshot ¶ added in v0.7.1
type RangeFilterStatsSnapshot struct {
PointCandidates uint64 `json:"point_candidates"`
PointPruned uint64 `json:"point_pruned"`
BoundedCandidates uint64 `json:"bounded_candidates"`
BoundedPruned uint64 `json:"bounded_pruned"`
Fallbacks uint64 `json:"fallbacks"`
}
RangeFilterStatsSnapshot summarizes range-filter pruning activity on read paths.
type RegionStatsSnapshot ¶ added in v0.6.0
type RegionStatsSnapshot struct {
Total int64 `json:"total"`
New int64 `json:"new"`
Running int64 `json:"running"`
Removing int64 `json:"removing"`
Tombstone int64 `json:"tombstone"`
Other int64 `json:"other"`
}
RegionStatsSnapshot reports region counts grouped by region state.
type Stats ¶
type Stats struct {
// contains filtered or unexported fields
}
Stats owns periodic runtime metric collection and snapshot publication.
func (*Stats) SetRegionMetrics ¶
func (s *Stats) SetRegionMetrics(rm *metrics.RegionMetrics)
SetRegionMetrics attaches region metrics recorder used in snapshots.
func (*Stats) Snapshot ¶
func (s *Stats) Snapshot() StatsSnapshot
Snapshot returns a point-in-time metrics snapshot without mutating state.
func (*Stats) StartStats ¶
func (s *Stats) StartStats()
StartStats runs periodic collection of internal backlog metrics.
type StatsSnapshot ¶
type StatsSnapshot struct {
Entries int64 `json:"entries"`
Flush FlushStatsSnapshot `json:"flush"`
Compaction CompactionStatsSnapshot `json:"compaction"`
ValueLog ValueLogStatsSnapshot `json:"value_log"`
WAL WALStatsSnapshot `json:"wal"`
Raft RaftStatsSnapshot `json:"raft"`
Write WriteStatsSnapshot `json:"write"`
Region RegionStatsSnapshot `json:"region"`
Hot HotStatsSnapshot `json:"hot"`
Cache CacheStatsSnapshot `json:"cache"`
LSM LSMStatsSnapshot `json:"lsm"`
Transport transportpkg.GRPCTransportMetrics `json:"transport"`
Redis metrics.RedisSnapshot `json:"redis"`
}
StatsSnapshot captures a point-in-time view of internal backlog metrics.
type ValueLogStatsSnapshot ¶ added in v0.6.0
type ValueLogStatsSnapshot struct {
Segments int `json:"segments"`
PendingDeletes int `json:"pending_deletes"`
DiscardQueue int `json:"discard_queue"`
Heads map[uint32]kv.ValuePtr `json:"heads,omitempty"`
GC metrics.ValueLogGCSnapshot `json:"gc"`
}
ValueLogStatsSnapshot reports value-log segment status and GC counters.
type WALStatsSnapshot ¶ added in v0.6.0
type WALStatsSnapshot struct {
ActiveSegment int64 `json:"active_segment"`
SegmentCount int64 `json:"segment_count"`
ActiveSize int64 `json:"active_size"`
SegmentsRemoved uint64 `json:"segments_removed"`
RecordCounts wal.RecordMetrics `json:"record_counts"`
SegmentsWithRaftRecords int `json:"segments_with_raft_records"`
RemovableRaftSegments int `json:"removable_raft_segments"`
TypedRecordRatio float64 `json:"typed_record_ratio"`
TypedRecordWarning bool `json:"typed_record_warning"`
TypedRecordReason string `json:"typed_record_reason,omitempty"`
AutoGCRuns uint64 `json:"auto_gc_runs"`
AutoGCRemoved uint64 `json:"auto_gc_removed"`
AutoGCLastUnix int64 `json:"auto_gc_last_unix"`
}
WALStatsSnapshot captures WAL head position, record mix, and watchdog status.
type WriteStatsSnapshot ¶ added in v0.6.0
type WriteStatsSnapshot struct {
QueueDepth int64 `json:"queue_depth"`
QueueEntries int64 `json:"queue_entries"`
QueueBytes int64 `json:"queue_bytes"`
AvgBatchEntries float64 `json:"avg_batch_entries"`
AvgBatchBytes float64 `json:"avg_batch_bytes"`
AvgRequestWaitMs float64 `json:"avg_request_wait_ms"`
AvgValueLogMs float64 `json:"avg_vlog_ms"`
AvgApplyMs float64 `json:"avg_apply_ms"`
AvgSyncMs float64 `json:"avg_sync_ms"`
AvgSyncBatch float64 `json:"avg_sync_batch"`
SyncCount int64 `json:"sync_count"`
BatchesTotal int64 `json:"batches_total"`
ThrottleActive bool `json:"throttle_active"`
SlowdownActive bool `json:"slowdown_active"`
ThrottleMode string `json:"throttle_mode"`
ThrottlePressure uint32 `json:"throttle_pressure_permille"`
ThrottleRate uint64 `json:"throttle_rate_bytes_per_sec"`
HotKeyLimited uint64 `json:"hot_key_limited"`
}
WriteStatsSnapshot tracks write-path queue pressure, latency, and throttling.
Source Files
¶
Directories
¶
| Path | Synopsis |
|---|---|
|
cmd
|
|
|
nokv
command
|
|
|
nokv-config
command
|
|
|
nokv-redis
command
|
|
|
Package file provides low-level file and mmap primitives shared by WAL, vlog, and SST layers.
|
Package file provides low-level file and mmap primitives shared by WAL, vlog, and SST layers. |
|
Package manifest persists storage-engine metadata such as SST layout, WAL replay position, and value-log state.
|
Package manifest persists storage-engine metadata such as SST layout, WAL replay position, and value-log state. |
|
pd
|
|
|
raftstore
|
|
|
Package vfs provides a tiny filesystem abstraction and fault-injection wrapper.
|
Package vfs provides a tiny filesystem abstraction and fault-injection wrapper. |
|
Package vlog implements the value-log segment manager and IO helpers.
|
Package vlog implements the value-log segment manager and IO helpers. |
|
Package wal implements the write-ahead log manager and replay logic.
|
Package wal implements the write-ahead log manager and replay logic. |
