pg_upgrade bug in handling postgres/template1 databases
pg_upgrade bug in handling postgres/template1 databases
I received a private pg_upgrade bug report related to its affect on the removal of clog files in the upgraded cluster. The user reported that an upgraded cluster yielded this error very soon after being started for the first time: SELECT * FROM test; ERROR: could not access status of transaction 685 DETAIL: Could not open file "pg_clog/0000": No such file or directory. I was confused as I had never seen such a report before. After much digging, I found out that the user was storing data _only_ in the 'postgres' database, not any other databases, and that pg_upgrade was not preserving pg_database.datfrozenxid and pg_database.datminmxid, even though it was processing those databases and copying over any user tables and indexes. When the new server was started, pg_database.datminmxid equaled the current transaction counter and old clog files were removed, yielding the error. This is not a problem for users who store functions or extensions in the postgres or template1 database, just user tables and indexes. The attached patch fixes the problem, and I have reproduced the bug and verified the patch fixes it. It would have been nice if I had figured this out two weeks ago, before we released minor version upgrades. This bug has existed back to 9.0 or earlier, so it isn't new. -- Bruce Momjian http://momjian.us EnterpriseDB http://enterprisedb.com + Everyone has their own god. +
Re: pg_upgrade bug in handling postgres/template1 databases
От:
Bruce Momjian <bruce@momjian.us>
Дата:
On Tue, Feb 10, 2015 at 12:52:33PM -0500, Bruce Momjian wrote: > The attached patch fixes the problem, and I have reproduced the bug and > verified the patch fixes it. It would have been nice if I had figured > this out two weeks ago, before we released minor version upgrades. This > bug has existed back to 9.0 or earlier, so it isn't new. Patch applied back through 9.0. This bug was reported by an EDB customer. -- Bruce Momjian http://momjian.us EnterpriseDB http://enterprisedb.com + Everyone has their own god. +