summaryrefslogtreecommitdiff
path: root/sql/ha_partition.cc
diff options
context:
space:
mode:
authorMattias Jonsson <mattiasj@mysql.com>2008-07-07 17:54:42 +0200
committerMattias Jonsson <mattiasj@mysql.com>2008-07-07 17:54:42 +0200
commitce30b928b7002a2e5b1b21860ba29336b51ce235 (patch)
tree683e56da7ba5a02bf0e2e3016489b73b35f2e804 /sql/ha_partition.cc
parent41c80004ff55d46332fe5825a0357766f12537fd (diff)
downloadmariadb-git-ce30b928b7002a2e5b1b21860ba29336b51ce235.tar.gz
Bug#35161: --myisam-recover does not work for partitioned MyISAM tables
Problem was that auto_repair, is_crashed and check_and_repair was not implemented in ha_partition. Solution, implemented them as loop over all partitions for is_crashed and check_and_repair, and using the first partition for auto_repair. (Recommit after fixing review comments) mysql-test/lib/mtr_report.pl: Bug#35161: --myisam-recover does not work for partitioned MyISAM tables Added filter for crashed tables, when testing auto repair mysql-test/std_data/corrupt_t1#P#p1.MYI: Bug#35161: --myisam-recover does not work for partitioned MyISAM tables Corrupt MYI file for testing auto repair mysql-test/std_data/corrupt_t1.MYI: Bug#35161: --myisam-recover does not work for partitioned MyISAM tables Corrupt MYI file for testing auto repair mysql-test/suite/parts/r/partition_repair_myisam.result: Bug#35161: --myisam-recover does not work for partitioned MyISAM tables Result file for testing auto repair of crashed myisam partitions mysql-test/suite/parts/t/partition_repair_myisam-master.opt: Bug#35161: --myisam-recover does not work for partitioned MyISAM tables opt file for testing auto repair of crashed myisam partitions mysql-test/suite/parts/t/partition_repair_myisam.test: Bug#35161: --myisam-recover does not work for partitioned MyISAM tables Test file for testing auto repair of crashed myisam partitions sql/ha_partition.cc: Bug#35161: --myisam-recover does not work for partitioned MyISAM tables Added auto_repair as returning the first partitions auto_repair Added is_crashed and check_and_repair as loop over all partitions sql/ha_partition.h: Bug#35161: --myisam-recover does not work for partitioned MyISAM tables Activating check_and_repair, auto_repair and is_crashed
Diffstat (limited to 'sql/ha_partition.cc')
-rw-r--r--sql/ha_partition.cc64
1 files changed, 64 insertions, 0 deletions
diff --git a/sql/ha_partition.cc b/sql/ha_partition.cc
index 2e0bb090ad2..0959d6db974 100644
--- a/sql/ha_partition.cc
+++ b/sql/ha_partition.cc
@@ -1129,6 +1129,70 @@ int ha_partition::handle_opt_partitions(THD *thd, HA_CHECK_OPT *check_opt,
#endif
}
+
+/**
+ @brief Check and repair the table if neccesary
+
+ @param thd Thread object
+
+ @retval TRUE Error/Not supported
+ @retval FALSE Success
+*/
+
+bool ha_partition::check_and_repair(THD *thd)
+{
+ handler **file= m_file;
+ DBUG_ENTER("ha_partition::check_and_repair");
+
+ do
+ {
+ if ((*file)->ha_check_and_repair(thd))
+ DBUG_RETURN(TRUE);
+ } while (*(++file));
+ DBUG_RETURN(FALSE);
+}
+
+
+/**
+ @breif Check if the table can be automatically repaired
+
+ @retval TRUE Can be auto repaired
+ @retval FALSE Cannot be auto repaired
+*/
+
+bool ha_partition::auto_repair() const
+{
+ DBUG_ENTER("ha_partition::auto_repair");
+
+ /*
+ 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());
+}
+
+
+/**
+ @breif Check if the table is crashed
+
+ @retval TRUE Crashed
+ @retval FALSE Not crashed
+*/
+
+bool ha_partition::is_crashed() const
+{
+ handler **file= m_file;
+ DBUG_ENTER("ha_partition::is_crashed");
+
+ do
+ {
+ if ((*file)->is_crashed())
+ DBUG_RETURN(TRUE);
+ } while (*(++file));
+ DBUG_RETURN(FALSE);
+}
+
+
/*
Prepare by creating a new partition