mirror of
https://github.com/FirebirdSQL/firebird.git
synced 2025-01-22 22:43:03 +01:00
Fixed #8039: Segfault when opening damaged (last TIP is missing in RDB$PAGES) database
This commit is contained in:
parent
4fb6643907
commit
593d350807
@ -464,6 +464,25 @@ namespace Jrd
|
||||
dbb_filename, dbb_config));
|
||||
}
|
||||
|
||||
void Database::startTipCache(thread_db* tdbb)
|
||||
{
|
||||
fb_assert(!dbb_tip_cache);
|
||||
|
||||
TipCache* cache = FB_NEW_POOL(*dbb_permanent) TipCache(this);
|
||||
try
|
||||
{
|
||||
cache->initializeTpc(tdbb);
|
||||
}
|
||||
catch(const Exception&)
|
||||
{
|
||||
cache->finalizeTpc(tdbb);
|
||||
delete cache;
|
||||
throw;
|
||||
}
|
||||
|
||||
dbb_tip_cache = cache;
|
||||
}
|
||||
|
||||
// Database::Linger class implementation
|
||||
|
||||
void Database::Linger::handler()
|
||||
|
@ -666,6 +666,7 @@ public:
|
||||
static int replStateAst(void*);
|
||||
|
||||
const CoercionArray *getBindings() const;
|
||||
void startTipCache(thread_db* tdbb);
|
||||
|
||||
void initGlobalObjects();
|
||||
void shutdownGlobalObjects();
|
||||
|
@ -1851,8 +1851,7 @@ JAttachment* JProvider::internalAttach(CheckStatusWrapper* user_status, const ch
|
||||
|
||||
// Initialize TIP cache. We do this late to give SDW a chance to
|
||||
// work while we read states for all interesting transactions
|
||||
dbb->dbb_tip_cache = FB_NEW_POOL(*dbb->dbb_permanent) TipCache(dbb);
|
||||
dbb->dbb_tip_cache->initializeTpc(tdbb);
|
||||
dbb->startTipCache(tdbb);
|
||||
|
||||
// linger
|
||||
dbb->dbb_linger_seconds = MET_get_linger(tdbb);
|
||||
@ -3164,8 +3163,7 @@ JAttachment* JProvider::createDatabase(CheckStatusWrapper* user_status, const ch
|
||||
config->notify();
|
||||
|
||||
// Initialize TIP cache
|
||||
dbb->dbb_tip_cache = FB_NEW_POOL(*dbb->dbb_permanent) TipCache(dbb);
|
||||
dbb->dbb_tip_cache->initializeTpc(tdbb);
|
||||
dbb->startTipCache(tdbb);
|
||||
|
||||
// Init complete - we can release dbInitMutex
|
||||
dbb->dbb_flags &= ~(DBB_new | DBB_creating);
|
||||
|
Loading…
Reference in New Issue
Block a user