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

Commitf5c798e

Browse files
committed
Fix no-longer-correct bit-pushing in TransactionIdSetStatus, per Alvaro.
1 parente34082e commitf5c798e

File tree

1 file changed

+7
-2
lines changed
  • src/backend/access/transam

1 file changed

+7
-2
lines changed

‎src/backend/access/transam/clog.c

Lines changed: 7 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -13,7 +13,7 @@
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)
9292
intbyteno=TransactionIdToByte(xid);
9393
intbshift=TransactionIdToBIndex(xid)*CLOG_BITS_PER_XACT;
9494
char*byteptr;
95+
charbyteval;
9596

9697
Assert(status==TRANSACTION_STATUS_COMMITTED||
9798
status==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

0 commit comments

Comments
 (0)

[8]ページ先頭

©2009-2025 Movatter.jp