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

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

Description of the change

- Launchpad Bug #686392 : Buffer pool dump may result in incomplete dump file.
  - Dump will save to a temporary file first and rename it to the
    actual lru file on success.
  - Added dump file structure sanity checks on restore which were pulled
    from external sources.
- Launchpad Bug #712055 : Loading LRU dump prevents shutdown
  - Merged outside patch noted in lp bug and also implemented same logic
    when shutdown comes while performing actual dump.
- Launchpad Bug #713481 : Clean up messaging for LRU dump
  - Added verbiage to the 'missing file' message to make it not so scary.

jenkins result http://jenkins.percona.com/view/PS%205.5/job/percona-server-5.5-param/373/

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

Looks good, thank you!

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/innobase/buf/buf0lru.c'
2--- Percona-Server/storage/innobase/buf/buf0lru.c 2012-05-02 07:37:27 +0000
3+++ Percona-Server/storage/innobase/buf/buf0lru.c 2012-05-18 15:36:27 +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_pool->LRU_old_ratio/BUF_LRU_OLD_RATIO_DIV
12@@ -2506,6 +2507,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@@ -2540,8 +2542,10 @@
21 goto end;
22 }
23
24- dump_file = os_file_create(innodb_file_temp_key, LRU_DUMP_FILE, OS_FILE_OVERWRITE,
25- OS_FILE_NORMAL, OS_DATA_FILE, &success);
26+ dump_file = os_file_create(innodb_file_temp_key, LRU_DUMP_TEMP_FILE,
27+ OS_FILE_OVERWRITE, OS_FILE_NORMAL, OS_DATA_FILE,
28+ &success);
29+
30 if (!success) {
31 os_file_get_last_error(TRUE);
32 fprintf(stderr,
33@@ -2570,6 +2574,13 @@
34 offset++;
35
36 if (offset == UNIV_PAGE_SIZE/4) {
37+ if (srv_shutdown_state != SRV_SHUTDOWN_NONE) {
38+ success = 0;
39+ fprintf(stderr,
40+ " InnoDB: stopped dumping lru"
41+ " pages because of server"
42+ " shutdown.\n");
43+ }
44 success = os_file_write(LRU_DUMP_FILE, dump_file, buffer,
45 (buffers << UNIV_PAGE_SIZE_SHIFT) & 0xFFFFFFFFUL,
46 (buffers >> (32 - UNIV_PAGE_SIZE_SHIFT)),
47@@ -2609,8 +2620,16 @@
48
49 ret = TRUE;
50 end:
51- if (dump_file != -1)
52+ if (dump_file != -1) {
53+ if (success) {
54+ success = os_file_flush(dump_file, TRUE);
55+ }
56 os_file_close(dump_file);
57+ }
58+ if (success) {
59+ success = os_file_rename(innodb_file_temp_key,
60+ LRU_DUMP_TEMP_FILE, LRU_DUMP_FILE);
61+ }
62 if (buffer_base)
63 ut_free(buffer_base);
64
65@@ -2656,6 +2675,7 @@
66 dump_record_t* records = NULL;
67 ulint size;
68 ulint size_high;
69+ ulint recsize = sizeof(dump_record_t);
70 ulint length;
71
72 dump_file = os_file_create_simple_no_error_handling(innodb_file_temp_key,
73@@ -2663,7 +2683,14 @@
74 if (!success || !os_file_get_size(dump_file, &size, &size_high)) {
75 os_file_get_last_error(TRUE);
76 fprintf(stderr,
77- " InnoDB: cannot open %s\n", LRU_DUMP_FILE);
78+ " InnoDB: cannot open %s, "
79+ " buffer pool preload not done.\n", LRU_DUMP_FILE);
80+ goto end;
81+ }
82+
83+ if (size == 0 || size_high > 0 || size % recsize) {
84+ fprintf(stderr, " InnoDB: broken LRU dump file,"
85+ " buffer pool preload not done\n");
86 goto end;
87 }
88
89@@ -2747,6 +2774,14 @@
90 if (offset % 16 == 15) {
91 os_aio_simulated_wake_handler_threads();
92 buf_flush_free_margins(FALSE);
93+ /* skip loading of the rest of the file if we are
94+ terminating anyway */
95+ if(srv_shutdown_state != SRV_SHUTDOWN_NONE) {
96+ fprintf(stderr,
97+ " InnoDB: stopped loading lru pages"
98+ " because of server shutdown\n");
99+ break;
100+ }
101 }
102
103 zip_size = fil_space_get_zip_size(space_id);

Subscribers

People subscribed via source and target branches