mirror of
https://github.com/FirebirdSQL/firebird.git
synced 2025-01-23 10:43:03 +01:00
Small metadata cache cleanup
This commit is contained in:
parent
301e56f1d3
commit
eb1ae27de8
@ -2333,7 +2333,7 @@ static bool delete_index(thread_db* tdbb, SSHORT phase, DeferredWork* work,
|
||||
wait = (transaction->tra_flags & TRA_nowait) ? FALSE : TRUE;
|
||||
// Try to clear trigger cache to release lock
|
||||
if (index->idl_count)
|
||||
MET_clear_cache(tdbb, NULL);
|
||||
MET_clear_cache(tdbb);
|
||||
if (index->idl_count ||
|
||||
!LCK_lock_non_blocking(tdbb, index->idl_lock, LCK_EX, wait))
|
||||
{
|
||||
@ -2673,7 +2673,7 @@ static bool delete_relation(thread_db* tdbb, SSHORT phase, DeferredWork* work,
|
||||
|
||||
wait = (transaction->tra_flags & TRA_nowait) ? FALSE : TRUE;
|
||||
if (relation->rel_use_count)
|
||||
MET_clear_cache(tdbb, NULL);
|
||||
MET_clear_cache(tdbb);
|
||||
if (relation->rel_use_count ||
|
||||
(relation->rel_existence_lock &&
|
||||
!LCK_convert_non_blocking(tdbb, relation->rel_existence_lock,
|
||||
|
@ -550,6 +550,11 @@ class jrd_prc : public pool_alloc_rpt<SCHAR, type_prc>
|
||||
#define PRC_blocking 16 /* Blocking someone from dropping procedure */
|
||||
#define PRC_create 32 /* Newly created */
|
||||
#define PRC_being_altered 64 /* Procedure is getting altered */
|
||||
// This flag is used to make sure that MET_remove_procedure
|
||||
// does not delete and remove procedure block from cache
|
||||
// so dfw.epp:modify_procedure() can flip procedure body without
|
||||
// invalidating procedure pointers from other parts of metadata cache
|
||||
|
||||
#define PRC_check_existence 128 /* Existence lock released */
|
||||
|
||||
#define MAX_PROC_ALTER 64 /* No. of times an in-cache procedure can be altered */
|
||||
|
@ -37,7 +37,7 @@
|
||||
* 2004.01.16 Vlad Horsun: added support for default parameters
|
||||
*/
|
||||
/*
|
||||
$Id: met.epp,v 1.107 2004-04-10 19:03:42 skidder Exp $
|
||||
$Id: met.epp,v 1.108 2004-04-10 19:46:47 skidder Exp $
|
||||
*/
|
||||
// This MUST be at the top of the file
|
||||
#ifdef DARWIN
|
||||
@ -332,7 +332,7 @@ void MET_verify_cache(thread_db* tdbb) {
|
||||
}
|
||||
#endif
|
||||
|
||||
bool MET_clear_cache(thread_db* tdbb, jrd_prc* proc)
|
||||
void MET_clear_cache(thread_db* tdbb)
|
||||
{
|
||||
/**************************************
|
||||
*
|
||||
@ -341,9 +341,8 @@ bool MET_clear_cache(thread_db* tdbb, jrd_prc* proc)
|
||||
**************************************
|
||||
*
|
||||
* Functional description
|
||||
* Try to release all resources locked by cached triggers
|
||||
* do not remove proc procedure from cache because it will be
|
||||
* handled by the caller
|
||||
* Remove all unused objects from metadata cache to
|
||||
* release resources they use
|
||||
*
|
||||
**************************************/
|
||||
SET_TDBB(tdbb);
|
||||
@ -368,8 +367,6 @@ bool MET_clear_cache(thread_db* tdbb, jrd_prc* proc)
|
||||
release_cached_triggers(tdbb, relation->rel_post_modify);
|
||||
}
|
||||
|
||||
bool result = true;
|
||||
|
||||
vec* procedures = dbb->dbb_procedures;
|
||||
if (procedures) {
|
||||
jrd_prc* procedure;
|
||||
@ -396,19 +393,12 @@ bool MET_clear_cache(thread_db* tdbb, jrd_prc* proc)
|
||||
{
|
||||
if ( (procedure = (jrd_prc*)(*ptr)) && procedure->prc_request &&
|
||||
!(procedure->prc_flags & PRC_obsolete) &&
|
||||
procedure->prc_use_count != procedure->prc_int_use_count
|
||||
&& procedure != proc )
|
||||
procedure->prc_use_count != procedure->prc_int_use_count )
|
||||
{
|
||||
adjust_dependencies(procedure);
|
||||
}
|
||||
}
|
||||
|
||||
if (proc) {
|
||||
result = proc->prc_use_count == proc->prc_int_use_count;
|
||||
if (proc->prc_request)
|
||||
adjust_dependencies(proc);
|
||||
}
|
||||
|
||||
/* Deallocate all used requests */
|
||||
for (ptr = procedures->begin(), end = procedures->end();
|
||||
ptr < end; ptr++)
|
||||
@ -419,8 +409,7 @@ bool MET_clear_cache(thread_db* tdbb, jrd_prc* proc)
|
||||
if ( procedure->prc_request &&
|
||||
!(procedure->prc_flags & PRC_obsolete) &&
|
||||
procedure->prc_int_use_count >= 0 &&
|
||||
procedure->prc_use_count == procedure->prc_int_use_count &&
|
||||
procedure != proc )
|
||||
procedure->prc_use_count == procedure->prc_int_use_count )
|
||||
{
|
||||
CMP_release(tdbb, procedure->prc_request);
|
||||
procedure->prc_request = NULL;
|
||||
@ -441,9 +430,8 @@ bool MET_clear_cache(thread_db* tdbb, jrd_prc* proc)
|
||||
ptr < end; ptr++)
|
||||
{
|
||||
if ( (procedure = (jrd_prc*)(*ptr)) &&
|
||||
(procedure->prc_flags & PRC_obsolete) && (procedure != proc) )
|
||||
(procedure->prc_flags & PRC_obsolete) )
|
||||
{
|
||||
procedure->prc_flags &= ~PRC_being_altered; // Just a safety sake
|
||||
MET_remove_procedure(tdbb, procedure->prc_id, procedure);
|
||||
}
|
||||
}
|
||||
@ -452,7 +440,6 @@ bool MET_clear_cache(thread_db* tdbb, jrd_prc* proc)
|
||||
#ifdef DEV_BUILD
|
||||
MET_verify_cache(tdbb);
|
||||
#endif
|
||||
return result;
|
||||
}
|
||||
|
||||
bool MET_procedure_in_use(thread_db* tdbb, jrd_prc* proc)
|
||||
|
@ -85,7 +85,7 @@ void MET_release_triggers(Jrd::thread_db*, Jrd::trig_vec**);
|
||||
#ifdef DEV_BUILD
|
||||
void MET_verify_cache(Jrd::thread_db*);
|
||||
#endif
|
||||
bool MET_clear_cache(Jrd::thread_db*, Jrd::jrd_prc*);
|
||||
void MET_clear_cache(Jrd::thread_db*);
|
||||
bool MET_procedure_in_use(Jrd::thread_db*, Jrd::jrd_prc*);
|
||||
void MET_remove_procedure(Jrd::thread_db*, int, Jrd::jrd_prc*);
|
||||
void MET_revoke(Jrd::thread_db*, Jrd::jrd_tra*, const TEXT*, const TEXT*, const TEXT*);
|
||||
|
Loading…
Reference in New Issue
Block a user