From 5cf5a9a1e8660cbcc60362d90cc22b63b2c05ed7 Mon Sep 17 00:00:00 2001 From: Michael Widenius Date: Thu, 6 Jun 2013 15:51:36 +0300 Subject: [PATCH] Fixed timing failure in myisam-metadata.test mysql-test/include/wait_show_condition.inc: Print failing statement if timeout mysql-test/r/myisam-metadata.result: Updated DBUG_SYNC mysql-test/t/myisam-metadata.test: Updated DBUG_SYNC. Removed wait_show_condtion, as this is not needed when we use DBUG_SYNC This should fix timing issues with the test mysys/thr_mutex.c: Added comments sql/sql_acl.cc: atoi -> atoll() (Safety) storage/myisam/ha_myisam.cc: Send signal before mi_repair_by_sort. --- mysql-test/include/wait_show_condition.inc | 1 + mysql-test/r/myisam-metadata.result | 2 +- mysql-test/t/myisam-metadata.test | 7 +------ mysys/thr_mutex.c | 10 +++++----- sql/sql_acl.cc | 2 +- storage/myisam/ha_myisam.cc | 2 +- 6 files changed, 10 insertions(+), 14 deletions(-) diff --git a/mysql-test/include/wait_show_condition.inc b/mysql-test/include/wait_show_condition.inc index ae1600a7e30..b8dd9bdf971 100644 --- a/mysql-test/include/wait_show_condition.inc +++ b/mysql-test/include/wait_show_condition.inc @@ -127,5 +127,6 @@ if (!$found) echo # field : $field; echo # condition : $condition; echo # max_run_time : $max_run_time; + eval $show_statement; } diff --git a/mysql-test/r/myisam-metadata.result b/mysql-test/r/myisam-metadata.result index 4d49bac9436..f13e4ac8b60 100644 --- a/mysql-test/r/myisam-metadata.result +++ b/mysql-test/r/myisam-metadata.result @@ -5,7 +5,7 @@ a VARCHAR(100), INDEX(a) ) ENGINE=MyISAM; ALTER TABLE t1 DISABLE KEYS; -SET debug_sync= 'myisam_after_repair_by_sort SIGNAL waiting WAIT_FOR go'; +SET debug_sync= 'myisam_before_repair_by_sort SIGNAL waiting WAIT_FOR go'; ALTER TABLE t1 ENABLE KEYS; SET debug_sync= 'now WAIT_FOR waiting'; SET debug_sync= 'now SIGNAL go'; diff --git a/mysql-test/t/myisam-metadata.test b/mysql-test/t/myisam-metadata.test index 2bbcc89a702..609cf5d8c5e 100644 --- a/mysql-test/t/myisam-metadata.test +++ b/mysql-test/t/myisam-metadata.test @@ -30,16 +30,11 @@ while ($1) --enable_query_log --connect(con1,localhost,root,,) -SET debug_sync= 'myisam_after_repair_by_sort SIGNAL waiting WAIT_FOR go'; +SET debug_sync= 'myisam_before_repair_by_sort SIGNAL waiting WAIT_FOR go'; send ALTER TABLE t1 ENABLE KEYS; --connection default ---let $wait_timeout=60 ---let $show_statement= SHOW PROCESSLIST ---let $field= State ---let $condition= = 'Repair by sorting' ---source include/wait_show_condition.inc SET debug_sync= 'now WAIT_FOR waiting'; SET debug_sync= 'now SIGNAL go'; diff --git a/mysys/thr_mutex.c b/mysys/thr_mutex.c index 17cda782b30..c70aa342802 100644 --- a/mysys/thr_mutex.c +++ b/mysys/thr_mutex.c @@ -132,7 +132,7 @@ void safe_mutex_global_init(void) #ifdef SAFE_MUTEX_DETECT_DESTROY safe_mutex_create_root= 0; -#endif +#endif /* SAFE_MUTEX_DETECT_DESTROY */ } static inline void remove_from_active_list(safe_mutex_t *mp) @@ -553,7 +553,7 @@ int safe_cond_timedwait(pthread_cond_t *cond, safe_mutex_t *mp, "on %s at %s, line %d\n", error, errno, mp->name, file, line); } -#endif +#endif /* EXTRA_DEBUG */ pthread_mutex_lock(&mp->global); /* Restore state as it was before */ mp->thread= save_state.thread; @@ -612,7 +612,7 @@ int safe_mutex_destroy(safe_mutex_t *mp, const char *file, uint line) error=1; if (pthread_mutex_destroy(&mp->mutex)) error=1; -#endif +#endif /* __WIN__ */ mp->file= 0; /* Mark destroyed */ #ifdef SAFE_MUTEX_DETECT_DESTROY @@ -838,7 +838,7 @@ static void print_deadlock_warning(safe_mutex_t *new_mutex, DBUG_VOID_RETURN; } -#elif defined(MY_PTHREAD_FASTMUTEX) +#elif defined(MY_PTHREAD_FASTMUTEX) /* !SAFE_MUTEX_DEFINED */ static ulong mutex_delay(ulong delayloops) { @@ -922,4 +922,4 @@ void fastmutex_global_init(void) #endif } -#endif /* defined(MY_PTHREAD_FASTMUTEX) */ +#endif /* defined(MY_PTHREAD_FASTMUTEX) && defined(SAFE_MUTEX_DEFINED) */ diff --git a/sql/sql_acl.cc b/sql/sql_acl.cc index 69290a64a29..4fe99b24508 100644 --- a/sql/sql_acl.cc +++ b/sql/sql_acl.cc @@ -968,7 +968,7 @@ static my_bool acl_load(THD *thd, TABLE_LIST *tables) { /* Starting from 5.0.3 we have max_user_connections field */ ptr= get_field(thd->mem_root, table->field[next_field++]); - user.user_resource.user_conn= ptr ? atoi(ptr) : 0; + user.user_resource.user_conn= ptr ? atoll(ptr) : 0; } if (table->s->fields >= 41) diff --git a/storage/myisam/ha_myisam.cc b/storage/myisam/ha_myisam.cc index c5d4f987c00..cb9ded167d9 100644 --- a/storage/myisam/ha_myisam.cc +++ b/storage/myisam/ha_myisam.cc @@ -1126,9 +1126,9 @@ int ha_myisam::repair(THD *thd, HA_CHECK ¶m, bool do_optimize) else { thd_proc_info(thd, "Repair by sorting"); + DEBUG_SYNC(thd, "myisam_before_repair_by_sort"); error = mi_repair_by_sort(¶m, file, fixed_name, test(param.testflag & T_QUICK)); - DEBUG_SYNC(thd, "myisam_after_repair_by_sort"); } if (error && file->create_unique_index_by_sort && share->state.dupp_key != MAX_KEY)