Commit 6688b863 authored by marko's avatar marko

branches/zip: Reintroduce the local variables "sorted" that were removed

in r1445.  They are needed after all, but apparently the tests do not
actually verify that the records are sorted.  (Also, a buffer overflow
will occur in index_merge_innodb.test if MERGE_BLOCK_SIZE is made smaller.)
parent 366f0aa2
...@@ -568,6 +568,8 @@ row_merge_sort_linked_list( ...@@ -568,6 +568,8 @@ row_merge_sort_linked_list(
list_head = list->head; list_head = list->head;
for (block_size = 1;; block_size *= 2) { for (block_size = 1;; block_size *= 2) {
ibool sorted = TRUE;
list1 = list_head; list1 = list_head;
list_head = NULL; list_head = NULL;
list_tail = NULL; list_tail = NULL;
...@@ -660,12 +662,17 @@ pick2: ...@@ -660,12 +662,17 @@ pick2:
} }
if (!list2) { if (!list2) {
if (!sorted) {
break;
}
list->head = list_head; list->head = list_head;
list_tail->next = NULL; list_tail->next = NULL;
success = TRUE; success = TRUE;
goto func_exit; goto func_exit;
} }
sorted = FALSE;
list1 = list2; list1 = list2;
} }
...@@ -1156,6 +1163,7 @@ row_merge_sort_linked_list_in_disk( ...@@ -1156,6 +1163,7 @@ row_merge_sort_linked_list_in_disk(
output.file = file; output.file = file;
for (block_size = 1;; block_size *= 2) { for (block_size = 1;; block_size *= 2) {
ibool sorted = TRUE;
ibool list_is_empty = TRUE; ibool list_is_empty = TRUE;
block1 = backup1; block1 = backup1;
...@@ -1289,10 +1297,13 @@ file_error: ...@@ -1289,10 +1297,13 @@ file_error:
the disk. Swap blocks using pointers. */ the disk. Swap blocks using pointers. */
if (!block2) { if (!block2) {
if (sorted) {
goto func_exit; goto func_exit;
}
break;
} }
sorted = FALSE;
block2 = backup1; block2 = backup1;
block1 = backup2; block1 = backup2;
backup2 = block2; backup2 = block2;
......
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