Skip to content

Commit d09c60c

Browse files
committed
MDEV-8571 - After mysqloptimize sometimes one of the tables is marked as crashed
OPTIMIZE TABLE against MyISAM/Aria table may fail and leave stale temporary file if mysql_file_create() returns 0 file descriptor. This was due to wrong condition, which considered 0 as failure. 5.5 doesn't have fix for MDEV-5679, thus 0 file descriptor is always occupied by stdin and this bug is not reproducible. 10.1 has fix for MDEV-8475, which hides this bug. No test case since it mostly depends on how OS returns file descriptors.
1 parent 537c750 commit d09c60c

File tree

2 files changed

+2
-2
lines changed

2 files changed

+2
-2
lines changed

storage/maria/ma_check.c

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -3105,7 +3105,7 @@ int maria_sort_index(HA_CHECK *param, register MARIA_HA *info, char *name)
31053105
fn_format(param->temp_filename,name,"", MARIA_NAME_IEXT,2+4+32);
31063106
if ((new_file=mysql_file_create(key_file_kfile, fn_format(param->temp_filename,param->temp_filename,
31073107
"", INDEX_TMP_EXT,2+4),
3108-
0,param->tmpfile_createflag,MYF(0))) <= 0)
3108+
0, param->tmpfile_createflag, MYF(0))) < 0)
31093109
{
31103110
_ma_check_print_error(param,"Can't create new tempfile: '%s'",
31113111
param->temp_filename);

storage/myisam/mi_check.c

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1930,7 +1930,7 @@ int mi_sort_index(HA_CHECK *param, register MI_INFO *info, char * name)
19301930
fn_format(param->temp_filename,
19311931
param->temp_filename,
19321932
"", INDEX_TMP_EXT, 2+4),
1933-
0, param->tmpfile_createflag, MYF(0))) <= 0)
1933+
0, param->tmpfile_createflag, MYF(0))) < 0)
19341934
{
19351935
mi_check_print_error(param,"Can't create new tempfile: '%s'",
19361936
param->temp_filename);

0 commit comments

Comments
 (0)