Location via proxy:   [ UP ]  
[Report a bug]   [Manage cookies]                
Skip to content

Commit e25ebfb

Browse files
committed
Correctly handle two phase transation commit
1 parent cf9d417 commit e25ebfb

File tree

2 files changed

+16
-7
lines changed

2 files changed

+16
-7
lines changed

contrib/pg_dtm/tests/dtmbench.cpp

Lines changed: 15 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -190,13 +190,21 @@ void* writer(void* arg)
190190
i -= 1;
191191
continue;
192192
}
193-
pipeline srcPipe(srcTx);
194-
pipeline dstPipe(dstTx);
195-
srcPipe.insert("commit transaction");
196-
dstPipe.insert("commit transaction");
197-
srcPipe.complete();
198-
dstPipe.complete();
199-
193+
try {
194+
pipeline srcPipe(srcTx);
195+
pipeline dstPipe(dstTx);
196+
pipeline::query_id q1 = srcPipe.insert("commit transaction");
197+
pipeline::query_id q2 = dstPipe.insert("commit transaction");
198+
//srcPipe.complete();
199+
//dstPipe.complete();
200+
srcPipe.retrieve(q1);
201+
dstPipe.retrieve(q2);
202+
} catch (pqxx_exception const& x) {
203+
t.aborts += 1;
204+
i -= 1;
205+
continue;
206+
}
207+
200208
t.proceeded += 1;
201209
}
202210
return NULL;

src/backend/access/transam/xact.c

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1313,6 +1313,7 @@ RecordTransactionCommit(void)
13131313
END_CRIT_SECTION();
13141314
if (!committed) {
13151315
CurrentTransactionState->state = TRANS_ABORT;
1316+
CurrentTransactionState->blockState = TBLOCK_ABORT_PENDING;
13161317
elog(ERROR, "Transaction commit rejected by XTM");
13171318
}
13181319
}

0 commit comments

Comments
 (0)