caetanosauer / zero

Fork of the Shore-MT storage manager used by the research project Instant Recovery
Other
29 stars 10 forks source link

Virgin page is not initialized properly on btree growth #16

Closed caetanosauer closed 9 years ago

caetanosauer commented 9 years ago

So far, whenever a page is fixed as virgin (method bf_tree_m::_fix_nonswizzled with argument virgin_page = true), the contents were not zeroed out, such that the contents of whatever page was in the same frame before are reused. It should not be a problem, since a page_img_format operation usually follows. However, I've encountered a situation where this can be a problem.

In the implementation of B-tree growth (i.e., adding a new root page), a page is allocated and we use format_steal to copy the contents of the root page into it. This method, however, does not set the page LSN, meaning that the page_img_format log record will use whatever is in there (possibly garbage from an old frame) as its page_prev_lsn. In our tests, this garbage is usually zero anyway, so nothing happens. However, an intense test running with lots of data and a small buffer will eventually encounter the situation where some garbage will be used, leaving the per-page chain inconsistent.

There are two possible fixes: 1) The fix method zeroes the frame contents when virgin_page is given 2) format_steal sets an empty page LSN prior to generating a log record

caetanosauer commented 9 years ago

I went for fix number one in commit 73eb2a6

Waiting for feedback from Wey before closing.