mirror of
https://github.com/FirebirdSQL/firebird.git
synced 2025-01-24 00:03:03 +01:00
Attempt to fix CORE-5392: BUCHECK 179(decompression overran buffer) or unexpected lock conflict may happen during record version backout.
This commit is contained in:
parent
89c4acb3ce
commit
49d7996e02
@ -88,27 +88,17 @@ static void store_big_record(thread_db*, record_param*, PageStack&, const UCHAR*
|
||||
|
||||
namespace
|
||||
{
|
||||
Lock* lock_gc_active(thread_db* tdbb, const jrd_tra* transaction, record_param* rpb)
|
||||
inline Lock* lockGCActive(thread_db* tdbb, const jrd_tra* transaction, record_param* rpb)
|
||||
{
|
||||
AutoPtr<Lock> lock(FB_NEW_RPT(*tdbb->getDefaultPool(), 0)
|
||||
Lock(tdbb, sizeof(SINT64), LCK_record_gc));
|
||||
lock->lck_key.lck_long = ((SINT64) rpb->rpb_page << 16) | rpb->rpb_line;
|
||||
lock->lck_data = transaction->tra_number;
|
||||
|
||||
ThreadStatusGuard temp_status(tdbb);
|
||||
|
||||
if (LCK_lock(tdbb, lock, LCK_EX, LCK_NO_WAIT))
|
||||
return lock.release();
|
||||
|
||||
if (lock->lck_data != LCK_read_data(tdbb, lock))
|
||||
{
|
||||
fb_assert(false);
|
||||
CCH_RELEASE(tdbb, &rpb->getWindow(tdbb));
|
||||
temp_status.copyToOriginal();
|
||||
if (!LCK_lock(tdbb, lock, LCK_EX, LCK_WAIT))
|
||||
ERR_punt();
|
||||
}
|
||||
|
||||
return NULL;
|
||||
return lock.release();
|
||||
}
|
||||
}
|
||||
|
||||
@ -2645,7 +2635,7 @@ static void fragment(thread_db* tdbb,
|
||||
|
||||
header->rhdf_flags |= rhd_gc_active;
|
||||
|
||||
AutoLock gcLockGuard(tdbb, lock_gc_active(tdbb, transaction, rpb));
|
||||
AutoLock gcLockGuard(tdbb, lockGCActive(tdbb, transaction, rpb));
|
||||
|
||||
#ifdef VIO_DEBUG
|
||||
VIO_trace(DEBUG_WRITES_INFO,
|
||||
|
@ -278,7 +278,7 @@ inline bool checkGCActive(thread_db* tdbb, record_param* rpb, int& state)
|
||||
if (!LCK_lock(tdbb, &temp_lock, LCK_SR, LCK_NO_WAIT))
|
||||
{
|
||||
rpb->rpb_transaction_nr = LCK_read_data(tdbb, &temp_lock);
|
||||
state = TRA_pc_active(tdbb, rpb->rpb_transaction_nr) ? tra_precommitted : tra_active;
|
||||
state = tra_active;
|
||||
return true;
|
||||
}
|
||||
|
||||
@ -664,6 +664,8 @@ void VIO_backout(thread_db* tdbb, record_param* rpb, const jrd_tra* transaction)
|
||||
rpb->rpb_prior = data;
|
||||
}
|
||||
|
||||
gcLockGuard.release();
|
||||
|
||||
if (samePage)
|
||||
{
|
||||
DPM_backout(tdbb, rpb);
|
||||
|
Loading…
Reference in New Issue
Block a user