Re: Question regarding how databases support atomicity
От | Christophe Pettus |
---|---|
Тема | Re: Question regarding how databases support atomicity |
Дата | |
Msg-id | BA0D2CFA-7BFF-407A-98E8-41FD40B211BD@thebuild.com обсуждение исходный текст |
Ответ на | Re: Question regarding how databases support atomicity (Siddharth Jain <siddhsql@gmail.com>) |
Список | pgsql-general |
> On May 3, 2024, at 20:02, Siddharth Jain <siddhsql@gmail.com> wrote: > > > The way I understand this is that if there is a failure in-between, we start undoing and reverting the previous operationsone by one. But what if there is a failure and we are not able to revert an operation. How is that situation handled?e.g., something failed when we tried to do Step 3. now we revert Step 2 and succeed. but when we try to revert step1 we fail. what happens now? To me, it seems its impossible to guarantee true atomicity in general. PostgreSQL does not "undo" operations as such. When modifications are made to the database, those modifications (inserts,updates, deletes) are marked with the ID of the transaction that made them. A COMMIT or ROLLBACK in PostgreSQLjust notes if those modifications are now "permanent" (if the transaction committed) or "invisible" (if the transactionrolled back). This technique in general is called Multi-Version Concurrency Control. Here's a good presentationthat describes how it works in PostgreSQL: https://momjian.us/main/writings/pgsql/mvcc.pdf
В списке pgsql-general по дате отправления: