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

Function delete_tail

src/jrd/vio.cpp:4984–5040  ·  view source on GitHub ↗

Source from the content-addressed store, hash-verified

4982
4983
4984static UCHAR* delete_tail(thread_db* tdbb,
4985 record_param* rpb,
4986 ULONG prior_page,
4987 UCHAR* tail,
4988 const UCHAR* tail_end)
4989{
4990/**************************************
4991 *
4992 * d e l e t e _ t a i l
4993 *
4994 **************************************
4995 *
4996 * Functional description
4997 * Delete the tail of a record. If no tail, don't do nuttin'.
4998 * If the address of a record tail has been passed, fetch data.
4999 *
5000 **************************************/
5001 SET_TDBB(tdbb);
5002
5003#ifdef VIO_DEBUG
5004 jrd_rel* relation = rpb->rpb_relation;
5005 VIO_trace(DEBUG_WRITES,
5006 "delete_tail (rel_id %u, record_param %" QUADFORMAT"d, prior_page %" SLONGFORMAT", tail %p, length %u)\n",
5007 relation->rel_id, rpb->rpb_number.getValue(), prior_page, tail, tail_end - tail);
5008
5009 VIO_trace(DEBUG_WRITES_INFO,
5010 " tail of record %" SLONGFORMAT":%d, rpb_trans %" SQUADFORMAT
5011 ", flags %d, back %" SLONGFORMAT":%d, fragment %" SLONGFORMAT":%d\n",
5012 rpb->rpb_page, rpb->rpb_line, rpb->rpb_transaction_nr,
5013 rpb->rpb_flags, rpb->rpb_b_page, rpb->rpb_b_line,
5014 rpb->rpb_f_page, rpb->rpb_f_line);
5015#endif
5016
5017 RuntimeStatistics::Accumulator fragments(tdbb, rpb->rpb_relation,
5018 RuntimeStatistics::RECORD_FRAGMENT_READS);
5019
5020 while (rpb->rpb_flags & rpb_incomplete)
5021 {
5022 rpb->rpb_page = rpb->rpb_f_page;
5023 rpb->rpb_line = rpb->rpb_f_line;
5024
5025 // Since the callers are modifying this record, it should not be garbage collected.
5026
5027 if (!DPM_fetch(tdbb, rpb, LCK_write))
5028 BUGCHECK(248); // msg 248 cannot find record fragment
5029
5030 if (tail)
5031 tail = unpack(rpb, tail_end - tail, tail);
5032
5033 DPM_delete(tdbb, rpb, prior_page);
5034 prior_page = rpb->rpb_page;
5035
5036 ++fragments;
5037 }
5038
5039 return tail;
5040}
5041

Callers 4

VIO_backoutFunction · 0.85
delete_version_chainFunction · 0.85
delete_recordFunction · 0.85
replace_recordFunction · 0.85

Calls 4

SET_TDBBFunction · 0.85
VIO_traceFunction · 0.85
unpackFunction · 0.85
getValueMethod · 0.45

Tested by

no test coverage detected