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

Function CCH_init

src/jrd/cch.cpp:1546–1630  ·  view source on GitHub ↗

Source from the content-addressed store, hash-verified

1544
1545
1546void CCH_init(thread_db* tdbb, ULONG number)
1547{
1548/**************************************
1549 *
1550 * C C H _ i n i t
1551 *
1552 **************************************
1553 *
1554 * Functional description
1555 * Initialize the cache. Allocate buffers control block,
1556 * buffer descriptors, and actual buffers.
1557 *
1558 **************************************/
1559 SET_TDBB(tdbb);
1560 Database* const dbb = tdbb->getDatabase();
1561 const bool shared = (dbb->dbb_flags & DBB_shared);
1562
1563 CCH_TRACE(("INIT %s", dbb->dbb_filename.c_str()));
1564
1565 // Check for database-specific page buffers
1566
1567 if (dbb->dbb_page_buffers)
1568 number = dbb->dbb_page_buffers;
1569
1570 // Enforce page buffer cache constraints
1571
1572 if (number < MIN_PAGE_BUFFERS)
1573 number = MIN_PAGE_BUFFERS;
1574
1575 if (number > MAX_PAGE_BUFFERS)
1576 number = MAX_PAGE_BUFFERS;
1577
1578 const ULONG count = number;
1579
1580 // Allocate and initialize buffers control block
1581 BufferControl* bcb = BufferControl::create(dbb);
1582 while (true)
1583 {
1584 try
1585 {
1586 bcb->bcb_hashTable = FB_NEW_POOL(*bcb->bcb_bufferpool)
1587 BCBHashTable(*bcb->bcb_bufferpool, number);
1588 break;
1589 }
1590 catch (const Firebird::Exception& ex)
1591 {
1592 ex.stuffException(tdbb->tdbb_status_vector);
1593
1594 number -= number >> 2;
1595
1596 if (number < MIN_PAGE_BUFFERS)
1597 ERR_post(Arg::Gds(isc_cache_too_small));
1598 }
1599 }
1600
1601 dbb->dbb_bcb = bcb;
1602 bcb->bcb_page_size = dbb->dbb_page_size;
1603 bcb->bcb_database = dbb;

Callers 2

internalAttachMethod · 0.85
createDatabaseMethod · 0.85

Calls 11

SET_TDBBFunction · 0.85
createFunction · 0.85
GdsClass · 0.85
QUE_INITFunction · 0.85
memory_initFunction · 0.85
getDatabaseMethod · 0.80
BCBHashTableClass · 0.70
ERR_postFunction · 0.70
c_strMethod · 0.45
stuffExceptionMethod · 0.45
getAttachmentMethod · 0.45

Tested by

no test coverage detected