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

Function assert_gc_enabled

src/jrd/vio.cpp:605–642  ·  view source on GitHub ↗

Source from the content-addressed store, hash-verified

603
604
605static bool assert_gc_enabled(const jrd_tra* transaction, const jrd_rel* relation)
606{
607/**************************************
608 *
609 * a s s e r t _ g c _ e n a b l e d
610 *
611 **************************************
612 *
613 * Functional description
614 * Ensure that calls of purge\expunge\VIO_backout are safe and don't break
615 * results of online validation run.
616 *
617 * Notes
618 * System and temporary relations are not validated online.
619 * Non-zero rel_sweep_count is possible only under GCShared control when
620 * garbage collection is enabled.
621 *
622 * VIO_backout is more complex as it could run without GCShared control.
623 * Therefore we additionally check if we own relation lock in "write" mode -
624 * in this case online validation is not run against given relation.
625 *
626 **************************************/
627 if (relation->rel_sweep_count || relation->isSystem() || relation->isTemporary())
628 return true;
629
630 if (relation->rel_flags & REL_gc_disabled)
631 return false;
632
633 vec<Lock*>* vector = transaction->tra_relation_locks;
634 if (!vector || relation->rel_id >= vector->count())
635 return false;
636
637 Lock* lock = (*vector)[relation->rel_id];
638 if (!lock)
639 return false;
640
641 return (lock->lck_physical == LCK_SW) || (lock->lck_physical == LCK_EX);
642}
643
644
645// Pick up relation ids

Callers 3

VIO_backoutFunction · 0.85
expungeFunction · 0.85
purgeFunction · 0.85

Calls 3

isSystemMethod · 0.45
isTemporaryMethod · 0.45
countMethod · 0.45

Tested by

no test coverage detected