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

Method handler

src/jrd/vio.cpp:407–505  ·  view source on GitHub ↗

Source from the content-addressed store, hash-verified

405
406
407bool SweepTask::handler(WorkItem& _item)
408{
409 Item* item = reinterpret_cast<Item*>(&_item);
410
411 ThreadContextHolder tdbb(NULL);
412
413 if (!item->init(tdbb))
414 {
415 setError(tdbb->tdbb_status_vector, true);
416 return false;
417 }
418
419 WorkerContextHolder wrkHolder(tdbb, FB_FUNCTION);
420
421 record_param rpb;
422 jrd_rel* relation = NULL;
423
424 try
425 {
426 RelInfo* relInfo = item->m_relInfo;
427
428 Database* dbb = tdbb->getDatabase();
429 Attachment* att = tdbb->getAttachment();
430
431 /*relation = (*att->att_relations)[relInfo->rel_id];
432 if (relation)*/
433 relation = MET_lookup_relation_id(tdbb, relInfo->rel_id, false);
434
435 if (relation &&
436 !(relation->rel_flags & (REL_deleted | REL_deleting)) &&
437 !relation->isTemporary() &&
438 relation->getPages(tdbb)->rel_pages)
439 {
440 jrd_rel::GCShared gcGuard(tdbb, relation);
441 if (!gcGuard.gcEnabled())
442 {
443 string str;
444 str.printf("Acquire garbage collection lock failed (%s)", relation->rel_name.c_str());
445 status_exception::raise(Arg::Gds(isc_random) << Arg::Str(str));
446 }
447
448 jrd_tra* tran = tdbb->getTransaction();
449
450 if (relInfo->countPP == 0)
451 relInfo->countPP = relation->getPages(tdbb)->rel_pages->count();
452
453 rpb.rpb_relation = relation;
454 rpb.rpb_org_scans = relation->rel_scan_count++;
455 rpb.rpb_record = NULL;
456 rpb.rpb_stream_flags = RPB_s_no_data | RPB_s_sweeper;
457 rpb.getWindow(tdbb).win_flags = WIN_large_scan;
458
459 rpb.rpb_number.compose(dbb->dbb_max_records, dbb->dbb_dp_per_pp, 0, 0, item->m_firstPP);
460 rpb.rpb_number.decrement();
461
462 RecordNumber lastRecNo;
463 lastRecNo.compose(dbb->dbb_max_records, dbb->dbb_dp_per_pp, 0, 0, item->m_lastPP + 1);
464 lastRecNo.decrement();

Callers

nothing calls this directly

Calls 15

raiseFunction · 0.85
GdsClass · 0.85
StrClass · 0.85
VIO_next_recordFunction · 0.85
CCH_RELEASEFunction · 0.85
JRD_rescheduleFunction · 0.85
getDatabaseMethod · 0.80
gcEnabledMethod · 0.80
initMethod · 0.45
getAttachmentMethod · 0.45
isTemporaryMethod · 0.45
getPagesMethod · 0.45

Tested by

no test coverage detected