激情五月天婷婷,亚洲愉拍一区二区三区,日韩视频一区,a√天堂中文官网8

<ul id="buwfs"><strike id="buwfs"><strong id="buwfs"></strong></strike></ul>
    <output id="buwfs"></output>
  • <dfn id="buwfs"><source id="buwfs"></source></dfn>
      <dfn id="buwfs"><td id="buwfs"></td></dfn>
      <div id="buwfs"><small id="buwfs"></small></div>
      <dfn id="buwfs"><source id="buwfs"></source></dfn>
      1. <dfn id="buwfs"><td id="buwfs"></td></dfn>
        始創(chuàng)于2000年 股票代碼:831685
        咨詢熱線:0371-60135900 注冊有禮 登錄
        • 掛牌上市企業(yè)
        • 60秒人工響應
        • 99.99%連通率
        • 7*24h人工
        • 故障100倍補償
        全部產(chǎn)品
        您的位置: 網(wǎng)站首頁 > 幫助中心>文章內(nèi)容

        MySQL:同時設置innodb_force_recovery和innodb_purge_threa

        發(fā)布時間:  2012/8/31 17:13:53

        版本:Percona5.5.18

        設置參數(shù):

        innodb_force_recovery>=2

        innodb_purge_thread = 1


        觀察alert.log,出現(xiàn)大量信息:


        InnoDB: Waiting for the background threads to start-
         

         

        我們定位到相應的代碼:

        在srv_purge_thread里,會判斷當前是否以recovery mode啟動:


        [html]
        1.879         /* Check for shutdown and whether we should do purge at all. */ 
        2.3880         if (srv_force_recovery >= SRV_FORCE_NO_BACKGROUND  3.3881             || srv_shutdown_state != 0 
        4.3882             || srv_fast_shutdown) { 
        5.3883  
        6.3884             break; 
        7.3885         } 

        其中SRV_FORCE_NO_BACKGROUND值為2,可以看看不同的恢復級別分別代表什么:


        [cpp]
        1.enum { 
        2.    SRV_FORCE_IGNORE_CORRUPT = 1,   /*!< let the server run even if it 3.                    detects a corrupt page */ 
        4.    SRV_FORCE_NO_BACKGROUND = 2,    /*!< prevent the main thread from 5.                    running: if a crash would occur
        6.                    in purge, this prevents it */ 
        7.    SRV_FORCE_NO_TRX_UNDO = 3,  /*!< do not run trx rollback after 8.                    recovery */ 
        9.    SRV_FORCE_NO_IBUF_MERGE = 4,    /*!< prevent also ibuf operations: 10.                    if they would cause a crash, better
        11.                    not do them */ 
        12.    SRV_FORCE_NO_UNDO_LOG_SCAN = 5, /*!< do not look at undo logs when 13.                    starting the database: InnoDB will
        14.                    treat even incomplete transactions
        15.                    as committed */ 
        16.    SRV_FORCE_NO_LOG_REDO = 6   /*!< do not do the log roll-forward 17.                    in connection with recovery */ 
        18.}; 

        也就是說,當恢復級別大于等于2時,將會從while循環(huán)中break然后退出線程(os_thread_exit)

        但在函數(shù)innobase_start_or_create_for_mysql里,由于設置innodb_purge_thread為1,因此這里會等待purge線程起來


        [cpp]
        1.2027     while (srv_shutdown_state == SRV_SHUTDOWN_NONE) { 
        2.2028         if (srv_thread_has_reserved_slot(SRV_MASTER) == ULINT_UNDEFINED  3.2029             || (srv_n_purge_threads == 1 
        4.2030             && srv_thread_has_reserved_slot(SRV_WORKER) 
        5.2031             == ULINT_UNDEFINED)) { 
        6.2032  
        7.2033             ut_print_timestamp(stderr); 
        8.2034             fprintf(stderr, "  InnoDB: "  9.2035                 "Waiting for the background threads to "  10.2036                 "start\n");  11.2037             os_thread_sleep(1000000); 
        12.2038         } else {  13.2039             break;  14.2040         } 
        15.2041     } 

        FIX:

        在創(chuàng)建purge線程前,同時判斷recovery值,當>=2時,我們強制將innodb_purge_thread置為0,以防止無限Loop


        [cpp]
        1.diff -ur Percona-Server-5.5.18.stock/storage/innobase/srv/srv0start.c Percona-Server-5.5.18.fix-purge/storage/innobase/srv/srv0start.c 
        2.--- Percona-Server-5.5.18.stock/storage/innobase/srv/srv0start.c        2012-01-07 16:38:37.000000000 +0800 
        3.+++ Percona-Server-5.5.18.fix-purge/storage/innobase/srv/srv0start.c    2012-01-29 11:34:09.000000000 +0800 
        4.@@ -2019,7 +2019,14 @@ 
        5.        /* If the user has requested a separate purge thread then 6.        start the purge thread. */ 
        7.        if (srv_n_purge_threads == 1) {  8.-               os_thread_create(&srv_purge_thread, NULL, NULL); 
        9.+               if (srv_force_recovery < SRV_FORCE_NO_BACKGROUND) {  10.+                       os_thread_create(&srv_purge_thread, NULL, NULL); 
        11.+               } else {  12.+                       fprintf(stderr, " InnoDB: "  13.+                                       "we will force innodb_purge_thread to 0 "  14.+                                       "becanse force recovery is larger than 1\n");  15.+                       srv_n_purge_threads = 0; 
        16.+               } 
        17.        } 
        18.  
        19.        /* Wait for the purge and master thread to startup. */ 
         


        本文出自:億恩科技【mszdt.com】

        服務器租用/服務器托管中國五強!虛擬主機域名注冊頂級提供商!15年品質(zhì)保障!--億恩科技[ENKJ.COM]

      2. 您可能在找
      3. 億恩北京公司:
      4. 經(jīng)營性ICP/ISP證:京B2-20150015
      5. 億恩鄭州公司:
      6. 經(jīng)營性ICP/ISP/IDC證:豫B1.B2-20060070
      7. 億恩南昌公司:
      8. 經(jīng)營性ICP/ISP證:贛B2-20080012
      9. 服務器/云主機 24小時售后服務電話:0371-60135900
      10. 虛擬主機/智能建站 24小時售后服務電話:0371-60135900
      11. 專注服務器托管17年
        掃掃關注-微信公眾號
        0371-60135900
        Copyright© 1999-2019 ENKJ All Rights Reserved 億恩科技 版權所有  地址:鄭州市高新區(qū)翠竹街1號總部企業(yè)基地億恩大廈  法律顧問:河南亞太人律師事務所郝建鋒、杜慧月律師   京公網(wǎng)安備41019702002023號
          0
         
         
         
         

        0371-60135900
        7*24小時客服服務熱線