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

Function VIO_sweep

src/jrd/vio.cpp:4379–4505  ·  view source on GitHub ↗

Source from the content-addressed store, hash-verified

4377
4378
4379bool VIO_sweep(thread_db* tdbb, jrd_tra* transaction, TraceSweepEvent* traceSweep)
4380{
4381/**************************************
4382 *
4383 * V I O _ s w e e p
4384 *
4385 **************************************
4386 *
4387 * Functional description
4388 * Make a garbage collection pass.
4389 *
4390 **************************************/
4391 SET_TDBB(tdbb);
4392 Database* const dbb = tdbb->getDatabase();
4393 Jrd::Attachment* attachment = tdbb->getAttachment();
4394
4395#ifdef VIO_DEBUG
4396 VIO_trace(DEBUG_TRACE,
4397 "VIO_sweep (transaction %" SQUADFORMAT")\n", transaction ? transaction->tra_number : 0);
4398#endif
4399
4400 if (transaction->tra_attachment->att_flags & ATT_NO_CLEANUP)
4401 return false;
4402
4403 DPM_scan_pages(tdbb);
4404
4405 if (attachment->att_parallel_workers != 0)
4406 {
4407 EngineCheckout cout(tdbb, FB_FUNCTION);
4408
4409 Coordinator coord(dbb->dbb_permanent);
4410 SweepTask sweep(tdbb, dbb->dbb_permanent, traceSweep);
4411
4412 FbLocalStatus local_status;
4413 local_status->init();
4414
4415 coord.runSync(&sweep);
4416
4417 if (!sweep.getResult(&local_status))
4418 local_status.raise();
4419
4420 return true;
4421 }
4422
4423
4424 // hvlad: restore tdbb->transaction since it can be used later
4425 tdbb->setTransaction(transaction);
4426
4427 record_param rpb;
4428 rpb.rpb_record = NULL;
4429 rpb.rpb_stream_flags = RPB_s_no_data | RPB_s_sweeper;
4430 rpb.getWindow(tdbb).win_flags = WIN_large_scan;
4431
4432 jrd_rel* relation = NULL; // wasn't initialized: memory problem in catch () part.
4433 vec<jrd_rel*>* vector = NULL;
4434
4435 GarbageCollector* gc = dbb->dbb_garbage_collector;
4436 bool ret = true;

Callers 1

TRA_sweepFunction · 0.85

Calls 15

SET_TDBBFunction · 0.85
VIO_traceFunction · 0.85
VIO_next_recordFunction · 0.85
CCH_RELEASEFunction · 0.85
JRD_rescheduleFunction · 0.85
ERR_puntFunction · 0.85
getDatabaseMethod · 0.80
runSyncMethod · 0.80
gcEnabledMethod · 0.80
beginSweepRelationMethod · 0.80
sweptRelationMethod · 0.80
updateActiveSnapshotsMethod · 0.80

Tested by

no test coverage detected