One thing I'd like to point out is regarding second phase (commit phase)

It's important to understand that once this phase has started, there's no
way back. After code execution is behind commit point, the transactions
MUST commit no matter what. Data must be committed regardless of network
issues even if such last for minutes.

Let's say we have two databases.

On the first phase we have asked them and received a confirmation of being
ready to commit.


Then second (Commit) phase starts:

1. We have sent commit to the first database and it responded us with OK
(comitted)
2. Next we send commit to the second database, and it may be the case that
in that very moment we lose connection. Hence, if connection is lost before
final commit request, second database won't receive commit, and since It's
not aware of whether transaction should be committed or rolled back, data
is never made persistent.

FWIK, this case is usually handled at the application level using async
commit in message consumers. Meaning commit operation will be retied again,
and again, and again until the connection is restored.

Therefore, commit point is the point of no-return and network issues is the
problem we have to deal with.

Do you have any ideas how to handle this case at the core level in the
regard of php lifecycle?

Reply via email to