Re: Speedup twophase transactions
Michael Paquier <michael.paquier@gmail.com>
From: Michael Paquier <michael.paquier@gmail.com>
To: Stas Kelvich <s.kelvich@postgrespro.ru>
Cc: Simon Riggs <simon@2ndquadrant.com>, PostgreSQL mailing lists <pgsql-hackers@postgresql.org>,
Jesper Pedersen <jesper.pedersen@redhat.com>, Robert Haas <robertmhaas@gmail.com>
Date: 2016-12-21T12:56:10Z
Lists: pgsql-hackers
On Fri, Dec 16, 2016 at 8:00 PM, Stas Kelvich <s.kelvich@postgrespro.ru> wrote: > So, here is brand new implementation of the same thing. > > Now instead of creating pgproc entry for prepared transaction during > recovery, > I just store recptr/xid correspondence in separate 2L-list and deleting > entries in that > list if redo process faced commit/abort. In case of checkpoint or end of > recovery > transactions remaining in that list are dumped to files in pg_twophase. > > Seems that current approach is way more simpler and patch has two times less > LOCs then previous one. That's indeed way simpler than before. Have you as well looked at the most simple approach discussed? That would be just roughly replacing the pg_fsync() calls currently in RecreateTwoPhaseFile() by a save into a list as you are doing, then issue them all checkpoint. Even for 2PC files that are created and then removed before the next checkpoint, those will likely be in system cache. This removes as well the need to have XlogReadTwoPhaseData() work in crash recovery, which makes me a bit nervous. And this saves lookups at the WAL segments still present in pg_xlog, making the operation at checkpoint much faster with many 2PC files to process. -- Michael
Commits
-
Speedup 2PC recovery by skipping two phase state files in normal path
- 728bd991c3c4 10.0 landed
-
Add tests for two-phase commit
- 30820982b295 10.0 landed
-
Improve grammar of message about two-phase state files.
- 38c363adf497 10.0 landed
-
Speedup 2PC by skipping two phase state files in normal path
- 978b2f65aa12 9.6.0 cited