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

Function SDW_dump_pages

src/jrd/sdw.cpp:422–523  ·  view source on GitHub ↗

Source from the content-addressed store, hash-verified

420
421
422void SDW_dump_pages(thread_db* tdbb)
423{
424/**************************************
425 *
426 * S D W _ d u m p _ p a g e s
427 *
428 **************************************
429 *
430 * Functional description
431 * Look for any shadow files that haven't been written yet.
432 * Fetch pages from the database and write them
433 * to all unwritten shadow files.
434 *
435 **************************************/
436 SET_TDBB(tdbb);
437 Database* dbb = tdbb->getDatabase();
438 SyncLockGuard guard(&dbb->dbb_shadow_sync, SYNC_EXCLUSIVE, "SDW_dump_pages");
439
440 gds__log("conditional shadow dumped for database %s", dbb->dbb_filename.c_str());
441 const SLONG max = PAG_last_page(tdbb);
442
443 // mark the first shadow in the list because we don't
444 // want to start shadowing to any files that are added
445 // while we are in the middle of dumping pages
446
447 // none of these pages should need any alteration
448 // since header pages for extend files are not handled at this level
449 WIN window(DB_PAGE_SPACE, -1);
450 window.win_flags = WIN_large_scan;
451 window.win_scans = 1;
452
453 for (SLONG page_number = HEADER_PAGE + 1; page_number <= max; page_number++)
454 {
455#ifdef SUPERSERVER_V2
456 if (!(page_number % dbb->dbb_prefetch_sequence))
457 {
458 SLONG pages[PREFETCH_MAX_PAGES];
459
460 SLONG number = page_number;
461 SLONG i = 0;
462 while (i < dbb->dbb_prefetch_pages && number <= max) {
463 pages[i++] = number++;
464 }
465
466 CCH_PREFETCH(tdbb, pages, i);
467 }
468#endif
469 for (Shadow* shadow = dbb->dbb_shadow; shadow; shadow = shadow->sdw_next)
470 {
471 if (!(shadow->sdw_flags & (SDW_INVALID | SDW_dumped)))
472 {
473 window.win_page = page_number;
474
475 // when copying a database, it is possible that there are some pages defined
476 // in the pip that were never actually written to disk, in the case of a faked
477 // page which was never written to disk because of a rollback; to prevent
478 // checksum errors on this type of page, don't check for checksum when the
479 // page type is 0

Callers 3

CCH_write_all_shadowsFunction · 0.85
SDW_checkFunction · 0.85
SDW_rollover_to_shadowFunction · 0.85

Calls 10

SET_TDBBFunction · 0.85
PAG_last_pageFunction · 0.85
CCH_PREFETCHFunction · 0.85
CCH_FETCHFunction · 0.85
CCH_RELEASEFunction · 0.85
ERR_puntFunction · 0.85
CCH_RELEASE_TAILFunction · 0.85
getDatabaseMethod · 0.80
c_strMethod · 0.45
writeMethod · 0.45

Tested by

no test coverage detected