mirror of
https://github.com/MariaDB/server.git
synced 2025-01-20 14:02:32 +01:00
branches/zip: Correct the bug mentioned in r1872.
row_merge(): Add the assertion ut_ad(half > 0). row_merge_sort(): Compute the half of the merge file correctly. The previous implementation used truncating division, which may result in loss of records when the file size in blocks is not a power of 2.
This commit is contained in:
parent
757ca350ae
commit
0920bb661f
1 changed files with 6 additions and 2 deletions
|
@ -1322,6 +1322,7 @@ row_merge(
|
|||
merge_file_t of; /* output file */
|
||||
|
||||
UNIV_MEM_ASSERT_W(block[0], 3 * sizeof block[0]);
|
||||
ut_ad(half > 0);
|
||||
|
||||
of.fd = *tmpfd;
|
||||
of.offset = 0;
|
||||
|
@ -1380,8 +1381,11 @@ row_merge_sort(
|
|||
ulint blksz; /* block size */
|
||||
|
||||
for (blksz = 1; blksz < file->offset; blksz *= 2) {
|
||||
ulint half = ut_2pow_round((file->offset + 1) / 2, blksz);
|
||||
ulint error = row_merge(index, file, half, block, tmpfd);
|
||||
ulint half;
|
||||
ulint error;
|
||||
|
||||
half = ut_2pow_round((file->offset + blksz - 1) / 2, blksz);
|
||||
error = row_merge(index, file, half, block, tmpfd);
|
||||
|
||||
if (error != DB_SUCCESS) {
|
||||
return(error);
|
||||
|
|
Loading…
Reference in a new issue