Re: [PATCHES] A way to let Vacuum warn if FSM settings are low.

From: Ron Mayer <rm_pg(at)cheapcomplexdevices(dot)com>
To: Bruce Momjian <pgman(at)candle(dot)pha(dot)pa(dot)us>
Cc: Tom Lane <tgl(at)sss(dot)pgh(dot)pa(dot)us>, Simon Riggs <simon(at)2ndquadrant(dot)com>, pgsql-general(at)postgresql(dot)org, pgsql-patches(at)postgresql(dot)org
Subject: Re: [PATCHES] A way to let Vacuum warn if FSM settings are low.
Date: 2005-02-26 00:48:02
Message-ID: Pine.LNX.4.58.0502251625170.26845@greenie.cheapcomplexdevices.com
Views: Raw Message | Whole Thread | Download mbox | Resend email
Thread:
Lists: pgsql-general pgsql-patches


On Fri, 25 Feb 2005, Bruce Momjian wrote:
> Tom Lane wrote:
> > Ron Mayer <rm_pg(at)cheapcomplexdevices(dot)com> writes:
> > > Should the relation overflow be a WARNING or a LOG? ...
> > I'd go for making them both LOG, I think. More consistent.
>
> Can we also update this wording:
>
> INFO: free space map: 52 relations, 61 pages stored; 848 total pages needed
> DETAIL: Allocated FSM size: 1000 relations + 20000 pages = 182 kB shared memory.
>
> The "pages needed" is confusing. In fact it is the total pages used or
> allocated. I looked in the code and got confused. It needs clarity.

Any preference? To me, "allocated" has some risk of sounding like
it refers to the total free space map (memory allocated for fsm)
instead of just the used ones. "Allocated" is actually used for
that other meaning on the next line. I guess it's confusing there
too, so that line should be changed as well.

How about if I go for "used" in that first line; and simply remove the
word "Allocated" in the DETAIL line.

So instead of:
>
> INFO: free space map: 52 relations, 61 pages stored; 848 total pages needed
> DETAIL: Allocated FSM size: 1000 relations + 20000 pages = 182 kB shared memory.
>
it'll say
>
> INFO: free space map: 52 relations, 61 pages stored; 848 total pages used
> DETAIL: FSM size: 1000 relations + 20000 pages = 182 kB shared memory.
>

With those changes, the patch now looks like this...

======================================================================

% diff -u postgresql-8.0.1/src/backend/storage/freespace/freespace.c postgresql-patched/src/backend/storage/freespace/freespace.c
--- postgresql-8.0.1/src/backend/storage/freespace/freespace.c 2004-12-31 14:00:54.000000000 -0800
+++ postgresql-patched/src/backend/storage/freespace/freespace.c 2005-02-25 16:45:26.773792440 -0800
@@ -705,12 +705,25 @@
/* Convert stats to actual number of page slots needed */
needed = (sumRequests + numRels) * CHUNKPAGES;

- ereport(elevel,
- (errmsg("free space map: %d relations, %d pages stored; %.0f total pages needed",
+ ereport(INFO,
+ (errmsg("free space map: %d relations, %d pages stored; %.0f total pages used",
numRels, storedPages, needed),
- errdetail("Allocated FSM size: %d relations + %d pages = %.0f kB shared memory.",
+ errdetail("FSM size: %d relations + %d pages = %.0f kB shared memory.",
MaxFSMRelations, MaxFSMPages,
(double) FreeSpaceShmemSize() / 1024.0)));
+
+ if (numRels == MaxFSMRelations)
+ ereport(LOG,
+ (errmsg("max_fsm_relations(%d) is equal than the number of relations vacuum checked (%d)",
+ MaxFSMRelations, numRels),
+ errhint("You probably have more than %d relations. You should increase max_fsm_relations. Pages needed for max_fsm_pages may have been underestimated. ",numRels)));
+ else
+ if (needed > MaxFSMPages)
+ ereport(LOG,
+ (errmsg("max_fsm_pages(%d) is smaller than the actual number of page slots needed(%.0f)",
+ MaxFSMPages, needed),
+ errhint("You may want to increase max_fsm_pages to be larger than %.0f",needed)));
+
}

/*
======================================================================

Getting closer?

In response to

Responses

Browse pgsql-general by date

  From Date Subject
Next Message Rick Schumeyer 2005-02-26 01:02:09 Re: Is this correct behavior for ON DELETE rule?
Previous Message Mike Harding 2005-02-26 00:27:44 Re: row numbering

Browse pgsql-patches by date

  From Date Subject
Next Message Bruce Momjian 2005-02-26 20:50:23 Re: [HACKERS] UTF8 or Unicode
Previous Message Bruce Momjian 2005-02-25 18:36:57 Re: UTF8 or Unicode