bloatchurn

package
v0.3.0 Latest Latest
Warning

This package is not in the latest version of its module.

Go to latest
Published: Jun 29, 2026 License: BSD-3-Clause Imports: 11 Imported by: 0

Documentation

Overview

Package bloatchurn defines implementation of a workload which deliberately generates remediable table-and-index bloat via a rate attack: it floods a seed table with UPDATEs faster than autovacuum (left enabled) can reclaim the dead tuples. It is the sanctioned "rate attack" twin of xmin-horizon-holder (the "horizon attack", ADR-007-4) — built by copying that package's shape, removing every holder organ, and adding the bloat-shaping seed/churn (ADR-007-4).

The bloat mechanism is one move with a double effect (Decision 2): the seed table carries an updated_at timestamptz column with the SINGLE index on it, and every churn UPDATE sets updated_at = now(). Updating an indexed column forbids HOT (the heap bloats) and the monotonic now() bloats the btree on its right edge (a REINDEX CONCURRENTLY lesson). Churn touches only the lower half of the table (hotFraction = 0.5, Decision 3) — never the tail — so the live tail heap pages keep VACUUM from truncating the file and the bloat survives for the post-stop repair demo.

It hosts the Config surface, its validation, the NewWorkload constructor, the copied infrastructure helpers (sanitize, randomSuffix, formatBytes, rowsForSize, prepare, dropTable, cleanup), and the runtime engine: Run, the scattered-churn workers, and the self-report reporter.

The seed table is dropped on a fresh connection at exit (unless KeepTable). 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

func NewWorkload

func NewWorkload(config Config, logger log.Logger) (noisia.Workload, error)

NewWorkload creates a new workload with specified config.

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
	// TableSize defines the target seed-table size in bytes (from --table-size,
	// base-2 parsed). It is converted to a row count via a payload-aware estimate.
	TableSize int64
	// PayloadBytes defines the payload size in bytes written per UPDATE (>= 1).
	PayloadBytes int
	// Rate defines UPDATE statements rate per second PER worker; 0 means unlimited.
	Rate float64
	// ReportInterval defines the escalation panel print cadence.
	ReportInterval time.Duration
	// Jobs defines how many concurrent churn workers to run, taken from the global
	// --jobs flag (>= 1).
	Jobs uint16
	// KeepTable keeps the seed table on graceful exit instead of dropping it.
	KeepTable bool
}

Config defines configuration settings for bloat-churn workload.

Jump to

Keyboard shortcuts

? : This menu
/ : Search site
f or F : Jump to
y or Y : Canonical URL