1 diff -ruN a/innobase/buf/buf0flu.c b/innobase/buf/buf0flu.c
2 --- a/innobase/buf/buf0flu.c 2009-08-04 16:53:42.000000000 +0900
3 +++ b/innobase/buf/buf0flu.c 2009-08-04 17:02:36.000000000 +0900
6 b = UT_LIST_GET_FIRST(buf_pool->flush_list);
8 + if (srv_fast_recovery) {
10 + if (b == NULL || (ut_dulint_cmp(b->oldest_modification,
11 + block->oldest_modification) < 0)) {
12 + UT_LIST_ADD_FIRST(flush_list, buf_pool->flush_list, block);
14 + b = UT_LIST_GET_LAST(buf_pool->flush_list);
15 + if (ut_dulint_cmp(b->oldest_modification,
16 + block->oldest_modification) < 0) {
17 + /* align oldest_modification not to sort */
18 + block->oldest_modification = b->oldest_modification;
20 + UT_LIST_ADD_LAST(flush_list, buf_pool->flush_list, block);
24 while (b && (ut_dulint_cmp(b->oldest_modification,
25 block->oldest_modification) > 0)) {
28 UT_LIST_INSERT_AFTER(flush_list, buf_pool->flush_list, prev_b,
33 ut_ad(buf_flush_validate_low());
35 diff -ruN a/innobase/buf/buf0rea.c b/innobase/buf/buf0rea.c
36 --- a/innobase/buf/buf0rea.c 2009-08-04 16:53:42.000000000 +0900
37 +++ b/innobase/buf/buf0rea.c 2009-08-04 17:11:41.000000000 +0900
39 block = buf_page_init_for_read(err, mode, space, tablespace_version,
42 + /* bugfix: http://bugs.mysql.com/bug.php?id=43948 */
43 + if (recv_recovery_is_on() && *err == DB_TABLESPACE_DELETED) {
44 + /* hashed log recs must be treated here */
45 + recv_addr_t* recv_addr;
47 + mutex_enter(&(recv_sys->mutex));
49 + if (recv_sys->apply_log_recs == FALSE) {
50 + mutex_exit(&(recv_sys->mutex));
51 + goto not_to_recover;
54 + /* recv_get_fil_addr_struct() */
55 + recv_addr = HASH_GET_FIRST(recv_sys->addr_hash,
56 + hash_calc_hash(ut_fold_ulint_pair(space, offset),
57 + recv_sys->addr_hash));
59 + if ((recv_addr->space == space)
60 + && (recv_addr->page_no == offset)) {
63 + recv_addr = HASH_GET_NEXT(addr_hash, recv_addr);
66 + if ((recv_addr == NULL)
67 + || (recv_addr->state == RECV_BEING_PROCESSED)
68 + || (recv_addr->state == RECV_PROCESSED)) {
69 + mutex_exit(&(recv_sys->mutex));
70 + goto not_to_recover;
73 + fprintf(stderr, " (space:%lu is deleted)", space);
74 + recv_addr->state = RECV_PROCESSED;
76 + ut_a(recv_sys->n_addrs);
77 + recv_sys->n_addrs--;
79 + mutex_exit(&(recv_sys->mutex));
86 while (buf_pool->n_pend_reads >= recv_n_pool_free_frames / 2) {
88 os_aio_simulated_wake_handler_threads();
89 - os_thread_sleep(500000);
90 + os_thread_sleep(10000);
97 "InnoDB: Error: InnoDB has waited for 50 seconds for pending\n"
98 "InnoDB: reads to the buffer pool to be finished.\n"
99 diff -ruN a/innobase/include/srv0srv.h b/innobase/include/srv0srv.h
100 --- a/innobase/include/srv0srv.h 2009-08-04 16:53:42.000000000 +0900
101 +++ b/innobase/include/srv0srv.h 2009-08-04 17:39:51.000000000 +0900
103 extern ibool srv_file_per_table;
104 extern ibool srv_locks_unsafe_for_binlog;
106 +extern ibool srv_fast_recovery;
108 extern ulint srv_n_data_files;
109 extern char** srv_data_file_names;
110 extern ulint* srv_data_file_sizes;
111 diff -ruN a/innobase/log/log0recv.c b/innobase/log/log0recv.c
112 --- a/innobase/log/log0recv.c 2009-07-07 21:54:08.000000000 +0900
113 +++ b/innobase/log/log0recv.c 2009-08-04 17:15:15.000000000 +0900
115 use these free frames to read in pages when we start applying the
116 log records to the database. */
118 -ulint recv_n_pool_free_frames = 256;
119 +ulint recv_n_pool_free_frames = 1024;
121 /* The maximum lsn we see for a page during the recovery process. If this
122 is bigger than the lsn we are able to scan up to, that is an indication that
123 @@ -1135,6 +1135,8 @@
124 recv_addr = recv_get_fil_addr_struct(space, page_no);
126 if ((recv_addr == NULL)
127 + /* bugfix: http://bugs.mysql.com/bug.php?id=44140 */
128 + || (recv_addr->state == RECV_BEING_READ && !just_read_in)
129 || (recv_addr->state == RECV_BEING_PROCESSED)
130 || (recv_addr->state == RECV_PROCESSED)) {
132 diff -ruN a/innobase/srv/srv0srv.c b/innobase/srv/srv0srv.c
133 --- a/innobase/srv/srv0srv.c 2009-08-04 16:53:42.000000000 +0900
134 +++ b/innobase/srv/srv0srv.c 2009-08-04 17:41:05.000000000 +0900
136 i.e. do not use next-key locking
137 except on duplicate key checking and
138 foreign key checking */
139 +ibool srv_fast_recovery = FALSE;
141 ulint srv_n_data_files = 0;
142 char** srv_data_file_names = NULL;
143 ulint* srv_data_file_sizes = NULL; /* size in database pages */
144 diff -ruN a/patch_info/innodb_recovery_patches.info b/patch_info/innodb_recovery_patches.info
145 --- /dev/null 1970-01-01 09:00:00.000000000 +0900
146 +++ b/patch_info/innodb_recovery_patches.info 2009-08-04 16:58:07.000000000 +0900
148 +File=innodb_recovery_patches.patch
149 +Name=Bugfixes and adjustments about recovery process
151 +Author=Percona <info@percona.com>
154 diff -ruN a/sql/ha_innodb.cc b/sql/ha_innodb.cc
155 --- a/sql/ha_innodb.cc 2009-08-04 16:53:42.000000000 +0900
156 +++ b/sql/ha_innodb.cc 2009-08-04 17:35:44.000000000 +0900
158 my_bool innobase_rollback_on_timeout = FALSE;
159 my_bool innobase_create_status_file = FALSE;
160 my_bool innobase_adaptive_hash_index = TRUE;
161 +my_bool innobase_fast_recovery = FALSE;
163 static char *internal_innobase_data_file_path = NULL;
165 @@ -1534,6 +1535,8 @@
166 srv_lock_wait_timeout = (ulint) innobase_lock_wait_timeout;
167 srv_force_recovery = (ulint) innobase_force_recovery;
169 + srv_fast_recovery = (ibool) innobase_fast_recovery;
171 srv_use_doublewrite_buf = (ibool) innobase_use_doublewrite;
172 srv_use_checksums = (ibool) innobase_use_checksums;
174 diff -ruN a/sql/ha_innodb.h b/sql/ha_innodb.h
175 --- a/sql/ha_innodb.h 2009-08-04 16:53:42.000000000 +0900
176 +++ b/sql/ha_innodb.h 2009-08-04 17:37:18.000000000 +0900
178 innobase_use_large_pages,
179 innobase_use_native_aio,
180 innobase_file_per_table, innobase_locks_unsafe_for_binlog,
181 + innobase_fast_recovery,
182 innobase_rollback_on_timeout,
183 innobase_create_status_file,
184 innobase_adaptive_hash_index;
185 diff -ruN a/sql/mysqld.cc b/sql/mysqld.cc
186 --- a/sql/mysqld.cc 2009-08-04 16:53:42.000000000 +0900
187 +++ b/sql/mysqld.cc 2009-08-04 17:48:25.000000000 +0900
188 @@ -5102,6 +5102,7 @@
189 OPT_INNODB_READ_IO_THREADS,
190 OPT_INNODB_WRITE_IO_THREADS,
191 OPT_INNODB_USE_SYS_MALLOC,
192 + OPT_INNODB_FAST_RECOVERY,
193 OPT_INNODB_THREAD_CONCURRENCY_TIMER_BASED,
194 OPT_INNODB_EXTRA_RSEGMENTS,
195 OPT_INNODB_DICT_SIZE_LIMIT,
196 @@ -5347,6 +5348,10 @@
197 {"innodb_doublewrite", OPT_INNODB_DOUBLEWRITE, "Enable InnoDB doublewrite buffer (enabled by default). \
198 Disable with --skip-innodb-doublewrite.", (gptr*) &innobase_use_doublewrite,
199 (gptr*) &innobase_use_doublewrite, 0, GET_BOOL, NO_ARG, 1, 0, 0, 0, 0, 0},
200 + {"innodb_fast_recovery", OPT_INNODB_FAST_RECOVERY,
201 + "Enable to use speed hack of recovery avoiding flush list sorting.",
202 + (gptr*) &innobase_fast_recovery, (gptr*) &innobase_fast_recovery,
203 + 0, GET_BOOL, NO_ARG, 0, 0, 0, 0, 0, 0},
204 {"innodb_fast_shutdown", OPT_INNODB_FAST_SHUTDOWN,
205 "Speeds up the shutdown process of the InnoDB storage engine. Possible "
206 "values are 0, 1 (faster)"
207 diff -ruN a/sql/set_var.cc b/sql/set_var.cc
208 --- a/sql/set_var.cc 2009-08-04 16:53:42.000000000 +0900
209 +++ b/sql/set_var.cc 2009-08-04 17:51:49.000000000 +0900
210 @@ -1088,6 +1088,7 @@
211 {"innodb_read_io_threads", (char*) &innobase_read_io_threads, SHOW_LONG},
212 {"innodb_write_io_threads", (char*) &innobase_write_io_threads, SHOW_LONG},
213 {"innodb_use_sys_malloc", (char*) &innobase_use_sys_malloc, SHOW_MY_BOOL},
214 + {"innodb_fast_recovery", (char*) &innobase_fast_recovery, SHOW_MY_BOOL},
215 {"innodb_thread_concurrency_timer_based", (char*) &innobase_thread_concurrency_timer_based, SHOW_MY_BOOL},
216 {"innodb_extra_rsegments", (char*) &innobase_extra_rsegments, SHOW_LONG},
217 {sys_innodb_dict_size_limit.name, (char*) &sys_innodb_dict_size_limit, SHOW_SYS},