| 4861 | |
| 4862 | |
| 4863 | static bool write_page(thread_db* tdbb, BufferDesc* bdb, FbStatusVector* const status, const bool inAst) |
| 4864 | { |
| 4865 | /************************************** |
| 4866 | * |
| 4867 | * w r i t e _ p a g e |
| 4868 | * |
| 4869 | ************************************** |
| 4870 | * |
| 4871 | * Functional description |
| 4872 | * Do actions required when writing a database page, |
| 4873 | * including journaling, shadowing. |
| 4874 | * |
| 4875 | **************************************/ |
| 4876 | |
| 4877 | CCH_TRACE(("WRITE %d:%06d", bdb->bdb_page.getPageSpaceID(), bdb->bdb_page.getPageNum())); |
| 4878 | |
| 4879 | // hvlad: why it is needed in Vulcan ??? |
| 4880 | //Sync syncWrite(&bcb->bcb_syncPageWrite, "write_page"); |
| 4881 | //syncWrite.lock(SYNC_EXCLUSIVE); |
| 4882 | |
| 4883 | if (bdb->bdb_flags & BDB_not_valid) |
| 4884 | { |
| 4885 | ERR_build_status(status, Arg::Gds(isc_buf_invalid) << Arg::Num(bdb->bdb_page.getPageNum())); |
| 4886 | return false; |
| 4887 | } |
| 4888 | |
| 4889 | Database* const dbb = tdbb->getDatabase(); |
| 4890 | pag* const page = bdb->bdb_buffer; |
| 4891 | |
| 4892 | // Before writing db header page, make sure that |
| 4893 | // the next_transaction > oldest_active transaction |
| 4894 | if (bdb->bdb_page == HEADER_PAGE_NUMBER) |
| 4895 | { |
| 4896 | const header_page* const header = (header_page*) page; |
| 4897 | |
| 4898 | const TraNumber next_transaction = Ods::getNT(header); |
| 4899 | const TraNumber oldest_active = Ods::getOAT(header); |
| 4900 | const TraNumber oldest_transaction = Ods::getOIT(header); |
| 4901 | |
| 4902 | if (next_transaction) |
| 4903 | { |
| 4904 | if (oldest_active > next_transaction) |
| 4905 | BUGCHECK(266); // next transaction older than oldest active |
| 4906 | |
| 4907 | if (oldest_transaction > next_transaction) |
| 4908 | BUGCHECK(267); // next transaction older than oldest transaction |
| 4909 | } |
| 4910 | } |
| 4911 | |
| 4912 | page->pag_generation++; |
| 4913 | bool result = true; |
| 4914 | |
| 4915 | //if (!dbb->dbb_wal || write_thru) becomes |
| 4916 | //if (true || write_thru) then finally if (true) |
| 4917 | // I won't wipe out the if() itself to allow my changes be verified easily by others |
| 4918 | if (true) |
| 4919 | { |
| 4920 | tdbb->bumpStats(RuntimeStatistics::PAGE_WRITES); |
no test coverage detected