mirror of
https://github.com/FirebirdSQL/firebird.git
synced 2025-01-23 12:43:03 +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();
|
Database* dbb = tdbb->getDatabase();
|
||||||
CHECK_DBB(dbb);
|
CHECK_DBB(dbb);
|
||||||
|
|
||||||
|
rpb->rpb_flags &= ~(rpb_fragment | rpb_incomplete | rpb_large | rpb_chained | rpb_gc_active | rpb_long_tranum);
|
||||||
|
|
||||||
#ifdef VIO_DEBUG
|
#ifdef VIO_DEBUG
|
||||||
jrd_rel* relation = rpb->rpb_relation;
|
jrd_rel* relation = rpb->rpb_relation;
|
||||||
VIO_trace(DEBUG_WRITES,
|
VIO_trace(DEBUG_WRITES,
|
||||||
@ -2561,20 +2563,31 @@ static void delete_tail(thread_db* tdbb, rhdf* header, const USHORT page_space,
|
|||||||
|
|
||||||
if (!(header->rhdf_flags & rhd_blob))
|
if (!(header->rhdf_flags & rhd_blob))
|
||||||
{
|
{
|
||||||
|
USHORT flags = header->rhdf_flags;
|
||||||
ULONG page_number = header->rhdf_f_page;
|
ULONG page_number = header->rhdf_f_page;
|
||||||
while (true)
|
fb_assert(flags & rhd_incomplete);
|
||||||
|
|
||||||
|
while (flags & rhd_incomplete)
|
||||||
{
|
{
|
||||||
window.win_page = page_number;
|
window.win_page = page_number;
|
||||||
data_page* dpage = (data_page*) CCH_FETCH(tdbb, &window, LCK_read, pag_data);
|
data_page* dpage = (data_page*) CCH_FETCH(tdbb, &window, LCK_read, pag_data);
|
||||||
header = (rhdf*) ((UCHAR *) dpage + dpage->dpg_rpt[0].dpg_offset);
|
|
||||||
const USHORT flags = header->rhdf_flags;
|
|
||||||
page_number = header->rhdf_f_page;
|
|
||||||
|
|
||||||
CCH_RELEASE_TAIL(tdbb, &window);
|
if (dpage->dpg_header.pag_flags & dpg_orphan &&
|
||||||
PAG_release_page(tdbb, window.win_page, ZERO_PAGE_NUMBER);
|
dpage->dpg_header.pag_flags & dpg_full &&
|
||||||
|
dpage->dpg_count == 1)
|
||||||
|
{
|
||||||
|
header = (rhdf*) ((UCHAR *) dpage + dpage->dpg_rpt[0].dpg_offset);
|
||||||
|
flags = header->rhdf_flags;
|
||||||
|
page_number = header->rhdf_f_page;
|
||||||
|
|
||||||
if (!(flags & rhd_incomplete))
|
CCH_RELEASE_TAIL(tdbb, &window);
|
||||||
|
PAG_release_page(tdbb, window.win_page, ZERO_PAGE_NUMBER);
|
||||||
|
}
|
||||||
|
else
|
||||||
|
{
|
||||||
|
fb_assert(false);
|
||||||
break;
|
break;
|
||||||
|
}
|
||||||
}
|
}
|
||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
|
@ -666,8 +666,6 @@ void VIO_backout(thread_db* tdbb, record_param* rpb, const jrd_tra* transaction)
|
|||||||
else
|
else
|
||||||
{
|
{
|
||||||
// There is cleanup to be done. Bring the old version forward first
|
// 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);
|
DPM_update(tdbb, rpb, 0, transaction);
|
||||||
delete_tail(tdbb, &temp2, rpb->rpb_page, 0, 0);
|
delete_tail(tdbb, &temp2, rpb->rpb_page, 0, 0);
|
||||||
}
|
}
|
||||||
@ -6061,7 +6059,6 @@ static void replace_record(thread_db* tdbb,
|
|||||||
#endif
|
#endif
|
||||||
|
|
||||||
record_param temp = *rpb;
|
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);
|
DPM_update(tdbb, rpb, stack, transaction);
|
||||||
delete_tail(tdbb, &temp, rpb->rpb_page, 0, 0);
|
delete_tail(tdbb, &temp, rpb->rpb_page, 0, 0);
|
||||||
|
|
||||||
|
Loading…
Reference in New Issue
Block a user