Skip to content

Commit 14e2a26

Browse files
committed
Prevent CLUSTER from decreasing a relation's relfrozenxid. Bug
introduced in rewrite to make CLUSTER MVCC-safe.
1 parent ac12412 commit 14e2a26

File tree

1 file changed

+8
-1
lines changed

1 file changed

+8
-1
lines changed

src/backend/commands/cluster.c

Lines changed: 8 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -11,7 +11,7 @@
1111
*
1212
*
1313
* IDENTIFICATION
14-
* $PostgreSQL: pgsql/src/backend/commands/cluster.c,v 1.167 2008/01/02 23:34:42 tgl Exp $
14+
* $PostgreSQL: pgsql/src/backend/commands/cluster.c,v 1.168 2008/01/15 21:20:28 tgl Exp $
1515
*
1616
*-------------------------------------------------------------------------
1717
*/
@@ -751,6 +751,13 @@ copy_heap_data(Oid OIDNewHeap, Oid OIDOldHeap, Oid OIDOldIndex)
751751
vacuum_set_xid_limits(-1, OldHeap->rd_rel->relisshared,
752752
&OldestXmin, &FreezeXid);
753753

754+
/*
755+
* FreezeXid will become the table's new relfrozenxid, and that mustn't
756+
* go backwards, so take the max.
757+
*/
758+
if (TransactionIdPrecedes(FreezeXid, OldHeap->rd_rel->relfrozenxid))
759+
FreezeXid = OldHeap->rd_rel->relfrozenxid;
760+
754761
/* Initialize the rewrite operation */
755762
rwstate = begin_heap_rewrite(NewHeap, OldestXmin, FreezeXid, use_wal);
756763

0 commit comments

Comments
 (0)
pFad - Phonifier reborn

Pfad - The Proxy pFad of © 2024 Garber Painting. All rights reserved.

Note: This service is not intended for secure transactions such as banking, social media, email, or purchasing. Use at your own risk. We assume no liability whatsoever for broken pages.


Alternative Proxies:

Alternative Proxy

pFad Proxy

pFad v3 Proxy

pFad v4 Proxy