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

Method garbageCollectIdxLite

src/jrd/Savepoint.cpp:81–158  ·  view source on GitHub ↗

Source from the content-addressed store, hash-verified

79// VerbAction implementation
80
81void VerbAction::garbageCollectIdxLite(thread_db* tdbb, jrd_tra* transaction, SINT64 recordNumber,
82 VerbAction* nextAction, Record* goingRecord)
83{
84 // Clean up index entries and referenced BLOBs.
85 // This routine uses smaller set of staying record than original VIO_garbage_collect_idx().
86 //
87 // Notes:
88 //
89 // This speed trick is possible only because btr.cpp:insert_node() allows duplicate nodes
90 // which work as an index entry reference counter.
91
92 record_param rpb;
93 rpb.rpb_relation = vct_relation;
94 rpb.rpb_number.setValue(recordNumber);
95 rpb.rpb_record = NULL;
96 rpb.getWindow(tdbb).win_flags = 0;
97 rpb.rpb_transaction_nr = transaction->tra_number;
98
99 Record* next_ver;
100 AutoTempRecord undo_next_ver(transaction->findNextUndo(this, vct_relation, recordNumber));
101 AutoPtr<Record> real_next_ver;
102
103 next_ver = undo_next_ver;
104
105 if (!DPM_get(tdbb, &rpb, LCK_read))
106 BUGCHECK(186); // msg 186 record disappeared
107 else
108 {
109 if (next_ver || (rpb.rpb_flags & rpb_deleted))
110 CCH_RELEASE(tdbb, &rpb.getWindow(tdbb));
111 else
112 {
113 VIO_data(tdbb, &rpb, transaction->tra_pool);
114 next_ver = real_next_ver = rpb.rpb_record;
115 }
116 }
117
118 if (rpb.rpb_transaction_nr != transaction->tra_number)
119 BUGCHECK(185); // msg 185 wrong record version
120
121 Record* prev_ver = NULL;
122 AutoTempRecord undo_prev_ver;
123 AutoPtr<Record> real_prev_ver;
124
125 if (nextAction && nextAction->vct_undo && nextAction->vct_undo->locate(recordNumber))
126 {
127 prev_ver = undo_prev_ver = nextAction->vct_undo->current().setupRecord(transaction);
128 }
129 else if (rpb.rpb_b_page) // previous version exists and we have to find it in a hard way
130 {
131 record_param temp = rpb;
132 temp.rpb_record = NULL;
133 temp.rpb_page = rpb.rpb_b_page;
134 temp.rpb_line = rpb.rpb_b_line;
135
136 if (!DPM_fetch(tdbb, &temp, LCK_read))
137 BUGCHECK(291); // Back version disappeared
138

Callers 1

verb_postFunction · 0.80

Calls 10

CCH_RELEASEFunction · 0.85
VIO_dataFunction · 0.85
IDX_garbage_collectFunction · 0.85
BLB_garbage_collectFunction · 0.85
findNextUndoMethod · 0.80
setupRecordMethod · 0.80
setValueMethod · 0.45
locateMethod · 0.45
currentMethod · 0.45
pushMethod · 0.45

Tested by

no test coverage detected