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

Commitf86a895

Browse files
committed
Further cleanup of ReorderBufferCommit().
On closer inspection, we can remove the "volatile" qualifier on"using_subtxn" so long as we initialize that before the PG_TRY block,which there's no particularly good reason not to do.Also, push the "change" variable inside the PG_TRY so as to removeall question of whether it needs "volatile", and remove uselessearly initializations of "snapshow_now" and "using_subtxn".
1 parent138a5c4 commitf86a895

File tree

1 file changed

+17
-17
lines changed

1 file changed

+17
-17
lines changed

‎src/backend/replication/logical/reorderbuffer.c

Lines changed: 17 additions & 17 deletions
Original file line numberDiff line numberDiff line change
@@ -1259,12 +1259,10 @@ ReorderBufferCommit(ReorderBuffer *rb, TransactionId xid,
12591259
TimestampTzcommit_time)
12601260
{
12611261
ReorderBufferTXN*txn;
1262-
ReorderBufferIterTXNState*volatileiterstate=NULL;
1263-
ReorderBufferChange*change;
1264-
1262+
volatileSnapshotsnapshot_now;
12651263
volatileCommandIdcommand_id=FirstCommandId;
1266-
volatileSnapshotsnapshot_now=NULL;
1267-
volatileboolusing_subtxn= false;
1264+
boolusing_subtxn;
1265+
ReorderBufferIterTXNState*volatileiterstate=NULL;
12681266

12691267
txn=ReorderBufferTXNByXid(rb,xid, false,NULL,InvalidXLogRecPtr,
12701268
false);
@@ -1302,19 +1300,21 @@ ReorderBufferCommit(ReorderBuffer *rb, TransactionId xid,
13021300
/* setup the initial snapshot */
13031301
SetupHistoricSnapshot(snapshot_now,txn->tuplecid_hash);
13041302

1303+
/*
1304+
* Decoding needs access to syscaches et al., which in turn use
1305+
* heavyweight locks and such. Thus we need to have enough state around to
1306+
* keep track of those. The easiest way is to simply use a transaction
1307+
* internally. That also allows us to easily enforce that nothing writes
1308+
* to the database by checking for xid assignments.
1309+
*
1310+
* When we're called via the SQL SRF there's already a transaction
1311+
* started, so start an explicit subtransaction there.
1312+
*/
1313+
using_subtxn=IsTransactionOrTransactionBlock();
1314+
13051315
PG_TRY();
13061316
{
1307-
/*
1308-
* Decoding needs access to syscaches et al., which in turn use
1309-
* heavyweight locks and such. Thus we need to have enough state
1310-
* around to keep track of those. The easiest way is to simply use a
1311-
* transaction internally. That also allows us to easily enforce that
1312-
* nothing writes to the database by checking for xid assignments.
1313-
*
1314-
* When we're called via the SQL SRF there's already a transaction
1315-
* started, so start an explicit subtransaction there.
1316-
*/
1317-
using_subtxn=IsTransactionOrTransactionBlock();
1317+
ReorderBufferChange*change;
13181318

13191319
if (using_subtxn)
13201320
BeginInternalSubTransaction("replay");
@@ -1324,7 +1324,7 @@ ReorderBufferCommit(ReorderBuffer *rb, TransactionId xid,
13241324
rb->begin(rb,txn);
13251325

13261326
iterstate=ReorderBufferIterTXNInit(rb,txn);
1327-
while ((change=ReorderBufferIterTXNNext(rb,iterstate)))
1327+
while ((change=ReorderBufferIterTXNNext(rb,iterstate))!=NULL)
13281328
{
13291329
Relationrelation=NULL;
13301330
Oidreloid;

0 commit comments

Comments
 (0)

[8]ページ先頭

©2009-2025 Movatter.jp