Skip to content

Commit

Permalink
A quick fix for CORE-2257: Internal consistency check while altering …
Browse files Browse the repository at this point in the history
…dependent procedures.

To be reviewed some day, along with the whole ALTER mechanism.
  • Loading branch information
dyemanov committed Dec 29, 2008
1 parent a79092e commit b441891
Showing 1 changed file with 4 additions and 2 deletions.
6 changes: 4 additions & 2 deletions src/jrd/met.epp
Expand Up @@ -3009,12 +3009,14 @@ jrd_prc* MET_procedure(thread_db* tdbb, int id, bool noscan, USHORT flags)
// or if the cached procedure instance is in use and thus cannot be re-scanned.
// In the latter case, the metadata cache slot is updated with the new instance
// and the old one will be automagically destroyed when all the interested
// requests are released (see CMP_decrement_prc_use_count).
// requests are released (see CMP_decrement_prc_use_count). But we must forcibly
// scan the procedure in place if it's being altered, as the callers expect the
// procedure instance to persist in the cache.
//
// Otherwise, if the cached procedure instance exists but is not used
// by any compiled statements, then it can be safely re-scanned in place.

if (!procedure || procedure->prc_use_count)
if (!procedure || (!(procedure->prc_flags & PRC_being_altered) && procedure->prc_use_count))
{
procedure = FB_NEW(*dbb->dbb_permanent) jrd_prc(*dbb->dbb_permanent);
}
Expand Down

0 comments on commit b441891

Please sign in to comment.