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

Method resize

src/jrd/cch.cpp:5305–5350  ·  view source on GitHub ↗

Source from the content-addressed store, hash-verified

5303/// class BCBHashTable
5304
5305void BCBHashTable::resize(ULONG count)
5306{
5307 const ULONG old_count = m_count;
5308 chain_type* const old_chains = m_chains;
5309
5310 chain_type* new_chains = FB_NEW_POOL(m_pool) chain_type[count];
5311 m_count = count;
5312 m_chains = new_chains;
5313
5314#ifndef HASH_USE_CDS_LIST
5315 // Initialize all new new_chains
5316 for (chain_type* que = new_chains; que < new_chains + count; que++)
5317 QUE_INIT(*que);
5318#endif
5319
5320 if (!old_chains)
5321 return;
5322
5323 const chain_type* const old_end = old_chains + old_count;
5324
5325 // Move any active buffers from old hash table to new
5326 for (chain_type* old_tail = old_chains; old_tail < old_end; old_tail++)
5327 {
5328#ifndef HASH_USE_CDS_LIST
5329 while (QUE_NOT_EMPTY(*old_tail))
5330 {
5331 QUE que_inst = old_tail->que_forward;
5332 BufferDesc* bdb = BLOCK(que_inst, BufferDesc, bdb_que);
5333 QUE_DELETE(*que_inst);
5334 QUE mod_que = &new_chains[hash(bdb->bdb_page)];
5335 QUE_INSERT(*mod_que, *que_inst);
5336 }
5337#else
5338 while (!old_tail->empty())
5339 {
5340 auto n = old_tail->begin();
5341 old_tail->erase(n->first); // bdb_page
5342
5343 chain_type* new_chain = &m_chains[hash(n->first)];
5344 new_chain->insert(n->first, n->second); // bdb_page, bdb
5345 }
5346#endif
5347 }
5348
5349 delete[] old_chains;
5350}
5351
5352void BCBHashTable::clear()
5353{

Callers 15

prepareMethod · 0.45
hashMethod · 0.45
authenticateMethod · 0.45
sql_infoFunction · 0.45
setCursorMethod · 0.45
ValueListNodeMethod · 0.45
getDescMethod · 0.45
dsqlPassMethod · 0.45
buildStatementKeyMethod · 0.45
parseParametersMethod · 0.45
internalDsqlPassMethod · 0.45
readLineMethod · 0.45

Calls 9

QUE_INITFunction · 0.85
QUE_NOT_EMPTYFunction · 0.85
QUE_DELETEFunction · 0.85
QUE_INSERTFunction · 0.85
hashFunction · 0.50
emptyMethod · 0.45
beginMethod · 0.45
eraseMethod · 0.45
insertMethod · 0.45

Tested by

no test coverage detected