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

Поиск
Список
Период
Сортировка
От Ron Mayer
Тема Re: A way to let Vacuum warn if FSM settings are low.
Дата
Msg-id Pine.LNX.4.58.0502251625170.26845@greenie.cheapcomplexdevices.com
обсуждение исходный текст
Ответ на Re: A way to let Vacuum warn if FSM settings are low.  (Bruce Momjian <pgman@candle.pha.pa.us>)
Ответы Re: A way to let Vacuum warn if FSM settings are low.  (Simon Riggs <simon@2ndquadrant.com>)
Список pgsql-patches
On Fri, 25 Feb 2005, Bruce Momjian wrote:
> Tom Lane wrote:
> > Ron Mayer <rm_pg@cheapcomplexdevices.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
formax_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?


В списке pgsql-patches по дате отправления:

Предыдущее
От: Nicolai Tufar
Дата:
Сообщение: Re: [pgsql-hackers-win32] Repleacement for src/port/snprintf.c
Следующее
От: Bruce Momjian
Дата:
Сообщение: Re: [HACKERS] UTF8 or Unicode