13
13
* Portions Copyright (c) 1996-2003, PostgreSQL Global Development Group
14
14
* Portions Copyright (c) 1994, Regents of the University of California
15
15
*
16
- * $PostgreSQL: pgsql/src/backend/access/transam/clog.c,v 1.21 2004/07/01 00:49:42 tgl Exp $
16
+ * $PostgreSQL: pgsql/src/backend/access/transam/clog.c,v 1.22 2004/07/03 02:55:56 tgl Exp $
17
17
*
18
18
*-------------------------------------------------------------------------
19
19
*/
@@ -92,6 +92,7 @@ TransactionIdSetStatus(TransactionId xid, XidStatus status)
92
92
int byteno = TransactionIdToByte (xid );
93
93
int bshift = TransactionIdToBIndex (xid )* CLOG_BITS_PER_XACT ;
94
94
char * byteptr ;
95
+ char byteval ;
95
96
96
97
Assert (status == TRANSACTION_STATUS_COMMITTED ||
97
98
status == TRANSACTION_STATUS_ABORTED ||
@@ -107,7 +108,11 @@ TransactionIdSetStatus(TransactionId xid, XidStatus status)
107
108
((* byteptr >>bshift )& CLOG_XACT_BITMASK )== TRANSACTION_STATUS_SUB_COMMITTED ||
108
109
((* byteptr >>bshift )& CLOG_XACT_BITMASK )== status );
109
110
110
- * byteptr |= (status <<bshift );
111
+ /* note this assumes exclusive access to the clog page */
112
+ byteval = * byteptr ;
113
+ byteval &= ~(((1 <<CLOG_BITS_PER_XACT )- 1 ) <<bshift );
114
+ byteval |= (status <<bshift );
115
+ * byteptr = byteval ;
111
116
112
117
/* ...->page_status[slotno] = SLRU_PAGE_DIRTY; already done */
113
118