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

Method fetch_page

src/jrd/validation.cpp:1170–1294  ·  view source on GitHub ↗

Source from the content-addressed store, hash-verified

1168}
1169
1170Validation::FETCH_CODE Validation::fetch_page(bool mark, ULONG page_number,
1171 USHORT type, WIN* window, void* aPage_pointer)
1172{
1173/**************************************
1174 *
1175 * f e t c h _ p a g e
1176 *
1177 **************************************
1178 *
1179 * Functional description
1180 * Fetch page and return type of illness, if any. If "mark" is true,
1181 * check for doubly allocated pages and account for page use.
1182 *
1183 **************************************/
1184 Database* dbb = vdr_tdbb->getDatabase();
1185
1186 if (JRD_reschedule(vdr_tdbb))
1187 {
1188 if (vdr_service && vdr_service->finished())
1189 {
1190 CCH_unwind(vdr_tdbb, false);
1191 Arg::Gds(isc_att_shutdown).raise();
1192 }
1193 }
1194
1195 window->win_page = page_number;
1196 window->win_flags = 0;
1197 pag** page_pointer = reinterpret_cast<pag**>(aPage_pointer);
1198
1199 FB_SIZE_T pos;
1200 if (vdr_used_bdbs.find(page_number, pos))
1201 {
1202 vdr_used_bdbs[pos].count++;
1203
1204 BufferDesc* bdb = vdr_used_bdbs[pos].bdb;
1205 fb_assert(bdb->bdb_page == PageNumber(DB_PAGE_SPACE, page_number));
1206
1207 window->win_bdb = bdb;
1208 *page_pointer = window->win_buffer = bdb->bdb_buffer;
1209 }
1210 else
1211 {
1212 *page_pointer = CCH_FETCH_NO_SHADOW(vdr_tdbb, window,
1213 (vdr_flags & VDR_online ? LCK_read : LCK_write),
1214 0);
1215
1216 vdr_used_bdbs.add(UsedBdb(window->win_bdb));
1217 }
1218
1219 if ((*page_pointer)->pag_type != type && type != pag_undefined)
1220 {
1221 corrupt(VAL_PAG_WRONG_TYPE, 0, page_number,
1222 pagtype(type).c_str(), pagtype((*page_pointer)->pag_type).c_str());
1223 return fetch_type;
1224 }
1225
1226 if (!mark)
1227 return fetch_ok;

Callers

nothing calls this directly

Calls 15

JRD_rescheduleFunction · 0.85
CCH_unwindFunction · 0.85
GdsClass · 0.85
CCH_FETCH_NO_SHADOWFunction · 0.85
UsedBdbClass · 0.85
corruptFunction · 0.85
pagtypeFunction · 0.85
CCH_validateFunction · 0.85
CCH_MARKFunction · 0.85
getDatabaseMethod · 0.80
PageNumberClass · 0.70
testFunction · 0.50

Tested by

no test coverage detected