8
0
mirror of https://github.com/FirebirdSQL/firebird.git synced 2025-02-02 10:40:38 +01:00

Fix cases where the precedence relationship between a record page and a blob page is not set

1. While performing the intermediate garbage collection.
2. While modifying a blob field of a record.
This commit is contained in:
Ilya Eremin 2023-08-29 15:34:55 +03:00
parent cf6424565b
commit ed3287c70e
2 changed files with 15 additions and 11 deletions

View File

@ -448,6 +448,7 @@ void BLB_garbage_collect(thread_db* tdbb,
**************************************/ **************************************/
SET_TDBB(tdbb); SET_TDBB(tdbb);
fb_assert(prior_page > 0);
RecordBitmap bmGoing; RecordBitmap bmGoing;
ULONG cntGoing = 0; ULONG cntGoing = 0;

View File

@ -2485,25 +2485,26 @@ static void delete_version_chain(thread_db* tdbb, record_param* rpb, bool delete
ULONG prior_page = 0; ULONG prior_page = 0;
if (!delete_head) // Note that the page number of the oldest version in the chain should
// be stored in rpb->rpb_page before exiting this function because
// VIO_intermediate_gc will use it as a prior page number.
while (rpb->rpb_b_page != 0 || delete_head)
{ {
prior_page = rpb->rpb_page; if (!delete_head)
rpb->rpb_page = rpb->rpb_b_page; {
rpb->rpb_line = rpb->rpb_b_line; prior_page = rpb->rpb_page;
} rpb->rpb_page = rpb->rpb_b_page;
rpb->rpb_line = rpb->rpb_b_line;
}
else
delete_head = false;
while (rpb->rpb_page != 0)
{
if (!DPM_fetch(tdbb, rpb, LCK_write)) if (!DPM_fetch(tdbb, rpb, LCK_write))
BUGCHECK(291); // msg 291 cannot find record back version BUGCHECK(291); // msg 291 cannot find record back version
record_param temp_rpb = *rpb; record_param temp_rpb = *rpb;
DPM_delete(tdbb, &temp_rpb, prior_page); DPM_delete(tdbb, &temp_rpb, prior_page);
delete_tail(tdbb, &temp_rpb, temp_rpb.rpb_page); delete_tail(tdbb, &temp_rpb, temp_rpb.rpb_page);
prior_page = rpb->rpb_page;
rpb->rpb_page = rpb->rpb_b_page;
rpb->rpb_line = rpb->rpb_b_line;
} }
} }
@ -3678,6 +3679,8 @@ bool VIO_modify(thread_db* tdbb, record_param* org_rpb, record_param* new_rpb, j
org_rpb->rpb_flags &= ~(rpb_delta | rpb_uk_modified); org_rpb->rpb_flags &= ~(rpb_delta | rpb_uk_modified);
org_rpb->rpb_flags |= new_rpb->rpb_flags & (rpb_delta | rpb_uk_modified); org_rpb->rpb_flags |= new_rpb->rpb_flags & (rpb_delta | rpb_uk_modified);
stack.merge(new_rpb->rpb_record->getPrecedence());
replace_record(tdbb, org_rpb, &stack, transaction); replace_record(tdbb, org_rpb, &stack, transaction);
if (!(transaction->tra_flags & TRA_system) && if (!(transaction->tra_flags & TRA_system) &&