rpk cluster txn

Information about transactions and transactional producers.

Concept

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.

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.

Usage

rpk cluster txn [command] [flags]

Aliases

txn, transaction

Flags

Value Type Description

--format

string

Output format. Possible values: json, yaml, text, wide, help. Default: text.

-h, --help

-

Help for txn.

--config

string

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

-X, --config-opt

stringArray

Override rpk configuration settings. See rpk -X or execute rpk -X help for inline detail or rpk -X list for terser detail.

--profile

string

Profile to use. See rpk profile for more details.

-v, --verbose

-

Enable verbose logging.