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

Function flushDirty

src/jrd/cch.cpp:2674–2708  ·  view source on GitHub ↗

Collect pages modified by given or system transaction and write it to disk. See also comments in flushPages.

Source from the content-addressed store, hash-verified

2672// Collect pages modified by given or system transaction and write it to disk.
2673// See also comments in flushPages.
2674static void flushDirty(thread_db* tdbb, SLONG transaction_mask, const bool sys_only)
2675{
2676 SET_TDBB(tdbb);
2677 Database* dbb = tdbb->getDatabase();
2678 BufferControl* bcb = dbb->dbb_bcb;
2679 Firebird::HalfStaticArray<BufferDesc*, 1024> flush;
2680
2681 { // dirtySync scope
2682 Sync dirtySync(&bcb->bcb_syncDirtyBdbs, "flushDirty");
2683 dirtySync.lock(SYNC_EXCLUSIVE);
2684
2685 QUE que_inst = bcb->bcb_dirty.que_forward, next;
2686 for (; que_inst != &bcb->bcb_dirty; que_inst = next)
2687 {
2688 next = que_inst->que_forward;
2689 BufferDesc* bdb = BLOCK(que_inst, BufferDesc, bdb_dirty);
2690
2691 if (!(bdb->bdb_flags & BDB_dirty))
2692 {
2693 removeDirty(bcb, bdb);
2694 continue;
2695 }
2696
2697 if ((transaction_mask & bdb->bdb_transactions) ||
2698 (bdb->bdb_flags & BDB_system_dirty) ||
2699 (!transaction_mask && !sys_only) ||
2700 (!bdb->bdb_transactions))
2701 {
2702 flush.add(bdb);
2703 }
2704 }
2705 }
2706
2707 flushPages(tdbb, FLUSH_TRAN, flush.begin(), flush.getCount());
2708}
2709
2710
2711// Collect pages modified by garbage collector or all dirty pages or release page

Callers 1

CCH_flushFunction · 0.85

Calls 8

SET_TDBBFunction · 0.85
removeDirtyFunction · 0.85
flushPagesFunction · 0.85
getDatabaseMethod · 0.80
lockMethod · 0.45
addMethod · 0.45
beginMethod · 0.45
getCountMethod · 0.45

Tested by

no test coverage detected