Skip to content

Commit

Permalink
Fixed CORE-1080 : Bugcheck 167 (invalid SEND request) in SS when many…
Browse files Browse the repository at this point in the history
… parallel attachments begin to execute trigger not loaded into metadata cache
  • Loading branch information
hvlad committed Jan 6, 2007
1 parent 6d3edea commit b9d0a9b
Showing 1 changed file with 32 additions and 1 deletion.
33 changes: 32 additions & 1 deletion src/jrd/jrd.cpp
Expand Up @@ -202,10 +202,33 @@ static REC_MUTX_T databases_rec_mutex;

void Jrd::Trigger::compile(thread_db* tdbb)
{
if (!request && !compile_in_progress)
if (!request /*&& !compile_in_progress*/)
{
SET_TDBB(tdbb);

#ifdef SUPERSERVER
Database* dbb = tdbb->tdbb_database;

if (!(dbb->dbb_flags & DBB_sp_rec_mutex_init))
{
THD_rec_mutex_init(&dbb->dbb_sp_rec_mutex);
dbb->dbb_flags |= DBB_sp_rec_mutex_init;
}

THREAD_EXIT();
const int error = THD_rec_mutex_lock(&dbb->dbb_sp_rec_mutex);
THREAD_ENTER();

if (error) {
Firebird::system_call_failed::raise("mutex_lock", error);
}
if (request)
{
THD_rec_mutex_unlock(&dbb->dbb_sp_rec_mutex);
return;
}
#endif /* SUPERSERVER */

compile_in_progress = true;
// Allocate statement memory pool
JrdMemoryPool* new_pool = JrdMemoryPool::createPool();
Expand Down Expand Up @@ -247,6 +270,10 @@ void Jrd::Trigger::compile(thread_db* tdbb)
else {
JrdMemoryPool::deletePool(new_pool);
}

#ifdef SUPERSERVER
THD_rec_mutex_unlock(&dbb->dbb_sp_rec_mutex);
#endif
throw;
}

Expand All @@ -262,6 +289,10 @@ void Jrd::Trigger::compile(thread_db* tdbb)
}

compile_in_progress = false;

#ifdef SUPERSERVER
THD_rec_mutex_unlock(&dbb->dbb_sp_rec_mutex);
#endif
}
}

Expand Down

0 comments on commit b9d0a9b

Please sign in to comment.