mirror of
https://github.com/FirebirdSQL/firebird.git
synced 2025-01-23 06:03:02 +01:00
Merge pull request #7666 from red-soft-ru/5_0_drop_table_fix
All checks were successful
continuous-integration/drone/push Build is passing
All checks were successful
continuous-integration/drone/push Build is passing
Fix #7664: DROP TABLE executed for a table with big records may lead to "wrong page type" or "end of file" error
This commit is contained in:
parent
04a246c5c3
commit
c867663df1
@ -2299,6 +2299,8 @@ void DPM_update( thread_db* tdbb, record_param* rpb, PageStack* stack, const jrd
|
||||
Database* dbb = tdbb->getDatabase();
|
||||
CHECK_DBB(dbb);
|
||||
|
||||
rpb->rpb_flags &= ~(rpb_fragment | rpb_incomplete | rpb_large | rpb_chained | rpb_gc_active | rpb_long_tranum);
|
||||
|
||||
#ifdef VIO_DEBUG
|
||||
jrd_rel* relation = rpb->rpb_relation;
|
||||
VIO_trace(DEBUG_WRITES,
|
||||
@ -2561,21 +2563,32 @@ static void delete_tail(thread_db* tdbb, rhdf* header, const USHORT page_space,
|
||||
|
||||
if (!(header->rhdf_flags & rhd_blob))
|
||||
{
|
||||
USHORT flags = header->rhdf_flags;
|
||||
ULONG page_number = header->rhdf_f_page;
|
||||
while (true)
|
||||
fb_assert(flags & rhd_incomplete);
|
||||
|
||||
while (flags & rhd_incomplete)
|
||||
{
|
||||
window.win_page = page_number;
|
||||
data_page* dpage = (data_page*) CCH_FETCH(tdbb, &window, LCK_read, pag_data);
|
||||
|
||||
if (dpage->dpg_header.pag_flags & dpg_orphan &&
|
||||
dpage->dpg_header.pag_flags & dpg_full &&
|
||||
dpage->dpg_count == 1)
|
||||
{
|
||||
header = (rhdf*) ((UCHAR *) dpage + dpage->dpg_rpt[0].dpg_offset);
|
||||
const USHORT flags = header->rhdf_flags;
|
||||
flags = header->rhdf_flags;
|
||||
page_number = header->rhdf_f_page;
|
||||
|
||||
CCH_RELEASE_TAIL(tdbb, &window);
|
||||
PAG_release_page(tdbb, window.win_page, ZERO_PAGE_NUMBER);
|
||||
|
||||
if (!(flags & rhd_incomplete))
|
||||
}
|
||||
else
|
||||
{
|
||||
fb_assert(false);
|
||||
break;
|
||||
}
|
||||
}
|
||||
return;
|
||||
}
|
||||
|
||||
|
@ -666,8 +666,6 @@ void VIO_backout(thread_db* tdbb, record_param* rpb, const jrd_tra* transaction)
|
||||
else
|
||||
{
|
||||
// There is cleanup to be done. Bring the old version forward first
|
||||
|
||||
rpb->rpb_flags &= ~(rpb_fragment | rpb_incomplete | rpb_chained | rpb_gc_active | rpb_long_tranum);
|
||||
DPM_update(tdbb, rpb, 0, transaction);
|
||||
delete_tail(tdbb, &temp2, rpb->rpb_page, 0, 0);
|
||||
}
|
||||
@ -6061,7 +6059,6 @@ static void replace_record(thread_db* tdbb,
|
||||
#endif
|
||||
|
||||
record_param temp = *rpb;
|
||||
rpb->rpb_flags &= ~(rpb_fragment | rpb_incomplete | rpb_chained | rpb_gc_active | rpb_long_tranum);
|
||||
DPM_update(tdbb, rpb, stack, transaction);
|
||||
delete_tail(tdbb, &temp, rpb->rpb_page, 0, 0);
|
||||
|
||||
|
Loading…
Reference in New Issue
Block a user