{"id":4341,"date":"2019-06-16T15:24:17","date_gmt":"2019-06-16T07:24:17","guid":{"rendered":"http:\/\/www.xttblog.com\/?p=4341"},"modified":"2019-06-16T15:24:17","modified_gmt":"2019-06-16T07:24:17","slug":"mysql-%e4%ba%8c%e7%ba%a7%e7%b4%a2%e5%bc%95%e5%9c%a8-rr-%e5%92%8c-rc-%e9%9a%94%e7%a6%bb%e7%ba%a7%e5%88%ab%e4%b8%8b%e7%9a%84%e5%8a%a0%e9%94%81%e6%83%85%e5%86%b5%e6%80%bb%e7%bb%93","status":"publish","type":"post","link":"https:\/\/www.xttblog.com\/?p=4341","title":{"rendered":"MySQL \u4e8c\u7ea7\u7d22\u5f15\u5728 RR \u548c RC \u9694\u79bb\u7ea7\u522b\u4e0b\u7684\u52a0\u9501\u60c5\u51b5\u603b\u7ed3"},"content":{"rendered":"\n<p class=\"wp-block-paragraph\">\u4e8c\u7ea7\u7d22\u5f15\u53c8\u79f0\u4e3a\u975e\u552f\u4e00\u7d22\u5f15\u3002\u90a3\u4e48\u9488\u5bf9\u975e\u552f\u4e00\u7d22\u5f15\uff0c\u5982\u679c\u67e5\u8be2\u547d\u4e2d\u7684\u662f\u4e8c\u7ea7\u7d22\u5f15\uff0c\u90a3\u4e48\u5728 RR \u548c RC \u7ea7\u522b\u4e0b\uff0c\u53c8\u4f1a\u52a0\u54ea\u4e9b\u9501\u5462\uff1f\u4eca\u5929\u6211\u4eec\u518d\u6765\u4e00\u8d77\u770b\u770b\uff01<\/p>\n\n\n\n<p class=\"wp-block-paragraph\">\u8fd8\u662f\u4e4b\u524d\u4e24\u7bc7\u6587\u7ae0\u4e2d\u7684\u6d4b\u8bd5\u6570\u636e\uff0c\u6211\u76f4\u63a5\u7c98\u8d34\u8fc7\u6765\uff01<\/p>\n\n\n\n<pre class=\"wp-block-code\"><code>CREATE TABLE `xttblog` (\n  `id` bigint(20) NOT NULL,\n  `name` varchar(16) COLLATE utf8mb4_bin DEFAULT NULL,\n  `idcard` bigint(20) NOT NULL,\n  PRIMARY KEY (`id`),\n  KEY `name` (`name`) \n) ENGINE=InnoDB DEFAULT CHARSET=utf8mb4 COLLATE=utf8mb4_bin;\ninsert into `xttblog` values(1,\u2019\u4e1a\u4f59\u8349\u2019,100),(5,'xttblog\u2019,200),\n(8,\u2019xttblog\u2019,300),(10,\u2019\u4e1a\u4f59\u8349\u516c\u4f17\u53f7\u2019,400);<\/code><\/pre>\n\n\n\n<p class=\"wp-block-paragraph\">\u73b0\u5728\u5047\u8bbe name \u81ea\u5df1\u6709\u4e8c\u7ea7\u7d22\u5f15\uff0cidcard \u5b57\u6bb5\u6ca1\u6709\u7d22\u5f15\u3002\u90a3\u4e48\u5728\u7cbe\u786e\u67e5\u8be2\u3001\u8303\u56f4\u67e5\u8be2\u3001\u67e5\u8be2\u7ed3\u679c\u4e3a\u7a7a\u7684\u60c5\u51b5\u5206\u522b\u52a0\u54ea\u4e9b\u9501\u5462\uff1f<\/p>\n\n\n\n<p class=\"wp-block-paragraph\">\u9996\u5148\u770b\u7cbe\u786e\u67e5\u8be2\uff0c\u5982\u679c\u5728 RC \u9694\u79bb\u7ea7\u522b\u4e0b\uff0c\u4f1a\u5bf9\u547d\u4e2d\u7684\u4e8c\u7ea7\u7d22\u5f15\u548c\u805a\u7c07\u7d22\u5f15\u52a0 record lock\u3002<\/p>\n\n\n\n<pre class=\"wp-block-code\"><code>\/\/ \u5728name='xttblog'\u7684\u4e24\u6761\u7d22\u5f15\u8bb0\u5f55\u4e0a\u52a0X\u9501\n\/\/ \u5e76\u5728id=5\u548cid=8\u7684\u805a\u7c07\u7d22\u5f15\u4e0a\u52a0X\u9501\nupdate `xttblog` set idcard=600 where name='xttblog';<\/code><\/pre>\n\n\n\n<p class=\"wp-block-paragraph\">\u5982\u679c\u5728 RR \u9694\u79bb\u7ea7\u522b\u4e0b\uff0c\u4f1a\u5728\u547d\u4e2d\u7684\u4e8c\u7ea7\u7d22\u5f15\u4e0a\u52a0 next-key lock\uff0c\u6700\u540e\u547d\u4e2d\u7684\u7d22\u5f15\u7684\u540e\u9762\u7684\u95f4\u9699\u4f1a\u52a0\u4e0a gap lock\u3002\u5bf9\u5e94\u7684\u805a\u7c07\u7d22\u5f15\u4e0a\u52a0 record lock\u3002<\/p>\n\n\n\n<pre class=\"wp-block-code\"><code>\/\/ \u5728name='xttblog'\u7684\u4e24\u6761\u7d22\u5f15\u8bb0\u5f55\u4e0a\u52a0X\u9501\n\/\/ \u5e76\u5728id=5\u548cid=8\u7684\u805a\u7c07\u7d22\u5f15\u4e0a\u52a0X\u9501\n\/\/ \u5e76\u5728\u4e8c\u7ea7\u7d22\u5f15\u7684\u95f4\u9699('\u4e1a\u4f59\u8349','xttblog')('xttblog','xttblog')('xttblog','\u4e1a\u4f59\u8349\u516c\u4f17\u53f7')\u52a0gap lock\nupdate `xttblog` set idcard=880 where name='xttblog';<\/code><\/pre>\n\n\n\n<p class=\"wp-block-paragraph\">\u5269\u4e0b\u7684\u8303\u56f4\u67e5\u8be2\uff0c\u67e5\u8be2\u7ed3\u679c\u4e3a\u7a7a\u7684\u60c5\u51b5\u90fd\u9700\u8981\u52a0\u5f88\u591a\u95f4\u9699\u9501\u3002\u53e6\u5916\u6a21\u7cca\u67e5\u8be2\uff0c\u4e5f\u662f\u975e\u5e38\u590d\u6742\u7684\u3002\u6211\u8fd9\u91cc\u6ca1\u5206\u6790\uff01<\/p>\n\n\n\n<p class=\"wp-block-paragraph\">\u7ed3\u5408\u4e00\u8d77\u7684\u6587\u7ae0\uff0cRC \u7ea7\u522b\u6bd4 RR \u7ea7\u522b\u52a0\u7684\u9501\uff0c\u770b\u8d77\u6765\u6bd4\u8f83\u5c11\u3002\u56e0\u6b64\uff0c\u8fd9\u4e5f\u662f\u5f88\u591a\u516c\u53f8\u9996\u9009 RC \u7ea7\u522b\u7684\u539f\u56e0\u4e4b\u4e00\uff01<\/p>\n<!-- <audio autoplay=\"autoplay\" height=\"100\" width=\"100\" hidden=\"true\"><source src=\"https:\/\/c.coka.la\/orAvPR.mp3\" type=\"audio\/mp3\"\/><\/audio><img decoding=\"async\" src=\"https:\/\/images.weserv.nl\/?url=https:\/\/ws3.sinaimg.cn\/large\/8fa5dcfcgy1g4em3rzar5j20ib089ae0.jpg\" alt=\"\u4e1a\u4f59\u8349\u516c\u4f17\u53f7\"\/> --><p><!-- <img decoding=\"async\" src=\"https:\/\/raw.githubusercontent.com\/xmt1139057136\/xttblog\/master\/8fa5dcfcgy1g4em3rzar5j20ib089ae0.jpg\" alt=\"\u4e1a\u4f59\u8349\u516c\u4f17\u53f7\"\/>--><img decoding=\"async\" src=\"https:\/\/saas.51autoparts.cn\/api\/admin\/sys-file\/oss\/file?fileName=84db51f8561e448f9a4fda2eff0811f9.jpg\" alt=\"\u4e1a\u4f59\u8349\u516c\u4f17\u53f7\"\/><\/p><p>\u6700\u540e\uff0c\u6b22\u8fce\u5173\u6ce8\u6211\u7684\u4e2a\u4eba\u5fae\u4fe1\u516c\u4f17\u53f7\uff1a\u4e1a\u4f59\u8349\uff08yyucao\uff09\uff01<b>\u53ef\u52a0\u4f5c\u8005\u5fae\u4fe1\u53f7\uff1a<font color=\"red\">xttblog2<\/font>\u3002\u5907\u6ce8\uff1a\u201c1\u201d\uff0c\u6dfb\u52a0\u535a\u4e3b\u5fae\u4fe1\u62c9\u4f60\u8fdb\u5fae\u4fe1\u7fa4\u3002\u5907\u6ce8\u9519\u8bef\u4e0d\u4f1a\u540c\u610f\u597d\u53cb\u7533\u8bf7\u3002<\/b>\u518d\u6b21\u611f\u8c22\u60a8\u7684\u5173\u6ce8\uff01\u540e\u7eed\u6709\u7cbe\u5f69\u5185\u5bb9\u4f1a\u7b2c\u4e00\u65f6\u95f4\u53d1\u7ed9\u60a8\uff01\u539f\u521b\u6587\u7ae0\u6295\u7a3f\u8bf7\u53d1\u9001\u81f3532009913@qq.com\u90ae\u7bb1\u3002\u5546\u52a1\u5408\u4f5c\u4e5f\u53ef\u6dfb\u52a0\u4f5c\u8005\u5fae\u4fe1\u8fdb\u884c\u8054\u7cfb\uff01<\/p><p>\u672c\u6587\u539f\u6587\u51fa\u5904\uff1a<a href=\"https:\/\/www.xttblog.com\">\u4e1a\u4f59\u8349<\/a>\uff1a &raquo; <a href=\"https:\/\/www.xttblog.com\/?p=4341\">MySQL \u4e8c\u7ea7\u7d22\u5f15\u5728 RR \u548c RC \u9694\u79bb\u7ea7\u522b\u4e0b\u7684\u52a0\u9501\u60c5\u51b5\u603b\u7ed3<\/a><\/p><!-- <div class=\"bd-reward-stl\"><button id=\"bdRewardBtn\"><span><\/span><\/button><\/div> -->","protected":false},"excerpt":{"rendered":"<p>\u4e8c\u7ea7\u7d22\u5f15\u53c8\u79f0\u4e3a\u975e\u552f\u4e00\u7d22\u5f15\u3002\u90a3\u4e48\u9488\u5bf9\u975e\u552f\u4e00\u7d22\u5f15\uff0c\u5982\u679c\u67e5\u8be2\u547d\u4e2d\u7684\u662f\u4e8c\u7ea7\u7d22\u5f15\uff0c\u90a3\u4e48\u5728 RR \u548c RC \u7ea7\u522b\u4e0b\uff0c\u53c8\u4f1a\u52a0 [&hellip;]<\/p>\n","protected":false},"author":2,"featured_media":0,"comment_status":"closed","ping_status":"closed","sticky":false,"template":"","format":"standard","meta":{"footnotes":""},"categories":[12],"tags":[83,580,1683,1148,1931],"class_list":["post-4341","post","type-post","status-publish","format-standard","hentry","category-sql","tag-mysql","tag-mysql----dba","tag-next-key-locks","tag-1148","tag-1931"],"_links":{"self":[{"href":"https:\/\/www.xttblog.com\/index.php?rest_route=\/wp\/v2\/posts\/4341","targetHints":{"allow":["GET"]}}],"collection":[{"href":"https:\/\/www.xttblog.com\/index.php?rest_route=\/wp\/v2\/posts"}],"about":[{"href":"https:\/\/www.xttblog.com\/index.php?rest_route=\/wp\/v2\/types\/post"}],"author":[{"embeddable":true,"href":"https:\/\/www.xttblog.com\/index.php?rest_route=\/wp\/v2\/users\/2"}],"replies":[{"embeddable":true,"href":"https:\/\/www.xttblog.com\/index.php?rest_route=%2Fwp%2Fv2%2Fcomments&post=4341"}],"version-history":[{"count":1,"href":"https:\/\/www.xttblog.com\/index.php?rest_route=\/wp\/v2\/posts\/4341\/revisions"}],"predecessor-version":[{"id":4342,"href":"https:\/\/www.xttblog.com\/index.php?rest_route=\/wp\/v2\/posts\/4341\/revisions\/4342"}],"wp:attachment":[{"href":"https:\/\/www.xttblog.com\/index.php?rest_route=%2Fwp%2Fv2%2Fmedia&parent=4341"}],"wp:term":[{"taxonomy":"category","embeddable":true,"href":"https:\/\/www.xttblog.com\/index.php?rest_route=%2Fwp%2Fv2%2Fcategories&post=4341"},{"taxonomy":"post_tag","embeddable":true,"href":"https:\/\/www.xttblog.com\/index.php?rest_route=%2Fwp%2Fv2%2Ftags&post=4341"}],"curies":[{"name":"wp","href":"https:\/\/api.w.org\/{rel}","templated":true}]}}