diff options
author | Inaam Rana <inaam.rana@oracle.com> | 2012-01-31 09:31:31 -0500 |
---|---|---|
committer | Inaam Rana <inaam.rana@oracle.com> | 2012-01-31 09:31:31 -0500 |
commit | 7d696c9d24b1d8aff532fd3fcc3aa668044d8679 (patch) | |
tree | 175db8b8a0a0a9084cee5c43c44a90a18d428e2a | |
parent | 4b6e5cf7d652ea6a32803f26e41dfbca2eb325db (diff) | |
download | mariadb-git-7d696c9d24b1d8aff532fd3fcc3aa668044d8679.tar.gz |
Bug#13636122 THE ORIGINAL TABLE MISSING WHILE EXECUTE THE DDL 'ALTER TABLE ADD COLUMN
rb://914
approved by: Marko Makela
Poll in fil_rename_tablespace() after setting ::stop_ios flag can
result in a hang because the other thread actually dispatching the IO
won't wake IO helper threads or flush the tablespace before starting
wait in fil_mutex_enter_and_prepare_for_io().
-rw-r--r-- | storage/innobase/fil/fil0fil.c | 24 | ||||
-rw-r--r-- | storage/innodb_plugin/ChangeLog | 6 | ||||
-rw-r--r-- | storage/innodb_plugin/fil/fil0fil.c | 31 |
3 files changed, 49 insertions, 12 deletions
diff --git a/storage/innobase/fil/fil0fil.c b/storage/innobase/fil/fil0fil.c index 6ca8381ebdf..1d3cdc6e227 100644 --- a/storage/innobase/fil/fil0fil.c +++ b/storage/innobase/fil/fil0fil.c @@ -772,11 +772,6 @@ retry: return; } - if (system->n_open < system->max_n_open) { - - return; - } - HASH_SEARCH(hash, system->spaces, space_id, space, space->id == space_id); if (space != NULL && space->stop_ios) { @@ -793,6 +788,18 @@ retry: mutex_exit(&(system->mutex)); +#ifndef UNIV_HOTBACKUP + /* Wake the i/o-handler threads to make sure pending + i/o's are performed */ + os_aio_simulated_wake_handler_threads(); + + os_thread_sleep(20000); +#endif /* UNIV_HOTBACKUP */ + + /* Flush tablespaces so that we can close modified + files in the LRU list */ + fil_flush_file_spaces(FIL_TABLESPACE); + os_thread_sleep(20000); count2++; @@ -800,6 +807,11 @@ retry: goto retry; } + if (system->n_open < system->max_n_open) { + + return; + } + /* If the file is already open, no need to do anything; if the space does not exist, we handle the situation in the function which called this function */ @@ -2290,7 +2302,7 @@ fil_rename_tablespace( retry: count++; - if (count > 1000) { + if (!(count % 1000)) { ut_print_timestamp(stderr); fputs(" InnoDB: Warning: problems renaming ", stderr); ut_print_filename(stderr, old_name); diff --git a/storage/innodb_plugin/ChangeLog b/storage/innodb_plugin/ChangeLog index 97647b679e2..45b4d05de68 100644 --- a/storage/innodb_plugin/ChangeLog +++ b/storage/innodb_plugin/ChangeLog @@ -1,3 +1,9 @@ +2012-01-30 The InnoDB Team + + * fil/fil0fil.c: + Fix Bug#13636122 THE ORIGINAL TABLE MISSING WHILE EXECUTE THE + DDL 'ALTER TABLE ADD COLUMN' + 2012-01-16 The InnoDB Team * ibuf/ibuf0ibuf.c: diff --git a/storage/innodb_plugin/fil/fil0fil.c b/storage/innodb_plugin/fil/fil0fil.c index 0f774dcaaa1..01057c26d94 100644 --- a/storage/innodb_plugin/fil/fil0fil.c +++ b/storage/innodb_plugin/fil/fil0fil.c @@ -918,11 +918,6 @@ retry: return; } - if (fil_system->n_open < fil_system->max_n_open) { - - return; - } - space = fil_space_get_by_id(space_id); if (space != NULL && space->stop_ios) { @@ -939,6 +934,25 @@ retry: mutex_exit(&fil_system->mutex); +#ifndef UNIV_HOTBACKUP + + /* Wake the i/o-handler threads to make sure pending + i/o's are performed */ + os_aio_simulated_wake_handler_threads(); + + /* The sleep here is just to give IO helper threads a + bit of time to do some work. It is not required that + all IO related to the tablespace being renamed must + be flushed here as we do fil_flush() in + fil_rename_tablespace() as well. */ + os_thread_sleep(20000); + +#endif /* UNIV_HOTBACKUP */ + + /* Flush tablespaces so that we can close modified + files in the LRU list */ + fil_flush_file_spaces(FIL_TABLESPACE); + os_thread_sleep(20000); count2++; @@ -946,6 +960,11 @@ retry: goto retry; } + if (fil_system->n_open < fil_system->max_n_open) { + + return; + } + /* If the file is already open, no need to do anything; if the space does not exist, we handle the situation in the function which called this function */ @@ -2496,7 +2515,7 @@ fil_rename_tablespace( retry: count++; - if (count > 1000) { + if (!(count % 1000)) { ut_print_timestamp(stderr); fputs(" InnoDB: Warning: problems renaming ", stderr); ut_print_filename(stderr, old_name); |