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
=== modified file 'patches/innodb_lru_dump_restore.patch'
--- patches/innodb_lru_dump_restore.patch 2011-09-25 06:42:17 +0000
+++ patches/innodb_lru_dump_restore.patch 2011-09-25 06:42:18 +0000
@@ -41,7 +41,7 @@
41+--file_exists $MYSQLD_DATADIR/ib_lru_dump;41+--file_exists $MYSQLD_DATADIR/ib_lru_dump;
42--- a/storage/innodb_plugin/buf/buf0lru.c42--- a/storage/innodb_plugin/buf/buf0lru.c
43+++ b/storage/innodb_plugin/buf/buf0lru.c43+++ b/storage/innodb_plugin/buf/buf0lru.c
44@@ -2121,6 +2121,277 @@44@@ -2121,6 +2121,282 @@
45 memset(&buf_LRU_stat_cur, 0, sizeof buf_LRU_stat_cur);45 memset(&buf_LRU_stat_cur, 0, sizeof buf_LRU_stat_cur);
46 }46 }
47 47
@@ -201,6 +201,11 @@
201+ " InnoDB: cannot open %s\n", LRU_DUMP_FILE);201+ " InnoDB: cannot open %s\n", LRU_DUMP_FILE);
202+ goto end;202+ goto end;
203+ }203+ }
204+
205+ ut_print_timestamp(stderr);
206+ fprintf(stderr, " InnoDB: Restoring buffer pool pages from %s\n",
207+ LRU_DUMP_FILE);
208+
204+ if (size == 0 || size_high > 0 || size % 8) {209+ if (size == 0 || size_high > 0 || size % 8) {
205+ fprintf(stderr, " InnoDB: broken LRU dump file\n");210+ fprintf(stderr, " InnoDB: broken LRU dump file\n");
206+ goto end;211+ goto end;
@@ -302,7 +307,7 @@
302+307+
303+ ut_print_timestamp(stderr);308+ ut_print_timestamp(stderr);
304+ fprintf(stderr,309+ fprintf(stderr,
305+ " InnoDB: reading pages based on the dumped LRU list was done."310+ " InnoDB: Completed reading buffer pool pages"
306+ " (requested: %lu, read: %lu)\n", req, reads);311+ " (requested: %lu, read: %lu)\n", req, reads);
307+ ret = TRUE;312+ ret = TRUE;
308+end:313+end:
@@ -405,7 +410,25 @@
405 Waits for an aio operation to complete. This function is used to write the410 Waits for an aio operation to complete. This function is used to write the
406--- a/storage/innodb_plugin/handler/ha_innodb.cc411--- a/storage/innodb_plugin/handler/ha_innodb.cc
407+++ b/storage/innodb_plugin/handler/ha_innodb.cc412+++ b/storage/innodb_plugin/handler/ha_innodb.cc
408@@ -11478,6 +11478,12 @@413@@ -197,6 +197,8 @@
414
415 static char* innodb_version_str = (char*) INNODB_VERSION_STR;
416
417+static my_bool innobase_blocking_lru_restore = FALSE;
418+
419 /** Possible values for system variable "innodb_stats_method". The values
420 are defined the same as its corresponding MyISAM system variable
421 "myisam_stats_method"(see "myisam_stats_method_names"), for better usability */
422@@ -2408,6 +2410,8 @@
423 srv_use_doublewrite_buf = (ibool) innobase_use_doublewrite;
424 srv_use_checksums = (ibool) innobase_use_checksums;
425
426+ srv_blocking_lru_restore = (ibool) innobase_blocking_lru_restore;
427+
428 #ifdef HAVE_LARGE_PAGES
429 if ((os_use_large_pages = (ibool) my_use_large_pages))
430 os_large_page_size = (ulint) opt_large_page_size;
431@@ -11478,6 +11482,18 @@
409 "Limit the allocated memory for dictionary cache. (0: unlimited)",432 "Limit the allocated memory for dictionary cache. (0: unlimited)",
410 NULL, NULL, 0, 0, LONG_MAX, 0);433 NULL, NULL, 0, 0, LONG_MAX, 0);
411 434
@@ -415,14 +438,21 @@
415+ "0 (the default) disables automatic dumps.",438+ "0 (the default) disables automatic dumps.",
416+ NULL, NULL, 0, 0, UINT_MAX32, 0);439+ NULL, NULL, 0, 0, UINT_MAX32, 0);
417+440+
441+static MYSQL_SYSVAR_BOOL(blocking_lru_restore, innobase_blocking_lru_restore,
442+ PLUGIN_VAR_NOCMDARG | PLUGIN_VAR_READONLY,
443+ "Block XtraDB startup process until buffer pool is full restored from a "
444+ "dump file (if present). Disabled by default.",
445+ NULL, NULL, FALSE);
446+
418 static struct st_mysql_sys_var* innobase_system_variables[]= {447 static struct st_mysql_sys_var* innobase_system_variables[]= {
419 MYSQL_SYSVAR(additional_mem_pool_size),448 MYSQL_SYSVAR(additional_mem_pool_size),
420 MYSQL_SYSVAR(autoextend_increment),449 MYSQL_SYSVAR(autoextend_increment),
421@@ -11557,6 +11563,7 @@450@@ -11557,6 +11573,8 @@
422 #endif /* UNIV_DEBUG || UNIV_IBUF_DEBUG */451 #endif /* UNIV_DEBUG || UNIV_IBUF_DEBUG */
423 MYSQL_SYSVAR(read_ahead_threshold),452 MYSQL_SYSVAR(read_ahead_threshold),
424 MYSQL_SYSVAR(io_capacity),453 MYSQL_SYSVAR(io_capacity),
425+ MYSQL_SYSVAR(auto_lru_dump),454+ MYSQL_SYSVAR(auto_lru_dump),
455+ MYSQL_SYSVAR(blocking_lru_restore),
426 MYSQL_SYSVAR(use_purge_thread),456 MYSQL_SYSVAR(use_purge_thread),
427 NULL457 NULL
428 };458 };
@@ -562,17 +592,20 @@
562 handler for completed requests. The aio array of pending requests is divided592 handler for completed requests. The aio array of pending requests is divided
563--- a/storage/innodb_plugin/include/srv0srv.h593--- a/storage/innodb_plugin/include/srv0srv.h
564+++ b/storage/innodb_plugin/include/srv0srv.h594+++ b/storage/innodb_plugin/include/srv0srv.h
565@@ -332,6 +332,9 @@595@@ -332,6 +332,12 @@
566 reading of a disk page */596 reading of a disk page */
567 extern ulint srv_buf_pool_reads;597 extern ulint srv_buf_pool_reads;
568 598
569+/** Time in seconds between automatic buffer pool dumps */599+/** Time in seconds between automatic buffer pool dumps */
570+extern uint srv_auto_lru_dump;600+extern uint srv_auto_lru_dump;
571+601+
602+/** Whether startup should be blocked until buffer pool is fully restored */
603+extern ibool srv_blocking_lru_restore;
604+
572 /** Status variables to be passed to MySQL */605 /** Status variables to be passed to MySQL */
573 typedef struct export_var_struct export_struc;606 typedef struct export_var_struct export_struc;
574 607
575@@ -613,6 +616,16 @@608@@ -613,6 +619,16 @@
576 /*=====================*/609 /*=====================*/
577 void* arg); /*!< in: a dummy parameter required by610 void* arg); /*!< in: a dummy parameter required by
578 os_thread_create */611 os_thread_create */
@@ -591,17 +624,20 @@
591 @return FALSE if not all information printed624 @return FALSE if not all information printed
592--- a/storage/innodb_plugin/srv/srv0srv.c625--- a/storage/innodb_plugin/srv/srv0srv.c
593+++ b/storage/innodb_plugin/srv/srv0srv.c626+++ b/storage/innodb_plugin/srv/srv0srv.c
594@@ -303,6 +303,9 @@627@@ -303,6 +303,12 @@
595 reading of a disk page */628 reading of a disk page */
596 UNIV_INTERN ulint srv_buf_pool_reads = 0;629 UNIV_INTERN ulint srv_buf_pool_reads = 0;
597 630
598+/** Time in seconds between automatic buffer pool dumps */631+/** Time in seconds between automatic buffer pool dumps */
599+UNIV_INTERN uint srv_auto_lru_dump = 0;632+UNIV_INTERN uint srv_auto_lru_dump = 0;
600+633+
634+/** Whether startup should be blocked until buffer pool is fully restored */
635+UNIV_INTERN ibool srv_blocking_lru_restore;
636+
601 /* structure to pass status variables to MySQL */637 /* structure to pass status variables to MySQL */
602 UNIV_INTERN export_struc export_vars;638 UNIV_INTERN export_struc export_vars;
603 639
604@@ -2552,6 +2555,56 @@640@@ -2552,6 +2558,58 @@
605 OS_THREAD_DUMMY_RETURN;641 OS_THREAD_DUMMY_RETURN;
606 }642 }
607 643
@@ -626,7 +662,9 @@
626+ os_thread_pf(os_thread_get_curr_id()));662+ os_thread_pf(os_thread_get_curr_id()));
627+#endif663+#endif
628+664+
629+ if (srv_auto_lru_dump)665+ /* If srv_blocking_lru_restore is TRUE, restore will be done
666+ synchronously on startup. */
667+ if (srv_auto_lru_dump && !srv_blocking_lru_restore)
630+ buf_LRU_file_restore();668+ buf_LRU_file_restore();
631+669+
632+ last_dump_time = time(NULL);670+ last_dump_time = time(NULL);
@@ -660,7 +698,15 @@
660 and wakes up the master thread if it is suspended (not sleeping). Used698 and wakes up the master thread if it is suspended (not sleeping). Used
661--- a/storage/innodb_plugin/srv/srv0start.c699--- a/storage/innodb_plugin/srv/srv0start.c
662+++ b/storage/innodb_plugin/srv/srv0start.c700+++ b/storage/innodb_plugin/srv/srv0start.c
663@@ -126,9 +126,9 @@701@@ -88,6 +88,7 @@
702 # include "thr0loc.h"
703 # include "os0sync.h" /* for INNODB_RW_LOCKS_USE_ATOMICS */
704 # include "zlib.h" /* for ZLIB_VERSION */
705+# include "buf0lru.h" /* for buf_LRU_file_restore() */
706
707 /** Log sequence number immediately after startup */
708 UNIV_INTERN ib_uint64_t srv_start_lsn;
709@@ -126,9 +127,9 @@
664 static ulint ios;710 static ulint ios;
665 711
666 /** io_handler_thread parameters for thread identification */712 /** io_handler_thread parameters for thread identification */
@@ -672,7 +718,7 @@
672 718
673 /** We use this mutex to test the return value of pthread_mutex_trylock719 /** We use this mutex to test the return value of pthread_mutex_trylock
674 on successful locking. HP-UX does NOT return 0, though Linux et al do. */720 on successful locking. HP-UX does NOT return 0, though Linux et al do. */
675@@ -1706,6 +1706,10 @@721@@ -1706,6 +1707,15 @@
676 os_thread_create(&srv_monitor_thread, NULL,722 os_thread_create(&srv_monitor_thread, NULL,
677 thread_ids + 4 + SRV_MAX_N_IO_THREADS);723 thread_ids + 4 + SRV_MAX_N_IO_THREADS);
678 724
@@ -680,10 +726,15 @@
680+ os_thread_create(&srv_LRU_dump_restore_thread, NULL,726+ os_thread_create(&srv_LRU_dump_restore_thread, NULL,
681+ thread_ids + 5 + SRV_MAX_N_IO_THREADS);727+ thread_ids + 5 + SRV_MAX_N_IO_THREADS);
682+728+
729+ /* If srv_blocking_lru_restore is TRUE, load buffer pool contents
730+ synchronously */
731+ if (srv_auto_lru_dump && srv_blocking_lru_restore)
732+ buf_LRU_file_restore();
733+
683 srv_is_being_started = FALSE;734 srv_is_being_started = FALSE;
684 735
685 if (trx_doublewrite == NULL) {736 if (trx_doublewrite == NULL) {
686@@ -1730,13 +1734,13 @@737@@ -1730,13 +1740,13 @@
687 ulint i;738 ulint i;
688 739
689 os_thread_create(&srv_purge_thread, NULL, thread_ids740 os_thread_create(&srv_purge_thread, NULL, thread_ids
690741
=== modified file 'patches/mysql-test.diff'
--- patches/mysql-test.diff 2011-09-12 12:25:39 +0000
+++ patches/mysql-test.diff 2011-09-25 06:42:18 +0000
@@ -4093,6 +4093,7 @@
4093+INNODB_AUTOEXTEND_INCREMENT4093+INNODB_AUTOEXTEND_INCREMENT
4094+INNODB_AUTOINC_LOCK_MODE4094+INNODB_AUTOINC_LOCK_MODE
4095+INNODB_AUTO_LRU_DUMP4095+INNODB_AUTO_LRU_DUMP
4096+INNODB_BLOCKING_LRU_RESTORE
4096+INNODB_BUFFER_POOL_SHM_CHECKSUM4097+INNODB_BUFFER_POOL_SHM_CHECKSUM
4097+INNODB_BUFFER_POOL_SHM_KEY4098+INNODB_BUFFER_POOL_SHM_KEY
4098+INNODB_BUFFER_POOL_SIZE4099+INNODB_BUFFER_POOL_SIZE
@@ -4441,6 +4442,7 @@
4441+INNODB_AUTOEXTEND_INCREMENT4442+INNODB_AUTOEXTEND_INCREMENT
4442+INNODB_AUTOINC_LOCK_MODE4443+INNODB_AUTOINC_LOCK_MODE
4443+INNODB_AUTO_LRU_DUMP4444+INNODB_AUTO_LRU_DUMP
4445+INNODB_BLOCKING_LRU_RESTORE
4444+INNODB_BUFFER_POOL_SHM_CHECKSUM4446+INNODB_BUFFER_POOL_SHM_CHECKSUM
4445+INNODB_BUFFER_POOL_SHM_KEY4447+INNODB_BUFFER_POOL_SHM_KEY
4446+INNODB_BUFFER_POOL_SIZE4448+INNODB_BUFFER_POOL_SIZE

Subscribers

People subscribed via source and target branches