• marko's avatar
    branches/zip: page_zip_copy(): Copy only those B-tree page header · 731ead1d
    marko authored
    fields that are related to the records stored in the page.
    
    page_zip_copy() is a fall-back method in certain B-tree operations
    (tree compression, splitting or merging nodes).  The contents of a
    page may fit in the compressed page frame when it has been modified in
    a certain sequence, but not when the page is recompressed.  Sometimes,
    copying all or part of the records to an empty page could fail because
    of compression overflow.  In such cases, we copy the compressed and
    uncompressed pages bit for bit and delete any unwanted records from
    the copy.  (Deletion is guaranteed to succeed.)  The method
    page_zip_copy() is invoked very rarely.
    
    In one case, page_zip_copy() was called in btr_lift_page_up() to move
    the records to the root page of the B-tree.  Because page_zip_copy()
    copied all B-tree page header fields, it overwrote the file segment
    header fields PAGE_BTR_SEG_LEAF and PAGE_BTR_SEG_TOP.  This is the
    probable cause of the corruption that was reported as Mantis issue #63
    and others.
    731ead1d
page0zip.c 124 KB