Merge lp:~akopytov/percona-server/bug785489-5.5 into lp:percona-server/5.5

Proposed by Alexey Kopytov
Status: Merged
Approved by: Stewart Smith
Approved revision: no longer in the source branch.
Merged at revision: 165
Proposed branch: lp:~akopytov/percona-server/bug785489-5.5
Merge into: lp:percona-server/5.5
Diff against target: 227 lines (+77/-13)
2 files modified
patches/innodb_lru_dump_restore.patch (+73/-11)
patches/mysql-test.diff (+4/-2)
To merge this branch: bzr merge lp:~akopytov/percona-server/bug785489-5.5
Reviewer Review Type Date Requested Status
Stewart Smith (community) Approve
Review via email: mp+76895@code.launchpad.net
To post a comment you must log in.
Revision history for this message
Alexey Kopytov (akopytov) wrote :
Revision history for this message
Stewart Smith (stewart) :
review: Approve
Revision history for this message
Stewart Smith (stewart) :
review: Approve

Preview Diff

[H/L] Next/Prev Comment, [J/K] Next/Prev File, [N/P] Next/Prev Hunk
1=== modified file 'patches/innodb_lru_dump_restore.patch'
2--- patches/innodb_lru_dump_restore.patch 2011-08-09 20:52:20 +0000
3+++ patches/innodb_lru_dump_restore.patch 2011-09-25 09:54:24 +0000
4@@ -7,7 +7,7 @@
5 # should be done or reviewed by the maintainer!
6 --- a/storage/innobase/buf/buf0lru.c
7 +++ b/storage/innobase/buf/buf0lru.c
8-@@ -2167,6 +2167,284 @@
9+@@ -2167,6 +2167,289 @@
10 memset(&buf_LRU_stat_cur, 0, sizeof buf_LRU_stat_cur);
11 }
12
13@@ -174,6 +174,11 @@
14 + " InnoDB: cannot open %s\n", LRU_DUMP_FILE);
15 + goto end;
16 + }
17++
18++ ut_print_timestamp(stderr);
19++ fprintf(stderr, " InnoDB: Restoring buffer pool pages from %s\n",
20++ LRU_DUMP_FILE);
21++
22 + if (size == 0 || size_high > 0 || size % 8) {
23 + fprintf(stderr, " InnoDB: broken LRU dump file\n");
24 + goto end;
25@@ -275,7 +280,7 @@
26 +
27 + ut_print_timestamp(stderr);
28 + fprintf(stderr,
29-+ " InnoDB: reading pages based on the dumped LRU list was done."
30++ " InnoDB: Completed reading buffer pool pages"
31 + " (requested: %lu, read: %lu)\n", req, reads);
32 + ret = TRUE;
33 +end:
34@@ -378,7 +383,25 @@
35 Waits for an aio operation to complete. This function is used to write the
36 --- a/storage/innobase/handler/ha_innodb.cc
37 +++ b/storage/innobase/handler/ha_innodb.cc
38-@@ -11809,6 +11809,12 @@
39+@@ -196,6 +196,8 @@
40+
41+ static char* innodb_version_str = (char*) INNODB_VERSION_STR;
42+
43++static my_bool innobase_blocking_lru_restore = FALSE;
44++
45+ /** Possible values for system variable "innodb_stats_method". The values
46+ are defined the same as its corresponding MyISAM system variable
47+ "myisam_stats_method"(see "myisam_stats_method_names"), for better usability */
48+@@ -2623,6 +2625,8 @@
49+ srv_use_doublewrite_buf = (ibool) innobase_use_doublewrite;
50+ srv_use_checksums = (ibool) innobase_use_checksums;
51+
52++ srv_blocking_lru_restore = (ibool) innobase_blocking_lru_restore;
53++
54+ #ifdef HAVE_LARGE_PAGES
55+ if ((os_use_large_pages = (ibool) my_use_large_pages))
56+ os_large_page_size = (ulint) opt_large_page_size;
57+@@ -11809,6 +11813,19 @@
58 "Limit the allocated memory for dictionary cache. (0: unlimited)",
59 NULL, NULL, 0, 0, LONG_MAX, 0);
60
61@@ -388,14 +411,22 @@
62 + "0 (the default) disables automatic dumps.",
63 + NULL, NULL, 0, 0, UINT_MAX32, 0);
64 +
65++static MYSQL_SYSVAR_BOOL(blocking_buffer_pool_restore,
66++ innobase_blocking_lru_restore,
67++ PLUGIN_VAR_NOCMDARG | PLUGIN_VAR_READONLY,
68++ "Block XtraDB startup process until buffer pool is full restored from a "
69++ "dump file (if present). Disabled by default.",
70++ NULL, NULL, FALSE);
71++
72 static struct st_mysql_sys_var* innobase_system_variables[]= {
73 MYSQL_SYSVAR(additional_mem_pool_size),
74 MYSQL_SYSVAR(autoextend_increment),
75-@@ -11891,6 +11897,7 @@
76+@@ -11891,6 +11908,8 @@
77 #endif /* UNIV_DEBUG || UNIV_IBUF_DEBUG */
78 MYSQL_SYSVAR(read_ahead_threshold),
79 MYSQL_SYSVAR(io_capacity),
80 + MYSQL_SYSVAR(buffer_pool_restore_at_startup),
81++ MYSQL_SYSVAR(blocking_buffer_pool_restore),
82 MYSQL_SYSVAR(purge_threads),
83 MYSQL_SYSVAR(purge_batch_size),
84 MYSQL_SYSVAR(rollback_segments),
85@@ -526,17 +557,20 @@
86 handler for completed requests. The aio array of pending requests is divided
87 --- a/storage/innobase/include/srv0srv.h
88 +++ b/storage/innobase/include/srv0srv.h
89-@@ -356,6 +356,9 @@
90+@@ -356,6 +356,12 @@
91 reading of a disk page */
92 extern ulint srv_buf_pool_reads;
93
94 +/** Time in seconds between automatic buffer pool dumps */
95 +extern uint srv_auto_lru_dump;
96 +
97++/** Whether startup should be blocked until buffer pool is fully restored */
98++extern ibool srv_blocking_lru_restore;
99++
100 /** Status variables to be passed to MySQL */
101 typedef struct export_var_struct export_struc;
102
103-@@ -661,6 +664,16 @@
104+@@ -661,6 +667,16 @@
105 /*=====================*/
106 void* arg); /*!< in: a dummy parameter required by
107 os_thread_create */
108@@ -555,17 +589,20 @@
109 @return FALSE if not all information printed
110 --- a/storage/innobase/srv/srv0srv.c
111 +++ b/storage/innobase/srv/srv0srv.c
112-@@ -330,6 +330,9 @@
113+@@ -330,6 +330,12 @@
114 reading of a disk page */
115 UNIV_INTERN ulint srv_buf_pool_reads = 0;
116
117 +/** Time in seconds between automatic buffer pool dumps */
118 +UNIV_INTERN uint srv_auto_lru_dump = 0;
119 +
120++/** Whether startup should be blocked until buffer pool is fully restored */
121++UNIV_INTERN ibool srv_blocking_lru_restore;
122++
123 /* structure to pass status variables to MySQL */
124 UNIV_INTERN export_struc export_vars;
125
126-@@ -2706,6 +2709,56 @@
127+@@ -2706,6 +2712,58 @@
128 OS_THREAD_DUMMY_RETURN;
129 }
130
131@@ -590,7 +627,9 @@
132 + os_thread_pf(os_thread_get_curr_id()));
133 +#endif
134 +
135-+ if (srv_auto_lru_dump)
136++ /* If srv_blocking_lru_restore is TRUE, restore will be done
137++ synchronously on startup. */
138++ if (srv_auto_lru_dump && !srv_blocking_lru_restore)
139 + buf_LRU_file_restore();
140 +
141 + last_dump_time = time(NULL);
142@@ -624,7 +663,15 @@
143 @return FALSE if all are are suspended or have exited. */
144 --- a/storage/innobase/srv/srv0start.c
145 +++ b/storage/innobase/srv/srv0start.c
146-@@ -120,9 +120,9 @@
147+@@ -87,6 +87,7 @@
148+ # include "btr0pcur.h"
149+ # include "os0sync.h" /* for INNODB_RW_LOCKS_USE_ATOMICS */
150+ # include "zlib.h" /* for ZLIB_VERSION */
151++# include "buf0lru.h" /* for buf_LRU_file_restore() */
152+
153+ /** Log sequence number immediately after startup */
154+ UNIV_INTERN ib_uint64_t srv_start_lsn;
155+@@ -120,9 +121,9 @@
156 static os_file_t files[1000];
157
158 /** io_handler_thread parameters for thread identification */
159@@ -636,7 +683,7 @@
160
161 /** We use this mutex to test the return value of pthread_mutex_trylock
162 on successful locking. HP-UX does NOT return 0, though Linux et al do. */
163-@@ -1821,6 +1821,10 @@
164+@@ -1821,6 +1822,15 @@
165 os_thread_create(&srv_monitor_thread, NULL,
166 thread_ids + 4 + SRV_MAX_N_IO_THREADS);
167
168@@ -644,6 +691,21 @@
169 + os_thread_create(&srv_LRU_dump_restore_thread, NULL,
170 + thread_ids + 5 + SRV_MAX_N_IO_THREADS);
171 +
172++ /* If srv_blocking_lru_restore is TRUE, load buffer pool contents
173++ synchronously */
174++ if (srv_auto_lru_dump && srv_blocking_lru_restore)
175++ buf_LRU_file_restore();
176++
177 srv_is_being_started = FALSE;
178
179 err = dict_create_or_check_foreign_constraint_tables();
180+--- /dev/null
181++++ b/mysql-test/suite/sys_vars/r/innodb_blocking_buffer_pool_restore_basic.result
182+@@ -0,0 +1,3 @@
183++SELECT @@global.innodb_blocking_buffer_pool_restore;
184++@@global.innodb_blocking_buffer_pool_restore
185++0
186+--- /dev/null
187++++ b/mysql-test/suite/sys_vars/t/innodb_blocking_buffer_pool_restore_basic.test
188+@@ -0,0 +1 @@
189++SELECT @@global.innodb_blocking_buffer_pool_restore;
190
191=== modified file 'patches/mysql-test.diff'
192--- patches/mysql-test.diff 2011-09-07 14:00:24 +0000
193+++ patches/mysql-test.diff 2011-09-25 09:54:24 +0000
194@@ -1297,7 +1297,7 @@
195 +SELECT Variable_name FROM INFORMATION_SCHEMA.SESSION_VARIABLES ORDER BY 1;
196 --- /dev/null
197 +++ b/mysql-test/r/percona_server_variables_debug.result
198-@@ -0,0 +1,373 @@
199+@@ -0,0 +1,374 @@
200 +SELECT Variable_name FROM INFORMATION_SCHEMA.SESSION_VARIABLES ORDER BY 1;
201 +Variable_name
202 +AUTOCOMMIT
203@@ -1383,6 +1383,7 @@
204 +INNODB_ADDITIONAL_MEM_POOL_SIZE
205 +INNODB_AUTOEXTEND_INCREMENT
206 +INNODB_AUTOINC_LOCK_MODE
207++INNODB_BLOCKING_BUFFER_POOL_RESTORE
208 +INNODB_BUFFER_POOL_INSTANCES
209 +INNODB_BUFFER_POOL_RESTORE_AT_STARTUP
210 +INNODB_BUFFER_POOL_SHM_CHECKSUM
211@@ -1673,7 +1674,7 @@
212 +WARNING_COUNT
213 --- /dev/null
214 +++ b/mysql-test/r/percona_server_variables_release.result
215-@@ -0,0 +1,369 @@
216+@@ -0,0 +1,370 @@
217 +SELECT Variable_name FROM INFORMATION_SCHEMA.SESSION_VARIABLES ORDER BY 1;
218 +Variable_name
219 +AUTOCOMMIT
220@@ -1757,6 +1758,7 @@
221 +INNODB_ADDITIONAL_MEM_POOL_SIZE
222 +INNODB_AUTOEXTEND_INCREMENT
223 +INNODB_AUTOINC_LOCK_MODE
224++INNODB_BLOCKING_BUFFER_POOL_RESTORE
225 +INNODB_BUFFER_POOL_INSTANCES
226 +INNODB_BUFFER_POOL_RESTORE_AT_STARTUP
227 +INNODB_BUFFER_POOL_SHM_CHECKSUM

Subscribers

People subscribed via source and target branches