Skip to content

Commit 564c98b

Browse files
committed
Implement #6413 : Data pages of newly gbak restored databases should marked as "swept" [CORE6164]
1 parent cdd2943 commit 564c98b

File tree

2 files changed

+40
-4
lines changed

2 files changed

+40
-4
lines changed

src/burp/BurpTasks.cpp

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -902,7 +902,7 @@ void RestoreRelationTask::initItem(BurpGlobals* tdgbl, Item& item)
902902
m_masterGbl->gbl_dpb_data.begin(),
903903
m_masterGbl->gbl_dpb_data.getCount());
904904

905-
dpb.deleteWithTag(isc_dpb_gbak_attach);
905+
//dpb.deleteWithTag(isc_dpb_gbak_attach);
906906

907907
const UCHAR* dpbBuffer = dpb.getBuffer();
908908
const USHORT dpbLength = dpb.getBufferLength();

src/jrd/dpm.epp

Lines changed: 39 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -2232,7 +2232,14 @@ void DPM_store( thread_db* tdbb, record_param* rpb, PageStack& stack, const Jrd:
22322232
memset(data + size, 0, fill);
22332233

22342234
Ods::pag* page = rpb->getWindow(tdbb).win_buffer;
2235-
if (page->pag_flags & dpg_swept)
2235+
2236+
// When restoring, mark primary data page as swept, pointer page already marked by locate_space()
2237+
if (tdbb->getAttachment()->isGbak() && !rpb->rpb_relation->isSystem() && (type == DPM_primary))
2238+
{
2239+
page->pag_flags |= dpg_swept;
2240+
CCH_RELEASE(tdbb, &rpb->getWindow(tdbb));
2241+
}
2242+
else if (page->pag_flags & dpg_swept)
22362243
{
22372244
page->pag_flags &= ~dpg_swept;
22382245
mark_full(tdbb, rpb);
@@ -3083,7 +3090,13 @@ static void extend_relation(thread_db* tdbb, jrd_rel* relation, WIN* window, con
30833090
UCHAR* bits = (UCHAR*) (ppage->ppg_page + dbb->dbb_dp_per_pp);
30843091
PPG_DP_BIT_CLEAR(bits, slot, PPG_DP_ALL_BITS);
30853092

3086-
if (type != DPM_primary)
3093+
if (type == DPM_primary)
3094+
{
3095+
// When restoring, mark slot as swept, data page will be marked by our caller
3096+
if (tdbb->getAttachment()->isGbak() && !relation->isSystem())
3097+
PPG_DP_BIT_SET(bits, slot, ppg_dp_swept);
3098+
}
3099+
else
30873100
PPG_DP_BIT_SET(bits, slot, ppg_dp_secondary);
30883101

30893102
for (unsigned i = 1; i < cntAlloc; i++)
@@ -3536,7 +3549,13 @@ static rhd* locate_space(thread_db* tdbb,
35363549

35373550
PPG_DP_BIT_CLEAR(bits, slot, ppg_dp_empty);
35383551
if (type == DPM_primary)
3552+
{
35393553
PPG_DP_BIT_CLEAR(bits, slot, ppg_dp_secondary);
3554+
3555+
// When restoring, mark slot as swept, data page will be marked by our caller
3556+
if (tdbb->getAttachment()->isGbak() && !relation->isSystem())
3557+
PPG_DP_BIT_SET(bits, slot, ppg_dp_swept);
3558+
}
35403559
else
35413560
PPG_DP_BIT_SET(bits, slot, ppg_dp_secondary);
35423561

@@ -3918,11 +3937,28 @@ static void store_big_record(thread_db* tdbb,
39183937
header->rhdf_b_page, header->rhdf_b_line);
39193938
#endif
39203939

3940+
3941+
bool markPP = false;
3942+
3943+
// When restoring, mark primary data page as swept, pointer page already marked by locate_space()
3944+
if (tdbb->getAttachment()->isGbak() && !rpb->rpb_relation->isSystem() && (type == DPM_primary))
3945+
{
3946+
page->dpg_header.pag_flags |= dpg_swept;
3947+
}
3948+
else if (page->dpg_header.pag_flags & dpg_swept)
3949+
{
3950+
page->dpg_header.pag_flags &= ~dpg_swept;
3951+
markPP = true;
3952+
}
3953+
39213954
if (!(page->dpg_header.pag_flags & dpg_large))
39223955
{
39233956
page->dpg_header.pag_flags |= dpg_large;
3924-
mark_full(tdbb, rpb);
3957+
markPP = true;
39253958
}
3959+
3960+
if (markPP)
3961+
mark_full(tdbb, rpb);
39263962
else
39273963
CCH_RELEASE(tdbb, &rpb->getWindow(tdbb));
39283964
}

0 commit comments

Comments
 (0)