8
0
mirror of https://github.com/FirebirdSQL/firebird.git synced 2025-01-23 22:03:03 +01:00

Fixed use of monitoring tables in on disconnect trigger, make pool for DatabaseSnapshot independent

This commit is contained in:
alexpeshkoff 2009-06-08 11:47:35 +00:00
parent de76a6c806
commit 9861f79f05
4 changed files with 11 additions and 10 deletions

View File

@ -406,7 +406,7 @@ int DatabaseSnapshot::blockingAst(void* ast_object)
// We create a static pool in order to avoid dbb_permanent being a point of
// concurrency conflicts. This pool will be automagically destroyed during
// database detach. This is safe in Classic, as a process holds single dbb.
static JrdMemoryPool* const pool = JrdMemoryPool::createPool();
static JrdMemoryPool* const pool = JrdMemoryPool::createPool(false);
#endif
Jrd::ContextPoolHolder context(tdbb, pool);
@ -416,7 +416,7 @@ int DatabaseSnapshot::blockingAst(void* ast_object)
// Write the data to the shared memory
try
{
dumpData(tdbb);
dumpData(tdbb, true);
}
catch (const Exception& ex)
{
@ -465,7 +465,7 @@ DatabaseSnapshot::DatabaseSnapshot(thread_db* tdbb, MemoryPool& pool)
LCK_release(tdbb, dbb->dbb_monitor_lock);
// Dump our own data
dumpData(tdbb);
dumpData(tdbb, false);
// Signal other processes to dump their data
Lock temp_lock, *lock = &temp_lock;
@ -830,14 +830,14 @@ const char* DatabaseSnapshot::checkNull(int rid, int fid, const char* source, si
}
void DatabaseSnapshot::dumpData(thread_db* tdbb)
void DatabaseSnapshot::dumpData(thread_db* tdbb, bool ast)
{
fb_assert(tdbb);
Database* const dbb = tdbb->getDatabase();
fb_assert(dbb);
if (dbb->dbb_flags & DBB_not_in_use)
if (ast && dbb->dbb_flags & DBB_not_in_use)
{
return;
}

View File

@ -127,7 +127,7 @@ private:
void clearRecord(Record*);
void putField(Record*, int, const Firebird::ClumpletReader&, bool);
static void dumpData(thread_db*);
static void dumpData(thread_db*, bool ast);
static const char* checkNull(int, int, const char*, size_t);
static SINT64 getGlobalId(int);

View File

@ -83,15 +83,16 @@ JrdMemoryPool *JrdMemoryPool::createDbPool(Firebird::MemoryStats &stats) {
return result;
}
JrdMemoryPool *JrdMemoryPool::createPool() {
JrdMemoryPool *JrdMemoryPool::createPool(bool withParent) {
Database* dbb = GET_DBB();
fb_assert(dbb);
#ifdef SUPERSERVER
JrdMemoryPool* result = (JrdMemoryPool *)internal_create(sizeof(JrdMemoryPool),
dbb->dbb_permanent, dbb->dbb_memory_stats);
withParent ? dbb->dbb_permanent : NULL, dbb->dbb_memory_stats);
#else
JrdMemoryPool *result = (JrdMemoryPool *)internal_create(sizeof(JrdMemoryPool), dbb->dbb_permanent);
JrdMemoryPool *result = (JrdMemoryPool *)internal_create(sizeof(JrdMemoryPool),
withParent ? dbb->dbb_permanent : NULL);
#endif
result->plb_dccs = NULL;
dbb->dbb_pools.push(result);

View File

@ -49,7 +49,7 @@ protected:
~JrdMemoryPool();
public:
static JrdMemoryPool *createDbPool(Firebird::MemoryStats &stats);
static JrdMemoryPool *createPool();
static JrdMemoryPool *createPool(bool withParent = true);
static JrdMemoryPool** deletePool(JrdMemoryPool* pool);
static void noDbbDeletePool(JrdMemoryPool* pool);