summaryrefslogtreecommitdiff
path: root/storage/myisam
diff options
context:
space:
mode:
Diffstat (limited to 'storage/myisam')
-rw-r--r--storage/myisam/ha_myisam.cc17
-rw-r--r--storage/myisam/mi_locking.c2
-rw-r--r--storage/myisam/myisamchk.c1
-rw-r--r--storage/myisam/myisamdef.h1
4 files changed, 18 insertions, 3 deletions
diff --git a/storage/myisam/ha_myisam.cc b/storage/myisam/ha_myisam.cc
index a6e6d4ea9cb..d20148f5be5 100644
--- a/storage/myisam/ha_myisam.cc
+++ b/storage/myisam/ha_myisam.cc
@@ -1272,7 +1272,7 @@ int ha_myisam::preload_keys(THD* thd, HA_CHECK_OPT *check_opt)
ulonglong map;
TABLE_LIST *table_list= table->pos_in_table_list;
my_bool ignore_leaves= table_list->ignore_leaves;
- char buf[ERRMSGSIZE+20];
+ char buf[MYSQL_ERRMSG_SIZE];
DBUG_ENTER("ha_myisam::preload_keys");
@@ -1300,7 +1300,7 @@ int ha_myisam::preload_keys(THD* thd, HA_CHECK_OPT *check_opt)
errmsg= "Failed to allocate buffer";
break;
default:
- my_snprintf(buf, ERRMSGSIZE,
+ my_snprintf(buf, sizeof(buf),
"Failed to read from index file (errno: %d)", my_errno);
errmsg= buf;
}
@@ -1775,7 +1775,7 @@ int ha_myisam::info(uint flag)
if (share->key_parts)
memcpy((char*) table->key_info[0].rec_per_key,
(char*) misam_info.rec_per_key,
- sizeof(table->key_info[0].rec_per_key)*share->key_parts);
+ sizeof(table->key_info[0].rec_per_key[0])*share->key_parts);
if (share->tmp_table == NO_TMP_TABLE)
pthread_mutex_unlock(&share->mutex);
@@ -1811,6 +1811,8 @@ int ha_myisam::extra(enum ha_extra_function operation)
{
if ((specialflag & SPECIAL_SAFE_MODE) && operation == HA_EXTRA_KEYREAD)
return 0;
+ if (operation == HA_EXTRA_MMAP && !opt_myisam_use_mmap)
+ return 0;
return mi_extra(file, operation, 0);
}
@@ -2195,6 +2197,15 @@ my_bool ha_myisam::register_query_cache_table(THD *thd, char *table_name,
}
}
+ /*
+ This query execution might have started after the query cache was flushed
+ by a concurrent INSERT. In this case, don't cache this statement as the
+ data file length difference might not be visible yet if the tables haven't
+ been unlocked by the concurrent insert thread.
+ */
+ if (file->state->uncacheable)
+ DBUG_RETURN(FALSE);
+
/* It is ok to try to cache current statement. */
DBUG_RETURN(TRUE);
}
diff --git a/storage/myisam/mi_locking.c b/storage/myisam/mi_locking.c
index 2edeefad45f..f3d9934ed8c 100644
--- a/storage/myisam/mi_locking.c
+++ b/storage/myisam/mi_locking.c
@@ -299,6 +299,8 @@ void mi_get_status(void* param, my_bool concurrent_insert)
info->save_state=info->s->state.state;
info->state= &info->save_state;
info->append_insert_at_end= concurrent_insert;
+ if (concurrent_insert)
+ info->s->state.state.uncacheable= TRUE;
DBUG_VOID_RETURN;
}
diff --git a/storage/myisam/myisamchk.c b/storage/myisam/myisamchk.c
index 6fbc67dbc70..5edc2cf9828 100644
--- a/storage/myisam/myisamchk.c
+++ b/storage/myisam/myisamchk.c
@@ -360,6 +360,7 @@ static void usage(void)
-#, --debug=... Output debug log. Often this is 'd:t:o,filename'.\n");
#endif
printf("\
+ -H, --HELP Display this help and exit.\n\
-?, --help Display this help and exit.\n\
-O, --set-variable var=option.\n\
Change the value of a variable. Please note that\n\
diff --git a/storage/myisam/myisamdef.h b/storage/myisam/myisamdef.h
index 6ab7451196a..f311202e47a 100644
--- a/storage/myisam/myisamdef.h
+++ b/storage/myisam/myisamdef.h
@@ -39,6 +39,7 @@ typedef struct st_mi_status_info
my_off_t key_file_length;
my_off_t data_file_length;
ha_checksum checksum;
+ my_bool uncacheable; /* Active concurrent insert */
} MI_STATUS_INFO;
typedef struct st_mi_state_info