Merge lp:~gl-az/percona-server/5.1-lru_dump_load_work into lp:percona-server/5.1

Proposed by George Ormond Lorch III
Status: Merged
Approved by: Alexey Kopytov
Approved revision: no longer in the source branch.
Merged at revision: 444
Proposed branch: lp:~gl-az/percona-server/5.1-lru_dump_load_work
Merge into: lp:percona-server/5.1
Diff against target: 100 lines (+37/-3)
1 file modified
Percona-Server/storage/innodb_plugin/buf/buf0lru.c (+37/-3)
To merge this branch: bzr merge lp:~gl-az/percona-server/5.1-lru_dump_load_work
Reviewer Review Type Date Requested Status
Alexey Kopytov (community) Approve
Review via email: mp+106114@code.launchpad.net

Description of the change

- Launchpad Bug #686392 : Buffer pool dump may result in incomplete dump file.
  - Implemented simple temp file on save and rename to real file on successful dump.
  - Carried over one or two dump file sanity checks from Alexey K prior work.
- Launchpad Bug #712055 : Loading LRU dump prevents shutdown
    - Merged patch noted in bug and also implemented same logic when shutdown comes while performing actual dump. Was able to test and verify its effectiveness with a 1G buffer pool and innodb_auto_lru_dump.
    - Tried to create a test case for this issue but I don't think a proper 'success' case can be built due to the need for a sizable, existing ib_lru_dump file and the natural race conditions ump/that this works with (there is no guarantee that the preload won't finish before the shutdown signal comes).
- Launchpad Bug #713481 : Clean up messaging for LRU dump
    - It appears that PS 5.1 already has begin/end messages for lru restore. Added some verbage to the missing file message to make it not so scary.

Jenkins results at: http://jenkins.percona.com/view/Percona%20Server%205.1/job/percona-server-5.1-param/320/

I am unsure about the failures but they _look_ like Jenkins issues..

To post a comment you must log in.
Revision history for this message
Alexey Kopytov (akopytov) wrote :

OK to merge, but please duplicate the MP description in the revision comment.

review: Approve

Preview Diff

[H/L] Next/Prev Comment, [J/K] Next/Prev File, [N/P] Next/Prev Hunk
1=== modified file 'Percona-Server/storage/innodb_plugin/buf/buf0lru.c'
2--- Percona-Server/storage/innodb_plugin/buf/buf0lru.c 2011-11-24 16:33:30 +0000
3+++ Percona-Server/storage/innodb_plugin/buf/buf0lru.c 2012-05-17 17:56:20 +0000
4@@ -48,6 +48,7 @@
5 #include "page0zip.h"
6 #include "log0recv.h"
7 #include "srv0srv.h"
8+#include "srv0start.h"
9
10 /** The number of blocks from the LRU_old pointer onward, including
11 the block pointed to, must be buf_LRU_old_ratio/BUF_LRU_OLD_RATIO_DIV
12@@ -2098,6 +2099,7 @@
13 /********************************************************************//**
14 Dump the LRU page list to the specific file. */
15 #define LRU_DUMP_FILE "ib_lru_dump"
16+#define LRU_DUMP_TEMP_FILE "ib_lru_dump.tmp"
17
18 UNIV_INTERN
19 ibool
20@@ -2132,7 +2134,7 @@
21 goto end;
22 }
23
24- dump_file = os_file_create(LRU_DUMP_FILE, OS_FILE_OVERWRITE,
25+ dump_file = os_file_create(LRU_DUMP_TEMP_FILE, OS_FILE_OVERWRITE,
26 OS_FILE_NORMAL, OS_DATA_FILE, &success);
27 if (!success) {
28 os_file_get_last_error(TRUE);
29@@ -2156,6 +2158,13 @@
30 offset++;
31
32 if (offset == UNIV_PAGE_SIZE/4) {
33+ if (srv_shutdown_state != SRV_SHUTDOWN_NONE) {
34+ success = 0;
35+ fprintf(stderr,
36+ " InnoDB: stopped dumping lru pages"
37+ " because of server shutdown.\n");
38+ goto end;
39+ }
40 success = os_file_write(LRU_DUMP_FILE, dump_file, buffer,
41 (buffers << UNIV_PAGE_SIZE_SHIFT) & 0xFFFFFFFFUL,
42 (buffers >> (32 - UNIV_PAGE_SIZE_SHIFT)),
43@@ -2194,8 +2203,16 @@
44
45 ret = TRUE;
46 end:
47- if (dump_file != -1)
48+ if (dump_file != -1) {
49+ if (success) {
50+ success = os_file_flush(dump_file, TRUE);
51+ }
52 os_file_close(dump_file);
53+ }
54+ if (success) {
55+ success = os_file_rename(LRU_DUMP_TEMP_FILE,
56+ LRU_DUMP_FILE);
57+ }
58 if (buffer_base)
59 ut_free(buffer_base);
60
61@@ -2241,6 +2258,7 @@
62 dump_record_t* records = NULL;
63 ulint size;
64 ulint size_high;
65+ ulint recsize = sizeof(dump_record_t);
66 ulint length;
67
68 dump_file = os_file_create_simple_no_error_handling(
69@@ -2248,7 +2266,15 @@
70 if (!success || !os_file_get_size(dump_file, &size, &size_high)) {
71 os_file_get_last_error(TRUE);
72 fprintf(stderr,
73- " InnoDB: cannot open %s\n", LRU_DUMP_FILE);
74+ " InnoDB: cannot open %s,"
75+ " buffer pool preload not done\n",
76+ LRU_DUMP_FILE);
77+ goto end;
78+ }
79+
80+ if (size == 0 || size_high > 0 || size % recsize) {
81+ fprintf(stderr, " InnoDB: broken LRU dump file,"
82+ " buffer pool preload not done\n");
83 goto end;
84 }
85
86@@ -2332,6 +2358,14 @@
87 if (offset % 16 == 15) {
88 os_aio_simulated_wake_handler_threads();
89 buf_flush_free_margin(FALSE);
90+ /* skip loading of the rest of the file if we are
91+ terminating anyway*/
92+ if (srv_shutdown_state != SRV_SHUTDOWN_NONE) {
93+ fprintf(stderr,
94+ " InnoDB: stopped loading LRU pages"
95+ " because of server shutdown.\n");
96+ break;
97+ }
98 }
99
100 zip_size = fil_space_get_zip_size(space_id);

Subscribers

People subscribed via source and target branches