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

Method initTempPageSpace

src/jrd/pag.cpp:2552–2588  ·  view source on GitHub ↗

Source from the content-addressed store, hash-verified

2550}
2551
2552void PageManager::initTempPageSpace(thread_db* tdbb)
2553{
2554 SET_TDBB(tdbb);
2555 Database* const dbb = tdbb->getDatabase();
2556
2557 fb_assert(tempPageSpaceID == 0);
2558
2559 if (dbb->dbb_config->getServerMode() != MODE_SUPER)
2560 {
2561 Jrd::Attachment* const attachment = tdbb->getAttachment();
2562
2563 if (!attachment->att_temp_pg_lock)
2564 {
2565 Lock* const lock = FB_NEW_RPT(*attachment->att_pool, 0)
2566 Lock(tdbb, sizeof(SLONG), LCK_page_space);
2567
2568 while (true)
2569 {
2570 const double tmp = rand() * (MAX_USHORT - TEMP_PAGE_SPACE - 1.0) / (RAND_MAX + 1.0);
2571 lock->setKey(static_cast<SLONG>(tmp) + TEMP_PAGE_SPACE + 1);
2572 if (LCK_lock(tdbb, lock, LCK_write, LCK_NO_WAIT))
2573 break;
2574 fb_utils::init_status(tdbb->tdbb_status_vector);
2575 }
2576
2577 attachment->att_temp_pg_lock = lock;
2578 }
2579
2580 tempPageSpaceID = (USHORT) attachment->att_temp_pg_lock->getKey();
2581 }
2582 else
2583 {
2584 tempPageSpaceID = TEMP_PAGE_SPACE;
2585 }
2586
2587 addPageSpace(tempPageSpaceID);
2588}
2589
2590USHORT PageManager::getTempPageSpaceID(thread_db* tdbb)
2591{

Callers 2

internalAttachMethod · 0.80
createDatabaseMethod · 0.80

Calls 9

SET_TDBBFunction · 0.85
LCK_lockFunction · 0.85
init_statusFunction · 0.85
getDatabaseMethod · 0.80
getServerModeMethod · 0.80
LockClass · 0.70
getAttachmentMethod · 0.45
setKeyMethod · 0.45
getKeyMethod · 0.45

Tested by

no test coverage detected