diff options
author | Marko Mäkelä <marko.makela@mariadb.com> | 2018-06-06 11:04:17 +0300 |
---|---|---|
committer | Marko Mäkelä <marko.makela@mariadb.com> | 2018-06-06 11:04:17 +0300 |
commit | 1d4e1d3263bf3b87b473c12d4876f368dc3450b6 (patch) | |
tree | d0caf15cd3d42ff05831fc25dda7bc5856465391 | |
parent | 3b7da8a44c8a0ff4b40b37e4db01f7e397aefab5 (diff) | |
parent | 55abcfa7b70968246a1a26a8839013ebb8f5c506 (diff) | |
download | mariadb-git-1d4e1d3263bf3b87b473c12d4876f368dc3450b6.tar.gz |
Merge 10.0 to 10.1
-rw-r--r-- | storage/innobase/fil/fil0fil.cc | 111 | ||||
-rw-r--r-- | storage/innobase/include/fil0fil.h | 4 | ||||
-rw-r--r-- | storage/innobase/os/os0file.cc | 7 | ||||
-rw-r--r-- | storage/xtradb/fil/fil0fil.cc | 111 | ||||
-rw-r--r-- | storage/xtradb/include/fil0fil.h | 4 | ||||
-rw-r--r-- | storage/xtradb/os/os0file.cc | 7 |
6 files changed, 8 insertions, 236 deletions
diff --git a/storage/innobase/fil/fil0fil.cc b/storage/innobase/fil/fil0fil.cc index 2ba1d90d347..112320bd3f5 100644 --- a/storage/innobase/fil/fil0fil.cc +++ b/storage/innobase/fil/fil0fil.cc @@ -1092,7 +1092,6 @@ fil_mutex_enter_and_prepare_for_io( { fil_space_t* space; ulint count = 0; - ulint count2 = 0; retry: mutex_enter(&fil_system->mutex); @@ -1108,47 +1107,6 @@ retry: return; } - if (space->stop_ios) { - ut_ad(space->id != 0); - /* We are going to do a rename file and want to stop new i/o's - for a while */ - - if (count2 > 20000) { - fputs("InnoDB: Warning: tablespace ", stderr); - ut_print_filename(stderr, space->name); - fprintf(stderr, - " has i/o ops stopped for a long time %lu\n", - (ulong) count2); - } - - 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++; - - goto retry; - } - fil_node_t* node = UT_LIST_GET_LAST(space->chain); ut_ad(space->id == 0 || node == UT_LIST_GET_FIRST(space->chain)); @@ -3204,7 +3162,6 @@ fil_rename_tablespace( ibool success; fil_space_t* space; fil_node_t* node; - ulint count = 0; char* new_path; char* old_name; char* old_path; @@ -3212,25 +3169,10 @@ fil_rename_tablespace( ut_a(id != 0); -retry: - count++; - - if (!(count % 1000)) { - ut_print_timestamp(stderr); - fputs(" InnoDB: Warning: problems renaming ", stderr); - ut_print_filename(stderr, - old_name_in ? old_name_in : not_given); - fputs(" to ", stderr); - ut_print_filename(stderr, new_name); - fprintf(stderr, ", %lu iterations\n", (ulong) count); - } - mutex_enter(&fil_system->mutex); space = fil_space_get_by_id(id); - DBUG_EXECUTE_IF("fil_rename_tablespace_failure_1", space = NULL; ); - if (space == NULL) { ib_logf(IB_LOG_LEVEL_ERROR, "Cannot find space id %lu in the tablespace " @@ -3242,54 +3184,11 @@ retry: return(FALSE); } - if (count > 25000) { - space->stop_ios = FALSE; - mutex_exit(&fil_system->mutex); - - return(FALSE); - } - - /* We temporarily close the .ibd file because we do not trust that - operating systems can rename an open file. For the closing we have to - wait until there are no pending i/o's or flushes on the file. */ - - space->stop_ios = TRUE; - /* The following code must change when InnoDB supports multiple datafiles per tablespace. */ ut_a(UT_LIST_GET_LEN(space->chain) == 1); node = UT_LIST_GET_FIRST(space->chain); - if (node->n_pending > 0 - || node->n_pending_flushes > 0 - || node->being_extended) { - /* There are pending i/o's or flushes or the file is - currently being extended, sleep for a while and - retry */ - - mutex_exit(&fil_system->mutex); - - os_thread_sleep(20000); - - goto retry; - - } else if (node->modification_counter > node->flush_counter) { - /* Flush the space */ - - mutex_exit(&fil_system->mutex); - - os_thread_sleep(20000); - - fil_flush(id); - - goto retry; - - } else if (node->open) { - /* Close the file */ - - fil_node_close_file(node, fil_system); - } - /* Check that the old name in the space is right */ if (old_name_in) { @@ -3308,17 +3207,9 @@ retry: space, node, new_name, new_path); if (success) { - - DBUG_EXECUTE_IF("fil_rename_tablespace_failure_2", - goto skip_second_rename; ); - success = os_file_rename( innodb_file_data_key, old_path, new_path); - DBUG_EXECUTE_IF("fil_rename_tablespace_failure_2", -skip_second_rename: - success = FALSE; ); - if (!success) { /* We have to revert the changes we made to the tablespace memory cache */ @@ -3328,8 +3219,6 @@ skip_second_rename: } } - space->stop_ios = FALSE; - mutex_exit(&fil_system->mutex); #ifndef UNIV_HOTBACKUP diff --git a/storage/innobase/include/fil0fil.h b/storage/innobase/include/fil0fil.h index f658f273136..9b6178bb8f1 100644 --- a/storage/innobase/include/fil0fil.h +++ b/storage/innobase/include/fil0fil.h @@ -281,10 +281,6 @@ struct fil_space_t { an insert buffer merge request for a page because it actually was for the previous incarnation of the space */ - ibool stop_ios;/*!< TRUE if we want to rename the - .ibd file of tablespace and want to - stop temporarily posting of new i/o - requests on the file */ bool stop_new_ops; /*!< we set this TRUE when we start deleting a single-table tablespace. diff --git a/storage/innobase/os/os0file.cc b/storage/innobase/os/os0file.cc index 81614549702..feb138631c4 100644 --- a/storage/innobase/os/os0file.cc +++ b/storage/innobase/os/os0file.cc @@ -1350,7 +1350,8 @@ os_file_create_simple_func( /* Use default security attributes and no template file. */ file = CreateFile( - (LPCTSTR) name, access, FILE_SHARE_READ, NULL, + (LPCTSTR) name, access, + FILE_SHARE_READ | FILE_SHARE_DELETE, NULL, create_flag, attributes, NULL); if (file == INVALID_HANDLE_VALUE) { @@ -1483,7 +1484,7 @@ os_file_create_simple_no_error_handling_func( DWORD access; DWORD create_flag; DWORD attributes = 0; - DWORD share_mode = FILE_SHARE_READ; + DWORD share_mode = FILE_SHARE_READ | FILE_SHARE_DELETE; ut_a(name); ut_a(!(create_mode & OS_FILE_ON_ERROR_SILENT)); @@ -1764,7 +1765,7 @@ os_file_create_func( #ifdef __WIN__ DWORD create_flag; - DWORD share_mode = FILE_SHARE_READ; + DWORD share_mode = FILE_SHARE_READ | FILE_SHARE_DELETE; on_error_no_exit = create_mode & OS_FILE_ON_ERROR_NO_EXIT ? TRUE : FALSE; diff --git a/storage/xtradb/fil/fil0fil.cc b/storage/xtradb/fil/fil0fil.cc index 9bd26fcf35b..bd7dfdf5ac8 100644 --- a/storage/xtradb/fil/fil0fil.cc +++ b/storage/xtradb/fil/fil0fil.cc @@ -1098,7 +1098,6 @@ fil_mutex_enter_and_prepare_for_io( { fil_space_t* space; ulint count = 0; - ulint count2 = 0; retry: mutex_enter(&fil_system->mutex); @@ -1114,47 +1113,6 @@ retry: return; } - if (space->stop_ios) { - ut_ad(space->id != 0); - /* We are going to do a rename file and want to stop new i/o's - for a while */ - - if (count2 > 20000) { - fputs("InnoDB: Warning: tablespace ", stderr); - ut_print_filename(stderr, space->name); - fprintf(stderr, - " has i/o ops stopped for a long time %lu\n", - (ulong) count2); - } - - 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++; - - goto retry; - } - fil_node_t* node = UT_LIST_GET_LAST(space->chain); ut_ad(space->id == 0 || node == UT_LIST_GET_FIRST(space->chain)); @@ -3249,7 +3207,6 @@ fil_rename_tablespace( ibool success; fil_space_t* space; fil_node_t* node; - ulint count = 0; char* new_path; char* old_name; char* old_path; @@ -3257,25 +3214,10 @@ fil_rename_tablespace( ut_a(id != 0); -retry: - count++; - - if (!(count % 1000)) { - ut_print_timestamp(stderr); - fputs(" InnoDB: Warning: problems renaming ", stderr); - ut_print_filename(stderr, - old_name_in ? old_name_in : not_given); - fputs(" to ", stderr); - ut_print_filename(stderr, new_name); - fprintf(stderr, ", %lu iterations\n", (ulong) count); - } - mutex_enter(&fil_system->mutex); space = fil_space_get_by_id(id); - DBUG_EXECUTE_IF("fil_rename_tablespace_failure_1", space = NULL; ); - if (space == NULL) { ib_logf(IB_LOG_LEVEL_ERROR, "Cannot find space id %lu in the tablespace " @@ -3287,54 +3229,11 @@ retry: return(FALSE); } - if (count > 25000) { - space->stop_ios = FALSE; - mutex_exit(&fil_system->mutex); - - return(FALSE); - } - - /* We temporarily close the .ibd file because we do not trust that - operating systems can rename an open file. For the closing we have to - wait until there are no pending i/o's or flushes on the file. */ - - space->stop_ios = TRUE; - /* The following code must change when InnoDB supports multiple datafiles per tablespace. */ ut_a(UT_LIST_GET_LEN(space->chain) == 1); node = UT_LIST_GET_FIRST(space->chain); - if (node->n_pending > 0 - || node->n_pending_flushes > 0 - || node->being_extended) { - /* There are pending i/o's or flushes or the file is - currently being extended, sleep for a while and - retry */ - - mutex_exit(&fil_system->mutex); - - os_thread_sleep(20000); - - goto retry; - - } else if (node->modification_counter > node->flush_counter) { - /* Flush the space */ - - mutex_exit(&fil_system->mutex); - - os_thread_sleep(20000); - - fil_flush(id); - - goto retry; - - } else if (node->open) { - /* Close the file */ - - fil_node_close_file(node, fil_system); - } - /* Check that the old name in the space is right */ if (old_name_in) { @@ -3353,17 +3252,9 @@ retry: space, node, new_name, new_path); if (success) { - - DBUG_EXECUTE_IF("fil_rename_tablespace_failure_2", - goto skip_second_rename; ); - success = os_file_rename( innodb_file_data_key, old_path, new_path); - DBUG_EXECUTE_IF("fil_rename_tablespace_failure_2", -skip_second_rename: - success = FALSE; ); - if (!success) { /* We have to revert the changes we made to the tablespace memory cache */ @@ -3373,8 +3264,6 @@ skip_second_rename: } } - space->stop_ios = FALSE; - mutex_exit(&fil_system->mutex); #ifndef UNIV_HOTBACKUP diff --git a/storage/xtradb/include/fil0fil.h b/storage/xtradb/include/fil0fil.h index 8a4aa9b7dff..a0db48f7037 100644 --- a/storage/xtradb/include/fil0fil.h +++ b/storage/xtradb/include/fil0fil.h @@ -275,10 +275,6 @@ struct fil_space_t { an insert buffer merge request for a page because it actually was for the previous incarnation of the space */ - ibool stop_ios;/*!< TRUE if we want to rename the - .ibd file of tablespace and want to - stop temporarily posting of new i/o - requests on the file */ bool stop_new_ops; /*!< we set this true when we start deleting a single-table tablespace. diff --git a/storage/xtradb/os/os0file.cc b/storage/xtradb/os/os0file.cc index 6a63f31b37a..da8548f0fa8 100644 --- a/storage/xtradb/os/os0file.cc +++ b/storage/xtradb/os/os0file.cc @@ -1437,7 +1437,8 @@ os_file_create_simple_func( /* Use default security attributes and no template file. */ file = CreateFile( - (LPCTSTR) name, access, FILE_SHARE_READ, NULL, + (LPCTSTR) name, access, + FILE_SHARE_READ | FILE_SHARE_DELETE, NULL, create_flag, attributes, NULL); if (file == INVALID_HANDLE_VALUE) { @@ -1603,7 +1604,7 @@ os_file_create_simple_no_error_handling_func( DWORD access; DWORD create_flag; DWORD attributes = 0; - DWORD share_mode = FILE_SHARE_READ; + DWORD share_mode = FILE_SHARE_READ | FILE_SHARE_DELETE; ut_a(name); ut_a(!(create_mode & OS_FILE_ON_ERROR_SILENT)); @@ -1925,7 +1926,7 @@ os_file_create_func( #ifdef __WIN__ DWORD create_flag; - DWORD share_mode = FILE_SHARE_READ; + DWORD share_mode = FILE_SHARE_READ | FILE_SHARE_DELETE; on_error_no_exit = create_mode & OS_FILE_ON_ERROR_NO_EXIT ? TRUE : FALSE; |