MyISAM repair-by-sort buffer cannot be > 4 GB even on 64-bit architectures

Bug #878404 reported by Alexey Kopytov
6
This bug affects 1 person
Affects Status Importance Assigned to Milestone
MySQL Server
Unknown
Unknown
Percona Server moved to https://jira.percona.com/projects/PS
Fix Released
Undecided
Alexey Kopytov
5.1
Fix Released
Undecided
Alexey Kopytov
5.5
Fix Released
Undecided
Alexey Kopytov

Bug Description

Description:
This applies to both server's myisam_sort_buffer_size and myisamchk
--sort_buffer_size. Even though both options are declared as GET_ULONG
which theoretically allows them to be greater than 4 GB on 64-bit
architectures (with 64-bit Windows being an exception), their value is
eventually cast to uint in _create_index_by_sort().

As a result, a wrap-around value is actually used as a buffer size. When
the wrap-around value is 0, _create_index_by_sort() fails with a
spurious "myisam_sort_buffer_size is too small" error.

How to repeat:
Try using myisam_sort_buffer_size=4G or "myisamchk -r --sort_buffer_size=4G" on a 64-bit
machine.

Suggested fix:
Remove casts to uint in _create_index_by_sort() and calls to it. Better yet, declare the
options as GET_ULL with SIZE_T_MAX as their max allowed value, and change all relevant
variables from ulong to ulonglong to fix 64-bit Windows as well.

Tags: cr i19156

Related branches

tags: added: cr i19156
Revision history for this message
Shahriyar Rzayev (rzayev-sehriyar) wrote :

Percona now uses JIRA for bug reports so this bug report is migrated to: https://jira.percona.com/browse/PS-2700

To post a comment you must log in.
This report contains Public information  
Everyone can see this information.

Other bug subscribers

Remote bug watches

Bug watches keep track of this bug in other bug trackers.