Documentation
¶
Overview ¶
Package slotbloat defines implementation of workload which deliberately drives a PostgreSQL instance towards a disk-full PANIC via a forgotten replication slot.
A single dedicated connection (not a pool) creates an un-consumed physical replication slot with immediately_reserve := true, which freezes restart_lsn at creation and pins WAL without any consumer. It then seeds a dedicated regular table with N rows of K-byte payload and drives a single-threaded rate-limited UPDATE-churn loop over that fixed row set. Because the slot pins WAL while the heap stays flat (UPDATE in place), pg_wal grows unbounded until the disk fills and the instance PANICs.
The workload self-reports honestly: it keeps an in-process counter of the application payload bytes it has written (count × K) and prints an escalation panel every report-interval via logger.Infof, labeled payload-written. It never polls server WAL state, so the log stays truthful even when the target becomes unreachable at the moment of catastrophe. On graceful stop the slot and table are dropped on a fresh context.Background(); with --keep-slot both are kept and their names are logged. Workload duration is controlled by a context created outside and passed to Run.
Index ¶
Constants ¶
This section is empty.
Variables ¶
This section is empty.
Functions ¶
Types ¶
type Config ¶
type Config struct {
// Conninfo defines connection string used for connecting to Postgres.
// It is a secret and must never be logged.
Conninfo string
// Rate defines UPDATE statements rate per second; 0 means unlimited (rate.Inf).
Rate float64
// Rows defines the number of seed rows churned in place (>= 1).
Rows int
// PayloadBytes defines the payload size in bytes per row/UPDATE (>= 1).
PayloadBytes int
// ReportInterval defines the escalation panel print cadence.
ReportInterval time.Duration
// KeepSlot keeps the slot and table on graceful exit instead of dropping them.
KeepSlot bool
}
Config defines configuration settings for slot-bloat workload.