Commit a67a1628 authored by marko's avatar marko

branches/zip: Correctly restore extra bytes in page_zip_apply_log().

page_zip_apply_log(): Correct an off-by-one error.

page_zip_write_rec(): Correct a debug assertion.
Encode heap_no as soon as possible.
parent 1aca6cad
......@@ -1141,11 +1141,10 @@ page_zip_apply_log(
/* Copy the extra bytes (backwards). */
{
ulint n = rec_offs_extra_size(offsets)
- REC_N_NEW_EXTRA_BYTES;
byte* start = rec_get_start(rec, offsets);
byte* b = rec - REC_N_NEW_EXTRA_BYTES;
while (n--) {
*b-- = *data++;
while (b != start) {
*--b = *data++;
}
}
......@@ -1729,13 +1728,10 @@ page_zip_write_rec(
/* Append to the modification log. */
data = page_zip->data + page_zip->m_end;
ut_ad(!mach_read_from_2(data));
ut_ad(!*data);
{
/* Identify the record by writing its heap number - 1. 0 is
reserved to indicate the end of the modification log. */
const byte* start = rec_get_start((rec_t*) rec, offsets);
const byte* b = rec - REC_N_NEW_EXTRA_BYTES;
/* Identify the record by writing its heap number - 1.
0 is reserved to indicate the end of the modification log. */
if (heap_no - 1 >= 128) {
*data++ = 0x80 | (heap_no - 1) >> 7;
......@@ -1743,6 +1739,10 @@ page_zip_write_rec(
*data++ = heap_no - 1;
}
{
const byte* start = rec_get_start((rec_t*) rec, offsets);
const byte* b = rec - REC_N_NEW_EXTRA_BYTES;
/* Write the extra bytes backwards, so that
rec_offs_extra_size() can be easily computed in
page_zip_apply_log() by invoking
......
Markdown is supported
0%
or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment