diff --git a/src/jrd/DatabaseSnapshot.cpp b/src/jrd/DatabaseSnapshot.cpp index b7df465f23..5caad76011 100644 --- a/src/jrd/DatabaseSnapshot.cpp +++ b/src/jrd/DatabaseSnapshot.cpp @@ -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; } diff --git a/src/jrd/DatabaseSnapshot.h b/src/jrd/DatabaseSnapshot.h index e381ce5f21..3d8b6a3fb6 100644 --- a/src/jrd/DatabaseSnapshot.h +++ b/src/jrd/DatabaseSnapshot.h @@ -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); diff --git a/src/jrd/all.cpp b/src/jrd/all.cpp index f8f21b8cfe..fde770e404 100644 --- a/src/jrd/all.cpp +++ b/src/jrd/all.cpp @@ -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); diff --git a/src/jrd/all.h b/src/jrd/all.h index 653fc5b6fe..40d58502cf 100644 --- a/src/jrd/all.h +++ b/src/jrd/all.h @@ -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);