Commit ddac4525 authored by unknown's avatar unknown

Fix for

./mtr --mysqld=--default-storage-engine=maria --mem ps:
I got "can't sync on file UNOPENED" among the messages of REPAIR TABLE;
due to a missing setting of bitmap.file.file to -1.
Maria had two names "Maria" and "MARIA", using one now: "MARIA".


storage/maria/ha_maria.cc:
  plug.in uses "MARIA". Some code apparently picks the name from
  plug.in (SHOW CREATE TABLE, run ps.test on Maria tables), other from
  mysql_declare_plugin (SHOW CREATE TABLE on partitioned tables, run
  partition.test with Maria tables), better make names identical.
storage/maria/ma_check.c:
  running ps.test on Maria tables I got "can't sync on file UNOPENED"
  among the messages of REPAIR TABLE. That was due to maria_repair()
  closing the data file, setting info->dfile.file to -1 to prevent
  a wrong double close, but forgetting to also set
  info->s->bitmap.file.file to -1; it left it unchanged and so,
  when close_thread_tables() closed the old version of the repaired
  table, _ma_once_end_block_record() tried to fsync the closed
  descriptor, resulting in a message.
  Basically, when setting info->dfile.file to something it's always
  safe and recommended to set bitmap.file.file to the same value
  as it's just a copy of the same descriptor see _ma_bitmap_init().
  Using change_data_file_descriptor() for that.
  Changing that function to use MY_WME as it looks safe.
storage/maria/ma_close.c:
  no need to make the index file durable if table is not transactional
parent c7f9cf12
...@@ -2390,7 +2390,7 @@ mysql_declare_plugin(maria) ...@@ -2390,7 +2390,7 @@ mysql_declare_plugin(maria)
{ {
MYSQL_STORAGE_ENGINE_PLUGIN, MYSQL_STORAGE_ENGINE_PLUGIN,
&maria_storage_engine, &maria_storage_engine,
"Maria", "MARIA",
"MySQL AB", "MySQL AB",
"Traditional transactional MySQL tables", "Traditional transactional MySQL tables",
PLUGIN_LICENSE_GPL, PLUGIN_LICENSE_GPL,
......
...@@ -2221,8 +2221,8 @@ int maria_repair(HA_CHECK *param, register MARIA_HA *info, ...@@ -2221,8 +2221,8 @@ int maria_repair(HA_CHECK *param, register MARIA_HA *info,
/* Replace the actual file with the temporary file */ /* Replace the actual file with the temporary file */
if (new_file >= 0) if (new_file >= 0)
my_close(new_file, MYF(MY_WME)); my_close(new_file, MYF(MY_WME));
my_close(info->dfile.file, MYF(MY_WME)); new_file= -1;
info->dfile.file= new_file= -1; change_data_file_descriptor(info, -1);
if (maria_change_to_newfile(share->data_file_name,MARIA_NAME_DEXT, if (maria_change_to_newfile(share->data_file_name,MARIA_NAME_DEXT,
DATA_TMP_EXT, DATA_TMP_EXT,
(param->testflag & T_BACKUP_DATA ? (param->testflag & T_BACKUP_DATA ?
...@@ -5354,7 +5354,7 @@ static void restore_data_file_type(MARIA_SHARE *share) ...@@ -5354,7 +5354,7 @@ static void restore_data_file_type(MARIA_SHARE *share)
static void change_data_file_descriptor(MARIA_HA *info, File new_file) static void change_data_file_descriptor(MARIA_HA *info, File new_file)
{ {
my_close(info->dfile.file, MYF(0)); my_close(info->dfile.file, MYF(MY_WME));
info->dfile.file= info->s->bitmap.file.file= new_file; info->dfile.file= info->s->bitmap.file.file= new_file;
} }
......
...@@ -78,7 +78,7 @@ int maria_close(register MARIA_HA *info) ...@@ -78,7 +78,7 @@ int maria_close(register MARIA_HA *info)
File must be synced as it is going out of the maria_open_list and so File must be synced as it is going out of the maria_open_list and so
becoming unknown to Checkpoint. becoming unknown to Checkpoint.
*/ */
if (my_sync(share->kfile.file, MYF(MY_WME))) if (share->now_transactional && my_sync(share->kfile.file, MYF(MY_WME)))
error= my_errno; error= my_errno;
/* /*
If we are crashed, we can safely flush the current state as it will If we are crashed, we can safely flush the current state as it will
......
Markdown is supported
0%
or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment