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

Function signal_index_deletion

src/jrd/idx.cpp:2175–2224  ·  view source on GitHub ↗

Source from the content-addressed store, hash-verified

2173
2174
2175static void signal_index_deletion(thread_db* tdbb, jrd_rel* relation, USHORT id)
2176{
2177/**************************************
2178 *
2179 * s i g n a l _ i n d e x _ d e l e t i o n
2180 *
2181 **************************************
2182 *
2183 * Functional description
2184 * On delete of an index, force all
2185 * processes to get rid of index info.
2186 *
2187 **************************************/
2188 IndexBlock* index_block;
2189 Lock* lock = NULL;
2190
2191 SET_TDBB(tdbb);
2192
2193 // get an exclusive lock on the associated index
2194 // block (if it exists) to make sure that all other
2195 // processes flush their cached information about this index
2196
2197 for (index_block = relation->rel_index_blocks; index_block; index_block = index_block->idb_next)
2198 {
2199 if (index_block->idb_id == id)
2200 {
2201 lock = index_block->idb_lock;
2202 break;
2203 }
2204 }
2205
2206 // if one didn't exist, create it
2207
2208 if (!index_block)
2209 {
2210 index_block = IDX_create_index_block(tdbb, relation, id);
2211 lock = index_block->idb_lock;
2212 }
2213
2214 // signal other processes to clear out the index block
2215
2216 if (lock->lck_physical == LCK_SR) {
2217 LCK_convert(tdbb, lock, LCK_EX, LCK_WAIT);
2218 }
2219 else {
2220 LCK_lock(tdbb, lock, LCK_EX, LCK_WAIT);
2221 }
2222
2223 release_index_block(tdbb, index_block);
2224}

Callers 1

IDX_delete_indexFunction · 0.85

Calls 5

SET_TDBBFunction · 0.85
IDX_create_index_blockFunction · 0.85
LCK_convertFunction · 0.85
LCK_lockFunction · 0.85
release_index_blockFunction · 0.85

Tested by

no test coverage detected