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

Proposed by Alexey Kopytov
Status: Merged
Approved by: Stewart Smith
Approved revision: no longer in the source branch.
Merged at revision: 295
Proposed branch: lp:~akopytov/percona-server/bug785489-5.1
Merge into: lp:percona-server/5.1
Prerequisite: lp:~akopytov/percona-server/bug858467-5.1
Diff against target: 203 lines (+65/-12)
2 files modified
patches/innodb_lru_dump_restore.patch (+63/-12)
patches/mysql-test.diff (+2/-0)
To merge this branch: bzr merge lp:~akopytov/percona-server/bug785489-5.1
Reviewer Review Type Date Requested Status
Stewart Smith (community) Approve
Review via email: mp+76886@code.launchpad.net

This proposal supersedes a proposal from 2011-09-25.

To post a comment you must log in.
Revision history for this message
Alexey Kopytov (akopytov) wrote : Posted in a previous version of this proposal
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-09-25 06:42:17 +0000
3+++ patches/innodb_lru_dump_restore.patch 2011-09-25 06:42:18 +0000
4@@ -41,7 +41,7 @@
5 +--file_exists $MYSQLD_DATADIR/ib_lru_dump;
6 --- a/storage/innodb_plugin/buf/buf0lru.c
7 +++ b/storage/innodb_plugin/buf/buf0lru.c
8-@@ -2121,6 +2121,277 @@
9+@@ -2121,6 +2121,282 @@
10 memset(&buf_LRU_stat_cur, 0, sizeof buf_LRU_stat_cur);
11 }
12
13@@ -201,6 +201,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@@ -302,7 +307,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@@ -405,7 +410,25 @@
35 Waits for an aio operation to complete. This function is used to write the
36 --- a/storage/innodb_plugin/handler/ha_innodb.cc
37 +++ b/storage/innodb_plugin/handler/ha_innodb.cc
38-@@ -11478,6 +11478,12 @@
39+@@ -197,6 +197,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+@@ -2408,6 +2410,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+@@ -11478,6 +11482,18 @@
58 "Limit the allocated memory for dictionary cache. (0: unlimited)",
59 NULL, NULL, 0, 0, LONG_MAX, 0);
60
61@@ -415,14 +438,21 @@
62 + "0 (the default) disables automatic dumps.",
63 + NULL, NULL, 0, 0, UINT_MAX32, 0);
64 +
65++static MYSQL_SYSVAR_BOOL(blocking_lru_restore, innobase_blocking_lru_restore,
66++ PLUGIN_VAR_NOCMDARG | PLUGIN_VAR_READONLY,
67++ "Block XtraDB startup process until buffer pool is full restored from a "
68++ "dump file (if present). Disabled by default.",
69++ NULL, NULL, FALSE);
70++
71 static struct st_mysql_sys_var* innobase_system_variables[]= {
72 MYSQL_SYSVAR(additional_mem_pool_size),
73 MYSQL_SYSVAR(autoextend_increment),
74-@@ -11557,6 +11563,7 @@
75+@@ -11557,6 +11573,8 @@
76 #endif /* UNIV_DEBUG || UNIV_IBUF_DEBUG */
77 MYSQL_SYSVAR(read_ahead_threshold),
78 MYSQL_SYSVAR(io_capacity),
79 + MYSQL_SYSVAR(auto_lru_dump),
80++ MYSQL_SYSVAR(blocking_lru_restore),
81 MYSQL_SYSVAR(use_purge_thread),
82 NULL
83 };
84@@ -562,17 +592,20 @@
85 handler for completed requests. The aio array of pending requests is divided
86 --- a/storage/innodb_plugin/include/srv0srv.h
87 +++ b/storage/innodb_plugin/include/srv0srv.h
88-@@ -332,6 +332,9 @@
89+@@ -332,6 +332,12 @@
90 reading of a disk page */
91 extern ulint srv_buf_pool_reads;
92
93 +/** Time in seconds between automatic buffer pool dumps */
94 +extern uint srv_auto_lru_dump;
95 +
96++/** Whether startup should be blocked until buffer pool is fully restored */
97++extern ibool srv_blocking_lru_restore;
98++
99 /** Status variables to be passed to MySQL */
100 typedef struct export_var_struct export_struc;
101
102-@@ -613,6 +616,16 @@
103+@@ -613,6 +619,16 @@
104 /*=====================*/
105 void* arg); /*!< in: a dummy parameter required by
106 os_thread_create */
107@@ -591,17 +624,20 @@
108 @return FALSE if not all information printed
109 --- a/storage/innodb_plugin/srv/srv0srv.c
110 +++ b/storage/innodb_plugin/srv/srv0srv.c
111-@@ -303,6 +303,9 @@
112+@@ -303,6 +303,12 @@
113 reading of a disk page */
114 UNIV_INTERN ulint srv_buf_pool_reads = 0;
115
116 +/** Time in seconds between automatic buffer pool dumps */
117 +UNIV_INTERN uint srv_auto_lru_dump = 0;
118 +
119++/** Whether startup should be blocked until buffer pool is fully restored */
120++UNIV_INTERN ibool srv_blocking_lru_restore;
121++
122 /* structure to pass status variables to MySQL */
123 UNIV_INTERN export_struc export_vars;
124
125-@@ -2552,6 +2555,56 @@
126+@@ -2552,6 +2558,58 @@
127 OS_THREAD_DUMMY_RETURN;
128 }
129
130@@ -626,7 +662,9 @@
131 + os_thread_pf(os_thread_get_curr_id()));
132 +#endif
133 +
134-+ if (srv_auto_lru_dump)
135++ /* If srv_blocking_lru_restore is TRUE, restore will be done
136++ synchronously on startup. */
137++ if (srv_auto_lru_dump && !srv_blocking_lru_restore)
138 + buf_LRU_file_restore();
139 +
140 + last_dump_time = time(NULL);
141@@ -660,7 +698,15 @@
142 and wakes up the master thread if it is suspended (not sleeping). Used
143 --- a/storage/innodb_plugin/srv/srv0start.c
144 +++ b/storage/innodb_plugin/srv/srv0start.c
145-@@ -126,9 +126,9 @@
146+@@ -88,6 +88,7 @@
147+ # include "thr0loc.h"
148+ # include "os0sync.h" /* for INNODB_RW_LOCKS_USE_ATOMICS */
149+ # include "zlib.h" /* for ZLIB_VERSION */
150++# include "buf0lru.h" /* for buf_LRU_file_restore() */
151+
152+ /** Log sequence number immediately after startup */
153+ UNIV_INTERN ib_uint64_t srv_start_lsn;
154+@@ -126,9 +127,9 @@
155 static ulint ios;
156
157 /** io_handler_thread parameters for thread identification */
158@@ -672,7 +718,7 @@
159
160 /** We use this mutex to test the return value of pthread_mutex_trylock
161 on successful locking. HP-UX does NOT return 0, though Linux et al do. */
162-@@ -1706,6 +1706,10 @@
163+@@ -1706,6 +1707,15 @@
164 os_thread_create(&srv_monitor_thread, NULL,
165 thread_ids + 4 + SRV_MAX_N_IO_THREADS);
166
167@@ -680,10 +726,15 @@
168 + os_thread_create(&srv_LRU_dump_restore_thread, NULL,
169 + thread_ids + 5 + SRV_MAX_N_IO_THREADS);
170 +
171++ /* If srv_blocking_lru_restore is TRUE, load buffer pool contents
172++ synchronously */
173++ if (srv_auto_lru_dump && srv_blocking_lru_restore)
174++ buf_LRU_file_restore();
175++
176 srv_is_being_started = FALSE;
177
178 if (trx_doublewrite == NULL) {
179-@@ -1730,13 +1734,13 @@
180+@@ -1730,13 +1740,13 @@
181 ulint i;
182
183 os_thread_create(&srv_purge_thread, NULL, thread_ids
184
185=== modified file 'patches/mysql-test.diff'
186--- patches/mysql-test.diff 2011-09-12 12:25:39 +0000
187+++ patches/mysql-test.diff 2011-09-25 06:42:18 +0000
188@@ -4093,6 +4093,7 @@
189 +INNODB_AUTOEXTEND_INCREMENT
190 +INNODB_AUTOINC_LOCK_MODE
191 +INNODB_AUTO_LRU_DUMP
192++INNODB_BLOCKING_LRU_RESTORE
193 +INNODB_BUFFER_POOL_SHM_CHECKSUM
194 +INNODB_BUFFER_POOL_SHM_KEY
195 +INNODB_BUFFER_POOL_SIZE
196@@ -4441,6 +4442,7 @@
197 +INNODB_AUTOEXTEND_INCREMENT
198 +INNODB_AUTOINC_LOCK_MODE
199 +INNODB_AUTO_LRU_DUMP
200++INNODB_BLOCKING_LRU_RESTORE
201 +INNODB_BUFFER_POOL_SHM_CHECKSUM
202 +INNODB_BUFFER_POOL_SHM_KEY
203 +INNODB_BUFFER_POOL_SIZE

Subscribers

People subscribed via source and target branches