waitxacts

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: 9 Imported by: 0

Documentation

Overview

Package waitxacts defines implementation of workload which locks tables and blocks queries. Blocked queries have to wait until lock is released.

Before starting the workload looking for the tables with the most UPDATE and DELETE operations. Suppose there is a concurrent workload is running on those tables. Start goroutines in a loop (where number of goroutines depends on Config.Jobs). Each goroutine select random table from the list and set EXCLUSIVE lock. During the time the table is locked, all activity related to this table is stuck in waiting until lock is released. Goroutine release the lock after random time between Config.LocktimeMin and Config.LocktimeMax.

There is also fixture mode exists, for scenarios with no concurrent activity, or when no tables found. In this mode, special working table is created, which is used for locks. Worker use two goroutines, first used for locking the table, the second used for issuing query to locked table.

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.
	Conninfo string
	// Jobs defines how many workers should be created for producing waiting transactions.
	Jobs uint16
	// Fixture defines to run fixture test which is not affect already running workload.
	Fixture bool
	// LocktimeMin defines a lower threshold of locking interval for blocking transactions.
	LocktimeMin time.Duration
	// LocktimeMax defines an upper threshold of locking interval for blocking transactions.
	LocktimeMax time.Duration
}

Config defines configuration settings for waiting transactions workload

Jump to

Keyboard shortcuts

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