Re: Vacuum Question

From: Tom Lane <tgl(at)sss(dot)pgh(dot)pa(dot)us>
To: Ed Loehr <eloehr(at)austin(dot)rr(dot)com>
Cc: pgsql-general(at)postgresql(dot)org
Subject: Re: Vacuum Question
Date: 2000-06-06 21:25:04
Message-ID: 1002.960326704@sss.pgh.pa.us
Views: Raw Message | Whole Thread | Download mbox | Resend email
Thread:
Lists: pgsql-general

Ed Loehr <eloehr(at)austin(dot)rr(dot)com> writes:
> Tom Lane wrote:
>> I can't reproduce any problem with just a "vacuum" (with or without
>> analyze) and no following command.
>>
>> I did, however, notice that very occasionally the inserting process
>> would spit out weird error messages like "Function '(int4)' does not
>> exist" and null probin for procedure 481". This seems
>> to be due to VACUUM (on system tables) causing syscache entries to be
>> flushed at unexpected times. I've committed patches for the two cases
>> I observed, but there may be more lurking...

> Yes, I was getting a similar Function error message, though I never saw
> the init_fcache message. And it appeared the backend would crash
> coincidentally with the function error message. If the patch can be
> applied to 7.0 (beta3), and you don't mind posting it, I could test it
> here...

Hmm, I only saw error messages, no crashes --- but I suppose a crash is
possible, since the root of the problem here is a dangling pointer.

Patches for 7.0.2 are attached. Not sure if they will apply perfectly
cleanly to beta3, but you should be able to make the right mods by hand
if patch doesn't cope...

regards, tom lane

*** src/backend/parser/parse_type.c.orig Tue May 30 00:24:49 2000
--- src/backend/parser/parse_type.c Tue Jun 6 11:41:08 2000
***************
*** 48,54 ****
return NULL;
}
typetuple = (Form_pg_type) GETSTRUCT(tup);
! return NameStr(typetuple->typname);
}

/* return a Type structure, given a type id */
--- 48,55 ----
return NULL;
}
typetuple = (Form_pg_type) GETSTRUCT(tup);
! /* pstrdup here because result may need to outlive the syscache entry */
! return pstrdup(NameStr(typetuple->typname));
}

/* return a Type structure, given a type id */
***************
*** 119,125 ****
Form_pg_type typ;

typ = (Form_pg_type) GETSTRUCT(t);
! return NameStr(typ->typname);
}

/* given a type, return its typetype ('c' for 'c'atalog types) */
--- 120,127 ----
Form_pg_type typ;

typ = (Form_pg_type) GETSTRUCT(t);
! /* pstrdup here because result may need to outlive the syscache entry */
! return pstrdup(NameStr(typ->typname));
}

/* given a type, return its typetype ('c' for 'c'atalog types) */

*** src/backend/utils/cache/fcache.c~ Wed Apr 12 13:15:53 2000
--- src/backend/utils/cache/fcache.c Tue Jun 6 13:39:03 2000
***************
*** 14,19 ****
--- 14,20 ----
*/
#include "postgres.h"

+ #include "access/heapam.h"
#include "catalog/pg_language.h"
#include "catalog/pg_proc.h"
#include "catalog/pg_type.h"
***************
*** 89,97 ****
if (!use_syscache)
elog(ERROR, "what the ????, init the fcache without the catalogs?");

! procedureTuple = SearchSysCacheTuple(PROCOID,
! ObjectIdGetDatum(foid),
! 0, 0, 0);

if (!HeapTupleIsValid(procedureTuple))
elog(ERROR, "init_fcache: Cache lookup failed for procedure %u",
--- 90,98 ----
if (!use_syscache)
elog(ERROR, "what the ????, init the fcache without the catalogs?");

! procedureTuple = SearchSysCacheTupleCopy(PROCOID,
! ObjectIdGetDatum(foid),
! 0, 0, 0);

if (!HeapTupleIsValid(procedureTuple))
elog(ERROR, "init_fcache: Cache lookup failed for procedure %u",
***************
*** 258,263 ****
--- 259,266 ----
}
else
retval->func.fn_addr = (func_ptr) NULL;
+
+ heap_freetuple(procedureTuple);

return retval;
}

In response to

Browse pgsql-general by date

  From Date Subject
Next Message Merrill Oveson 2000-06-06 21:36:01 deferred primary key
Previous Message Tom Lane 2000-06-06 21:20:06 Re: Precision of calculated numeric fields