Commit b18aa573 authored by marko's avatar marko

branches/zip: row_merge(): Remove a bogus debug assertion

that was triggered when creating an index on an empty table.

row_merge_sort(): Add debug assertions and comments that justify
the loop termination condition.

The bogus assertion ut_ad(ihalf > 0) was reported by Michael.
parent e36a13e4
......@@ -1576,7 +1576,6 @@ row_merge(
ulint ohalf; /*!< half the output file */
UNIV_MEM_ASSERT_W(block[0], 3 * sizeof block[0]);
ut_ad(ihalf > 0);
ut_ad(ihalf < file->offset);
of.fd = *tmpfd;
......@@ -1665,6 +1664,10 @@ row_merge_sort(
{
ulint half = file->offset / 2;
/* The file should always contain at least one byte (the end
of file marker). Thus, it must be at least one block. */
ut_ad(file->offset > 0);
do {
ulint error;
......@@ -1673,6 +1676,10 @@ row_merge_sort(
if (error != DB_SUCCESS) {
return(error);
}
/* half > 0 should hold except when the file consists
of one block. No need to merge further then. */
ut_ad(half > 0 || file->offset == 1);
} while (half < file->offset && half > 0);
return(DB_SUCCESS);
......
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