Re: A way to let Vacuum warn if FSM settings are low. - Mailing list pgsql-patches

From Ron Mayer
Subject Re: A way to let Vacuum warn if FSM settings are low.
Date
Msg-id Pine.LNX.4.58.0502271135410.26845@greenie.cheapcomplexdevices.com
Whole thread Raw
In response to Re: A way to let Vacuum warn if FSM settings are low.  (Simon Riggs <simon@2ndquadrant.com>)
Responses Re: A way to let Vacuum warn if FSM settings are low. [final?]
List pgsql-patches
On Sun, 27 Feb 2005, Simon Riggs wrote:
> On Fri, 2005-02-25 at 16:48 -0800, Ron Mayer wrote:
> > Getting closer?
> For me, yes.  [...]
> The not-warnings seem a little wordy for me, but they happen when and
> how I would hope for.
>
> So, for me, it looks like a polish of final wording and commit.

Thanks for the feedback.  How about I replace the grammatically poor:

 LOG:  max_fsm_relations(%d) is equal than the number of relations vacuum checked (%d)",
 HINT:  You probably have more than %d relations. You should increase max_fsm_relations. Pages needed for
max_fsm_pages may have been underestimated.

with this:

 LOG:  max_fsm_relations(100) equals the number of relations checked
 HINT:  You have >= 100 relations. You should increase max_fsm_relations.


and replace this:

 LOG:  max_fsm_pages(%d) is smaller than the actual number of page slots needed(%.0f)",
 HINT:  You may want to increase max_fsm_pages to be larger than %.0f"

with the slightly smaller

 LOG:  the number of page slots needed (2832) exceeds max_fsm_pages (1601)
 HINT:  You may want to increase max_fsm_pages to a value over 2832.


These updated messages would fit on an 80-column display if the numbers
aren't too big.   Here's 80 characters for a quick reference.
 01234567890123456789012345678901234567890123456789012345678901234567890123456789
The "pages needed...underestimate" in the first message was no longer
useful anyway; since it's no longer logging fsm_pages stuff when the
max_fsm_relations condition occurred anyway

  Ron

The patch now looks like:

================================================================================
% 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-27 11:54:39.776546200 -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) equals the number of relations checked",
+             MaxFSMRelations),
+             errhint("You have >= %d relations. You should increase max_fsm_relations.",numRels)));
+    else
+    if (needed > MaxFSMPages)
+        ereport(LOG,
+            (errmsg("the number of page slots needed (%.0f) exceeds max_fsm_pages (%d)",
+             needed,MaxFSMPages),
+             errhint("You may want to increase max_fsm_pages to a value over %.0f.",needed)));
+
 }

 /*
%
================================================================================

pgsql-patches by date:

Previous
From: Neil Conway
Date:
Subject: Re: array max() / min()
Next
From: Bruce Momjian
Date:
Subject: Re: Patch for Array min() / max()