Backport improved replication logic (v13.12)
Backport improved replication logic so that we do not have to create replication jobs in some edgecases anymore:
- If a transaction was created on secondaries, but the primary dropped out before voting.
- If there were no transactions and the primary errored out early.
- If nodes committed transactions, but failed with the same error as the primary.
This also backports a new metric which allows us to easily deduce why replication jobs have been created for improved debugging and monitoring capabitilities.