replay

package
v1.4.0-nextgen.202510.7 Latest Latest
Warning

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

Go to latest
Published: Apr 20, 2026 License: Apache-2.0 Imports: 32 Imported by: 0

Documentation

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

func NewHandshakeHandler

func NewHandshakeHandler(hsHsHandler backend.HandshakeHandler) *handshakeHandler

func NewReplay

func NewReplay(lg *zap.Logger, idMgr *id.IDManager) *replay

Types

type Replay

type Replay interface {
	// Start starts the replay
	Start(cfg ReplayConfig, backendTLSConfig *tls.Config, hsHandler backend.HandshakeHandler, bcConfig *backend.BCConfig) error
	// Wait for the job done.
	Wait()
	// Stop stops the replay
	Stop(err error, graceful bool)
	// Progress returns the progress of the replay job
	Progress() (float64, time.Time, time.Time, time.Time, bool, error)
	// Close closes the replay
	Close()
}

type ReplayConfig

type ReplayConfig struct {
	Format   string
	Input    string
	Username string
	Password string `json:"-"`
	KeyFile  string
	// It's specified when executing with the statement `TRAFFIC REPLAY` so that all TiProxy instances
	// use the same start time and the time acts as the job ID.
	StartTime time.Time
	Speed     float64
	ReadOnly  bool

	// CommandStartTime is the start time of the command being replayed. It's different from StartTime,
	// which means the start time of the whole replay job.
	CommandStartTime time.Time
	// CommandEndTime is the end time of the command being replayed. This config is only valid for audit
	// log plugin format.
	CommandEndTime time.Time
	// IgnoreErrs indicates whether to ignore decoding errors.
	// The errors are just printed if true, otherwise the replayer stops.
	IgnoreErrs bool
	// BufSize is the size of the buffer for reordering commands from audit files. 0 means no buffering.
	BufSize int
	// PSCloseStrategy defines when to close the prepared statements.
	PSCloseStrategy cmd.PSCloseStrategy
	// DryRun indicates whether to actually execute the commands.
	DryRun bool
	// CheckPointFilePath is the path to the file that stores the current state of the replay
	CheckPointFilePath string
	// Dynamic defines whether the input is dynamic, e.g. a path prefix.
	DynamicInput bool
	// ReplayerCount is the total number of replayers which share the same dynamic input. The count
	// and index is used to determine whether this replayer should process a new
	ReplayerCount uint64
	// ReplayerIndex is the index of this replayer among all replayers.
	ReplayerIndex uint64
	// OutputPath is the path to output replayed sql.
	OutputPath string
	// Addr is the downstream address to connect to
	Addr string
	// FilterCommandWithRetry indicates whether to filter out commands that are retries according to the audit log.
	FilterCommandWithRetry bool
	// WaitOnEOF indicates whether the replayer waits for the next file when no more files.
	WaitOnEOF bool
	// contains filtered or unexported fields
}

func (*ReplayConfig) LoadFromCheckpoint

func (cfg *ReplayConfig) LoadFromCheckpoint() error

LoadFromCheckpoint loads the config from the checkpoint file.

func (*ReplayConfig) Validate

func (cfg *ReplayConfig) Validate() ([]storage.ExternalStorage, error)

Jump to

Keyboard shortcuts

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