diff options
author | svoj@june.mysql.com <> | 2007-06-07 13:53:23 +0500 |
---|---|---|
committer | svoj@june.mysql.com <> | 2007-06-07 13:53:23 +0500 |
commit | d0a044a0bfc882dfc7921a2a8945262578ff220c (patch) | |
tree | e968dc9a6540caeb50868196c6c51bc43da534d5 /storage/myisammrg | |
parent | 1f0aca962654797e40a836d69207d1a18fc56b63 (diff) | |
parent | c45b4cf893b45f44006ae0edba3293666be1abe0 (diff) | |
download | mariadb-git-d0a044a0bfc882dfc7921a2a8945262578ff220c.tar.gz |
Merge mysql.com:/home/svoj/devel/mysql/BUG26976/mysql-5.0-engines
into mysql.com:/home/svoj/devel/mysql/BUG26976/mysql-5.1-engines
Diffstat (limited to 'storage/myisammrg')
-rw-r--r-- | storage/myisammrg/ha_myisammrg.cc | 26 | ||||
-rw-r--r-- | storage/myisammrg/ha_myisammrg.h | 1 | ||||
-rw-r--r-- | storage/myisammrg/myrg_def.h | 5 | ||||
-rw-r--r-- | storage/myisammrg/myrg_open.c | 12 |
4 files changed, 42 insertions, 2 deletions
diff --git a/storage/myisammrg/ha_myisammrg.cc b/storage/myisammrg/ha_myisammrg.cc index d6ea2b4772e..c7907c53582 100644 --- a/storage/myisammrg/ha_myisammrg.cc +++ b/storage/myisammrg/ha_myisammrg.cc @@ -52,6 +52,13 @@ extern int check_definition(MI_KEYDEF *t1_keyinfo, MI_COLUMNDEF *t1_recinfo, uint t1_keys, uint t1_recs, MI_KEYDEF *t2_keyinfo, MI_COLUMNDEF *t2_recinfo, uint t2_keys, uint t2_recs, bool strict); +extern "C" void myrg_print_wrong_table(const char *table_name) +{ + push_warning_printf(current_thd, MYSQL_ERROR::WARN_LEVEL_ERROR, + ER_ADMIN_WRONG_MRG_TABLE, ER(ER_ADMIN_WRONG_MRG_TABLE), + table_name); +} + const char **ha_myisammrg::bas_ext() const { @@ -102,6 +109,8 @@ int ha_myisammrg::open(const char *name, int mode, uint test_if_locked) { DBUG_PRINT("error",("reclength: %lu mean_rec_length: %lu", table->s->reclength, stats.mean_rec_length)); + if (test_if_locked & HA_OPEN_FOR_REPAIR) + myrg_print_wrong_table(file->open_tables->table->filename); error= HA_ERR_WRONG_MRG_TABLE_DEF; goto err; } @@ -122,10 +131,18 @@ int ha_myisammrg::open(const char *name, int mode, uint test_if_locked) { my_free((uchar*) recinfo, MYF(0)); error= HA_ERR_WRONG_MRG_TABLE_DEF; - goto err; + if (test_if_locked & HA_OPEN_FOR_REPAIR) + myrg_print_wrong_table(u_table->table->filename); + else + { + my_free((uchar*) recinfo, MYF(0)); + goto err; + } } } my_free((uchar*) recinfo, MYF(0)); + if (error == HA_ERR_WRONG_MRG_TABLE_DEF) + goto err; #if !defined(BIG_TABLES) || SIZEOF_OFF_T == 4 /* Merge table has more than 2G rows */ if (table->s->crashed) @@ -593,6 +610,13 @@ bool ha_myisammrg::check_if_incompatible_data(HA_CREATE_INFO *info, return COMPATIBLE_DATA_NO; } + +int ha_myisammrg::check(THD* thd, HA_CHECK_OPT* check_opt) +{ + return HA_ADMIN_OK; +} + + extern int myrg_panic(enum ha_panic_function flag); int myisammrg_panic(handlerton *hton, ha_panic_function flag) { diff --git a/storage/myisammrg/ha_myisammrg.h b/storage/myisammrg/ha_myisammrg.h index 88bb5dd2e21..91f583c3330 100644 --- a/storage/myisammrg/ha_myisammrg.h +++ b/storage/myisammrg/ha_myisammrg.h @@ -84,4 +84,5 @@ class ha_myisammrg: public handler void append_create_info(String *packet); MYRG_INFO *myrg_info() { return file; } bool check_if_incompatible_data(HA_CREATE_INFO *info, uint table_changes); + int check(THD* thd, HA_CHECK_OPT* check_opt); }; diff --git a/storage/myisammrg/myrg_def.h b/storage/myisammrg/myrg_def.h index ec33d2c0bb4..9c69da1424d 100644 --- a/storage/myisammrg/myrg_def.h +++ b/storage/myisammrg/myrg_def.h @@ -29,4 +29,7 @@ extern pthread_mutex_t THR_LOCK_open; int _myrg_init_queue(MYRG_INFO *info,int inx,enum ha_rkey_function search_flag); int _myrg_mi_read_record(MI_INFO *info, uchar *buf); - +#ifdef __cplusplus +extern "C" +#endif +void myrg_print_wrong_table(const char *table_name); diff --git a/storage/myisammrg/myrg_open.c b/storage/myisammrg/myrg_open.c index cca81f0f605..500d3a29327 100644 --- a/storage/myisammrg/myrg_open.c +++ b/storage/myisammrg/myrg_open.c @@ -92,6 +92,11 @@ MYRG_INFO *myrg_open(const char *name, int mode, int handle_locking) if (!(isam=mi_open(buff,mode,(handle_locking?HA_OPEN_WAIT_IF_LOCKED:0)))) { my_errno= HA_ERR_WRONG_MRG_TABLE_DEF; + if (handle_locking & HA_OPEN_FOR_REPAIR) + { + myrg_print_wrong_table(buff); + continue; + } goto err; } if (!m_info) /* First file */ @@ -120,6 +125,11 @@ MYRG_INFO *myrg_open(const char *name, int mode, int handle_locking) if (m_info->reclength != isam->s->base.reclength) { my_errno=HA_ERR_WRONG_MRG_TABLE_DEF; + if (handle_locking & HA_OPEN_FOR_REPAIR) + { + myrg_print_wrong_table(buff); + continue; + } goto err; } m_info->options|= isam->s->options; @@ -133,6 +143,8 @@ MYRG_INFO *myrg_open(const char *name, int mode, int handle_locking) m_info->tables); } + if (my_errno == HA_ERR_WRONG_MRG_TABLE_DEF) + goto err; if (!m_info && !(m_info= (MYRG_INFO*) my_malloc(sizeof(MYRG_INFO), MYF(MY_WME | MY_ZEROFILL)))) goto err; |