This stage consists of the following steps:
- Each node uses ActiveLocalTxMinimumRequiredTimeProvider to determine the minimum begin time among all local active read-write transactions and sends it to coordinator.
- Coordinator calculates global minimum and sends it to all nodes using CatalogCompactionPrepareUpdateTxBeginTimeMessage.
- Each node stores this time within replication groups for which the local node is the leader
(using UpdateMinimumActiveTxBeginTimeReplicaRequest
and UpdateMinimumActiveTxBeginTimeCommand. - This timestamp (let's call it
minTxTime
) is published (becomes available to compaction process) only after checkpoint happens (partition data is flushed to disk).
Compaction stage

- Each node determines the local minimum required time, this consists of the following steps:
- Using the introduced MinimumRequiredTimeCollectorService to determine minimum time among all published timestamps (
minTxTime
) in local replication groups. - If
minTxTime
is not published yet, the current iteration of compaction is aborted. - Selects minimum between determined minimum
minTxTime
and current low watermark
.
- Each node sends the calculated local minimum timestamp to the coordinator, as well as a set of local replication groups that was used to calculate the local minimum.
- The coordinator determines global minimum required time.
- Using this time, the coordinator determines the version of the catalog up to which (inclusive) history can be trimmed.
- Based on the calculated catalog version, the coordinator determines the list of required
partitions by it and compares actual replication groups distribution with what was received from remote nodes, and current iteration will be aborted in the following cases:- the logical topology is missing some node required by catalog
- some node is missing required replication group
- calculated catalog version has an index that is still building
- there is an active rebalance, which refer to the calculated (or below calculated) version of the catalog
- The coordinator performs catalog compaction.