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

Commitd0e1091

Browse files
committed
we found a problem in GiST with massive insert/update operations
with many NULLs ( inserting of NULL into indexed field causeERROR: MemoryContextAlloc: invalid request size)As a workaround 'vacuum analyze' could be used.This patch resolves the problem, please upply to 7.1.1 sources andcurrent cvs tree.Oleg Bartunov
1 parent3848a14 commitd0e1091

File tree

2 files changed

+18
-11
lines changed

2 files changed

+18
-11
lines changed

‎src/backend/access/gist/gist.c

Lines changed: 10 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -6,7 +6,7 @@
66
*
77
*
88
* IDENTIFICATION
9-
* $Header: /cvsroot/pgsql/src/backend/access/gist/gist.c,v 1.75 2001/05/1503:49:34 momjian Exp $
9+
* $Header: /cvsroot/pgsql/src/backend/access/gist/gist.c,v 1.76 2001/05/1514:14:49 momjian Exp $
1010
*
1111
*-------------------------------------------------------------------------
1212
*/
@@ -1199,13 +1199,17 @@ gistdentryinit(GISTSTATE *giststate, GISTENTRY *e, char *pr, Relation r,
11991199
gistentryinit(*e,pr,r,pg,o,b,l);
12001200
if (giststate->haskeytype)
12011201
{
1202-
dep= (GISTENTRY*)
1203-
DatumGetPointer(FunctionCall1(&giststate->decompressFn,
1202+
if (b ) {
1203+
dep= (GISTENTRY*)
1204+
DatumGetPointer(FunctionCall1(&giststate->decompressFn,
12041205
PointerGetDatum(e)));
1205-
gistentryinit(*e,dep->pred,dep->rel,dep->page,dep->offset,dep->bytes,
1206+
gistentryinit(*e,dep->pred,dep->rel,dep->page,dep->offset,dep->bytes,
12061207
dep->leafkey);
1207-
if (dep!=e)
1208-
pfree(dep);
1208+
if (dep!=e)
1209+
pfree(dep);
1210+
}else {
1211+
gistentryinit(*e, (char*)NULL,r,pg,o,0,l);
1212+
}
12091213
}
12101214
}
12111215

‎src/backend/access/gist/gistget.c

Lines changed: 8 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -241,16 +241,16 @@ gistindex_keytest(IndexTuple tuple,
241241
1,
242242
tupdesc,
243243
&isNull);
244-
gistdentryinit(giststate,&de, (char*)datum,r,p,offset,
245-
IndexTupleSize(tuple)-sizeof(IndexTupleData),
246-
FALSE);
247-
248-
if (isNull)
244+
if (isNull||IndexTupleSize(tuple)==sizeof(IndexTupleData) )
249245
{
250246
/* XXX eventually should check if SK_ISNULL */
251247
return false;
252248
}
253249

250+
gistdentryinit(giststate,&de, (char*)datum,r,p,offset,
251+
IndexTupleSize(tuple)-sizeof(IndexTupleData),
252+
FALSE);
253+
254254
if (key[0].sk_flags&SK_COMMUTE)
255255
{
256256
test=FunctionCall3(&key[0].sk_func,
@@ -266,6 +266,9 @@ gistindex_keytest(IndexTuple tuple,
266266
ObjectIdGetDatum(key[0].sk_procedure));
267267
}
268268

269+
if ( (char*)de.pred!= (char*)datum )
270+
if (de.pred )pfree(de.pred );
271+
269272
if (DatumGetBool(test)== !!(key[0].sk_flags&SK_NEGATE))
270273
return false;
271274

0 commit comments

Comments
 (0)

[8]ページ先頭

©2009-2025 Movatter.jp