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

Function TRA_release_transaction

src/jrd/tra.cpp:1200–1363  ·  view source on GitHub ↗

Source from the content-addressed store, hash-verified

1198
1199
1200void TRA_release_transaction(thread_db* tdbb, jrd_tra* transaction, Jrd::TraceTransactionEnd* trace)
1201{
1202/**************************************
1203 *
1204 * T R A _ r e l e a s e _ t r a n s a c t i o n
1205 *
1206 **************************************
1207 *
1208 * Functional description
1209 * Cleanup a transaction. This is called by both COMMIT and
1210 * ROLLBACK as well as code in JRD to get rid of remote
1211 * transactions.
1212 *
1213 **************************************/
1214 SET_TDBB(tdbb);
1215 Jrd::Attachment* const attachment = tdbb->getAttachment();
1216 Database* const dbb = tdbb->getDatabase();
1217 CHECK_DBB(dbb);
1218
1219 if (!transaction->tra_outer)
1220 {
1221 for (auto& item : transaction->tra_blob_util_map)
1222 {
1223 auto blb = item.second;
1224
1225 // Let temporary blobs be cancelled in the block below.
1226 if (!(blb->blb_flags & BLB_temporary))
1227 blb->BLB_close(tdbb);
1228 }
1229
1230 transaction->tra_blob_util_map.clear();
1231
1232 if (transaction->tra_blobs->getFirst())
1233 {
1234 while (true)
1235 {
1236 BlobIndex *current = &transaction->tra_blobs->current();
1237 if (current->bli_materialized)
1238 {
1239 if (!transaction->tra_blobs->getNext())
1240 break;
1241 }
1242 else
1243 {
1244 ULONG temp_id = current->bli_temp_id;
1245 current->bli_blob_object->BLB_cancel(tdbb);
1246 if (!transaction->tra_blobs->locate(Firebird::locGreat, temp_id))
1247 break;
1248 }
1249 }
1250 }
1251
1252 while (transaction->tra_arrays)
1253 blb::release_array(transaction->tra_arrays);
1254 }
1255
1256 fb_assert(transaction->tra_temp_blobs_count == 0);
1257

Callers 4

freeEngineDataMethod · 0.85
purge_transactionsFunction · 0.85
TRA_commitFunction · 0.85
TRA_rollbackFunction · 0.85

Calls 15

SET_TDBBFunction · 0.85
CHECK_DBBFunction · 0.85
TRA_detach_requestFunction · 0.85
EXT_tra_detachFunction · 0.85
release_temp_tablesFunction · 0.85
LCK_releaseFunction · 0.85
getDatabaseMethod · 0.80
BLB_closeMethod · 0.80
BLB_cancelMethod · 0.80
decUseCountMethod · 0.80
unlinkFromAttachmentMethod · 0.80
endSnapshotMethod · 0.80

Tested by

no test coverage detected