rpk cluster txn

Information about transactions and transactional producers.

Transactions allow producing, or consume-modifying-producing, to Redpanda. The consume-modify-produce loop is also referred to as EOS (exactly once semantics). Transactions involve a lot of technical complexity that is largely hidden within clients. This command space helps shed a light on what is actually happening in clients and brokers while transactions are in use.

Usage

rpk cluster txn [flags]

Transactional ID

The transactional ID is the string you define in clients when actually using transactions.

Producer ID & Epoch

The producer ID is generated within clients when you transactionally produce. The producer ID is a number that maps to your transactional ID, allowing requests to be smaller when producing, and allowing some optimizations within brokers when managing transactions.

Some clients expose the producer ID, allowing you to track the transactional ID that a producer ID maps to. If possible, it is recommended to monitor the producer ID used in your applications.

The producer epoch is a number that somewhat counts the number of times your transaction has been initialized or expired. If you have one client that uses a transactional ID, it may receive producer ID 3 epoch 0. Another client that uses that same transactional ID will receive producer ID 3 epoch 1. If the client starts a transaction but does not finish it in time, the cluster will internally bump the epoch to 2. The epoch allows the cluster to fence clients: if a client attempts to use a producer ID with an old epoch, the cluster will reject the client’s produce request as stale.

Transaction State

The state of a transaction indicates what is currently happening with a transaction. A high level overview of transactional states:

  • Empty: the transactional ID is ready but there are no partitions nor groups added to it — there is no active transaction

  • Ongoing: the transactional ID is being used in a began transaction

  • PrepareCommit: a commit is in progress

  • PrepareAbort: an abort is in progress

  • PrepareEpochFence: the transactional ID is timing out

  • Dead: the transactional ID has expired and/or is not in use

Last Stable Offset

The last stable offset is the offset at which a transaction has begun and clients cannot consume past, if the client is configured to read only committed offsets. The last stable offset can be seen when describing active transactional producers by looking for the earliest transaction start offset per partition.

Aliases

rpk cluster transaction

Subcommands

Command Description

rpk cluster txn describe

Describe transactional IDs. This command, in comparison to list, is a more detailed per-transaction view of transactional IDs.

rpk cluster txn describe-producers

Describe transactional producers to partitions. This command describes partitions that active transactional producers are producing to.

rpk cluster txn list

List transactions and their current states This command lists all known transactions in the cluster, the producer ID for the transactional ID, and the and the state of the transaction. For information on what the columns in the output mean, see rpk cluster txn --help.

Flags

Value Type Description

--format

string

Output format (json,yaml,text,wide,help).

Global flags

Value Type Description

--config

string

Redpanda or rpk config file; default search paths are ~/.config/rpk/rpk.yaml, $PWD/redpanda.yaml, and /etc/redpanda/redpanda.yaml.

-X, --config-opt

stringArray

Override rpk configuration settings; -X help for detail or -X list for terser detail.

--ignore-profile

bool

Ignore rpk.yaml and redpanda.yaml; use default settings.

--profile

string

rpk profile to use.

-v, --verbose

bool

Enable verbose logging.