{"id":2215,"date":"2010-07-06T22:45:55","date_gmt":"2010-07-06T14:45:55","guid":{"rendered":"http:\/\/www.orczhou.com\/?p=2215"},"modified":"2010-11-08T19:35:59","modified_gmt":"2010-11-08T11:35:59","slug":"mysql-innodb-source-code-sync-2","status":"publish","type":"post","link":"https:\/\/www.orczhou.com\/index.php\/2010\/07\/mysql-innodb-source-code-sync-2\/","title":{"rendered":"MySQL\/InnoDB\u6e90\u4ee3\u7801\uff1a\u7ebf\u7a0b\u5e76\u53d1\u8bbf\u95ee\u63a7\u5236(\u7eed)"},"content":{"rendered":"<p><a href=\"http:\/\/www.orczhou.com\/index.php\/2010\/06\/mysql-innodb-source-code-sync-1\/\">\u524d\u9762<\/a>\u505a\u4e86\u4e00\u4e2a\u5f00\u59cb\uff0c\u6cbf\u7740\u8def\u6162\u6162\u8d70\u4e0b\u53bb\u3002<\/p>\n<div class=\"myt1\">0. \u8d77\u6e90<\/div>\n<p>\u5f00\u59cb\u4e4b\u524d\uff0c\u8fd9\u91cc\u53ef\u4ee5\u8bf4\u8bf4\u8fd9\u6b21\u51c6\u5907\u5f00\u59cb\u7814\u7a76\u6e90\u4ee3\u7801\u7684\u4e00\u4e2a\u5f88\u5927\u8bf1\u56e0\u4e86\u3002\u524d\u4e00\u6bb5\u65f6\u95f4\u5728\u751f\u4ea7\u73af\u5883\u9047\u5230\u4e86\u4e00\u4e2aInnoDB\u62a5\u9519\uff0c\u8fd9\u4e2a\u9519\u8bef\u751a\u81f3\u4f1a\u5bfc\u81f4InnoDB Crash\uff1a<\/p>\n<div class=\"mycode\">InnoDB: Warning: a long semaphore wait:<br \/>\n&#8211;Thread 1222654272 has waited at .\/include\/btr0btr.ic line 53 for 241.00 seconds the semaphore:<br \/>\nS-lock on RW-latch at 0x2aaab510b818 created in file buf\/buf0buf.c line 680<\/div>\n<p>\u6cbf\u7740\u8fd9\u91cc\u7684\u7ebf\u7d22 buf\/buf0buf.c line 680  \u627e\u5230\u4e86\uff1a<\/p>\n<div class=\"mycode\">678\tmutex_create(&#038;block->mutex, SYNC_BUF_BLOCK);<br \/>\n679<br \/>\n680\trw_lock_create(&#038;block->lock, SYNC_LEVEL_VARYING);<br \/>\n681\tut_ad(rw_lock_validate(&#038;(block->lock)));<\/div>\n<p>\u7ee7\u7eed\uff0c\u5c31\u5f00\u59cb\u770brw_lock_create\u7684\u5b9e\u73b0\uff0c\u7136\u540e\u611f\u89c9\u9700\u8981\u770b\u66f4\u591a\u57fa\u7840\u7684\u4e00\u70b9\u7684\u5185\u5bb9\uff0c\u8fd9\u6837\u5c31\u6709\u4e86\u524d\u9762\u4e00\u7247\u6587\u7ae0\uff0c\u7ee7\u7eed\u7814\u7a76\uff0c\u5c31\u6709\u4e86\u73b0\u5728\u7684\u8fd9\u7bc7\u6587\u7ae0\u3002<!--more--><\/p>\n<div class=\"myt1\">1. \u8bfb\u5199\u9501<\/div>\n<p>\u524d\u6587\u4ecb\u7ecd\u4e86\uff0cInnoDB\u4e2d\u5982\u4f55\u4f7f\u7528mutex_struct\u7ed3\u6784\u6765\u4fdd\u62a4\u5185\u5b58\uff08\u53d8\u91cf\uff09\u3002\u6211\u4eec\u53ef\u4ee5\u770b\u5230\uff0c\u5982\u679c\u4f7f\u7528mutex_struct\u65f6\uff0c\u5176\u5b9e\u5b9e\u73b0\u7684\u662f\u4e00\u4e2a\u6392\u4ed6\u9501\u3002\u5982\u679c\u6bcf\u4e2a\u53d8\u91cf\u53ef\u4ee5\u88ab\u5141\u8bb8\u5e76\u53d1\u5171\u4eab\uff08\u53ea\u8bfb\uff09\u8bbf\u95ee\uff0c\u5199\u7684\u65f6\u5019\u624d\u9700\u8981\u201c\u6392\u4ed6\u201d\u8bbf\u95ee\u7684\u8bdd\uff0c\u518d\u7528mutex_struct\u7684\u8bdd\u5c31\u4e0d\u5408\u9002\u4e86\u3002\u6240\u4ee5\uff0cInnoDB\u5728mutex_struct\u7684\u57fa\u7840\u4e0a\uff0c\u53c8\u5b9e\u73b0\u4e86\u4e00\u4e2a<strong>\u8bfb\u5199\u9501<\/strong>\u3002<\/p>\n<p>\u672c\u6587\u4e2d&#8221;\u5171\u4eab\u9501&#8221;\u5373&#8221;\u8bfb\u9501&#8221;\uff0c&#8221;\u6392\u4ed6\u9501&#8221;\u5373&#8221;\u5199\u9501&#8221;\u3002\u5173\u4e8e\u8bfb\u5199\u9501\u7684\u57fa\u672c\u77e5\u8bc6\u8fd9\u91cc\u5c31\u4e0d\u518d\u4ecb\u7ecd\u4e86\u3002\u5148\u8bf4\u8bf4InnoDB\u7684\u5b9e\u73b0\u539f\u7406\uff0c\u518d\u6765\u770b\u7ec6\u8282\u3002InnoDB\u4f7f\u7528\u4e86\u4e00\u4e2a\u6574\u6570\u6765\u6807\u8bb0\u5f53\u524d\u9501\u7684\u72b6\u6001\u3002<\/p>\n<div class=\"myt1\">2. \u8bfb\u5199\u9501 InnoDB\u5b9e\u73b0\u673a\u5236<\/div>\n<p>InnoDB\u7528\u4e86\u4e00\u4e2a\u5f88\u7b80\u5355\u7684\u8bfb\u5199\u9501\u5b9e\u73b0\u673a\u5236\uff0c\u4f7f\u7528\u4e00\u4e2a\u6574\u578b\u53d8\u91cflock_word\u6807\u5fd7\u5f53\u524d\u9501\u7684\u72b6\u6001\uff1a<\/p>\n<div class=\"mycode\">struct rw_lock_struct {<br \/>\n\tvolatile lint\t<strong>lock_word<\/strong>; \t\/*!< Holds the state of the lock. *\/<\/div>\n<p>\u521d\u59cb\u5316\u65f6\uff0clock_word\u7684\u503c\u4e3a1048576\uff080x00100000\uff09\uff0c\u5f53\u6bcf\u4e00\u4e2a\u7ebf\u7a0b\u83b7\u5f97\u4e00\u6b21\u8bfb\u9501\u65f6\uff0clock_word\u503c\u51cf\u4e00\u3002\u6bcf\u6b21\u83b7\u53d6\u5199\u9501\u65f6\uff0clock_word\u7684\u503c\u5219\u51cf\u5c111048576\u3002\u8fd9\u6837\uff0c\u6bcf\u6b21\u6839\u636elock_word\u5f53\u524d\u503c\uff0c\u5c31\u53ef\u4ee5\u83b7\u53d6\u5f53\u524d\u9501\u7684\u72b6\u6001\u4e86\u3002\u4e0b\u9762\u662f\u5173\u4e8elock_word\u89c4\u5219\u7684\u8be6\u7ec6\u8bf4\u660e\uff1a<\/p>\n<div class=\"myt2\">1\uff09 lock_word\u521d\u59cb\u503c\u4e3aX_LOCK_DECR\uff08#define X_LOCK_DECR\t 0\u00d700100000 \/\/1,048,575\uff09<\/div>\n<div class=\"myt2\">2\uff09 \u6bcf\u4e00\u7ebf\u7a0b\u4ee5\u8bfb\uff08\u5171\u4eab\uff09\u7684\u65b9\u5f0f\u83b7\u53d6\u8be5\u9501\uff0c\u5219lock_word\u51cf1<\/div>\n<div class=\"myt2\">3\uff09 \u6bcf\u6b21\u7ebf\u7a0b\u4ee5\u5199\uff08\u6392\u4ed6\uff09\u7684\u65b9\u5f0f\u83b7\u53d6\u9501\uff0c\u5219lock_word\u51cfX_LOCK_DECR<\/div>\n<div class=\"myt2\">4\uff09 \u5982\u679c\u67d0\u7ebf\u7a0b\u4ee5\u5199\uff08\u6392\u4ed6\uff09\u65b9\u5f0f\u83b7\u5f97\u9501\uff0c\u8be5\u7ebf\u7a0b\u4ecd\u53ef\u4ee5\u4ee5\u9012\u5f52\u7684\u65b9\u5f0f\u83b7\u5f97\u8be5\u5199\u9501<\/div>\n<div class=\"myt2\">5\uff09 \u5982\u679c\u7ebf\u7a0b\u5728\u7b49\u5f85\u83b7\u53d6\u5199\u9501\uff0clock_word\u51cfX_LOCK_DECR\uff0c<strong>\u4e14\u8fd9\u6837\u53ef\u4ee5\u963b\u6b62\u7ebf\u7a0b\u518d\u83b7\u5f97\u8bfb\u9501<\/strong><\/div>\n<div class=\"myt2\">6\uff09 \u5199\u9501\u867d\u7136\u53ef\u4ee5\u9012\u5f52\u83b7\u53d6\uff0c\u4f46\u662f\u8bfb\u9501\u4e0d\u80fd\u9012\u5f52\u83b7\u53d6<\/div>\n<p>\u6839\u636e\u4e0a\u9762\u7684\u89c4\u5f8b\uff0c\u6211\u4eec\u5c31\u53ef\u4ee5\u63a8\u5bfc\u51fa\uff0clock_word\u53d6\u4e0d\u540c\u533a\u95f4\u7684\u503c\u65f6\uff0c\u5f53\u524d\u9501\u7684\u72b6\u6001\u3002\u4f8b\u5982\u5f530&lt;lock_word&lt;X_LOCK_DECR\u65f6\uff0c\u5f53\u524d\u9501\u4ee5\u8bfb\u7684\u65b9\u5f0f\u88ab\u83b7\u53d6\uff0c\u4e0b\u9762\u662flock_word\u4e0d\u540c\u533a\u95f4\u503c\u9501\u7684\u72b6\u6001\u8868\uff1a<\/p>\n<div class=\"myt2\">1\uff09 lock_word == X_LOCK_DECR   \u5219\u9501\u5904\u4e8e\u521d\u59cb\u72b6\u6001\uff0c\u5373\u6ca1\u6709\u4efb\u4f55\u7ebf\u7a0b\u83b7\u5f97\u8be5\u9501<\/div>\n<div class=\"myt2\">2\uff09 0 < lock_word < X_LOCK_DECR  \u5219\u9501\u5904\u4e8e\u8bfb\u9501\u72b6\u6001\uff0c\u8bfb\u9501\u6301\u6709\u8005\u4e2a\u6570\u4e3aX_LOCK_DECR-lock_word\uff1b\u4e14\u5e76\u6ca1\u6709\u4efb\u4f55\u5199\u9501\u5904\u4e8e\u7b49\u5f85\u72b6\u6001<\/div>\n<div class=\"myt2\">3\uff09 lock_word == 0  \u5219\u9501\u5904\u4e8e\u5199\u9501\u72b6\u6001<\/div>\n<div class=\"myt2\">4\uff09 -X_LOCK_DECR < lock_word < 0  \u5219\u9501\u5904\u4e8e\u8bfb\u9501\u72b6\u6001\uff0c\u4e14\u6709\u4e00\u4e2a\u7ebf\u7a0b\u5728\u7b49\u5f85\u5199\u9501\u3002-lock_word\u5c31\u662f\u8bfb\u9501\u7684\u4e2a\u6570<\/div>\n<div class=\"myt2\">5\uff09 lock_word <= -X_LOCK_DECR  \u5219\u5f53\u524d\u9501\u5904\u4e8e\u201c\u9012\u5f52\u5199\u9501\u201d\uff08\u540c\u4e00\u4e2a\u7ebf\u7a0b\u591a\u6b21\u83b7\u5f97\u8be5\u5199\u9501\uff09\u72b6\u6001\uff0c\u5199\u9501\u7684\u4e2a\u6570\u662f((-lock_word) \/ X_LOCK_DECR) + 1<\/div>\n<p>\u8fd9\u91cc\u770b\u5230\uff0c\u5f53\u7ebf\u7a0b\u9700\u8981\u83b7\u53d6\u8be5\u9501\uff08\u8bfb\u3001\u5199\uff09\u7684\u65f6\u5019\uff0c\u6839\u636elock_word\u503c\u5373\u53ef\u4ee5\u5224\u65ad\u5f53\u524d\u9501\u7684\u72b6\u6001\uff0c\u4e5f\u5c31\u53ef\u4ee5\u77e5\u9053\u81ea\u5df1\u662f\u5426\u53ef\u4ee5\u83b7\u5f97\u9501\u3002<\/p>\n<div class=\"myt1\">3. \u5173\u4e8e\u9012\u5f52\u5199\u9501<\/div>\n<p>lock_word\u57fa\u672c\u4e0a\u5305\u542b\u4e86\u9501\u7684\u5168\u90e8\u72b6\u6001\uff0c\u4f46\u662f\u5982\u679c\u7ec6\u5fc3\u7684\u8bdd\uff0c\u4f60\u4f1a\u53d1\u73b0\u6709\u4e00\u4e2a\u4f8b\u5916\uff1a\u5f53\u4e00\u4e2a\u7ebf\u7a0bA\u9700\u8981\u83b7\u5f97\u5199\u9501\u7684\u65f6\u5019\uff0clock_word\u7684\u5982\u679c\u662f\u5199\u9501\u72b6\u6001\u65f6\uff0c\u7ebf\u7a0bA\u8fd8\u5fc5\u987b\u77e5\u9053\u5f53\u524d\u6301\u6709\u8be5\u9501\u7684\u7ebf\u7a0bID\uff0c\u5982\u679c\u6301\u6709\u9501\u7684\u7ebf\u7a0b\u5c31\u662f\u81ea\u5df1\uff0c\u5219\u7ebf\u7a0bA\u53ef\u4ee5\u83b7\u5f97\u5199\u9501\u3002\u6240\u4ee5\uff0crw_lock_struct\u7ed3\u6784\u4e2d\u8fd8\u6709\u53e6\u4e00\u4e2a\u6210\u5458\u53d8\u91cf\uff1a<\/p>\n<div class=\"mycode\">volatile os_thread_id_t\twriter_thread;<\/div>\n<p>\u5f53\u9501\u4ee5\u6392\u4ed6\u65b9\u5f0f\u88ab\u6301\u6709\u7684\u65f6\u5019\uff0c\u8be5\u53d8\u91cf\u8bb0\u5f55\u6301\u6709\u8005\u7684\u7ebf\u7a0bID\u3002<\/p>\n<p>\u5982\u679c\u7ec6\u5fc3\uff0c\u4f60\u8fd8\u53ef\u80fd\u53d1\u73b0\uff0c\u8fd9\u91cc\u867d\u7136\u63d0\u5230\u4e86\u201c\u9012\u5f52\u5199\u9501\u201d\uff0c\u5374\u6ca1\u6709\u63d0\u5230\u201c\u9012\u5f52\u8bfb\u9501\u201d\u3002\u5728InnoDB\u7684\u8bfb\u5199\u9501\u5b9e\u73b0\u65f6\uff0c\u5e76\u4e0d\u8003\u8651\u8bfb\u9501\u7684\u9012\u5f52\uff0c\u5982\u679c\u9501\u88ab\u6392\u4ed6\u65b9\u5f0f\u83b7\u53d6\uff0c\u5373\u4f7f\u662f\u540c\u4e00\u4e2a\u7ebf\u7a0b\uff0c\u4ecd\u7136\u65e0\u6cd5\u83b7\u53d6\u8bfb\u9501\u3002<\/p>\n<div class=\"myt1\">4 .lock_word\u7684\u4e00\u81f4\u6027<\/div>\n<p>\u5728\u8bfb\u5199\u9501\u7684\u5b9e\u73b0\u4e2d\uff0clock_word\u7684\u53ef\u4ee5\u201c\u4e3e\u8db3\u8f7b\u91cd\u201d\u3002\u8fd9\u5c31\u8981\u6c42\u6bcf\u6b21\u5bf9lock_word\u7684\u4fee\u6539\u90fd\u8981\u505a\u5230\u201c\u4e00\u81f4\u201d\u3002\u5426\u5219\uff0c\u8fd9\u628a\u9501\u5c31\u574f\u4e86\u3002<\/p>\n<div class=\"myt2\">4.1 \u4ec0\u4e48\u662f\u4e00\u81f4\u6027<\/div>\n<p>\u5982\u679c\u662f\u5355\u7ebf\u7a0b\uff0c\u83b7\u53d6\u8bfb\u9501\u6211\u4eec\u53ef\u80fd\u5199\u51fa\u4e0b\u9762\u7684\u4ee3\u7801\uff1a<\/p>\n<div class=\"mycode\">if(local_lock_word > 0){<br \/>\n    local_lock_word = local_lock_word -1;<br \/>\n}\n<\/div>\n<p>\u4e0a\u9762\u7684\u4ee3\u7801\uff0c\u5728\u591a\u7ebf\u591a\u5904\u7406\u73af\u5883\u662f\u4e0d\u5b89\u5168\u7684\uff0c\u4f1a\u5bfc\u81f4lock_word\u7684\u4e0d\u4e00\u81f4\u3002\u7ebf\u7a0bA\u9700\u8981\u83b7\u53d6\u8bfb\u9501\uff0c\u5219CPU\u5728\u6267\u884c\u4e0a\u9762\u4ee3\u7801\u7684\u65f6\u5019\uff0c\u9996\u5148\u83b7\u53d6local_lock_word\u7684\u503c\u5c06\u5176\u8f7d\u5165\u5bc4\u5b58\u5668\uff0c\u7136\u540e\u8fd0\u7b97\uff0c\u7136\u540e\u8fd4\u56de\u5230\u5185\u5b58\u3002\u5982\u679c\u5728\u201c\u8f7d\u5165\u5bc4\u5b58\u5668\u4e4b\u540e\u8fd0\u7b97\u4e4b\u524d\u201d\uff0clock_word\u7684\u503c\u53d1\u751f\u4e86\u6539\u53d8\uff08\u4f8b\u5982\u53e6\u4e00\u4e2a\u7ebf\u7a0bB\u6210\u529f\u83b7\u53d6\u4e86\u8bfb\u9501\uff09\uff0c\u800c\u8fd9\u65f6\u5f53\u524d\u7ebf\u7a0bA\u5374\u4e0d\u77e5\u9053\uff0c\u7ebf\u7a0bA\u4ecd\u7136\u628a\u81ea\u5df1\u7684\u503c\u56de\u5199\u5230\u5185\u5b58\uff0c\u5219\u4f1a\u8986\u76d6\u7ebf\u7a0bB\u5bf9lock_word\u7684\u4fee\u6539\u3002lock_word\u7684\u503c\u5c31\u4e0d\u4e00\u81f4\u4e86\uff0c\u7b49\u9501\u5168\u90e8\u91ca\u653e\u540e\uff0clock_word\u7684\u503c\u5c31\u53ef\u80fd\u4e0d\u662fX_LOCK_DECR\u3002<\/p>\n<p>\u4e0a\u9762\u8fd9\u6bb5\u8bdd\u53ef\u80fd\u6709\u70b9\u7ed5\uff0c\u7b80\u5355\u7684\u8bf4\uff1a\u591a\u7ebf\u7a0b\u5e76\u53d1\u65f6\uff0c\u4e0a\u9762\u7b80\u5355\u7684\u8d4b\u503c\u64cd\u4f5c\u662f\u4e0d\u53ef\u9760\u7684\u3002\u56de\u60f3\u4e00\u4e0b\u591a\u7ebf\u7a0b\uff0c\u5c31\u4e0d\u96be\u7406\u89e3\u4e0a\u9762\u8fd9\u6bb5\u8bdd\u4e86\u3002<\/p>\n<div class=\"myt2\">4.2 InnoDB\u5982\u4f55\u4fdd\u8bc1lock_wrod\u7684\u4e00\u81f4\u6027<\/div>\n<p>\u4ecb\u7ecd\u5b8c\u4e86\u524d\u9762\u90a3\u4e48\u591a\u539f\u7406\uff0c\u8fd9\u91cc\u603b\u7b97\u53ef\u4ee5\u770b\u770b\u6e90\u4ee3\u7801\u7684\u4e00\u4e9b\u4e1c\u897f\u4e86\u3002InnoDB\u5c01\u88c5\u4e86\u51fd\u6570rw_lock_lock_word_decr\u6765\u5b9e\u73b0\u5bf9lock_wrod\u7684\u4e00\u81f4\u64cd\u4f5c\u3002InnoDB\u4f1a\u6839\u636e\u4e0d\u540c\u7684\u7f16\u8bd1\u73af\u5883\uff0c\u51b3\u5b9a\u4f7f\u7528\u4e0d\u540c\u7684\u7b56\u7565\u3002\u7b80\u5355\u5730\uff0cInnoDB\u4f7f\u7528\u4e86\u524d\u9762\u4ecb\u7ecd\u7684mutex_t\uff08\u6392\u4ed6\u9501\uff09\u6765\u5b9e\u73b0lock_word\u7684\u4e00\u81f4\u64cd\u4f5c\uff0c\u5373\u5728\u64cd\u4f5c\u4e4b\u524d\u83b7\u53d6\u6392\u4ed6\u9501\uff1b\u53e6\u5916\uff0cInnoDB\u6839\u636e\u4e0d\u540c\u7684CPU\u5e73\u53f0\u8fd8\u53ef\u4ee5\u4f7f\u7528<a href=\"http:\/\/en.wikipedia.org\/wiki\/Compare-and-swap\">Compare-And-Swap<\/a>\u6765\u5b9e\u73b0\uff0c\u4e0b\u9762\u6765\u770b\u770b\u6e90\u7801\uff1a<\/p>\n<p>\u8fd9\u91cc\u662f\u6838\u5fc3\u4ee3\u7801\uff0c\u8be6\u7ec6\u53c2\u8003sync0rw.ic\u6587\u4ef6<\/p>\n<pre><div class=\"mycode\">ibool rw_lock_lock_word_decr(rw_lock_t*\tlock, ulint amount)\r\n{\r\n#ifdef INNODB_RW_LOCKS_USE_ATOMICS\r\n\twhile (local_lock_word > 0) {\r\n\t\tif (<font color=\"blue\">os_compare_and_swap_lint<\/font>(&lock->lock_word,local_lock_word,local_lock_word - amount)) {\r\n\t\t\treturn(TRUE);\r\n\t\t}\r\n\t\tlocal_lock_word = lock->lock_word;\r\n\t}\r\n\treturn(FALSE);\r\n#else \/* INNODB_RW_LOCKS_USE_ATOMICS *\/\r\n\tibool success = FALSE;\r\n\t<strong><font color=\"blue\">mutex_enter(&(lock->mutex));<\/font><\/strong>\r\n\tif (lock->lock_word > 0) {\r\n\t\tlock->lock_word -= amount;\r\n\t\tsuccess = TRUE;\r\n\t}\r\n\t<strong><font color=\"blue\">mutex_exit(&(lock->mutex));<\/font><\/strong>\r\n\treturn(success);\r\n#endif \/* INNODB_RW_LOCKS_USE_ATOMICS *\/\r\n}<\/div><\/pre>\n<p>\u6709\u4e86<a href=\"http:\/\/en.wikipedia.org\/wiki\/Compare-and-swap\">Compare-And-Swap<\/a>\u6216\u8005\u6392\u4ed6\u9501(<a href=\"http:\/\/www.orczhou.com\/index.php\/2010\/06\/mysql-innodb-source-code-sync-1\/\">\u524d\u6587<\/a>\u7684mutex_t)\u7684\u4fdd\u8bc1\uff0cInnoDB\u5c31\u53ef\u4ee5\u4e00\u81f4\u7684\u66f4\u6539\u9501\u7684\u72b6\u6001\uff08lock_word\uff09\u4e86\u3002<\/p>\n<div class=\"myt1\">5. \u518d\u4f11\u606f\u4e00\u4e0b<\/div>\n<p>\u8fd9\u7bc7\u6587\u7ae0\u7b97\u662f\u4ecb\u7ecd\u4e86\u4e00\u4e0bInnoDB\u8bfb\u5199\u9501\u7684\u5b9e\u73b0\u673a\u5236\uff0c\u672c\u6765\u60f3\u628a\u5177\u4f53\u5b9e\u73b0\u4e5f\u5199\u4e86\uff0c\u53d1\u73b0\u4f5c\u4e3a\u4e00\u7bc7\u535a<del datetime=\"2010-07-06T09:04:48+00:00\">\u5ba2<\/del>\u6587\u662f\u6709\u70b9\u957f\u4e86\uff0c\u800c\u4e14\u5df2\u7ecf\u975e\u5e38\u7684\u6666\u6da9\u96be\u61c2\u4e86\u3002\u6240\u4ee5\u6682\u65f6\u4f11\u606f\u4e00\u4e0b\uff0c\u6b32\u77e5\u540e\u4e8b\u5982\u4f55\uff0c\u4e14\u542c\u4e0b\u56de\u5206\u89e3\u3002<\/p>\n<p>\u5e7f\u544a\u65f6\u95f4\uff1a<a href=\"http:\/\/www.orczhou.com\/index.php\/projects\/we-are-hunting-mysql-hacker\/\">\u5de5\u4f5c\u673a\u4f1a&#8211;MySQL Hacker<\/a><\/p>\n","protected":false},"excerpt":{"rendered":"<p>\u524d\u9762\u505a\u4e86\u4e00\u4e2a\u5f00\u59cb\uff0c\u6cbf\u7740\u8def\u6162\u6162\u8d70\u4e0b\u53bb\u3002 0. \u8d77\u6e90 \u5f00\u59cb\u4e4b\u524d\uff0c\u8fd9\u91cc\u53ef\u4ee5\u8bf4\u8bf4\u8fd9\u6b21\u51c6\u5907\u5f00\u59cb\u7814\u7a76\u6e90\u4ee3\u7801\u7684\u4e00\u4e2a\u5f88\u5927\u8bf1\u56e0\u4e86\u3002\u524d\u4e00\u6bb5\u65f6\u95f4\u5728\u751f\u4ea7\u73af\u5883\u9047\u5230\u4e86\u4e00\u4e2aInnoDB\u62a5\u9519\uff0c\u8fd9\u4e2a\u9519\u8bef\u751a\u81f3\u4f1a\u5bfc\u81f4InnoDB Crash\uff1a InnoDB: Warning: a long semaphore wait: &#8211;Thread 1222654272 has waited at .\/include\/btr0btr.ic line 53 for 241.00 seconds the semaphore: S-lock on RW-latch at 0x2aaab510b818 created in file buf\/buf0buf.c line 680 \u6cbf\u7740\u8fd9\u91cc\u7684\u7ebf\u7d22 buf\/buf0buf.c line 680 \u627e\u5230\u4e86\uff1a 678 mutex_create(&#038;block->mutex, SYNC_BUF_BLOCK); 679 680 rw_lock_create(&#038;block->lock, SYNC_LEVEL_VARYING); 681 ut_ad(rw_lock_validate(&#038;(block->lock))); \u7ee7\u7eed\uff0c\u5c31\u5f00\u59cb\u770brw_lock_create\u7684\u5b9e\u73b0\uff0c\u7136\u540e\u611f\u89c9\u9700\u8981\u770b\u66f4\u591a\u57fa\u7840\u7684\u4e00\u70b9\u7684\u5185\u5bb9\uff0c\u8fd9\u6837\u5c31\u6709\u4e86\u524d\u9762\u4e00\u7247\u6587\u7ae0\uff0c\u7ee7\u7eed\u7814\u7a76\uff0c\u5c31\u6709\u4e86\u73b0\u5728\u7684\u8fd9\u7bc7\u6587\u7ae0\u3002<\/p>\n","protected":false},"author":2,"featured_media":0,"comment_status":"open","ping_status":"open","sticky":false,"template":"","format":"standard","meta":{"_eb_attr":"","inline_featured_image":false,"_tocer_settings":[],"footnotes":""},"categories":[6,5],"tags":[120,118,58],"class_list":["post-2215","post","type-post","status-publish","format-standard","hentry","category-mysql","category-code-staff","tag-innodb","tag-mysql","tag-source-code"],"_links":{"self":[{"href":"https:\/\/www.orczhou.com\/index.php\/wp-json\/wp\/v2\/posts\/2215","targetHints":{"allow":["GET"]}}],"collection":[{"href":"https:\/\/www.orczhou.com\/index.php\/wp-json\/wp\/v2\/posts"}],"about":[{"href":"https:\/\/www.orczhou.com\/index.php\/wp-json\/wp\/v2\/types\/post"}],"author":[{"embeddable":true,"href":"https:\/\/www.orczhou.com\/index.php\/wp-json\/wp\/v2\/users\/2"}],"replies":[{"embeddable":true,"href":"https:\/\/www.orczhou.com\/index.php\/wp-json\/wp\/v2\/comments?post=2215"}],"version-history":[{"count":30,"href":"https:\/\/www.orczhou.com\/index.php\/wp-json\/wp\/v2\/posts\/2215\/revisions"}],"predecessor-version":[{"id":2650,"href":"https:\/\/www.orczhou.com\/index.php\/wp-json\/wp\/v2\/posts\/2215\/revisions\/2650"}],"wp:attachment":[{"href":"https:\/\/www.orczhou.com\/index.php\/wp-json\/wp\/v2\/media?parent=2215"}],"wp:term":[{"taxonomy":"category","embeddable":true,"href":"https:\/\/www.orczhou.com\/index.php\/wp-json\/wp\/v2\/categories?post=2215"},{"taxonomy":"post_tag","embeddable":true,"href":"https:\/\/www.orczhou.com\/index.php\/wp-json\/wp\/v2\/tags?post=2215"}],"curies":[{"name":"wp","href":"https:\/\/api.w.org\/{rel}","templated":true}]}}