mirror of
https://github.com/FirebirdSQL/firebird.git
synced 2025-01-22 20:03:02 +01:00
Use snapshot mode for PSQL blocks executed in autonomous transactions
This commit is contained in:
parent
ac16bb032a
commit
accb0e9f8a
@ -10,7 +10,7 @@ need to raise an exception but do not want the database changes to be rolled-bac
|
|||||||
If exceptions are raised inside the body of an autonomous transaction block, the changes are
|
If exceptions are raised inside the body of an autonomous transaction block, the changes are
|
||||||
rolled-back. If the block runs till the end, the transaction is committed.
|
rolled-back. If the block runs till the end, the transaction is committed.
|
||||||
|
|
||||||
The new transaction is initiated with the same isolation level of the existing one.
|
The new transaction is initiated with snapshot isolation level and lock timeout of the existing one.
|
||||||
Should be used with caution to avoid deadlocks.
|
Should be used with caution to avoid deadlocks.
|
||||||
|
|
||||||
Author:
|
Author:
|
||||||
|
@ -3964,7 +3964,7 @@ const StmtNode* InAutonomousTransactionNode::execute(thread_db* tdbb, jrd_req* r
|
|||||||
jrd_tra* const org_transaction = request->req_transaction;
|
jrd_tra* const org_transaction = request->req_transaction;
|
||||||
fb_assert(tdbb->getTransaction() == org_transaction);
|
fb_assert(tdbb->getTransaction() == org_transaction);
|
||||||
|
|
||||||
jrd_tra* const transaction = TRA_start(tdbb, org_transaction->tra_flags,
|
jrd_tra* const transaction = TRA_start(tdbb, 0,
|
||||||
org_transaction->tra_lock_timeout,
|
org_transaction->tra_lock_timeout,
|
||||||
org_transaction);
|
org_transaction);
|
||||||
|
|
||||||
@ -3989,12 +3989,6 @@ const StmtNode* InAutonomousTransactionNode::execute(thread_db* tdbb, jrd_req* r
|
|||||||
const Savepoint* const savepoint = transaction->startSavepoint();
|
const Savepoint* const savepoint = transaction->startSavepoint();
|
||||||
impure->savNumber = savepoint->getNumber();
|
impure->savNumber = savepoint->getNumber();
|
||||||
|
|
||||||
if ((transaction->tra_flags & TRA_read_committed) &&
|
|
||||||
(transaction->tra_flags & TRA_read_consistency))
|
|
||||||
{
|
|
||||||
TRA_setup_request_snapshot(tdbb, request, true);
|
|
||||||
}
|
|
||||||
|
|
||||||
return action;
|
return action;
|
||||||
}
|
}
|
||||||
|
|
||||||
@ -4006,16 +4000,6 @@ const StmtNode* InAutonomousTransactionNode::execute(thread_db* tdbb, jrd_req* r
|
|||||||
|
|
||||||
fb_assert(transaction->tra_number == impure->traNumber);
|
fb_assert(transaction->tra_number == impure->traNumber);
|
||||||
|
|
||||||
if (request->req_operation == jrd_req::req_return ||
|
|
||||||
request->req_operation == jrd_req::req_unwind)
|
|
||||||
{
|
|
||||||
if ((transaction->tra_flags & TRA_read_committed) &&
|
|
||||||
(transaction->tra_flags & TRA_read_consistency))
|
|
||||||
{
|
|
||||||
TRA_release_request_snapshot(tdbb, request);
|
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
||||||
switch (request->req_operation)
|
switch (request->req_operation)
|
||||||
{
|
{
|
||||||
case jrd_req::req_return:
|
case jrd_req::req_return:
|
||||||
|
Loading…
Reference in New Issue
Block a user