Movatterモバイル変換


[0]ホーム

URL:


Skip to content

Navigation Menu

Sign in
Appearance settings

Search code, repositories, users, issues, pull requests...

Provide feedback

We read every piece of feedback, and take your input very seriously.

Saved searches

Use saved searches to filter your results more quickly

Sign up
Appearance settings

Commit42ad25f

Browse files
committed
init_fcache was being careless about using SearchSysCacheTuple result
over multiple lookups --- it should use SearchSysCacheTupleCopy instead.This accounts for rare failures like 'init_fcache: null probin for procedure 481'when running concurrently with a VACUUM.
1 parente57e991 commit42ad25f

File tree

1 file changed

+9
-4
lines changed

1 file changed

+9
-4
lines changed

‎src/backend/utils/cache/fcache.c

Lines changed: 9 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -8,12 +8,13 @@
88
*
99
*
1010
* IDENTIFICATION
11-
* $Header: /cvsroot/pgsql/src/backend/utils/cache/Attic/fcache.c,v 1.31 2000/05/28 17:56:06 tgl Exp $
11+
* $Header: /cvsroot/pgsql/src/backend/utils/cache/Attic/fcache.c,v 1.32 2000/06/06 17:44:25 tgl Exp $
1212
*
1313
*-------------------------------------------------------------------------
1414
*/
1515
#include"postgres.h"
1616

17+
#include"access/heapam.h"
1718
#include"catalog/pg_language.h"
1819
#include"catalog/pg_proc.h"
1920
#include"catalog/pg_type.h"
@@ -77,11 +78,13 @@ init_fcache(Oid foid,
7778

7879
/* ----------------
7980
* get the procedure tuple corresponding to the given functionOid
81+
*
82+
* NB: use SearchSysCacheTupleCopy to ensure tuple lives long enough
8083
* ----------------
8184
*/
82-
procedureTuple=SearchSysCacheTuple(PROCOID,
83-
ObjectIdGetDatum(foid),
84-
0,0,0);
85+
procedureTuple=SearchSysCacheTupleCopy(PROCOID,
86+
ObjectIdGetDatum(foid),
87+
0,0,0);
8588

8689
if (!HeapTupleIsValid(procedureTuple))
8790
elog(ERROR,"init_fcache: Cache lookup failed for procedure %u",
@@ -245,6 +248,8 @@ init_fcache(Oid foid,
245248
else
246249
retval->func.fn_addr= (PGFunction)NULL;
247250

251+
heap_freetuple(procedureTuple);
252+
248253
returnretval;
249254
}
250255

0 commit comments

Comments
 (0)

[8]ページ先頭

©2009-2025 Movatter.jp