Savepoints
От | Bruce Momjian |
---|---|
Тема | Savepoints |
Дата | |
Msg-id | 200201231819.g0NIJ5i24508@candle.pha.pa.us обсуждение исходный текст |
Список | pgsql-hackers |
I have talked in the past about a possible implementation of savepoints/nested transactions. I would like to more formally outline my ideas below. We have talked about using WAL for such a purpose, but that requires WAL files to remain for the life of a transaction, which seems unacceptable. Other database systems do that, and it is a pain for administrators. I realized we could do some sort of WAL compaction, but that seems quite complex too. Basically, under my plan, WAL would be unchanged. WAL's function is crash recovery, and it would retain that. There would also be no on-disk changes. I would use the command counter in certain cases to identify savepoints. My idea is to keep savepoint undo information in a private area per backend, either in memory or on disk. We can either save the relid/tids of modified rows, or if there are too many, discard the saved ones and just remember the modified relids. On rollback to save point, either clear up the modified relid/tids, or sequential scan through the relid and clear up all the tuples that have our transaction id and have command counters that are part of the undo savepoint. It seems marking undo savepoint rows with a fixed aborted transaction id would be the easiest solution. Of course, we only remember modified rows when we are in savepoints, and only undo them when we rollback to a savepoint. Transaction processing remains the same. There is no reason for other backend to be able to see savepoint undo information, and keeping it private greatly simplifies the implementation. -- Bruce Momjian | http://candle.pha.pa.us pgman@candle.pha.pa.us | (610) 853-3000+ If your life is a hard drive, | 830 Blythe Avenue + Christ can be your backup. | Drexel Hill, Pennsylvania19026
В списке pgsql-hackers по дате отправления: