Skip site navigation (1) Skip section navigation (2)

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

From: Ron Mayer <rm_pg(at)cheapcomplexdevices(dot)com>
To: Tom Lane <tgl(at)sss(dot)pgh(dot)pa(dot)us>
Cc: Ron Mayer <rm_pg(at)cheapcomplexdevices(dot)com>,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-24 23:08:34
Message-ID: Pine.LNX.4.58.0502241458470.13185@greenie.cheapcomplexdevices.com (view raw or flat)
Thread:
Lists: pgsql-generalpgsql-patches
On Thu, 24 Feb 2005, Tom Lane wrote:
> I'd go for making them both LOG, I think.  More consistent.

Ok, here's another try :)  With a couple more questions...

  1. If I read Simon's email correctly, it implied that he wanted to see
     the "free space map" message for a VACUUM even when VERBOSE is turned off.  
     I could just tweak it in PrintFreeSpaceMapStastics() as shown here...
     but now elevel (which depended on VACUUM VERBOSE or not) is no longer
     needed by PrintFreeSpaceMapStastics.   
     1a. Is that desired to always show this line as an INFO instead of
         a DEBUG2 (which it currently is when VERBOSE is not selected)?
     1b. Should I tweak vacuum.c (feels cleaner) or just freespace.c (minimal
         changes).

  2. If I read Simon's email correctly, it implied that he wanted to see
     these new lines when you type VACUUM.  This would suggest making
     them INFOs. Making them INFOs would slightly contradict another 
     goal of wanting to see them in the LOG for automated log
     grepping scripts to find, since that would require turning on INFOs
     that I think commonly aren't logged.   Also making them LOGs is
     consistent with the checkpoint hint.   I suppose they could be
     made NOTICEs; but that isn't consistent with either.



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-24 14:54:36.619566040 -0800
@@ -705,12 +705,25 @@
     /* Convert stats to actual number of page slots needed */
     needed = (sumRequests + numRels) * CHUNKPAGES;
 
-    ereport(elevel,
+    ereport(INFO,
             (errmsg("free space map: %d relations, %d pages stored; %.0f total pages needed",
                     numRels, storedPages, needed),
              errdetail("Allocated 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)));
+
 }
 

In response to

pgsql-patches by date

Next:From: Bruce MomjianDate: 2005-02-25 00:48:05
Subject: Re: New FAQ questions. minor fixes
Previous:From: Eric CramptonDate: 2005-02-24 22:49:00
Subject: Patch for Postmaster Uptime (from the TODO)

pgsql-general by date

Next:From: Edmund BaconDate: 2005-02-24 23:13:01
Subject: Re: basic trigger using OLD not working?
Previous:From: Rick CaseyDate: 2005-02-24 22:50:47
Subject: Re: basic trigger using OLD not working?

Privacy Policy | About PostgreSQL
Copyright © 1996-2014 The PostgreSQL Global Development Group