-
-
Notifications
You must be signed in to change notification settings - Fork 205
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Fix #7664: DROP TABLE executed for a table with big records may lead to "wrong page type" or "end of file" error #7666
Conversation
…lead to "wrong page type" or "end of file" error The reason is that rhd_large flag can be set while rhd_incomplete flag is not set. It happens when a record which has 2 or more fragments is updated to a smaller record which fits on one page.
src/jrd/dpm.epp
Outdated
|
||
CCH_RELEASE_TAIL(tdbb, &window); | ||
PAG_release_page(tdbb, window.win_page, ZERO_PAGE_NUMBER); | ||
if (dpage->dpg_header.pag_flags & dpg_orphan) |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Could you explain this condition ?
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
If a database was created by the server which doesn't have the fix, it's possible to get a secondary data page here. But the code below works only for orphan data pages. It's just a protection from incorrect usage of rpb_large/rhd_large flag.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
The code used to release data pages allocated for fragments of big records when relation is dropped.
Fragments are allocated on own separate data pages and is not marked as orphan.
How this new code is going to release fragment's pages ?
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Sorry, fragment's page is marked as orphan, I missed it.
But it could be better (safer) to check also dpg_full
flag and number of records on page, same as in analyze_fragments()
at dba.epp
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Fragments are allocated on own separate data pages and is not marked as orphan.
How this new code is going to release fragment's pages ?
If a data page is not an orphan then it's included in a pointer page. Such pages will be released in DPM_delete_relation_pages function (note that it checks rhd_large flag for secondary data pages as well). It's not the task of delete_tail function.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
But it could be better (safer) to check also
dpg_full
flag and number of records on page, same as inanalyze_fragments()
at dba.epp
I agree. But I just looked at analyze_fragments()
and the condition there is a bit confusing for me. If a data page has dpg_full
and dpg_count = 1
but doesn't have dpg_orphan
, the condition is still true
, right?
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Yes, analyze_fragments()
is not as accurate (or paranoid) as it might be ;)
But you get the idea - lets check for all 3 conditions to be absolutely sure.
Fix #7664: DROP TABLE executed for a table with big records may lead to "wrong page type" or "end of file" error
No description provided.