1313 * Portions Copyright (c) 1996-2003, PostgreSQL Global Development Group
1414 * Portions Copyright (c) 1994, Regents of the University of California
1515 *
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 $
1717 *
1818 *-------------------------------------------------------------------------
1919 */
@@ -92,6 +92,7 @@ TransactionIdSetStatus(TransactionId xid, XidStatus status)
9292int byteno = TransactionIdToByte (xid );
9393int bshift = TransactionIdToBIndex (xid )* CLOG_BITS_PER_XACT ;
9494char * byteptr ;
95+ char byteval ;
9596
9697Assert (status == TRANSACTION_STATUS_COMMITTED ||
9798status == TRANSACTION_STATUS_ABORTED ||
@@ -107,7 +108,11 @@ TransactionIdSetStatus(TransactionId xid, XidStatus status)
107108 ((* byteptr >>bshift )& CLOG_XACT_BITMASK )== TRANSACTION_STATUS_SUB_COMMITTED ||
108109 ((* byteptr >>bshift )& CLOG_XACT_BITMASK )== status );
109110
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 ;
111116
112117/* ...->page_status[slotno] = SLRU_PAGE_DIRTY; already done */
113118