MCPcopy Create free account
hub / github.com/FirebirdSQL/firebird / TRA_commit

Function TRA_commit

src/jrd/tra.cpp:432–558  ·  view source on GitHub ↗

Source from the content-addressed store, hash-verified

430
431
432void TRA_commit(thread_db* tdbb, jrd_tra* transaction, const bool retaining_flag)
433{
434/**************************************
435 *
436 * T R A _ c o m m i t
437 *
438 **************************************
439 *
440 * Functional description
441 * Commit a transaction.
442 *
443 **************************************/
444 SET_TDBB(tdbb);
445
446 TraceTransactionEnd trace(transaction, true, retaining_flag);
447
448 EDS::Transaction::jrdTransactionEnd(tdbb, transaction, true, retaining_flag, false);
449
450 jrd_tra* const sysTran = tdbb->getAttachment()->getSysTransaction();
451
452 // If this is a commit retaining, and no updates have been performed,
453 // and no events have been posted (via stored procedures etc)
454 // no-op the operation.
455
456 if (retaining_flag && !((transaction->tra_flags & TRA_write) || transaction->tra_deferred_job))
457 {
458 if (sysTran->tra_flags & TRA_write)
459 transaction_flush(tdbb, FLUSH_SYSTEM, 0);
460
461 transaction->tra_flags &= ~TRA_prepared;
462
463 // Get rid of all user savepoints
464 while (transaction->tra_save_point && !transaction->tra_save_point->isRoot())
465 transaction->releaseSavepoint(tdbb);
466
467 trace.finish(ITracePlugin::RESULT_SUCCESS);
468 return;
469 }
470
471 if (transaction->tra_flags & TRA_invalidated)
472 ERR_post(Arg::Gds(isc_trans_invalid));
473
474 Jrd::ContextPoolHolder context(tdbb, transaction->tra_pool);
475
476 // Get rid of all user savepoints
477 while (transaction->tra_save_point && !transaction->tra_save_point->isRoot())
478 transaction->releaseSavepoint(tdbb);
479
480 // Let replicator perform heavy and error-prone part of work
481
482 REPL_trans_prepare(tdbb, transaction);
483
484 // Perform any meta data work deferred
485
486 if (!(transaction->tra_flags & TRA_prepared))
487 DFW_perform_work(tdbb, transaction);
488
489 // Commit associated transaction in security DB

Callers 14

executeMethod · 0.85
check_autocommitFunction · 0.85
internalAttachMethod · 0.85
commitFunction · 0.85
purge_transactionsFunction · 0.85
purge_attachmentFunction · 0.85
JRD_autocommit_ddlFunction · 0.85
~ItemMethod · 0.85
garbage_collectorMethod · 0.85
~AutoTransactionMethod · 0.85
runDBTriggersFunction · 0.85
TRA_sweepFunction · 0.85

Calls 15

SET_TDBBFunction · 0.85
transaction_flushFunction · 0.85
GdsClass · 0.85
REPL_trans_prepareFunction · 0.85
raiseFunction · 0.85
retain_contextFunction · 0.85
REPL_trans_commitFunction · 0.85
TRA_set_stateFunction · 0.85
LCK_convertFunction · 0.85
TRA_release_transactionFunction · 0.85
getSysTransactionMethod · 0.80
getSecDbContextMethod · 0.80

Tested by

no test coverage detected