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
=== modified file 'Percona-Server/storage/innobase/buf/buf0lru.c'
--- Percona-Server/storage/innobase/buf/buf0lru.c 2012-05-02 07:37:27 +0000
+++ Percona-Server/storage/innobase/buf/buf0lru.c 2012-05-18 15:36:27 +0000
@@ -48,6 +48,7 @@
48#include "page0zip.h"48#include "page0zip.h"
49#include "log0recv.h"49#include "log0recv.h"
50#include "srv0srv.h"50#include "srv0srv.h"
51#include "srv0start.h"
5152
52/** The number of blocks from the LRU_old pointer onward, including53/** The number of blocks from the LRU_old pointer onward, including
53the block pointed to, must be buf_pool->LRU_old_ratio/BUF_LRU_OLD_RATIO_DIV54the block pointed to, must be buf_pool->LRU_old_ratio/BUF_LRU_OLD_RATIO_DIV
@@ -2506,6 +2507,7 @@
2506/********************************************************************//**2507/********************************************************************//**
2507Dump the LRU page list to the specific file. */2508Dump the LRU page list to the specific file. */
2508#define LRU_DUMP_FILE "ib_lru_dump"2509#define LRU_DUMP_FILE "ib_lru_dump"
2510#define LRU_DUMP_TEMP_FILE "ib_lru_dump.tmp"
25092511
2510UNIV_INTERN2512UNIV_INTERN
2511ibool2513ibool
@@ -2540,8 +2542,10 @@
2540 goto end;2542 goto end;
2541 }2543 }
25422544
2543 dump_file = os_file_create(innodb_file_temp_key, LRU_DUMP_FILE, OS_FILE_OVERWRITE,2545 dump_file = os_file_create(innodb_file_temp_key, LRU_DUMP_TEMP_FILE,
2544 OS_FILE_NORMAL, OS_DATA_FILE, &success);2546 OS_FILE_OVERWRITE, OS_FILE_NORMAL, OS_DATA_FILE,
2547 &success);
2548
2545 if (!success) {2549 if (!success) {
2546 os_file_get_last_error(TRUE);2550 os_file_get_last_error(TRUE);
2547 fprintf(stderr,2551 fprintf(stderr,
@@ -2570,6 +2574,13 @@
2570 offset++;2574 offset++;
25712575
2572 if (offset == UNIV_PAGE_SIZE/4) {2576 if (offset == UNIV_PAGE_SIZE/4) {
2577 if (srv_shutdown_state != SRV_SHUTDOWN_NONE) {
2578 success = 0;
2579 fprintf(stderr,
2580 " InnoDB: stopped dumping lru"
2581 " pages because of server"
2582 " shutdown.\n");
2583 }
2573 success = os_file_write(LRU_DUMP_FILE, dump_file, buffer,2584 success = os_file_write(LRU_DUMP_FILE, dump_file, buffer,
2574 (buffers << UNIV_PAGE_SIZE_SHIFT) & 0xFFFFFFFFUL,2585 (buffers << UNIV_PAGE_SIZE_SHIFT) & 0xFFFFFFFFUL,
2575 (buffers >> (32 - UNIV_PAGE_SIZE_SHIFT)),2586 (buffers >> (32 - UNIV_PAGE_SIZE_SHIFT)),
@@ -2609,8 +2620,16 @@
26092620
2610 ret = TRUE;2621 ret = TRUE;
2611end:2622end:
2612 if (dump_file != -1)2623 if (dump_file != -1) {
2624 if (success) {
2625 success = os_file_flush(dump_file, TRUE);
2626 }
2613 os_file_close(dump_file);2627 os_file_close(dump_file);
2628 }
2629 if (success) {
2630 success = os_file_rename(innodb_file_temp_key,
2631 LRU_DUMP_TEMP_FILE, LRU_DUMP_FILE);
2632 }
2614 if (buffer_base)2633 if (buffer_base)
2615 ut_free(buffer_base);2634 ut_free(buffer_base);
26162635
@@ -2656,6 +2675,7 @@
2656 dump_record_t* records = NULL;2675 dump_record_t* records = NULL;
2657 ulint size;2676 ulint size;
2658 ulint size_high;2677 ulint size_high;
2678 ulint recsize = sizeof(dump_record_t);
2659 ulint length;2679 ulint length;
26602680
2661 dump_file = os_file_create_simple_no_error_handling(innodb_file_temp_key,2681 dump_file = os_file_create_simple_no_error_handling(innodb_file_temp_key,
@@ -2663,7 +2683,14 @@
2663 if (!success || !os_file_get_size(dump_file, &size, &size_high)) {2683 if (!success || !os_file_get_size(dump_file, &size, &size_high)) {
2664 os_file_get_last_error(TRUE);2684 os_file_get_last_error(TRUE);
2665 fprintf(stderr,2685 fprintf(stderr,
2666 " InnoDB: cannot open %s\n", LRU_DUMP_FILE);2686 " InnoDB: cannot open %s, "
2687 " buffer pool preload not done.\n", LRU_DUMP_FILE);
2688 goto end;
2689 }
2690
2691 if (size == 0 || size_high > 0 || size % recsize) {
2692 fprintf(stderr, " InnoDB: broken LRU dump file,"
2693 " buffer pool preload not done\n");
2667 goto end;2694 goto end;
2668 }2695 }
26692696
@@ -2747,6 +2774,14 @@
2747 if (offset % 16 == 15) {2774 if (offset % 16 == 15) {
2748 os_aio_simulated_wake_handler_threads();2775 os_aio_simulated_wake_handler_threads();
2749 buf_flush_free_margins(FALSE);2776 buf_flush_free_margins(FALSE);
2777 /* skip loading of the rest of the file if we are
2778 terminating anyway */
2779 if(srv_shutdown_state != SRV_SHUTDOWN_NONE) {
2780 fprintf(stderr,
2781 " InnoDB: stopped loading lru pages"
2782 " because of server shutdown\n");
2783 break;
2784 }
2750 }2785 }
27512786
2752 zip_size = fil_space_get_zip_size(space_id);2787 zip_size = fil_space_get_zip_size(space_id);

Subscribers

People subscribed via source and target branches