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

Function write_buffer

src/jrd/cch.cpp:4714–4860  ·  view source on GitHub ↗

Source from the content-addressed store, hash-verified

4712
4713
4714static int write_buffer(thread_db* tdbb,
4715 BufferDesc* bdb,
4716 const PageNumber page,
4717 const bool write_thru,
4718 FbStatusVector* const status, const bool write_this_page)
4719{
4720/**************************************
4721 *
4722 * w r i t e _ b u f f e r
4723 *
4724 **************************************
4725 *
4726 * Functional description
4727 * Write a dirty buffer. This may recurse due to
4728 * precedence problems.
4729 *
4730 * input: write_this_page
4731 * = true if the input page needs to be written
4732 * before returning. (normal case)
4733 * = false if the input page is being written
4734 * because of precedence. Only write
4735 * one page and return so that the caller
4736 * can re-establish the need to write this
4737 * page.
4738 *
4739 * return: 0 = Write failed.
4740 * 1 = Page is written. Page was written by this
4741 * call, or was written by someone else, or the
4742 * cache buffer is already reassigned.
4743 * 2 = Only possible if write_this_page is false.
4744 * This input page is not written. One
4745 * page higher in precedence is written
4746 * though. Probable action: re-establich the
4747 * need to write this page and retry write.
4748 *
4749 **************************************/
4750 SET_TDBB(tdbb);
4751#ifdef SUPERSERVER_V2
4752 Database* const dbb = tdbb->getDatabase();
4753#endif
4754
4755 bdb->lockIO(tdbb);
4756 if (bdb->bdb_page != page)
4757 {
4758 bdb->unLockIO(tdbb);
4759 return 1;
4760 }
4761
4762 if ((bdb->bdb_flags & BDB_marked) && !(bdb->bdb_flags & BDB_faked))
4763 BUGCHECK(217); // msg 217 buffer marked for update
4764
4765 if (!(bdb->bdb_flags & BDB_dirty) && !(write_thru && bdb->bdb_flags & BDB_db_dirty))
4766 {
4767 bdb->unLockIO(tdbb);
4768 clear_precedence(tdbb, bdb);
4769 return 1;
4770 }
4771

Callers 8

CCH_fakeFunction · 0.85
CCH_free_pageFunction · 0.85
CCH_releaseFunction · 0.85
flushPagesFunction · 0.85
cache_readerMethod · 0.85
cache_writerMethod · 0.85
check_precedenceFunction · 0.85
get_oldest_bufferFunction · 0.85

Calls 12

SET_TDBBFunction · 0.85
clear_precedenceFunction · 0.85
QUE_NOT_EMPTYFunction · 0.85
QUE_EMPTYFunction · 0.85
QUE_DELETEFunction · 0.85
TRA_header_writeFunction · 0.85
write_pageFunction · 0.85
getDatabaseMethod · 0.80
lockIOMethod · 0.80
unLockIOMethod · 0.80
lockMethod · 0.45
unlockMethod · 0.45

Tested by

no test coverage detected