deadlocks

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

Documentation

Overview

Package deadlocks defines implementation of workload which creates deadlocks between several concurrent transactions, which finally leads to Postgres have to resolve the deadlock and terminate an one participant of the deadlock.

Before starting the workload, some prepare steps have to be made - a special working table should be created. When the workload is finished this table should be dropped. For more info see prepare and cleanup methods. When working table is created, the workload is allowed to start. The number of necessary workers could be started (accordingly to Config.Jobs). Each worker calls a deadlock routine in a separate goroutine. Deadlock routine inserts to unique rows into the working table and than starts two transactions which tries to make a cross-update of these rows. Obviously, this update fails with a deadlock, which forces Postgres to resolve it. Postgres resolves the deadlock by terminating a single participant of the deadlock. As a result the second survived transaction can continue its work and return.

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 deadlocks.
	Jobs uint16
}

Config defines configuration settings for deadlocks workload.

Jump to

Keyboard shortcuts

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