Skip to content

Commit

Permalink
Fixed #7905: Segfault during TPC initialization
Browse files Browse the repository at this point in the history
(cherry picked from commit 1033733)
  • Loading branch information
AlexPeshkoff committed Dec 4, 2023
1 parent aa786f3 commit 4056a5e
Showing 1 changed file with 17 additions and 2 deletions.
19 changes: 17 additions & 2 deletions src/jrd/tpc.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -432,8 +432,23 @@ void TipCache::StatusBlockData::clear(thread_db* tdbb)
// wait for all initializing processes (PR)
acceptAst = false;

TraNumber oldest =
cache->m_tpcHeader->getHeader()->oldest_transaction.load(std::memory_order_relaxed);
TraNumber oldest;
if (cache->m_tpcHeader)
oldest = cache->m_tpcHeader->getHeader()->oldest_transaction.load(std::memory_order_relaxed);
else
{
Database* dbb = tdbb->getDatabase();
if (dbb->dbb_flags & DBB_shared)
oldest = dbb->dbb_oldest_transaction;
else
{
WIN window(HEADER_PAGE_NUMBER);
const Ods::header_page* header_page = (Ods::header_page*) CCH_FETCH(tdbb, &window, LCK_read, pag_header);
oldest = Ods::getOIT(header_page);
CCH_RELEASE(tdbb, &window);
}
}

if (blockNumber < oldest / cache->m_transactionsPerBlock && // old block => send AST
!LCK_convert(tdbb, &existenceLock, LCK_SW, LCK_WAIT))
{
Expand Down

0 comments on commit 4056a5e

Please sign in to comment.