Olav Sandstaa wrote:
> If this is the case, then it is the job of redo processing of this log
> record to ensure that the update is done correctly to the data page. I
> see the following to possible solutions:
> 1. We add code to DataPage::updateRecord() that detects that we are
> trying to update a "non-existing" record by checking that the given
> line number is equal to the maxLine. If this is the case, we can either:
> 2a. extend DataPage::updateRecord() so that it inserts the record into
> the page (insert the record data on the page or on an overflow page,
> update the new index/line entry, increase maxLine++)
> 2b. extend DataPage::updateRecord() so that it returns an error code
> (possibly returning a negative spaceAvailable value). This can then be
> handled by Section::updateRecord() so that it clears the entry in the
> record locator page (existing call to Section::deleteLine()) and do a
> complete new insert of the record by calling Section::storeRecord().
> If 2b can re-use the existing code this would be the easiest
> alternative (and safest) while 2a would be more "correct" since it
> would actually complete the storing of the record on the same page as
> the record originally was stored at.
> Does this seem like a correct approach? Any preferences? Please let me
> know if there are better ways for how to handle this. If not, then I
> will go ahead and try to implement one of the above strategies and see
> if it solves the two recovery situations I have.
I have done a quick prototype implementation of proposal 2b by extending
DataPage::updateRecord() and DataPage::deleteLine() to just do nothing
and return 0 (no space available) when the record's line number in the
data page is equal or larger than maxLine. This seems to solve the two
recovery crash bugs and recovery completes successfully. With this
solution I see that the record is inserted into a *different data page*
than the original page and the record locator page is also updated to
Is this an acceptable solution or would it be better to insert the
record into the original data page (proposal 2a)?