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

Function CCH_clean_page

src/jrd/cch.cpp:288–363  ·  view source on GitHub ↗

Source from the content-addressed store, hash-verified

286
287
288void CCH_clean_page(thread_db* tdbb, PageNumber page)
289{
290/**************************************
291 * C C H _ c l e a n _ p a g e
292 **************************************
293 *
294 * Functional description
295 * Clear dirty status and dependencies. Buffer must be unused.
296 * If buffer with given page number is not found - it is OK, do nothing.
297 * Used to remove dirty pages from cache after releasing temporary objects.
298 *
299 **************************************/
300 SET_TDBB(tdbb);
301 Database* dbb = tdbb->getDatabase();
302
303 fb_assert(page.getPageNum() > 0);
304 fb_assert(page.isTemporary());
305 if (!page.isTemporary())
306 return;
307
308 BufferControl* bcb = dbb->dbb_bcb;
309 BufferDesc* bdb = NULL;
310 {
311#ifndef HASH_USE_CDS_LIST
312 Sync bcbSync(&bcb->bcb_syncObject, "CCH_clean_page");
313 bcbSync.lock(SYNC_SHARED);
314#endif
315
316 bdb = bcb->bcb_hashTable->find(page);
317 if (!bdb)
318 return;
319
320 fb_assert(bdb->bdb_use_count == 0);
321 if (!bdb->addRefConditional(tdbb, SYNC_EXCLUSIVE))
322 return;
323 }
324
325 // temporary pages should have no precedence relationship
326 if (!QUE_EMPTY(bdb->bdb_higher))
327 purgePrecedence(bcb, bdb);
328
329 fb_assert(QUE_EMPTY(bdb->bdb_higher));
330 fb_assert(QUE_EMPTY(bdb->bdb_lower));
331
332 if (!QUE_EMPTY(bdb->bdb_lower) || !QUE_EMPTY(bdb->bdb_higher))
333 {
334 bdb->release(tdbb, true);
335 return;
336 }
337
338 if (bdb->bdb_flags & (BDB_dirty | BDB_db_dirty))
339 {
340 bdb->bdb_difference_page = 0;
341 bdb->bdb_transactions = 0;
342 bdb->bdb_mark_transaction = 0;
343
344 if (!(bdb->bdb_bcb->bcb_flags & BCB_keep_pages))
345 removeDirty(dbb->dbb_bcb, bdb);

Callers 1

PAG_release_pagesFunction · 0.85

Calls 15

SET_TDBBFunction · 0.85
QUE_EMPTYFunction · 0.85
purgePrecedenceFunction · 0.85
removeDirtyFunction · 0.85
requeueRecentlyUsedFunction · 0.85
QUE_DELETEFunction · 0.85
QUE_APPENDFunction · 0.85
getDatabaseMethod · 0.80
getPageNumMethod · 0.80
addRefConditionalMethod · 0.80
isTemporaryMethod · 0.45

Tested by

no test coverage detected