--- /home/mcallaghan/fil0fil.c 2012-01-27 20:42:32.632733000 -0800 +++ ./fil0fil.c 2012-01-27 20:25:30.000000000 -0800 @@ -954,11 +945,6 @@ 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) { @@ -982,6 +968,10 @@ 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 */ @@ -1399,7 +1389,6 @@ my_io_perf_init(&(space->io_perf2.read)); my_io_perf_init(&(space->io_perf2.write)); memset(&(space->comp_stat), 0, sizeof space->comp_stat); - space->n_lru = 0; UT_LIST_ADD_LAST(space_list, fil_system->space_list, space); @@ -2650,6 +2639,10 @@ ibool old_name_was_specified = TRUE; char* old_path; + ibool waiting = TRUE; + int sleep_time = 1000; + int factor = 20; + ut_a(id != 0); if (old_name == NULL) { @@ -2659,7 +2652,7 @@ retry: count++; - if (count > 1000) { + if (count > (1000 * factor)) { ut_print_timestamp(stderr); fputs(" InnoDB: Warning: problems renaming ", stderr); ut_print_filename(stderr, old_name); @@ -2684,13 +2677,26 @@ return(FALSE); } - if (count > 25000) { + if (count > (25000 * factor)) { space->stop_ios = FALSE; mutex_exit(&fil_system->mutex); return(FALSE); } + if (waiting) { + node = UT_LIST_GET_FIRST(space->chain); + if (count > (800 * factor)) { + waiting = FALSE; +fprintf(stderr, "disabled waiting at count %d\n", (int) count); + } else if (!node->n_pending) { + mutex_exit(&fil_system->mutex); + os_thread_sleep(sleep_time); + goto retry; + } +fprintf(stderr, "waited until n_pending %d at count %d\n", (int) node->n_pending, (int) count); + } + /* 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. */ @@ -2706,7 +2712,7 @@ mutex_exit(&fil_system->mutex); - os_thread_sleep(20000); + os_thread_sleep(sleep_time); goto retry; @@ -2715,7 +2721,7 @@ mutex_exit(&fil_system->mutex); - os_thread_sleep(20000); + os_thread_sleep(sleep_time); fil_flush(id, FLUSH_FROM_OTHER);