diff options
author | Michael Widenius <monty@askmonty.org> | 2012-03-28 13:22:21 +0300 |
---|---|---|
committer | Michael Widenius <monty@askmonty.org> | 2012-03-28 13:22:21 +0300 |
commit | 0a190b6b3cf9da78e098759a3b288f55e7e73648 (patch) | |
tree | 0edbcdc70f9ca702a1e95782f8f20472ff6849a5 /sql | |
parent | 98d5695a4a07d00d8c4972d1a5ace32888d9ff02 (diff) | |
download | mariadb-git-0a190b6b3cf9da78e098759a3b288f55e7e73648.tar.gz |
Fixed lp:944422 "mysql_upgrade destroys Maria tables?"
The issue was that check/optimize/anaylze did not zerofill the table before they started to work on it.
Added one more element to not often used function handler::auto_repair() to allow handler to decide when to auto repair.
mysql-test/suite/maria/r/maria-autozerofill.result:
Test case for lp:944422
mysql-test/suite/maria/t/maria-autozerofill.test:
Test case for lp:944422
sql/ha_partition.cc:
Added argument to auto_repair()
sql/ha_partition.h:
Added argument to auto_repair()
sql/handler.h:
Added argument to auto_repair()
sql/table.cc:
Let auto_repair() decide which errors to trigger auto-repair
storage/archive/ha_archive.h:
Added argument to auto_repair()
storage/csv/ha_tina.h:
Added argument to auto_repair()
storage/maria/ha_maria.cc:
Give better error & warning messages for auto-repaired tables.
storage/maria/ha_maria.h:
Added argument to auto_repair()
Always auto-repair in case of moved table.
storage/maria/ma_open.c:
Remove special handling of HA_ERR_OLD_FILE (this is now handled in auto_repair())
storage/myisam/ha_myisam.h:
Added argument to auto_repair()
Diffstat (limited to 'sql')
-rw-r--r-- | sql/ha_partition.cc | 4 | ||||
-rw-r--r-- | sql/ha_partition.h | 2 | ||||
-rw-r--r-- | sql/handler.h | 2 | ||||
-rw-r--r-- | sql/table.cc | 3 |
4 files changed, 5 insertions, 6 deletions
diff --git a/sql/ha_partition.cc b/sql/ha_partition.cc index e70eacfab5d..cc343eb6e75 100644 --- a/sql/ha_partition.cc +++ b/sql/ha_partition.cc @@ -1223,7 +1223,7 @@ bool ha_partition::check_and_repair(THD *thd) @retval FALSE Cannot be auto repaired */ -bool ha_partition::auto_repair() const +bool ha_partition::auto_repair(int error) const { DBUG_ENTER("ha_partition::auto_repair"); @@ -1231,7 +1231,7 @@ bool ha_partition::auto_repair() const As long as we only support one storage engine per table, we can use the first partition for this function. */ - DBUG_RETURN(m_file[0]->auto_repair()); + DBUG_RETURN(m_file[0]->auto_repair(error)); } diff --git a/sql/ha_partition.h b/sql/ha_partition.h index adb8214aae4..08e5a99f609 100644 --- a/sql/ha_partition.h +++ b/sql/ha_partition.h @@ -1105,7 +1105,7 @@ public: virtual int check(THD* thd, HA_CHECK_OPT *check_opt); virtual int repair(THD* thd, HA_CHECK_OPT *check_opt); virtual bool check_and_repair(THD *thd); - virtual bool auto_repair() const; + virtual bool auto_repair(int error) const; virtual bool is_crashed() const; private: diff --git a/sql/handler.h b/sql/handler.h index e8f6abdca65..605b6bd0a87 100644 --- a/sql/handler.h +++ b/sql/handler.h @@ -1668,7 +1668,7 @@ public: virtual bool low_byte_first() const { return 1; } virtual uint checksum() const { return 0; } virtual bool is_crashed() const { return 0; } - virtual bool auto_repair() const { return 0; } + virtual bool auto_repair(int error) const { return 0; } #define CHF_CREATE_FLAG 0 #define CHF_DELETE_FLAG 1 diff --git a/sql/table.cc b/sql/table.cc index 0bfa74dba75..0a564f8ad1d 100644 --- a/sql/table.cc +++ b/sql/table.cc @@ -1929,8 +1929,7 @@ partititon_err: HA_OPEN_IGNORE_IF_LOCKED) | ha_open_flags)))) { /* Set a flag if the table is crashed and it can be auto. repaired */ - share->crashed= ((ha_err == HA_ERR_CRASHED_ON_USAGE) && - outparam->file->auto_repair() && + share->crashed= (outparam->file->auto_repair(ha_err) && !(ha_open_flags & HA_OPEN_FOR_REPAIR)); switch (ha_err) |