Tue Mar 29 17:33:57 PST 2005
- Previous message: [Slony1-commit] By cbbrowne: Two changes to options: 1.
- Next message: [Slony1-commit] By xfade: First step of implementing slon_quote_ident.
- Messages sorted by: [ date ] [ thread ] [ subject ] [ author ]
Log Message: ----------- Changes to cleanup thread 1. Vacuum pg_statistic 2. Change calculation of random biases (e.g. - vac_bias and the per-iteration random value) to be proportional to SLON_CLEANUP_SLEEP. That way, if one modifies SLON_CLEANUP_SLEEP, the random adjustments will neither dominate nor disappear. 3. Change log message to describe the _real_ error - being unable to process the getMinXid() query. (It was referring to the old approach where it was looking at pg_locks.) Modified Files: -------------- slony1-engine/src/slon: cleanup_thread.c (r1.23 -> r1.24) -------------- next part -------------- Index: cleanup_thread.c =================================================================== RCS file: /usr/local/cvsroot/slony1/slony1-engine/src/slon/cleanup_thread.c,v retrieving revision 1.23 retrieving revision 1.24 diff -Lsrc/slon/cleanup_thread.c -Lsrc/slon/cleanup_thread.c -u -w -r1.23 -r1.24 --- src/slon/cleanup_thread.c +++ src/slon/cleanup_thread.c @@ -43,8 +43,12 @@ "%s.sl_log_1", "%s.sl_log_2", "%s.sl_seqlog", - "pg_catalog.pg_listener"}; -static char tstring[255]; + "pg_catalog.pg_listener", + "pg_catalog.pg_statistic"}; + +#define MAX_VAC_TABLE 9 /* Add to this if additional tables are added above */ + +static char tstring[255]; /* string used to store table names for the VACUUM statements */ /* * ---------- cleanupThread_main @@ -75,7 +79,7 @@ /* Want the vacuum time bias to be between 0 and 100 seconds, * hence between 0 and 100000 */ if (vac_bias == 0) { - vac_bias = rand() % 100000; + vac_bias = rand() % ( SLON_CLEANUP_SLEEP * 166 ); } slon_log(SLON_DEBUG4, "cleanupThread: bias = %d\n", vac_bias); @@ -105,7 +109,7 @@ * slons hitting the same cluster will run into conflicts due * to trying to vacuum pg_listener concurrently */ - while (sched_wait_time(conn, SCHED_WAIT_SOCK_READ, SLON_CLEANUP_SLEEP * 1000 + vac_bias + (rand() % 100000)) == SCHED_STATUS_OK) + while (sched_wait_time(conn, SCHED_WAIT_SOCK_READ, SLON_CLEANUP_SLEEP * 1000 + vac_bias + (rand() % (SLON_CLEANUP_SLEEP * 166))) == SCHED_STATUS_OK) { /* * Call the stored procedure cleanupEvent() @@ -210,7 +214,7 @@ */ dstring_init(&query3); gettimeofday(&tv_start, NULL); - for (t=0; t < 8; t++) { + for (t=0; t < MAX_VAC_TABLE; t++) { sprintf(tstring, table_list[t], rtcfg_namespace); slon_mkquery(&query3, "%s %s;", @@ -260,7 +264,13 @@ pthread_exit(NULL); } -/* "_T1".getMinXid(); */ +/* get_earliest_xid() reads the earliest XID that is still active. + + The idea is that if, between cleanupThread iterations, this XID has + not changed, then an old transaction is still in progress, + PostgreSQL is holding onto the tuples, and there is no value in + doing VACUUMs of the various Slony-I tables. +*/ static unsigned long get_earliest_xid (PGconn *dbconn) { long long xid; @@ -271,7 +281,7 @@ slon_mkquery(&query1, "select %s.getMinXid();", rtcfg_namespace); res = PQexec(dbconn, dstring_data(&query1)); if (PQresultStatus(res) != PGRES_TUPLES_OK) { - slon_log(SLON_FATAL, "cleanupThread: could not read locks from pg_locks!"); + slon_log(SLON_FATAL, "cleanupThread: could not getMinXid()!\n"); PQclear(res); slon_abort(); return -1;
- Previous message: [Slony1-commit] By cbbrowne: Two changes to options: 1.
- Next message: [Slony1-commit] By xfade: First step of implementing slon_quote_ident.
- Messages sorted by: [ date ] [ thread ] [ subject ] [ author ]
More information about the Slony1-commit mailing list