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

Method walk_record

src/jrd/validation.cpp:2727–2895  ·  view source on GitHub ↗

Source from the content-addressed store, hash-verified

2725
2726
2727Validation::RTN Validation::walk_record(jrd_rel* relation, const rhd* header, USHORT length,
2728 RecordNumber number, bool delta_flag)
2729{
2730/**************************************
2731 *
2732 * w a l k _ r e c o r d
2733 *
2734 **************************************
2735 *
2736 * Functional description
2737 * Walk a record.
2738 *
2739 **************************************/
2740
2741#ifdef DEBUG_VAL_VERBOSE
2742 if (VAL_debug_level)
2743 {
2744 fprintf(stdout, "record: number %ld (%d/%d) ",
2745 number,
2746 (USHORT) number / tdbb->getDatabase()->dbb_max_records,
2747 (USHORT) number % tdbb->getDatabase()->dbb_max_records);
2748 print_rhd(length, header);
2749 }
2750#endif
2751
2752 if (header->rhd_flags & rhd_damaged)
2753 {
2754 corrupt(VAL_REC_DAMAGED, relation, number.getValue());
2755 return rtn_ok;
2756 }
2757
2758 const TraNumber transaction = Ods::getTraNum(header);
2759
2760 if (transaction > vdr_max_transaction)
2761 corrupt(VAL_REC_BAD_TID, relation, number.getValue(), transaction);
2762
2763 // If there's a back pointer, verify that it's good
2764
2765 if (header->rhd_b_page && !(header->rhd_flags & rhd_chain))
2766 {
2767 const RTN result = walk_chain(relation, header, number);
2768 if (result != rtn_ok)
2769 return result;
2770 }
2771
2772 // If the record is a fragment, not large, or we're not interested in
2773 // chasing records, skip the record
2774
2775 if ((header->rhd_flags & (rhd_fragment | rhd_deleted)) ||
2776 !((header->rhd_flags & rhd_large) || (vdr_flags & VDR_records)))
2777 {
2778 return rtn_ok;
2779 }
2780
2781 // Pick up what length there is on the fragment
2782
2783 const rhdf* fragment = (rhdf*) header;
2784

Callers

nothing calls this directly

Calls 5

print_rhdFunction · 0.85
corruptFunction · 0.85
getTraNumFunction · 0.85
getDatabaseMethod · 0.80
getValueMethod · 0.45

Tested by

no test coverage detected