Thread: Another pg_autovacuum patch

Another pg_autovacuum patch

From
"Matthew T. O'Connor"
Date:
Ok, one more pg_autovacuum patch (Thanks to Tom for fixing the long long
overflow problem).

This patch addresses two minor issues (the last two pg_autovacuum bugs I
know of):

First the CountAtLastAnalyze varable was initially being set incorrectly
causing pg_autovacuum to perform unneeded analyzes on during startup.

Second, there was a debug print statement left in that was printing
relisshared.

The attached patch fixes both issues, and should be applied to both 7.4
and HEAD.

Thanks,

Matthew O'Connor

*** pg_autovacuum.c.orig    2003-12-07 15:25:08.000000000 -0500
--- pg_autovacuum.c    2003-12-07 15:46:07.000000000 -0500
***************
*** 108,114 ****

      new_tbl->CountAtLastAnalyze =
          (atol(PQgetvalue(res, row, PQfnumber(res, "n_tup_ins"))) +
!          atol(PQgetvalue(res, row, PQfnumber(res, "n_tup_upd"))));
      new_tbl->curr_analyze_count = new_tbl->CountAtLastAnalyze;

      new_tbl->CountAtLastVacuum =
--- 108,115 ----

      new_tbl->CountAtLastAnalyze =
          (atol(PQgetvalue(res, row, PQfnumber(res, "n_tup_ins"))) +
!          atol(PQgetvalue(res, row, PQfnumber(res, "n_tup_upd"))) +
!          atol(PQgetvalue(res, row, PQfnumber(res, "n_tup_del"))));
      new_tbl->curr_analyze_count = new_tbl->CountAtLastAnalyze;

      new_tbl->CountAtLastVacuum =
***************
*** 120,126 ****
      new_tbl->reltuples = atoi(PQgetvalue(res, row, PQfnumber(res, "reltuples")));
      new_tbl->relpages = atoi(PQgetvalue(res, row, PQfnumber(res, "relpages")));

-     log_entry(PQgetvalue(res, row, PQfnumber(res, "relisshared")));
      if (strcmp("t", PQgetvalue(res, row, PQfnumber(res, "relisshared"))))
          new_tbl->relisshared = 0;
      else
--- 121,126 ----

Re: Another pg_autovacuum patch

From
Tom Lane
Date:
"Matthew T. O'Connor" <matthew@zeut.net> writes:
> Ok, one more pg_autovacuum patch (Thanks to Tom for fixing the long long
> overflow problem).

Applied.

            regards, tom lane