[PDO] 2 phase commit
| From: | Saki Takamachi | Date: | Wed, 29 Nov 2023 23:10:14 +0000 |
| Subject: | [PDO] 2 phase commit | ||
| Groups: | php.internals | ||
| Request: | Send a blank email to internals+get-121865@lists.php.net to get a copy of this message | ||
Hi internals,
For the past few days I've been thinking about whether to make a suggestion to add two-phase
commit functionality to pdo.
I would like to hear everyone's opinions.
About two-phase commit
Regular transactions do not guarantee consistency across multiple DBs. For example, if you update
DB1 and DB2 at the same time, only DB1 may be updated and the DB2 update may fail.
When using two-phase commit, it is as if a common transaction has been started for multiple DBs, and
their consistency can be guaranteed.
Currently, pdo does not have such a feature as a method, but it is possible to use two-phase commit
by executing a query. Think of it as adding such functionality as a method.
Although I have only written about the advantages, two-phase commit also has disadvantages, such as
the possibility that locks may not be released forever under certain conditions.
Regards.
Saki