Skip to content

Commit 9e0b463

Browse files
committed
setheapoverride() is history. Uses replaced with CommandCounterIncrement()
where necessary --- several of them didn't really need it, though. tqual-checking macros simplified accordingly.
1 parent fb0627d commit 9e0b463

File tree

13 files changed

+59
-130
lines changed

13 files changed

+59
-130
lines changed

src/backend/access/gist/gist.c

Lines changed: 3 additions & 3 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.48 1999/12/10 03:55:42 momjian Exp $
9+
* $Header: /cvsroot/pgsql/src/backend/access/gist/gist.c,v 1.49 2000/01/17 23:57:41 tgl Exp $
1010
*
1111
*-------------------------------------------------------------------------
1212
*/
@@ -98,9 +98,9 @@ gistbuild(Relation heap,
9898

9999
/* no locking is needed */
100100

101-
setheapoverride(true); /* so we can see the new pg_index tuple */
101+
CommandCounterIncrement(); /* so we can see the new pg_index tuple */
102+
102103
initGISTstate(&giststate, index);
103-
setheapoverride(false);
104104

105105
pred = predInfo->pred;
106106
oldPred = predInfo->oldPred;

src/backend/catalog/aclchk.c

Lines changed: 2 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -7,7 +7,7 @@
77
*
88
*
99
* IDENTIFICATION
10-
* $Header: /cvsroot/pgsql/src/backend/catalog/aclchk.c,v 1.35 2000/01/16 20:04:54 petere Exp $
10+
* $Header: /cvsroot/pgsql/src/backend/catalog/aclchk.c,v 1.36 2000/01/17 23:57:43 tgl Exp $
1111
*
1212
* NOTES
1313
* See acl.h.
@@ -149,10 +149,8 @@ ChangeAcl(char *relname,
149149
replaces[Anum_pg_class_relacl - 1] = 'r';
150150
values[Anum_pg_class_relacl - 1] = (Datum) new_acl;
151151
tuple = heap_modifytuple(tuple, relation, values, nulls, replaces);
152-
/* XXX handle index on pg_class? */
153-
setheapoverride(true);
152+
154153
heap_update(relation, &tuple->t_self, tuple, NULL);
155-
setheapoverride(false);
156154

157155
/* keep the catalog indices up to date */
158156
CatalogOpenIndices(Num_pg_class_indices, Name_pg_class_indices,

src/backend/catalog/heap.c

Lines changed: 6 additions & 14 deletions
Original file line numberDiff line numberDiff line change
@@ -7,7 +7,7 @@
77
*
88
*
99
* IDENTIFICATION
10-
* $Header: /cvsroot/pgsql/src/backend/catalog/heap.c,v 1.116 2000/01/17 02:04:12 tgl Exp $
10+
* $Header: /cvsroot/pgsql/src/backend/catalog/heap.c,v 1.117 2000/01/17 23:57:43 tgl Exp $
1111
*
1212
*
1313
* INTERFACE ROUTINES
@@ -1065,7 +1065,7 @@ DeleteRelationTuple(Relation rel)
10651065
pg_class_desc = heap_openr(RelationRelationName, RowExclusiveLock);
10661066

10671067
tup = SearchSysCacheTupleCopy(RELOID,
1068-
ObjectIdGetDatum(rel->rd_att->attrs[0]->attrelid),
1068+
ObjectIdGetDatum(rel->rd_id),
10691069
0, 0, 0);
10701070
if (!HeapTupleIsValid(tup))
10711071
{
@@ -1509,40 +1509,32 @@ heap_drop_with_catalog(char *relname)
15091509
DeleteAttributeTuples(rel);
15101510

15111511
/* ----------------
1512-
* delete comments
1512+
* delete comments, statistics, and constraints
15131513
* ----------------
15141514
*/
15151515
DeleteComments(RelationGetRelid(rel));
15161516

1517-
/* ----------------
1518-
* delete statistics
1519-
* ----------------
1520-
*/
15211517
RemoveStatistics(rel);
15221518

1519+
RemoveConstraints(rel);
1520+
15231521
/* ----------------
1524-
* delete type tuple. here we want to see the effects
1525-
* of the deletions we just did, so we use setheapoverride().
1522+
* delete type tuple
15261523
* ----------------
15271524
*/
1528-
setheapoverride(true);
15291525
DeleteTypeTuple(rel);
1530-
setheapoverride(false);
15311526

15321527
/* ----------------
15331528
* delete relation tuple
15341529
* ----------------
15351530
*/
1536-
/* must delete fake tuple in cache */
15371531
DeleteRelationTuple(rel);
15381532

15391533
/*
15401534
* release dirty buffers of this relation
15411535
*/
15421536
ReleaseRelationBuffers(rel);
15431537

1544-
RemoveConstraints(rel);
1545-
15461538
/* ----------------
15471539
* unlink the relation's physical file and finish up.
15481540
* ----------------

src/backend/catalog/index.c

Lines changed: 4 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -7,7 +7,7 @@
77
*
88
*
99
* IDENTIFICATION
10-
* $Header: /cvsroot/pgsql/src/backend/catalog/index.c,v 1.101 1999/12/20 10:40:40 wieck Exp $
10+
* $Header: /cvsroot/pgsql/src/backend/catalog/index.c,v 1.102 2000/01/17 23:57:43 tgl Exp $
1111
*
1212
*
1313
* INTERFACE ROUTINES
@@ -904,19 +904,16 @@ InitIndexStrategy(int numatts,
904904

905905
/* ----------------
906906
* fill in the index strategy structure with information
907-
* from the catalogs. Note: we use heap override mode
908-
* in order to be allowed to see the correct information in the
909-
* catalogs, even though our transaction has not yet committed.
907+
* from the catalogs. First we must advance the command counter
908+
* so that we will see the newly-entered index catalog tuples.
910909
* ----------------
911910
*/
912-
setheapoverride(true);
911+
CommandCounterIncrement();
913912

914913
IndexSupportInitialize(strategy, support,
915914
attrelid, accessMethodObjectId,
916915
amstrategies, amsupport, numatts);
917916

918-
setheapoverride(false);
919-
920917
/* ----------------
921918
* store the strategy information in the index reldesc
922919
* ----------------

src/backend/catalog/pg_operator.c

Lines changed: 11 additions & 10 deletions
Original file line numberDiff line numberDiff line change
@@ -7,7 +7,7 @@
77
*
88
*
99
* IDENTIFICATION
10-
* $Header: /cvsroot/pgsql/src/backend/catalog/pg_operator.c,v 1.47 2000/01/10 17:14:31 momjian Exp $
10+
* $Header: /cvsroot/pgsql/src/backend/catalog/pg_operator.c,v 1.48 2000/01/17 23:57:43 tgl Exp $
1111
*
1212
* NOTES
1313
* these routines moved here from commands/define.c and somewhat cleaned up.
@@ -775,6 +775,9 @@ OperatorDef(char *operatorName,
775775
opKey[1].sk_argument = ObjectIdGetDatum(leftTypeId);
776776
opKey[2].sk_argument = ObjectIdGetDatum(rightTypeId);
777777

778+
/* Make sure we can see the shell even if it is new in current cmd */
779+
CommandCounterIncrement();
780+
778781
pg_operator_scan = heap_beginscan(pg_operator_desc,
779782
0,
780783
SnapshotSelf, /* no cache? */
@@ -790,9 +793,7 @@ OperatorDef(char *operatorName,
790793
nulls,
791794
replaces);
792795

793-
setheapoverride(true);
794796
heap_update(pg_operator_desc, &tup->t_self, tup, NULL);
795-
setheapoverride(false);
796797
}
797798
else
798799
elog(ERROR, "OperatorDef: no operator %u", operatorObjectId);
@@ -875,7 +876,13 @@ OperatorUpd(Oid baseId, Oid commId, Oid negId)
875876

876877
pg_operator_desc = heap_openr(OperatorRelationName, RowExclusiveLock);
877878

878-
/* check and update the commutator, if necessary */
879+
/*
880+
* check and update the commutator & negator, if necessary
881+
*
882+
* First make sure we can see them...
883+
*/
884+
CommandCounterIncrement();
885+
879886
opKey[0].sk_argument = ObjectIdGetDatum(commId);
880887

881888
pg_operator_scan = heap_beginscan(pg_operator_desc,
@@ -920,9 +927,7 @@ OperatorUpd(Oid baseId, Oid commId, Oid negId)
920927
nulls,
921928
replaces);
922929

923-
setheapoverride(true);
924930
heap_update(pg_operator_desc, &tup->t_self, tup, NULL);
925-
setheapoverride(false);
926931

927932
if (RelationGetForm(pg_operator_desc)->relhasindex)
928933
{
@@ -954,9 +959,7 @@ OperatorUpd(Oid baseId, Oid commId, Oid negId)
954959
nulls,
955960
replaces);
956961

957-
setheapoverride(true);
958962
heap_update(pg_operator_desc, &tup->t_self, tup, NULL);
959-
setheapoverride(false);
960963

961964
if (RelationGetForm(pg_operator_desc)->relhasindex)
962965
{
@@ -994,9 +997,7 @@ OperatorUpd(Oid baseId, Oid commId, Oid negId)
994997
nulls,
995998
replaces);
996999

997-
setheapoverride(true);
9981000
heap_update(pg_operator_desc, &tup->t_self, tup, NULL);
999-
setheapoverride(false);
10001001

10011002
if (RelationGetForm(pg_operator_desc)->relhasindex)
10021003
{

src/backend/catalog/pg_type.c

Lines changed: 1 addition & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -7,7 +7,7 @@
77
*
88
*
99
* IDENTIFICATION
10-
* $Header: /cvsroot/pgsql/src/backend/catalog/pg_type.c,v 1.46 2000/01/10 20:23:28 momjian Exp $
10+
* $Header: /cvsroot/pgsql/src/backend/catalog/pg_type.c,v 1.47 2000/01/17 23:57:43 tgl Exp $
1111
*
1212
*-------------------------------------------------------------------------
1313
*/
@@ -481,9 +481,7 @@ TypeCreate(char *typeName,
481481
nulls,
482482
replaces);
483483

484-
setheapoverride(true);
485484
heap_update(pg_type_desc, &tup->t_self, tup, NULL);
486-
setheapoverride(false);
487485

488486
typeObjectId = tup->t_data->t_oid;
489487
}
@@ -558,9 +556,7 @@ TypeRename(char *oldTypeName, char *newTypeName)
558556

559557
namestrcpy(&(((Form_pg_type) GETSTRUCT(oldtup))->typname), newTypeName);
560558

561-
setheapoverride(true);
562559
heap_update(pg_type_desc, &oldtup->t_self, oldtup, NULL);
563-
setheapoverride(false);
564560

565561
/* update the system catalog indices */
566562
CatalogOpenIndices(Num_pg_type_indices, Name_pg_type_indices, idescs);

src/backend/commands/_deadcode/recipe.c

Lines changed: 4 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -7,7 +7,7 @@
77
*
88
*
99
* IDENTIFICATION
10-
* $Header: /cvsroot/pgsql/src/backend/commands/_deadcode/Attic/recipe.c,v 1.8 2000/01/10 17:14:33 momjian Exp $
10+
* $Header: /cvsroot/pgsql/src/backend/commands/_deadcode/Attic/recipe.c,v 1.9 2000/01/17 23:57:44 tgl Exp $
1111
*
1212
*-------------------------------------------------------------------------
1313
*/
@@ -211,9 +211,10 @@ beginRecipe(RecipeStmt *stmt)
211211
/*
212212
* before we plan, we want to see all the changes we did, during
213213
* the rewrite phase, such as creating the tee tables,
214-
* setheapoverride() allows us to see the changes
214+
* CommandCounterIncrement() allows us to see the changes
215215
*/
216-
setheapoverride(true);
216+
CommandCounterIncrement();
217+
217218
plan = planner(parsetree);
218219

219220
/* ----------------------------------------------------------
@@ -265,8 +266,6 @@ beginRecipe(RecipeStmt *stmt)
265266

266267
} /* if (teeInfo) */
267268

268-
setheapoverride(false);
269-
270269
/* define a portal for this viewer input */
271270
/* for now, eyes can only have one input */
272271
snprintf(portalName, 1024, "%s%d", e->nodeName, 0);

src/backend/commands/comment.c

Lines changed: 0 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -165,9 +165,7 @@ void CreateComments(Oid oid, char *comment) {
165165
} else {
166166
desctuple = heap_modifytuple(searchtuple, description, values,
167167
nulls, replaces);
168-
setheapoverride(true);
169168
heap_update(description, &searchtuple->t_self, desctuple, NULL);
170-
setheapoverride(false);
171169
modified = TRUE;
172170
}
173171

src/backend/executor/execMain.c

Lines changed: 4 additions & 9 deletions
Original file line numberDiff line numberDiff line change
@@ -26,7 +26,7 @@
2626
*
2727
*
2828
* IDENTIFICATION
29-
* $Header: /cvsroot/pgsql/src/backend/executor/execMain.c,v 1.104 2000/01/05 18:23:46 momjian Exp $
29+
* $Header: /cvsroot/pgsql/src/backend/executor/execMain.c,v 1.105 2000/01/17 23:57:45 tgl Exp $
3030
*
3131
*-------------------------------------------------------------------------
3232
*/
@@ -723,18 +723,13 @@ InitPlan(CmdType operation, Query *parseTree, Plan *plan, EState *estate)
723723
FreeTupleDesc(tupdesc);
724724

725725
/*
726-
* XXX rather than having to call setheapoverride(true)
727-
* and then back to false, we should change the arguments
728-
* to heap_open() instead..
729-
*
730-
* XXX no, we should use commandCounterIncrement...
726+
* Advance command counter so that the newly-created
727+
* relation's catalog tuples will be visible to heap_open.
731728
*/
732-
setheapoverride(true);
729+
CommandCounterIncrement();
733730

734731
intoRelationDesc = heap_open(intoRelationId,
735732
AccessExclusiveLock);
736-
737-
setheapoverride(false);
738733
}
739734
}
740735
}

src/backend/utils/adt/sets.c

Lines changed: 1 addition & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -9,7 +9,7 @@
99
*
1010
*
1111
* IDENTIFICATION
12-
* $Header: /cvsroot/pgsql/src/backend/utils/adt/Attic/sets.c,v 1.28 1999/11/24 00:44:35 momjian Exp $
12+
* $Header: /cvsroot/pgsql/src/backend/utils/adt/Attic/sets.c,v 1.29 2000/01/17 23:57:46 tgl Exp $
1313
*
1414
*-------------------------------------------------------------------------
1515
*/
@@ -113,9 +113,7 @@ SetDefine(char *querystr, char *typename)
113113
replNull,
114114
repl);
115115

116-
setheapoverride(true);
117116
heap_update(procrel, &tup->t_self, newtup, NULL);
118-
setheapoverride(false);
119117

120118
setoid = newtup->t_data->t_oid;
121119
}

src/backend/utils/cache/catcache.c

Lines changed: 2 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -7,7 +7,7 @@
77
*
88
*
99
* IDENTIFICATION
10-
* $Header: /cvsroot/pgsql/src/backend/utils/cache/catcache.c,v 1.56 2000/01/10 16:13:15 momjian Exp $
10+
* $Header: /cvsroot/pgsql/src/backend/utils/cache/catcache.c,v 1.57 2000/01/17 23:57:46 tgl Exp $
1111
*
1212
*-------------------------------------------------------------------------
1313
*/
@@ -1047,8 +1047,7 @@ SearchSysCache(struct catcache * cache,
10471047
* if this isn't bootstrap (initdb) time, use the index.
10481048
* ----------------
10491049
*/
1050-
CACHE2_elog(DEBUG, "SearchSysCache: performing scan (override==%d)",
1051-
heapisoverride());
1050+
CACHE1_elog(DEBUG, "SearchSysCache: performing scan");
10521051

10531052
if ((RelationGetForm(relation))->relhasindex
10541053
&& !IsBootstrapProcessingMode())

src/backend/utils/time/tqual.c

Lines changed: 2 additions & 27 deletions
Original file line numberDiff line numberDiff line change
@@ -7,7 +7,7 @@
77
*
88
*
99
* IDENTIFICATION
10-
* $Header: /cvsroot/pgsql/src/backend/utils/time/tqual.c,v 1.33 1999/12/10 12:34:14 wieck Exp $
10+
* $Header: /cvsroot/pgsql/src/backend/utils/time/tqual.c,v 1.34 2000/01/17 23:57:47 tgl Exp $
1111
*
1212
*-------------------------------------------------------------------------
1313
*/
@@ -26,31 +26,6 @@ Snapshot SerializableSnapshot = NULL;
2626

2727
bool ReferentialIntegritySnapshotOverride = false;
2828

29-
/*
30-
* XXX Transaction system override hacks start here
31-
*/
32-
#ifndef GOODAMI
33-
34-
TransactionId HeapSpecialTransactionId = InvalidTransactionId;
35-
CommandId HeapSpecialCommandId = FirstCommandId;
36-
37-
void
38-
setheapoverride(bool on)
39-
{
40-
if (on)
41-
{
42-
TransactionIdStore(GetCurrentTransactionId(),
43-
&HeapSpecialTransactionId);
44-
HeapSpecialCommandId = GetCurrentCommandId();
45-
}
46-
else
47-
HeapSpecialTransactionId = InvalidTransactionId;
48-
}
49-
50-
#endif /* !defined(GOODAMI) */
51-
/*
52-
* XXX Transaction system override hacks end here
53-
*/
5429

5530
/*
5631
* HeapTupleSatisfiesItself
@@ -311,7 +286,7 @@ HeapTupleSatisfiesUpdate(HeapTuple tuple)
311286
}
312287
else if (TransactionIdIsCurrentTransactionId(th->t_xmin))
313288
{
314-
if (CommandIdGEScanCommandId(th->t_cmin) && !heapisoverride())
289+
if (CommandIdGEScanCommandId(th->t_cmin))
315290
return HeapTupleInvisible; /* inserted after scan
316291
* started */
317292

0 commit comments

Comments
 (0)