10
10
*
11
11
*
12
12
* IDENTIFICATION
13
- * $PostgreSQL: pgsql/src/backend/access/transam/xact.c,v 1.184 2004/08/30 02:54:38 momjian Exp $
13
+ * $PostgreSQL: pgsql/src/backend/access/transam/xact.c,v 1.185 2004/08/30 19:00:03 tgl Exp $
14
14
*
15
15
*-------------------------------------------------------------------------
16
16
*/
@@ -3462,12 +3462,30 @@ xact_redo(XLogRecPtr lsn, XLogRecord *record)
3462
3462
if (info == XLOG_XACT_COMMIT )
3463
3463
{
3464
3464
xl_xact_commit * xlrec = (xl_xact_commit * ) XLogRecGetData (record );
3465
+ TransactionId * sub_xids ;
3466
+ TransactionId max_xid ;
3465
3467
int i ;
3466
3468
3467
3469
TransactionIdCommit (record -> xl_xid );
3470
+
3468
3471
/* Mark committed subtransactions as committed */
3469
- TransactionIdCommitTree (xlrec -> nsubxacts ,
3470
- (TransactionId * ) & (xlrec -> xnodes [xlrec -> nrels ]));
3472
+ sub_xids = (TransactionId * ) & (xlrec -> xnodes [xlrec -> nrels ]);
3473
+ TransactionIdCommitTree (xlrec -> nsubxacts , sub_xids );
3474
+
3475
+ /* Make sure nextXid is beyond any XID mentioned in the record */
3476
+ max_xid = record -> xl_xid ;
3477
+ for (i = 0 ; i < xlrec -> nsubxacts ; i ++ )
3478
+ {
3479
+ if (TransactionIdPrecedes (max_xid , sub_xids [i ]))
3480
+ max_xid = sub_xids [i ];
3481
+ }
3482
+ if (TransactionIdFollowsOrEquals (max_xid ,
3483
+ ShmemVariableCache -> nextXid ))
3484
+ {
3485
+ ShmemVariableCache -> nextXid = max_xid ;
3486
+ TransactionIdAdvance (ShmemVariableCache -> nextXid );
3487
+ }
3488
+
3471
3489
/* Make sure files supposed to be dropped are dropped */
3472
3490
for (i = 0 ; i < xlrec -> nrels ; i ++ )
3473
3491
{
@@ -3478,12 +3496,30 @@ xact_redo(XLogRecPtr lsn, XLogRecord *record)
3478
3496
else if (info == XLOG_XACT_ABORT )
3479
3497
{
3480
3498
xl_xact_abort * xlrec = (xl_xact_abort * ) XLogRecGetData (record );
3499
+ TransactionId * sub_xids ;
3500
+ TransactionId max_xid ;
3481
3501
int i ;
3482
3502
3483
3503
TransactionIdAbort (record -> xl_xid );
3484
- /* mark subtransactions as aborted */
3485
- TransactionIdAbortTree (xlrec -> nsubxacts ,
3486
- (TransactionId * ) & (xlrec -> xnodes [xlrec -> nrels ]));
3504
+
3505
+ /* Mark subtransactions as aborted */
3506
+ sub_xids = (TransactionId * ) & (xlrec -> xnodes [xlrec -> nrels ]);
3507
+ TransactionIdAbortTree (xlrec -> nsubxacts , sub_xids );
3508
+
3509
+ /* Make sure nextXid is beyond any XID mentioned in the record */
3510
+ max_xid = record -> xl_xid ;
3511
+ for (i = 0 ; i < xlrec -> nsubxacts ; i ++ )
3512
+ {
3513
+ if (TransactionIdPrecedes (max_xid , sub_xids [i ]))
3514
+ max_xid = sub_xids [i ];
3515
+ }
3516
+ if (TransactionIdFollowsOrEquals (max_xid ,
3517
+ ShmemVariableCache -> nextXid ))
3518
+ {
3519
+ ShmemVariableCache -> nextXid = max_xid ;
3520
+ TransactionIdAdvance (ShmemVariableCache -> nextXid );
3521
+ }
3522
+
3487
3523
/* Make sure files supposed to be dropped are dropped */
3488
3524
for (i = 0 ; i < xlrec -> nrels ; i ++ )
3489
3525
{
0 commit comments