|
55 | 55 | *
|
56 | 56 | *
|
57 | 57 | * IDENTIFICATION
|
58 |
| - * $PostgreSQL: pgsql/src/backend/postmaster/autovacuum.c,v 1.95 2009/05/15 15:56:39 tgl Exp $ |
| 58 | + * $PostgreSQL: pgsql/src/backend/postmaster/autovacuum.c,v 1.96 2009/06/09 16:41:02 alvherre Exp $ |
59 | 59 | *
|
60 | 60 | *-------------------------------------------------------------------------
|
61 | 61 | */
|
@@ -123,6 +123,8 @@ intLog_autovacuum_min_duration = -1;
|
123 | 123 | /* how long to keep pgstat data in the launcher, in milliseconds */
|
124 | 124 | #defineSTATS_READ_DELAY 1000
|
125 | 125 |
|
| 126 | +/* the minimum allowed time between two awakening of the launcher */ |
| 127 | +#defineMIN_AUTOVAC_SLEEPTIME 100.0/* milliseconds */ |
126 | 128 |
|
127 | 129 | /* Flags to tell if we are in an autovacuum process */
|
128 | 130 | staticboolam_autovacuum_launcher= false;
|
@@ -822,11 +824,11 @@ launcher_determine_sleep(bool canlaunch, bool recursing, struct timeval * nap)
|
822 | 824 | return;
|
823 | 825 | }
|
824 | 826 |
|
825 |
| -/*100ms is thesmallest time we'll allow the launcher to sleep */ |
826 |
| -if (nap->tv_sec <=0&&nap->tv_usec <=100000) |
| 827 | +/*Thesmallest time we'll allow the launcher to sleep. */ |
| 828 | +if (nap->tv_sec <=0&&nap->tv_usec <=MIN_AUTOVAC_SLEEPTIME*1000) |
827 | 829 | {
|
828 | 830 | nap->tv_sec=0;
|
829 |
| -nap->tv_usec=100000;/* 100 ms */ |
| 831 | +nap->tv_usec=MIN_AUTOVAC_SLEEPTIME*1000; |
830 | 832 | }
|
831 | 833 | }
|
832 | 834 |
|
@@ -997,8 +999,17 @@ rebuild_database_list(Oid newdb)
|
997 | 999 | /* sort the array */
|
998 | 1000 | qsort(dbary,nelems,sizeof(avl_dbase),db_comparator);
|
999 | 1001 |
|
1000 |
| -/* this is the time interval between databases in the schedule */ |
| 1002 | +/* |
| 1003 | + * Determine the time interval between databases in the schedule. |
| 1004 | + * If we see that the configured naptime would take us to sleep times |
| 1005 | + * lower than our min sleep time (which launcher_determine_sleep is |
| 1006 | + * coded not to allow), silently use a larger naptime (but don't touch |
| 1007 | + * the GUC variable). |
| 1008 | + */ |
1001 | 1009 | millis_increment=1000.0*autovacuum_naptime /nelems;
|
| 1010 | +if (millis_increment <=MIN_AUTOVAC_SLEEPTIME) |
| 1011 | +millis_increment=MIN_AUTOVAC_SLEEPTIME*1.1; |
| 1012 | + |
1002 | 1013 | current_time=GetCurrentTimestamp();
|
1003 | 1014 |
|
1004 | 1015 | /*
|
|