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( ...@@ -1141,11 +1141,10 @@ page_zip_apply_log(
/* Copy the extra bytes (backwards). */ /* Copy the extra bytes (backwards). */
{ {
ulint n = rec_offs_extra_size(offsets) byte* start = rec_get_start(rec, offsets);
- REC_N_NEW_EXTRA_BYTES; byte* b = rec - REC_N_NEW_EXTRA_BYTES;
byte* b = rec - REC_N_NEW_EXTRA_BYTES; while (b != start) {
while (n--) { *--b = *data++;
*b-- = *data++;
} }
} }
...@@ -1729,20 +1728,21 @@ page_zip_write_rec( ...@@ -1729,20 +1728,21 @@ page_zip_write_rec(
/* Append to the modification log. */ /* Append to the modification log. */
data = page_zip->data + page_zip->m_end; 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. */
if (heap_no - 1 >= 128) {
*data++ = 0x80 | (heap_no - 1) >> 7;
} else {
*data++ = heap_no - 1;
}
{ {
/* 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* start = rec_get_start((rec_t*) rec, offsets);
const byte* b = rec - REC_N_NEW_EXTRA_BYTES; const byte* b = rec - REC_N_NEW_EXTRA_BYTES;
if (heap_no - 1 >= 128) {
*data++ = 0x80 | (heap_no - 1) >> 7;
} else {
*data++ = heap_no - 1;
}
/* Write the extra bytes backwards, so that /* Write the extra bytes backwards, so that
rec_offs_extra_size() can be easily computed in rec_offs_extra_size() can be easily computed in
page_zip_apply_log() by invoking 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