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

Method walk_relation

src/jrd/validation.cpp:3040–3218  ·  view source on GitHub ↗

Source from the content-addressed store, hash-verified

3038}
3039
3040Validation::RTN Validation::walk_relation(jrd_rel* relation)
3041{
3042/**************************************
3043 *
3044 * w a l k _ r e l a t i o n
3045 *
3046 **************************************
3047 *
3048 * Functional description
3049 * Walk all pages associated with a given relation.
3050 *
3051 **************************************/
3052
3053 try {
3054
3055 // If relation hasn't been scanned, do so now
3056
3057 if (!(relation->rel_flags & REL_scanned) || (relation->rel_flags & REL_being_scanned))
3058 {
3059 MET_scan_relation(vdr_tdbb, relation);
3060 }
3061
3062 // skip deleted relations
3063 if (relation->rel_flags & (REL_deleted | REL_deleting)) {
3064 return rtn_ok;
3065 }
3066
3067#ifdef DEBUG_VAL_VERBOSE
3068 if (VAL_debug_level)
3069 fprintf(stdout, "walk_relation: id %d Format %d %s %s\n",
3070 relation->rel_id, relation->rel_current_fmt,
3071 relation->rel_name.c_str(), relation->rel_owner_name.c_str());
3072#endif
3073
3074 // If it's a view, external file or virtual table, skip this
3075
3076 if (relation->rel_view_rse || relation->rel_file || relation->isVirtual()) {
3077 return rtn_ok;
3078 }
3079
3080 AutoLock lckRead(vdr_tdbb);
3081 jrd_rel::GCExclusive lckGC(vdr_tdbb, relation);
3082 if (vdr_flags & VDR_online)
3083 {
3084 lckRead = jrd_rel::createLock(vdr_tdbb, NULL, relation, LCK_relation, false);
3085 if (!LCK_lock(vdr_tdbb, lckRead, LCK_PR, vdr_lock_tout))
3086 {
3087 output("Acquire relation lock failed\n");
3088 vdr_errors++;
3089 return rtn_ok;
3090 }
3091
3092 if (!lckGC.acquire(vdr_lock_tout))
3093 {
3094 output("Acquire garbage collection lock failed\n");
3095 vdr_errors++;
3096 return rtn_ok;
3097 }

Callers

nothing calls this directly

Calls 15

LCK_lockFunction · 0.85
outputFunction · 0.85
getNTFunction · 0.85
corruptFunction · 0.85
isVirtualMethod · 0.80
getBasePagesMethod · 0.80
resetFunction · 0.50
c_strMethod · 0.45
acquireMethod · 0.45
clearMethod · 0.45
isSystemMethod · 0.45
countMethod · 0.45

Tested by

no test coverage detected