[Commits] 268f4c2: MDEV-8571 - After mysqloptimize sometimes one of the tables is marked as crashed

Sergey Vojtovich svoj at mariadb.org
Thu Dec 10 13:45:08 EET 2015


revision-id: 268f4c2cea0dfb4b6bdba7cd754dff321538e472 (mariadb-10.0.22-38-g268f4c2)
parent(s): b07043fd5154d507b173059c8fd889c4e484b140
committer: Sergey Vojtovich
timestamp: 2015-12-10 15:45:05 +0400
message:

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.

---
 storage/maria/ma_check.c  | 2 +-
 storage/myisam/mi_check.c | 2 +-
 2 files changed, 2 insertions(+), 2 deletions(-)

diff --git a/storage/maria/ma_check.c b/storage/maria/ma_check.c
index 73c5b2b..a189af4 100644
--- a/storage/maria/ma_check.c
+++ b/storage/maria/ma_check.c
@@ -3105,7 +3105,7 @@ int maria_sort_index(HA_CHECK *param, register MARIA_HA *info, char *name)
   fn_format(param->temp_filename,name,"", MARIA_NAME_IEXT,2+4+32);
   if ((new_file=mysql_file_create(key_file_kfile, fn_format(param->temp_filename,param->temp_filename,
 				    "", INDEX_TMP_EXT,2+4),
-			  0,param->tmpfile_createflag,MYF(0))) <= 0)
+                                  0, param->tmpfile_createflag, MYF(0))) < 0)
   {
     _ma_check_print_error(param,"Can't create new tempfile: '%s'",
 			 param->temp_filename);
diff --git a/storage/myisam/mi_check.c b/storage/myisam/mi_check.c
index 178fff6..ec72e0b 100644
--- a/storage/myisam/mi_check.c
+++ b/storage/myisam/mi_check.c
@@ -1930,7 +1930,7 @@ int mi_sort_index(HA_CHECK *param, register MI_INFO *info, char * name)
                                    fn_format(param->temp_filename,
                                              param->temp_filename,
                                              "", INDEX_TMP_EXT, 2+4),
-                                   0, param->tmpfile_createflag, MYF(0))) <= 0)
+                                   0, param->tmpfile_createflag, MYF(0))) < 0)
   {
     mi_check_print_error(param,"Can't create new tempfile: '%s'",
 			 param->temp_filename);


More information about the commits mailing list