首批通过分布式安全可靠测评,为关键业务系统打造
分区表 JOIN 报错,错误码 1317
更新时间:2026-05-21 09:16
本文介绍对分区表 JOIN 报 1317 错误的问题排查方法以及解决方法。
适用版本
OceanBase 数据库 V2.X 版本
问题现象
在租户 Primary Zone 设置为 RANDOM,分区表的分区 leader 打散到各个 Zone 的场景中,对两张分区表 t11 与 t12 进行 JOIN 操作报错。
obclient> SELECT t11.c1,t12.c2 FROM t11 ,t12 WHERE t11.c1=t12.c1 AND t11.c1=1;
ERROR 1317 (70100): strong consistency across distributed node not supported
可能原因
查询两张表的表 ID。
obclient> SELECT table_id FROM __all_virtual_table WHERE table_name='t11'; +---------------+ | table_id | +---------------+ | 1099511678139 | +---------------+ 1 row in set (0.02 sec) obclient> SELECT table_id FROM __all_virtual_table WHERE table_name='t12'; +---------------+ | table_id | +---------------+ | 1099511678140 | +---------------+ 1 row in set (0.02 sec)根据表 ID ,分别查询两张表的分区 Leader 分布。
发现两张表的 partition 1 不在同一个节点,t11 的 partition 1 位于
xx.xxx.xx.xxb,t12 的 partition 1 位于xx.xxx.xx.xxd。obclient> SELECT svr_ip,partition_idx,tg_id,partition_state FROM __all_virtual_pg_partition_info WHERE table_id=1099511678139 AND partition_state LIKE 'L%' ORDER BY partition_idx; +---------------+---------------+---------------+-----------------+ | svr_ip | partition_idx | tg_id | partition_state | +---------------+---------------+---------------+-----------------+ | xx.xxx.xx.xxa | 0 | 1099511678139 | L_WORKING | | xx.xxx.xx.xxb | 1 | 1099511678139 | L_WORKING | | xx.xxx.xx.xxc | 2 | 1099511678139 | L_WORKING | | xx.xxx.xx.xxd | 3 | 1099511678139 | L_WORKING | | xx.xxx.xx.xxe | 4 | 1099511678139 | L_WORKING | +---------------+---------------+---------------+-----------------+ 5 rows in set (0.12 sec) obclient> SELECT svr_ip,partition_idx,tg_id,partition_state FROM __all_virtual_pg_partition_info WHERE table_id=1099511678140 AND partition_state LIKE 'L%' ORDER BY partition_idx; +---------------+---------------+---------------+-----------------+ | svr_ip | partition_idx | tg_id | partition_state | +---------------+---------------+---------------+-----------------+ | xx.xxx.xx.xxa | 0 | 1099511678140 | L_WORKING | | xx.xxx.xx.xxd | 1 | 1099511678140 | L_WORKING | | xx.xxx.xx.xxc | 2 | 1099511678140 | L_WORKING | | xx.xxx.xx.xxb | 3 | 1099511678140 | L_WORKING | | xx.xxx.xx.xxe | 4 | 1099511678140 | L_WORKING | +---------------+---------------+---------------+-----------------+对 partition 分布不同的分区进行连接,复现问题。
obclient> SELECT t11.c1,t12.c2 FROM t11 ,t12 WHERE t11.c1=t12.c1 AND t11.c1=1; ERROR 1317 (70100): strong consistency across distributed node not supported对 partition 分布相同的分区进行连接,查询可以正常执行。
obclient> SELECT t11.c1,t12.c2 FROM t11,t12 WHERE t11.c1=t12.c1 AND t11.c1=3; +------+------+ | c1 | c2 | +------+------+ | 3 | 3 | +------+------+ 1 row in set (0.01 sec)
出现该问题的原因是由于 OceanBase 数据库 V2.x 版本如果没有开启 GTS,不支持跨机查询、更新、删除等操作。
解决方式
开启 GTS 或将这些表的分区 Leader 切换到同一台 OBServer上,都可以解决该问题。但推荐您在开启 GTS 的同时将表的分区 leader 切换到同一台 OBServer 上。
开启 GTS。
obclient> SET GLOBAL ob_timestamp_service='GTS';将这些表的分区 leader 切换到同一台 OBServer 上。
创建表组。
obclient> CREATE TABLEGROUP tg1 LOCALITY='F,R{ALL_SERVER}@z1' PARTITION BY hash PARTITIONS 5; Query OK, 0 rows affected (0.09 sec)将 t11 与 t12 加入表组。
obclient> ALTER TABLE t11 SET TABLEGROOUP tg1; Query OK, 0 rows affected (0.09 sec) obclient> ALTER TABLE t12 SET TABLEGROOUP tg1; Query OK, 0 rows affected (0.09 sec)