diff options
author | Tom Lane <tgl@sss.pgh.pa.us> | 2001-01-12 21:54:01 +0000 |
---|---|---|
committer | Tom Lane <tgl@sss.pgh.pa.us> | 2001-01-12 21:54:01 +0000 |
commit | 6162432de9fb023b710c171f196e27b910e45fa7 (patch) | |
tree | 51bba2e60ca2d3497b365b23edd52d52574faae2 /src/backend/access/heap/heapam.c | |
parent | be8477bc3718a05b02dd7e9f8236c16394f9a027 (diff) |
Add more critical-section calls: all code sections that hold spinlocks
are now critical sections, so as to ensure die() won't interrupt us while
we are munging shared-memory data structures. Avoid insecure intermediate
states in some code that proc_exit will call, like palloc/pfree. Rename
START/END_CRIT_CODE to START/END_CRIT_SECTION, since that seems to be
what people tend to call them anyway, and make them be called with () like
a function call, in hopes of not confusing pg_indent.
I doubt that this is sufficient to make SIGTERM safe anywhere; there's
just too much code that could get invoked during proc_exit().
Diffstat (limited to 'src/backend/access/heap/heapam.c')
-rw-r--r-- | src/backend/access/heap/heapam.c | 14 |
1 files changed, 7 insertions, 7 deletions
diff --git a/src/backend/access/heap/heapam.c b/src/backend/access/heap/heapam.c index 612e4c68611..db443218b4d 100644 --- a/src/backend/access/heap/heapam.c +++ b/src/backend/access/heap/heapam.c @@ -8,7 +8,7 @@ * * * IDENTIFICATION - * $Header: /cvsroot/pgsql/src/backend/access/heap/heapam.c,v 1.106 2001/01/07 22:14:31 tgl Exp $ + * $Header: /cvsroot/pgsql/src/backend/access/heap/heapam.c,v 1.107 2001/01/12 21:53:54 tgl Exp $ * * * INTERFACE ROUTINES @@ -1359,7 +1359,7 @@ heap_insert(Relation relation, HeapTuple tup) buffer = RelationGetBufferForTuple(relation, tup->t_len); /* NO ELOG(ERROR) from here till changes are logged */ - START_CRIT_CODE; + START_CRIT_SECTION(); RelationPutHeapTuple(relation, buffer, tup); /* XLOG stuff */ @@ -1405,7 +1405,7 @@ heap_insert(Relation relation, HeapTuple tup) PageSetLSN(page, recptr); PageSetSUI(page, ThisStartUpID); } - END_CRIT_CODE; + END_CRIT_SECTION(); LockBuffer(buffer, BUFFER_LOCK_UNLOCK); WriteBuffer(buffer); @@ -1503,7 +1503,7 @@ l1: return result; } - START_CRIT_CODE; + START_CRIT_SECTION(); /* store transaction information of xact deleting the tuple */ TransactionIdStore(GetCurrentTransactionId(), &(tp.t_data->t_xmax)); tp.t_data->t_cmax = GetCurrentCommandId(); @@ -1532,7 +1532,7 @@ l1: PageSetLSN(dp, recptr); PageSetSUI(dp, ThisStartUpID); } - END_CRIT_CODE; + END_CRIT_SECTION(); #ifdef TUPLE_TOASTER_ACTIVE /* ---------- @@ -1702,7 +1702,7 @@ l2: } /* NO ELOG(ERROR) from here till changes are logged */ - START_CRIT_CODE; + START_CRIT_SECTION(); RelationPutHeapTuple(relation, newbuf, newtup); /* insert new tuple */ if (buffer == newbuf) @@ -1734,7 +1734,7 @@ l2: PageSetLSN(BufferGetPage(buffer), recptr); PageSetSUI(BufferGetPage(buffer), ThisStartUpID); } - END_CRIT_CODE; + END_CRIT_SECTION(); if (newbuf != buffer) LockBuffer(newbuf, BUFFER_LOCK_UNLOCK); |