Another pg_autovacuum patch - Mailing list pgsql-patches

From Matthew T. O'Connor
Subject Another pg_autovacuum patch
Date
Msg-id 3FD393AB.8050403@zeut.net
Whole thread Raw
Responses Re: Another pg_autovacuum patch
List pgsql-patches
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 ----

pgsql-patches by date:

Previous
From: Peter Eisentraut
Date:
Subject: Re: Double Backslash example patch
Next
From: "Matthew T. O'Connor"
Date:
Subject: pg_autovacuum another one line patch