{"id":18603,"date":"2026-05-26T18:30:33","date_gmt":"2026-05-26T10:30:33","guid":{"rendered":"https:\/\/kbwp.transwarp.cn\/?p=18603"},"modified":"2026-05-26T18:30:33","modified_gmt":"2026-05-26T10:30:33","slug":"%e4%b8%bb%e9%94%ae%e8%af%ad%e4%b9%89holodesk%e8%a1%a8%e4%bd%bf%e7%94%a8%e8%af%b4%e6%98%8e","status":"publish","type":"post","link":"https:\/\/kbwp.transwarp.cn\/?p=18603","title":{"rendered":"\u4e3b\u952e\u8bed\u4e49holodesk\u8868\u4f7f\u7528\u8bf4\u660e"},"content":{"rendered":"<h3>\u6982\u8981\u63cf\u8ff0<\/h3>\n<hr \/>\n<p><strong>\u672c\u6587\u4e3b\u8981\u4ecb\u7ecd\u4e3b\u952e\u8bed\u4e49\u4e0b\uff0crowkey\u8868\u5728\u4e0b\u97622\u4e2a\u53c2\u6570\u7684\u4f5c\u7528\u4e0b\u7684\u4e0d\u540c\u4f53\u73b0\u3002<\/strong><\/p>\n<p><code>holodesk.rowkey.strategy<\/code>\uff0c\u8868\u793a\u9047\u5230\u91cd\u590d RowKey \u65f6\u5019\u5e94\u8be5\u600e\u4e48\u5904\u7406\uff0c2\u4e2a\u5907\u9009\u503c\uff1a<\/p>\n<ul>\n<li>replace(\u9ed8\u8ba4\u503c) \u8868\u793a\u9047\u5230\u91cd\u590d\u7684 RowKey \u65f6\uff0c\u7528\u65b0\u7684\u6570\u636e\u8986\u76d6\u65e7\u7684\u6570\u636e<\/li>\n<li>conflict \u8868\u793a\u9047\u5230\u91cd\u590d RowKey \u65f6\uff0c\u76f4\u63a5\u629b\u51fa\u5f02\u5e38<\/li>\n<\/ul>\n<p><code>holodesk.rowkey.unique.scope<\/code>\uff0c\u8868\u793a RowKey \u7684\u4f5c\u7528\u8303\u56f4\uff0c2\u4e2a\u5907\u9009\u503c\uff1a<\/p>\n<ul>\n<li>section(\u9ed8\u8ba4\u503c)\uff0c\u8868\u793a RowKey \u5728\u540c\u4e00\u4e2a\u5206\u533a\u5185\u662f\u552f\u4e00\u7684\uff0c\u4e0d\u540c\u7684\u5206\u533a\u53ef\u4ee5\u5305\u542b\u76f8\u540c\u7684 RowKey<\/li>\n<li>global\uff0c\u8868\u793a RowKey \u662f\u5168\u5c40\u552f\u4e00\u7684\uff0c\u4e0d\u540c\u7684\u5206\u533a\u4e0d\u53ef\u4ee5\u5305\u542b\u76f8\u540c\u7684 RowKey<\/li>\n<\/ul>\n<h3>\u8be6\u7ec6\u4ecb\u7ecd<\/h3>\n<hr \/>\n<h4>1. \u5206\u533a\u5185\u552f\u4e00\uff0c\u91cd\u590d\u503c\u8986\u76d6\uff08\u9ed8\u8ba4\u60c5\u51b5\uff09<\/h4>\n<p>holodesk.rowkey.strategy=replace<br \/>\nholodesk.rowkey.unique.scope=section<\/p>\n<pre><code class=\"language-sql\">drop table rk_bigint_1;\nCREATE TABLE IF NOT EXISTS rk_bigint_1\n(\nc1 INT,\nc2 STRING\n)\npartitioned by (p string)\nCLUSTERED BY(c1)\nSTORED AS HOLODESK\nTBLPROPERTIES \n('holodesk.rowkey'='c1');\n\ninsert into rk_bigint_1 select 1,'a','p1';\ninsert into rk_bigint_1 select 1,'b','p1';\n\nSELECT * FROM rk_bigint_1;<\/code><\/pre>\n<p>\u6267\u884c\u4e0d\u62a5\u9519\uff0cp=p1\u7684\u5206\u533a\u5185\uff0c\u76f8\u540crowkey\u4f1a\u88abreplace\u8986\u76d6\u6389\uff1a<\/p>\n<div style=\"box-shadow: 1px 1px 10px rgba(0,0,0,0.1); padding: 1px; display: inline-block; width: auto; margin-bottom: 10px;\">\n  <img decoding=\"async\" src=\"\/wp-content\/uploads\/2026\/05\/image-1779791252212.png\" style=\"display: block;\">\n<\/div>\n<h4>2. \u5168\u5c40\u552f\u4e00<\/h4>\n<p>holodesk.rowkey.strategy=conflict<br \/>\nholodesk.rowkey.unique.scope=global<\/p>\n<pre><code class=\"language-sql\">drop table IF EXISTS rk_bigint_2;\nCREATE TABLE  rk_bigint_2(\nc1 int\n)partitioned by (p string)\nCLUSTERED BY(c1)\nSTORED AS HOLODESK\nTBLPROPERTIES (\n'holodesk.rowkey'='c1',\n'holodesk.rowkey.strategy'='conflict',\n'holodesk.rowkey.unique.scope'='global'\n);\n\n--\u5148\u63d2\u5165\u4e00\u6761\u6570\u636e\ninsert into rk_bigint_2 select 1,'p1';\n--\u53e6\u4e00\u4e2a\u5206\u533a\uff0c\u76f8\u540crowkey\uff0c\u63d2\u5165\u5931\u8d25 java.lang.RuntimeException: There is a rowKey conflict between the new data and the old data globally.\ninsert into rk_bigint_2 select 1,'p2';<\/code><\/pre>\n","protected":false},"excerpt":{"rendered":"<p>\u6982\u8981\u63cf\u8ff0 \u672c\u6587\u4e3b\u8981\u4ecb\u7ecd\u4e3b\u952e\u8bed\u4e49\u4e0b\uff0crowkey\u8868\u5728\u4e0b\u97622\u4e2a\u53c2\u6570\u7684\u4f5c\u7528\u4e0b\u7684\u4e0d\u540c\u4f53\u73b0\u3002 holodesk.rowk ..<\/p>\n<div class=\"clear-fix\"><\/div>\n<p><a href=\"https:\/\/kbwp.transwarp.cn\/?p=18603\" title=\"read more...\">Read more<\/a><\/p>\n","protected":false},"author":12,"featured_media":0,"comment_status":"closed","ping_status":"closed","sticky":false,"template":"","format":"standard","meta":{"footnotes":""},"categories":[1],"tags":[],"class_list":["post-18603","post","type-post","status-publish","format-standard","hentry","category-uncategorized"],"acf":[],"_links":{"self":[{"href":"https:\/\/kbwp.transwarp.cn\/index.php?rest_route=\/wp\/v2\/posts\/18603","targetHints":{"allow":["GET"]}}],"collection":[{"href":"https:\/\/kbwp.transwarp.cn\/index.php?rest_route=\/wp\/v2\/posts"}],"about":[{"href":"https:\/\/kbwp.transwarp.cn\/index.php?rest_route=\/wp\/v2\/types\/post"}],"author":[{"embeddable":true,"href":"https:\/\/kbwp.transwarp.cn\/index.php?rest_route=\/wp\/v2\/users\/12"}],"replies":[{"embeddable":true,"href":"https:\/\/kbwp.transwarp.cn\/index.php?rest_route=%2Fwp%2Fv2%2Fcomments&post=18603"}],"version-history":[{"count":1,"href":"https:\/\/kbwp.transwarp.cn\/index.php?rest_route=\/wp\/v2\/posts\/18603\/revisions"}],"predecessor-version":[{"id":18606,"href":"https:\/\/kbwp.transwarp.cn\/index.php?rest_route=\/wp\/v2\/posts\/18603\/revisions\/18606"}],"wp:attachment":[{"href":"https:\/\/kbwp.transwarp.cn\/index.php?rest_route=%2Fwp%2Fv2%2Fmedia&parent=18603"}],"wp:term":[{"taxonomy":"category","embeddable":true,"href":"https:\/\/kbwp.transwarp.cn\/index.php?rest_route=%2Fwp%2Fv2%2Fcategories&post=18603"},{"taxonomy":"post_tag","embeddable":true,"href":"https:\/\/kbwp.transwarp.cn\/index.php?rest_route=%2Fwp%2Fv2%2Ftags&post=18603"}],"curies":[{"name":"wp","href":"https:\/\/api.w.org\/{rel}","templated":true}]}}