Commit 2ec8ec24 authored by marko's avatar marko

branches/zip: Apply a fix from Sunny. The function row_merge_block_merge()

was broken in one of the earlier cleanups.

row_merge_block_merge(): Remove the variable "selected".  Clear the record
count of new_block1 and new_block2.  Anticipate the right return values
from row_merge_cmp().
parent e0cb06f8
...@@ -885,8 +885,6 @@ row_merge_block_merge( ...@@ -885,8 +885,6 @@ row_merge_block_merge(
merge_block_t* new_block1; merge_block_t* new_block1;
merge_block_t* new_block2; merge_block_t* new_block2;
merge_block_t* tmp; merge_block_t* tmp;
merge_rec_t* mrec1;
merge_rec_t* mrec2;
ulint nth_rec1 = 0; ulint nth_rec1 = 0;
ulint nth_rec2 = 0; ulint nth_rec2 = 0;
ulint offset1 = 0; ulint offset1 = 0;
...@@ -894,7 +892,6 @@ row_merge_block_merge( ...@@ -894,7 +892,6 @@ row_merge_block_merge(
ulint offset3 = 0; ulint offset3 = 0;
ulint offset4 = 0; ulint offset4 = 0;
ibool fits_to_new = TRUE; ibool fits_to_new = TRUE;
int selected = 0;
mem_heap_t* heap; mem_heap_t* heap;
mem_heap_t* offset_heap = NULL; mem_heap_t* offset_heap = NULL;
ulint sec_offsets1_[REC_OFFS_SMALL_SIZE]; ulint sec_offsets1_[REC_OFFS_SMALL_SIZE];
...@@ -919,14 +916,17 @@ row_merge_block_merge( ...@@ -919,14 +916,17 @@ row_merge_block_merge(
new_block1->header = block1->header; new_block1->header = block1->header;
new_block2->header = tmp->header; new_block2->header = tmp->header;
new_block1->header.n_records = 0;
new_block2->header.n_records = 0;
/* Merge all records from both blocks */ /* Merge all records from both blocks */
while (nth_rec1 < block1->header.n_records || while (nth_rec1 < block1->header.n_records ||
nth_rec2 < tmp->header.n_records) { nth_rec2 < tmp->header.n_records) {
merge_rec_t* mrec1 = NULL;
merge_rec_t* mrec2 = NULL;
const ulint* rec_offsets; const ulint* rec_offsets;
mrec1 = mrec2 = NULL;
selected = 0;
mem_heap_empty(heap); mem_heap_empty(heap);
if (nth_rec1 < block1->header.n_records && if (nth_rec1 < block1->header.n_records &&
...@@ -999,17 +999,19 @@ row_merge_block_merge( ...@@ -999,17 +999,19 @@ row_merge_block_merge(
goto error_handling; goto error_handling;
} }
/* fall through */ /* fall through */
case 1: case -1:
rec_offsets = sec_offs1; rec_offsets = sec_offs1;
nth_rec1++; nth_rec1++;
offset2 = tmp_offset2; offset2 = tmp_offset2;
break; break;
case 2: case 1:
mrec1 = mrec2; mrec1 = mrec2;
rec_offsets = sec_offs2; rec_offsets = sec_offs2;
nth_rec2++; nth_rec2++;
offset1 = tmp_offset1; offset1 = tmp_offset1;
break; break;
default:
ut_error;
} }
} }
......
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