Synchronous replication abort of transaction and remote apply

Hey Community,

So i have a question. For a project we have been using a synchronous replication. It was set to ‘remote apply’. Now we have two nodes and a transaction has been started but our secondary can’t be reached. We have expected that we would just wait endlessly till our secondary comes back but if our waiting process is interrupted by no matter what, the data changes will be applied locally. We could already find out, that this is a known issue and that the cancellation shouldn’t be forbidden. Still we are confused, as per definition of synchronous streaming replication and remote apply, we thought that a transaction counts as successful committed if it has been streamed and written simultaneously to the primary and secondary Wal and then applied to both datasets, but apparently this isn’t true or is it?
As we see it now, the primary wal is written first. If this is true, is this always the case or just if the secondary can’t be reached?
And apparently also the changes to the primary dataset happen before they are applied to the secondary.
So can we even say that the remote apply is possible? Or synchronous replication?
Sorry if this is a trivial question but for us it seems that the deeper we the dig the more confused we get.
Hopefully you have some insights for us or can lead us to a direction where we can find the answer.

Thanks in advance,

sync replication with only 1 standby doesn’t make sense. If the standby is not reachable you have to wait endlessly OR you have to cancel the transaction on the primary, witch will mean the transaction will be rolled back. Period.

Und außerdem ist dies ein deutschsprachiges Forum.

Oh sorry dafür!

Das wissen wir, aber das ist ja nicht die Antwort auf meine Frage. Ich will wissen ob die PostgreSQL Theorie über Synchronität und die Implementierung sich decken. Weil uns ja aufgefallen ist, dass dem nicht der Fall ist. Hast du dazu noch weitere Infos für mich.