Here is a patch that will warn you during VACUUM when you are within 75%
of oid/xid wraparound.
I will apply it if 7.2 has no solution to the wraparounds.
--
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, Pennsylvania 19026
Index: src/backend/commands/vacuum.c
===================================================================
RCS file: /home/projects/pgsql/cvsroot/pgsql/src/backend/commands/vacuum.c,v
retrieving revision 1.195
diff -c -r1.195 vacuum.c
*** src/backend/commands/vacuum.c 2001/05/25 15:45:32 1.195
--- src/backend/commands/vacuum.c 2001/06/12 23:25:58
***************
*** 159,166 ****
static bool enough_space(VacPage vacpage, Size len);
static void init_rusage(VacRUsage *ru0);
static char *show_rusage(VacRUsage *ru0);
-
/*
* Primary entry point for VACUUM and ANALYZE commands.
*/
--- 159,166 ----
static bool enough_space(VacPage vacpage, Size len);
static void init_rusage(VacRUsage *ru0);
static char *show_rusage(VacRUsage *ru0);
+ static void check_limits(void);
/*
* Primary entry point for VACUUM and ANALYZE commands.
*/
***************
*** 236,241 ****
--- 236,242 ----
/* clean up */
vacuum_shutdown();
+ check_limits();
}
/*
***************
*** 2645,2648 ****
--- 2646,2672 ----
(int) (ru1.tv.tv_usec - ru0->tv.tv_usec) / 10000);
return result;
+ }
+
+ /*
+ * check if we are near OID or XID wraparound
+ */
+ static void check_limits(void)
+ {
+ Oid nextOid;
+
+ /* If we are 75% to the limit, warn the user */
+ if (GetCurrentTransactionId() >
+ ~(TransactionId)0 - (~(TransactionId)0) / 4)
+ elog(NOTICE,"You are within 75%% of the limit for transaction ids.\n"
+ "Dumping your databases, running initdb, and reloading will reset\n"
+ "the transaction id counter.");
+
+ /* If we are 75% to the limit, warn the user */
+ GetNewObjectId(&nextOid);
+ if (nextOid > ~(Oid)0 - (~(Oid)0) / 4)
+ elog(NOTICE,"You are within 75%% of the limit for object ids.\n"
+ "If you are not using object ids as primary keys, dumping your\n"
+ "databases, running initdb, and reloading will reset\n"
+ "the oid counter.");
}