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

Commita152ebe

Browse files
committed
Fix problems seen in parallel regress tests when SI buffer overruns (causing
syscache and relcache flushes). Relcache entry rebuild now preservesoriginal tupledesc, rewrite rules, and triggers if possible, so that pointersto these things remain valid --- if these things change while relcache entryhas positive refcount, we elog(ERROR) to avoid later crash. Arrange forxact-local rels to be rebuilt when an SI inval message is seen for them,so that they are updated by CommandCounterIncrement the same as regular rels.(This is useful because of Hiroshi's recent changes to process our own SImessages at CommandCounterIncrement time.) This allows simplification ofsome routines that previously hacked around the lack of an automatic update.catcache now keeps its own copy of tupledesc for its relation, rather thandepending on the relcache's copy; this avoids needing to reinitialize catcacheduring a cache flush, which saves some cycles and eliminates nasty circularityproblems that occur if a cache flush happens while trying to initialize acatcache.Eliminate a number of permanent memory leaks that used to happen duringcatcache or relcache flush; not least of which was that catcache neverfreed any cached tuples! (Rule parsetree storage is still leaked, however;will fix that separately.)Nothing done yet about code that uses tuples retrieved by SearchSysCachefor longer than is safe.
1 parentca0f143 commita152ebe

File tree

15 files changed

+593
-404
lines changed

15 files changed

+593
-404
lines changed

‎src/backend/access/common/tupdesc.c

Lines changed: 66 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -8,7 +8,7 @@
88
*
99
*
1010
* IDENTIFICATION
11-
* $Header: /cvsroot/pgsql/src/backend/access/common/tupdesc.c,v 1.60 2000/01/26 05:55:53 momjian Exp $
11+
* $Header: /cvsroot/pgsql/src/backend/access/common/tupdesc.c,v 1.61 2000/01/31 04:35:48 tgl Exp $
1212
*
1313
* NOTES
1414
* some of the executor utility code such as "ExecTypeFromTL" should be
@@ -226,6 +226,71 @@ FreeTupleDesc(TupleDesc tupdesc)
226226

227227
}
228228

229+
bool
230+
equalTupleDescs(TupleDesctupdesc1,TupleDesctupdesc2)
231+
{
232+
inti;
233+
234+
if (tupdesc1->natts!=tupdesc2->natts)
235+
return false;
236+
for (i=0;i<tupdesc1->natts;i++)
237+
{
238+
Form_pg_attributeattr1=tupdesc1->attrs[i];
239+
Form_pg_attributeattr2=tupdesc2->attrs[i];
240+
241+
/* We do not need to check every single field here, and in fact
242+
* some fields such as attdisbursion probably shouldn't be compared.
243+
*/
244+
if (strcmp(NameStr(attr1->attname),NameStr(attr2->attname))!=0)
245+
return false;
246+
if (attr1->atttypid!=attr2->atttypid)
247+
return false;
248+
if (attr1->atttypmod!=attr2->atttypmod)
249+
return false;
250+
if (attr1->attstorage!=attr2->attstorage)
251+
return false;
252+
if (attr1->attnotnull!=attr2->attnotnull)
253+
return false;
254+
}
255+
if (tupdesc1->constr!=NULL)
256+
{
257+
TupleConstr*constr1=tupdesc1->constr;
258+
TupleConstr*constr2=tupdesc2->constr;
259+
260+
if (constr2==NULL)
261+
return false;
262+
if (constr1->num_defval!=constr2->num_defval)
263+
return false;
264+
for (i=0;i< (int)constr1->num_defval;i++)
265+
{
266+
AttrDefault*defval1=constr1->defval+i;
267+
AttrDefault*defval2=constr2->defval+i;
268+
269+
if (defval1->adnum!=defval2->adnum)
270+
return false;
271+
if (strcmp(defval1->adbin,defval2->adbin)!=0)
272+
return false;
273+
}
274+
if (constr1->num_check!=constr2->num_check)
275+
return false;
276+
for (i=0;i< (int)constr1->num_check;i++)
277+
{
278+
ConstrCheck*check1=constr1->check+i;
279+
ConstrCheck*check2=constr2->check+i;
280+
281+
if (strcmp(check1->ccname,check2->ccname)!=0)
282+
return false;
283+
if (strcmp(check1->ccbin,check2->ccbin)!=0)
284+
return false;
285+
}
286+
if (constr1->has_not_null!=constr2->has_not_null)
287+
return false;
288+
}
289+
elseif (tupdesc2->constr!=NULL)
290+
return false;
291+
return true;
292+
}
293+
229294
/* ----------------------------------------------------------------
230295
*TupleDescInitEntry
231296
*

‎src/backend/catalog/heap.c

Lines changed: 1 addition & 13 deletions
Original file line numberDiff line numberDiff line change
@@ -8,7 +8,7 @@
88
*
99
*
1010
* IDENTIFICATION
11-
* $Header: /cvsroot/pgsql/src/backend/catalog/heap.c,v 1.119 2000/01/26 05:56:10 momjian Exp $
11+
* $Header: /cvsroot/pgsql/src/backend/catalog/heap.c,v 1.120 2000/01/31 04:35:48 tgl Exp $
1212
*
1313
*
1414
* INTERFACE ROUTINES
@@ -2098,18 +2098,6 @@ AddRelationRawConstraints(Relation rel,
20982098

20992099
heap_close(relrel,RowExclusiveLock);
21002100
heap_freetuple(reltup);
2101-
2102-
/*
2103-
* Force rebuild of our own relcache entry, otherwise subsequent commands
2104-
* in this transaction won't see the new defaults/constraints.
2105-
* Must bump command counter or relcache rebuild won't see 'em either.
2106-
*
2107-
* (This might seem unnecessary, since we are sending out an SI message;
2108-
* but if the relation has just been created then relcache.c will ignore
2109-
* the SI message on the grounds that the rel is transaction-local...)
2110-
*/
2111-
CommandCounterIncrement();
2112-
RelationRebuildRelation(rel);
21132101
}
21142102

21152103
staticvoid

0 commit comments

Comments
 (0)

[8]ページ先頭

©2009-2025 Movatter.jp