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

Function CCH_forget_page

src/jrd/cch.cpp:1071–1131  ·  view source on GitHub ↗

Source from the content-addressed store, hash-verified

1069
1070
1071void CCH_forget_page(thread_db* tdbb, WIN* window)
1072{
1073/**************************************
1074 *
1075 * C C H _ f o r g e t _ p a g e
1076 *
1077 **************************************
1078 *
1079 * Functional description
1080 * Page was faked but can't be written on disk. Most probably because
1081 * of out of disk space. Release page buffer and others resources and
1082 * unlink page from various queues
1083 *
1084 **************************************/
1085 SET_TDBB(tdbb);
1086 BufferDesc* bdb = window->win_bdb;
1087 Database* dbb = tdbb->getDatabase();
1088
1089 if (window->win_page != bdb->bdb_page || bdb->bdb_buffer->pag_type != pag_undefined)
1090 return; // buffer was reassigned or page was reused
1091
1092 window->win_bdb = NULL;
1093
1094 if (bdb->bdb_flags & BDB_io_error)
1095 dbb->dbb_flags &= ~DBB_suspend_bgio;
1096
1097 clear_dirty_flag_and_nbak_state(tdbb, bdb);
1098 BufferControl* bcb = dbb->dbb_bcb;
1099
1100 removeDirty(bcb, bdb);
1101
1102 // remove from LRU list
1103 {
1104 SyncLockGuard lruSync(&bcb->bcb_syncLRU, SYNC_EXCLUSIVE, FB_FUNCTION);
1105 requeueRecentlyUsed(bcb);
1106 QUE_DELETE(bdb->bdb_in_use);
1107 }
1108
1109 // remove from hash table and put into empty list
1110#ifndef HASH_USE_CDS_LIST
1111 {
1112 SyncLockGuard bcbSync(&bcb->bcb_syncObject, SYNC_EXCLUSIVE, FB_FUNCTION);
1113 bcb->bcb_hashTable->remove(bdb);
1114 QUE_INSERT(bcb->bcb_empty, bdb->bdb_que);
1115 bcb->bcb_inuse--;
1116 }
1117#else
1118 bcb->bcb_hashTable->remove(bdb);
1119
1120 {
1121 SyncLockGuard syncEmpty(&bcb->bcb_syncEmpty, SYNC_EXCLUSIVE, FB_FUNCTION);
1122 QUE_INSERT(bcb->bcb_empty, bdb->bdb_que);
1123 bcb->bcb_inuse--;
1124 }
1125#endif
1126
1127 bdb->bdb_flags = 0;
1128

Callers 1

ensureDiskSpaceFunction · 0.85

Calls 9

SET_TDBBFunction · 0.85
removeDirtyFunction · 0.85
requeueRecentlyUsedFunction · 0.85
QUE_DELETEFunction · 0.85
QUE_INSERTFunction · 0.85
getDatabaseMethod · 0.80
removeMethod · 0.45
releaseMethod · 0.45

Tested by

no test coverage detected