{"id":12450,"date":"2023-12-19T10:02:09","date_gmt":"2023-12-19T02:02:09","guid":{"rendered":"https:\/\/www.gbase8.cn\/?p=12450"},"modified":"2023-12-19T10:02:10","modified_gmt":"2023-12-19T02:02:10","slug":"gbase-8a%e9%9b%86%e7%be%a4%e6%9f%a5%e8%a1%a8%e6%8a%a5%e9%94%99cant-get-distribution-attribute-of-table","status":"publish","type":"post","link":"https:\/\/www.gbase8.cn\/en\/12450","title":{"rendered":"\u5357\u5927\u901a\u7528GBase 8a\u96c6\u7fa4\u67e5\u8868\u62a5\u9519Can't get distribution attribute of table"},"content":{"rendered":"<p>GBase 8a\u96c6\u7fa4\u5982\u679c\u51fa\u73b0OS\u5f02\u5e38\u65ad\u7535\uff0c\u6b7b\u673a\u65f6\uff0c\u53ef\u80fd\u4f1a\u51fa\u73b0\u90e8\u5206\u5143\u6570\u636e\u6ca1\u6709\u6b63\u786e\u4fdd\u5b58\u5230\u78c1\u76d8\u4e0a\u60c5\u51b5\uff0c\u6bd4\u5982gbase.table_distribution\u8868\u3002\u5982\u679c\u96c6\u7fa4\u4e3a\u5355\u8282\u70b9\uff0c\u6ca1\u6709\u526f\u672c\u7528\u4e8e\u81ea\u52a8\u6062\u590d\u65f6\uff0c\u53ef\u80fd\u9020\u6210\u90e8\u5206\u8868\u67e5\u8be2\u65f6\u62a5\u9519Can't get distribution attribute of table\u3002<\/p>\n\n\n\n<div id=\"ez-toc-container\" class=\"ez-toc-v2_0_84 counter-hierarchy ez-toc-counter ez-toc-grey ez-toc-container-direction\">\n<p class=\"ez-toc-title\" style=\"cursor:inherit\">Directory Navigation<\/p>\n<label for=\"ez-toc-cssicon-toggle-item-6a2b2c99261a0\" class=\"ez-toc-cssicon-toggle-label\"><span class=\"\"><span class=\"eztoc-hide\" style=\"display:none;\">Toggle<\/span><span class=\"ez-toc-icon-toggle-span\"><svg style=\"fill: #999;color:#999\" xmlns=\"http:\/\/www.w3.org\/2000\/svg\" class=\"list-377408\" width=\"20px\" height=\"20px\" viewbox=\"0 0 24 24\" fill=\"none\"><path d=\"M6 6H4v2h2V6zm14 0H8v2h12V6zM4 11h2v2H4v-2zm16 0H8v2h12v-2zM4 16h2v2H4v-2zm16 0H8v2h12v-2z\" fill=\"currentColor\"><\/path><\/svg><svg style=\"fill: #999;color:#999\" class=\"arrow-unsorted-368013\" xmlns=\"http:\/\/www.w3.org\/2000\/svg\" width=\"10px\" height=\"10px\" viewbox=\"0 0 24 24\" version=\"1.2\" baseprofile=\"tiny\"><path d=\"M18.2 9.3l-6.2-6.3-6.2 6.3c-.2.2-.3.4-.3.7s.1.5.3.7c.2.2.4.3.7.3h11c.3 0 .5-.1.7-.3.2-.2.3-.5.3-.7s-.1-.5-.3-.7zM5.8 14.7l6.2 6.3 6.2-6.3c.2-.2.3-.5.3-.7s-.1-.5-.3-.7c-.2-.2-.4-.3-.7-.3h-11c-.3 0-.5.1-.7.3-.2.2-.3.5-.3.7s.1.5.3.7z\"\/><\/svg><\/span><\/span><\/label><input type=\"checkbox\"  id=\"ez-toc-cssicon-toggle-item-6a2b2c99261a0\"  aria-label=\"Toggle\" \/><nav><ul class='ez-toc-list ez-toc-list-level-1' ><li class='ez-toc-page-1 ez-toc-heading-level-2'><a class=\"ez-toc-link ez-toc-heading-1\" href=\"https:\/\/www.gbase8.cn\/en\/12450\/#%E6%8A%A5%E9%94%99%E6%A0%B7%E4%BE%8B\" >\u62a5\u9519\u6837\u4f8b<\/a><\/li><li class='ez-toc-page-1 ez-toc-heading-level-2'><a class=\"ez-toc-link ez-toc-heading-2\" href=\"https:\/\/www.gbase8.cn\/en\/12450\/#%E6%8A%A5%E9%94%99%E5%8E%9F%E5%9B%A0\" >\u62a5\u9519\u539f\u56e0<\/a><\/li><li class='ez-toc-page-1 ez-toc-heading-level-2'><a class=\"ez-toc-link ez-toc-heading-3\" href=\"https:\/\/www.gbase8.cn\/en\/12450\/#%E8%A7%A3%E5%86%B3%E6%96%B9%E6%A1%88\" >Solution<\/a><ul class='ez-toc-list-level-3' ><li class='ez-toc-heading-level-3'><a class=\"ez-toc-link ez-toc-heading-4\" href=\"https:\/\/www.gbase8.cn\/en\/12450\/#%E6%89%8B%E5%B7%A5%E9%87%8D%E5%BB%BAtable_distribution%E6%95%B0%E6%8D%AE\" >\u624b\u5de5\u91cd\u5efatable_distribution\u6570\u636e<\/a><\/li><li class='ez-toc-page-1 ez-toc-heading-level-3'><a class=\"ez-toc-link ez-toc-heading-5\" href=\"https:\/\/www.gbase8.cn\/en\/12450\/#%E4%BB%8E%E5%85%B6%E5%AE%83%E9%9B%86%E7%BE%A4%E8%BF%98%E5%8E%9F\" >\u4ece\u5176\u5b83\u96c6\u7fa4\u8fd8\u539f<\/a><\/li><li class='ez-toc-page-1 ez-toc-heading-level-3'><a class=\"ez-toc-link ez-toc-heading-6\" href=\"https:\/\/www.gbase8.cn\/en\/12450\/#%E5%88%A0%E4%BA%86%E9%87%8D%E5%BB%BA\" >\u5220\u4e86\u91cd\u5efa<\/a><\/li><\/ul><\/li><\/ul><\/nav><\/div>\n<h2 class=\"wp-block-heading\"><span class=\"ez-toc-section\" id=\"%E6%8A%A5%E9%94%99%E6%A0%B7%E4%BE%8B\"><\/span>\u62a5\u9519\u6837\u4f8b<span class=\"ez-toc-section-end\"><\/span><\/h2>\n\n\n\n<pre class=\"wp-block-code has-small-font-size\"><code>ERROR 1149 (42000): (GBA-02SC-1001) Can't get distribution attribute of table `testdb`.`t2_test`, please check your gbase.table_distribution.<\/code><\/pre>\n\n\n\n<h2 class=\"wp-block-heading\"><span class=\"ez-toc-section\" id=\"%E6%8A%A5%E9%94%99%E5%8E%9F%E5%9B%A0\"><\/span>\u62a5\u9519\u539f\u56e0<span class=\"ez-toc-section-end\"><\/span><\/h2>\n\n\n\n<p>\u8868\u7684\u90e8\u5206\u5143\u6570\u636e\u4fe1\u606f\u4fdd\u5b58\u73b0\u5728gbase.table_distribution\u91cc\uff0c\u5305\u62ec\u5206\u5e03\u7c7b\u578b(hash\u5206\u5e03\u8fd8\u662f\u968f\u673a\u5206\u5e03)\uff0c\u662f\u5426\u4e3a\u590d\u5236\u8868\u7b49\u3002<\/p>\n\n\n\n<p>\u5982\u679c\u8868\u5728\u78c1\u76d8\u4e0a\u5b8c\u5168\u4e0d\u5b58\u5728\uff0c\u5219\u4f1a\u62a5not exists\u9519\u8bef<\/p>\n\n\n\n<pre class=\"wp-block-code has-small-font-size\"><code>gbase> select * from t2_test2;\r\nERROR 1146 (42S02): Table 'testdb.t2_test2' doesn't exist<\/code><\/pre>\n\n\n\n<p>\u5982\u679c\u8be5\u8868\u5b58\u5728\uff0c\u4f46\u5982\u4e0a\u5143\u6570\u636e\u8868\u6570\u636e\u56e0\u73af\u5883\u95ee\u9898\u5bfc\u81f4\u4e22\u5931\uff0c\u5219\u4f1a\u9020\u6210\u5982\u4e0b\u62a5\u9519<\/p>\n\n\n\n<pre class=\"wp-block-code has-small-font-size\"><code>gbase> select * from t2_test;\r\nERROR 1149 (42000): (GBA-02SC-1001) Can't get distribution attribute of table `testdb`.`t2_test`, please check your gbase.table_distribution.<\/code><\/pre>\n\n\n\n<p>\u53e6\u5916\uff0c\u5982\u679c\u5c1d\u8bd5\u91cd\u5efa\u8868\uff0c\u4f1a\u53d1\u73b0\u5982\u4e0b2\u4e2a\u5178\u578b\u73b0\u8c61\uff1a<\/p>\n\n\n\n<ul class=\"wp-block-list\"><li>\u5220\u9664\u8868\u65f6\uff0c\u62a5\u672a\u77e5\u7684\u8868(Unknown table)\u5efa\u8868\u65f6<\/li><li>\u62a5\u8868\u5df2\u7ecf\u5b58\u5728(already exists)<\/li><\/ul>\n\n\n\n<pre class=\"wp-block-code has-small-font-size\"><code>gbase> drop table t2_test;\r\nERROR 1702 (HY000): gcluster table error: (GBA-02DD-0017) Unknown table 'testdb.t2_test'\r\ngbase>\r\ngbase> create table t2_test like t2;\r\nERROR 1050 (42S01): Table 't2_test' already exists\r\ngbase><\/code><\/pre>\n\n\n\n<h2 class=\"wp-block-heading\"><span class=\"ez-toc-section\" id=\"%E8%A7%A3%E5%86%B3%E6%96%B9%E6%A1%88\"><\/span>Solution<span class=\"ez-toc-section-end\"><\/span><\/h2>\n\n\n\n<h3 class=\"wp-block-heading\"><span class=\"ez-toc-section\" id=\"%E6%89%8B%E5%B7%A5%E9%87%8D%E5%BB%BAtable_distribution%E6%95%B0%E6%8D%AE\"><\/span>\u624b\u5de5\u91cd\u5efatable_distribution\u6570\u636e<span class=\"ez-toc-section-end\"><\/span><\/h3>\n\n\n\n<p>\u5411gbase.table_distribution\u8868\u91cc\u9762\uff0c\u63d2\u5165\u4e22\u5931\u7684\u6570\u636e\u3002\u6bd4\u5982<\/p>\n\n\n\n<pre class=\"wp-block-code has-small-font-size\"><code>gbase> insert into table_distribution values('testdb.t2_test','testdb','t2_test','NO',null,null,null,'NO',2);\r\nQuery OK, 1 row affected (Elapsed: 00:00:00.00)\ngbase> select * from table_distribution where index_name like '%t2_test%';\r\n+----------------+--------+---------+-------------+-------------+------------------+--------------------+-------------+----------------------+\r\n| index_name     | dbName | tbName  | isReplicate | hash_column | lmt_storage_size | table_storage_size | is_nocopies | data_distribution_id |\r\n+----------------+--------+---------+-------------+-------------+------------------+--------------------+-------------+----------------------+\r\n| testdb.t2_test | testdb | t2_test | NO          | NULL        |             NULL |               NULL | NO          |                    2 |\r\n+----------------+--------+---------+-------------+-------------+------------------+--------------------+-------------+----------------------+\r\n1 row in set (Elapsed: 00:00:00.00)<\/code><\/pre>\n\n\n\n<p>\u5404\u4e2a\u5b57\u6bb5\u542b\u4e49\u53c2\u8003 <a href=\"https:\/\/www.gbase8.cn\/en\/1361\/\">GBase 8a\u5143\u6570\u636e\u8868gbase.<mark>table_distribution<\/mark><\/a>\u3002\u5176\u4e2d<\/p>\n\n\n\n<ul class=\"wp-block-list\"><li>isReplicate \u662f\u5426\u4e3a\u590d\u5236\u8868<\/li><li>hash_column \u5982\u679c\u6709hash\u5217\uff0c\u5219\u6b63\u786e\u586b\u5199<\/li><li>data_distribution_id \u8fd9\u4e2a\u53ef\u4ee5\u4ece\u5176\u5b83\u5b58\u5728\u7684\u53ef\u67e5\u8be2\u7684\u8868\u91cc\u5f97\u5230\uff0c\u4fdd\u6301\u4e00\u81f4\u5373\u53ef\u3002<\/li><\/ul>\n\n\n\n<p>\u7136\u540e\u5355\u72ec\u542f\u52a8gclusterd\u670d\u52a1\uff0c\u56e0\u4e3agnode\u4e0a\u6ca1\u6709\u8fd9\u4e2agbase.table_distribution\u8868<\/p>\n\n\n\n<pre class=\"wp-block-code has-small-font-size\"><code>&#91;gbase@localhost gbase]$ gcluster_services gcluster restart\r\nStopping gcluster :                                        &#91;  OK  ]\r\nStarting gcluster :                                    &#91;  OK  ]<\/code><\/pre>\n\n\n\n<p>\u5c31\u53ef\u4ee5\u6b63\u5e38\u67e5\u8be2\u4e86<\/p>\n\n\n\n<pre class=\"wp-block-code has-small-font-size\"><code>gbase> select * from t2_test;\r\nEmpty set (Elapsed: 00:00:00.03)<\/code><\/pre>\n\n\n\n<p>\u8fd9\u4e2a\u65b9\u6848\u9002\u5408\u6570\u636e\u91cd\u8981\u4e0d\u80fd\u5220\u9664\u7684\u60c5\u51b5\u3002<\/p>\n\n\n\n<p>\u6392\u67e5\u54ea\u4e9b\u8868\u53ef\u80fd\u4e22\u5931\uff0c\u53ef\u4ee5\u53c2\u8003\u5982\u4e0b\u65b9\u6848<\/p>\n\n\n\n<pre class=\"wp-block-code has-small-font-size\"><code>gbase> select table_name from information_schema.tables where table_schema='testdb' and table_name not in(select tbname from gbase.table_distribution where dbname='testdb');\r\n+------------+\r\n| table_name |\r\n+------------+\r\n| t2_test    |\r\n+------------+\r\n1 row in set (Elapsed: 00:00:00.00)<\/code><\/pre>\n\n\n\n<h3 class=\"wp-block-heading\"><span class=\"ez-toc-section\" id=\"%E4%BB%8E%E5%85%B6%E5%AE%83%E9%9B%86%E7%BE%A4%E8%BF%98%E5%8E%9F\"><\/span>\u4ece\u5176\u5b83\u96c6\u7fa4\u8fd8\u539f<span class=\"ez-toc-section-end\"><\/span><\/h3>\n\n\n\n<p>\u5982\u679c\u6709\u5176\u5b83\u73af\u5883\uff0c\u8868\u5b8c\u5168\u4e00\u6837\uff0c\u53ef\u4ee5\u5c06\u8be5\u8868\u6570\u636e\u590d\u5236\u8fc7\u6765\uff0c\u7136\u540e\u672c\u5730\u91cd\u542f\u670d\u52a1\u5373\u53ef<\/p>\n\n\n\n<pre class=\"wp-block-code has-small-font-size\"><code>scp gbase@XXXX:\/opt\/gbase\/gcluster\/userdata\/gcluster\/gbase\/table_distribution.* \/opt\/gbase\/gcluster\/userdata\/gcluster\/gbase\/<\/code><\/pre>\n\n\n\n<p>\u5efa\u8bae\u63d0\u524d\u5907\u4efd\u672c\u5730\u6587\u4ef6<\/p>\n\n\n\n<h3 class=\"wp-block-heading\"><span class=\"ez-toc-section\" id=\"%E5%88%A0%E4%BA%86%E9%87%8D%E5%BB%BA\"><\/span>\u5220\u4e86\u91cd\u5efa<span class=\"ez-toc-section-end\"><\/span><\/h3>\n\n\n\n<p>\u5982\u679c\u662f\u6d4b\u8bd5\u73af\u5883\uff0c\u6570\u636e\u4e0d\u91cd\u8981\uff0c\u5c3d\u5feb\u6062\u590d\u4f18\u5148\uff0c\u5efa\u8bae\u5220\u5e93\u91cd\u5efa\u3002<\/p>\n\n\n\n<p><\/p>","protected":false},"excerpt":{"rendered":"<p>\u5357\u5927\u901a\u7528GBase 8a\u96c6\u7fa4\u5982\u679c\u51fa\u73b0OS\u5f02\u5e38\u65ad\u7535\uff0c\u6b7b\u673a\u65f6\uff0c\u53ef\u80fd\u4f1a\u51fa\u73b0\u90e8\u5206\u5143\u6570\u636e\u6ca1\u6709\u6b63\u786e\u4fdd\u5b58\u5230\u78c1\u76d8\u4e0a\u60c5\u51b5\uff0c\u6bd4\u5982gbase.table_distribution\u8868\u3002\u5982\u679c\u96c6\u7fa4\u4e3a\u5355\u8282\u70b9\uff0c\u6ca1\u6709\u526f\u672c\u7528\u4e8e\u81ea\u52a8\u6062\u590d\u65f6\uff0c\u53ef\u80fd\u9020\u6210\u90e8\u5206\u8868\u67e5\u8be2\u65f6\u62a5\u9519Can't get distribution attribute of table\u3002<\/p>","protected":false},"author":1,"featured_media":0,"comment_status":"closed","ping_status":"closed","sticky":false,"template":"","format":"standard","meta":{"footnotes":""},"categories":[54],"tags":[],"class_list":["post-12450","post","type-post","status-publish","format-standard","hentry","category-gbase8a"],"_links":{"self":[{"href":"https:\/\/www.gbase8.cn\/en\/wp-json\/wp\/v2\/posts\/12450","targetHints":{"allow":["GET"]}}],"collection":[{"href":"https:\/\/www.gbase8.cn\/en\/wp-json\/wp\/v2\/posts"}],"about":[{"href":"https:\/\/www.gbase8.cn\/en\/wp-json\/wp\/v2\/types\/post"}],"author":[{"embeddable":true,"href":"https:\/\/www.gbase8.cn\/en\/wp-json\/wp\/v2\/users\/1"}],"replies":[{"embeddable":true,"href":"https:\/\/www.gbase8.cn\/en\/wp-json\/wp\/v2\/comments?post=12450"}],"version-history":[{"count":5,"href":"https:\/\/www.gbase8.cn\/en\/wp-json\/wp\/v2\/posts\/12450\/revisions"}],"predecessor-version":[{"id":12455,"href":"https:\/\/www.gbase8.cn\/en\/wp-json\/wp\/v2\/posts\/12450\/revisions\/12455"}],"wp:attachment":[{"href":"https:\/\/www.gbase8.cn\/en\/wp-json\/wp\/v2\/media?parent=12450"}],"wp:term":[{"taxonomy":"category","embeddable":true,"href":"https:\/\/www.gbase8.cn\/en\/wp-json\/wp\/v2\/categories?post=12450"},{"taxonomy":"post_tag","embeddable":true,"href":"https:\/\/www.gbase8.cn\/en\/wp-json\/wp\/v2\/tags?post=12450"}],"curies":[{"name":"wp","href":"https:\/\/api.w.org\/{rel}","templated":true}]}}