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

Function SDW_get_shadows

src/jrd/sdw.cpp:526–571  ·  view source on GitHub ↗

Source from the content-addressed store, hash-verified

524
525
526void SDW_get_shadows(thread_db* tdbb)
527{
528/**************************************
529 *
530 * S D W _ g e t _ s h a d o w s
531 *
532 **************************************
533 *
534 * Functional description
535 * Get any new shadows that have been
536 * defined.
537 *
538 **************************************/
539 SET_TDBB(tdbb);
540 Database* dbb = tdbb->getDatabase();
541 CHECK_DBB(dbb);
542
543 SyncLockGuard guard(&dbb->dbb_shadow_sync, SYNC_EXCLUSIVE, "SDW_get_shadows");
544
545 // unless we have one, get a shared lock to ensure that we don't miss any signals
546
547 dbb->dbb_ast_flags &= ~DBB_get_shadows;
548
549 Lock* lock = dbb->dbb_shadow_lock;
550
551 if (lock->lck_physical != LCK_SR)
552 {
553 // fb_assert (lock->lck_physical == LCK_none);
554
555 WIN window(HEADER_PAGE_NUMBER);
556 const header_page* header = (header_page*) CCH_FETCH(tdbb, &window, LCK_read, pag_header);
557 lock->setKey(header->hdr_shadow_count);
558 LCK_lock(tdbb, lock, LCK_SR, LCK_WAIT);
559 CCH_RELEASE(tdbb, &window);
560 }
561
562 // get all new shadow files, marking that we looked at them first
563 // to prevent missing any new ones later on, although it does not
564 // matter for the purposes of the current page being written
565
566 // no use even trying to get shadow files in a case when we invoked from
567 // JRD_shutdown_database, i.e. there are no attachments to database
568
569 if (tdbb->getAttachment())
570 MET_get_shadow_files(tdbb, false);
571}
572
573
574void SDW_init(thread_db* tdbb, bool activate, bool delete_files)

Callers 2

CCH_fakeFunction · 0.85
CCH_fetch_lockFunction · 0.85

Calls 8

SET_TDBBFunction · 0.85
CHECK_DBBFunction · 0.85
CCH_FETCHFunction · 0.85
LCK_lockFunction · 0.85
CCH_RELEASEFunction · 0.85
getDatabaseMethod · 0.80
setKeyMethod · 0.45
getAttachmentMethod · 0.45

Tested by

no test coverage detected