【 使用环境 】生产环境
【 OB 】
【 使用版本 】4.0
【问题描述】 我执行sysbench oltp_read_only 看到事务中有很多remote类型:
obclient [oceanbase]> select
-> plan_type, count(1)
-> from GV$OB_SQL_AUDIT
-> where
-> tenant_id = 1002
-> and request_time > time_to_usec('2023-02-20 15:39:21')
-> group by plan_type;
+-----------+----------+
| plan_type | count(1) |
+-----------+----------+
| 1 | 2419 | # 1 代表 local, 表示当前语句所涉及的分区 Leader 与 Session 所在的机器相同
| 2 | 1488 | # 2 代表 remote, 表示当前语句所涉及的分区 Leader 与 Sesison 所在的机器不同
| 0 | 3509 | # 0 代表无 plan 的 SQL 语句,比如:set autocommit=0/1,commit 等
+-----------+----------+
查出OB为Primary Zone 为单 Zone & 单 Unit,obproxy.log并没有看到 fail to caculate partition id, just use tenant server:
# 查出OB为Primary Zone 为单 Zone & 单 Unit
obclient [oceanbase]> select tenant_name,concat(svr_ip,svr_port) as node,role,count(*) as cnt from __all_ls_meta_table t1,__all_tenant t2 where t1.role=1 and t1.tenant_id=t2.tenant_id group by t2.tenant_name,concat(t1.svr_ip,t1.svr_port),t1.role;
+-------------+-------------------+------+------+
| tenant_name | node | role | cnt |
+-------------+-------------------+------+------+
| META$1002 | 172.16.11.1342882 | 1 | 1 |
+-------------+-------------------+------+------+
1 row in set (0.012 sec)
obclient [oceanbase]> select * from oceanbase.DBA_OB_UNIT_CONFIGS \G
*************************** 1. row ***************************
UNIT_CONFIG_ID: 1
NAME: sys_unit_config
CREATE_TIME: 2023-01-17 16:04:27.292020
MODIFY_TIME: 2023-01-17 16:04:27.292020
MAX_CPU: 1
MIN_CPU: 1
MEMORY_SIZE: 2147483648
LOG_DISK_SIZE: 2147483648
MAX_IOPS: 10000
MIN_IOPS: 10000
IOPS_WEIGHT: 1
*************************** 2. row ***************************
UNIT_CONFIG_ID: 1001
NAME: tenant1_unit
CREATE_TIME: 2023-01-29 13:55:55.225187
MODIFY_TIME: 2023-01-29 13:55:55.225187
MAX_CPU: 15
MIN_CPU: 15
MEMORY_SIZE: 4294967296
LOG_DISK_SIZE: 15032385536
MAX_IOPS: 150000
MIN_IOPS: 150000
IOPS_WEIGHT: 15
2 rows in set (0.001 sec)
所以请问老师们是我查询错 ,并不是“ Primary Zone 为单 Zone & 单 Unit”,还是有其他异常?
官方文档关于分布式事务的描述:
https://www.oceanbase.com/docs/community-observer-cn-10000000000901370#Primary%20Zone%20为单%20Zone%20%20多%20Unit