首批通过分布式安全可靠测评,为关键业务系统打造
执行报错 ERROR 4152 (42000): Null value,get obj error(ret=-4152)
更新时间:2026-05-29 08:46
问题现象
SQL 执行报错,错误码为 -4152,错误日志如下。
[2023-12-28 10:29:59.960155] WDIAG [SERVER] get_int (ob_inner_sql_result.cpp:500) [115237][T1004_L0_G0][T1004][xxxxx-xxxxx-xxxxx-xxxxx] [lt=17][errcode=-4152] get obj error(ret=-4152)
[2023-12-28 10:29:59.960196] WDIAG [SQL] fill_column_stat (ob_opt_stat_sql_service.cpp:1445) [115237][T1004_L0_G0][T1004][xxxxx-xxxxx-xxxxx-xxxxx] [lt=39][errcode=-4152] fail to get column in row. (column_name="endpoint_num", ret=-4152)
[2023-12-28 10:29:59.960220] WDIAG [COMMON] fetch_column_stat (ob_opt_stat_sql_service.cpp:1301) [115237][T1004_L0_G0][T1004][xxxxx-xxxxx-xxxxx-xxxxx] [lt=22][errcode=-4152] read stat from result failed. (ret=-4152)
[2023-12-28 10:29:59.960454] WDIAG [SQL.OPT] load_column_stat_and_put_cache (ob_opt_stat_service.cpp:204) [115237][T1004_L0_G0][T1004][xxxxx-xxxxx-xxxxx-xxxxx] [lt=7][errcode=-4152] failed to fetch column stat(ret=-4152)
[2023-12-28 10:29:59.960501] WDIAG [SQL.OPT] get_column_stat (ob_opt_stat_service.cpp:134) [115237][T1004_L0_G0][T1004][xxxxx-xxxxx-xxxxx-xxxxx] [lt=43][errcode=-4152] failed to load column stat and put cache(ret=-4152, regather_keys=[{tenant_id_:1004, table_id_:191, partition_id_:191, column_id_:21}])
[2023-12-28 10:29:59.960525] WDIAG [COMMON] get_column_stat (ob_opt_stat_manager.cpp:150) [115237][T1004_L0_G0][T1004][xxxxx-xxxxx-xxxxx-xxxxx] [lt=22][errcode=-4152] get column stat failed.(ret=-4152)
[2023-12-28 10:29:59.960533] WDIAG [COMMON] get_column_stat (ob_opt_stat_manager.cpp:631) [115237][T1004_L0_G0][T1004][xxxxx-xxxxx-xxxxx-xxxxx] [lt=5][errcode=-4152] failed to get opt column stats(ret=-4152, global_part_ids=[], part_ids=[191], cids=[21])
关键诊断信息
触发条件
目前触发条件不明确。
事前巡检
如果下面的 SQL,执行的结果不为空,说明存在有问题的表。
select distinct c.table_id,c.partition_id,c.column_id
from oceanbase.__all_virtual_column_stat c
left join oceanbase.__all_virtual_histogram_stat h
on c.tenant_id = h.tenant_id
and c.table_id = h.table_id
and c.partition_id = h.partition_id
and c.column_id = h.column_id
where c.tenant_id = xx and c.histogram_type != 0 and h.endpoint_num is null;
事后诊断
SQL 执行时报 -4152,且日志中存在 fail to get column in row. (column_name="endpoint_num", ret=-4152)。
问题原因
因为一个内存拷贝的 BUG 导致统计信息内部表错误。
问题的风险及影响
可能会导致出问题的内部表访问不了。
影响租户
影响 OceanBase 数据库中的 Oracle 租户和 MySQL 租户。
影响版本
OceanBase 数据库企业版 V4.2.1 GA(oceanbase-4.2.1.0-100000182023092722)及之后版本、V4.2.2 GA(oceanbase-4.2.2.0-100000082024011317)及之后版本、V4.3.0(oceanbase-4.3.0.0-100000072024020200)及之后版本。
解决方法
升级至问题已修复版本。目前已修复的版本包括 OceanBase 数据库企业版 V2.2.1 BP8 (oceanbase-4.2.1.8-108000052024072217) 及之后版本、V4.2.4 Beta(oceanbase-4.2.4.0-100000252024070621)及之后版本。
通过修正内部表的方式来规避此问题。
###-- 1. 直连,切换租户。 alter system change tenant xx;### -- 2. 修改有问题的 __all_column_stat。 update __all_column_stat set histogram_type = 0 where (table_id,partition_id,column_id) in (select distinct c.table_id,c.partition_id,c.column_id from oceanbase.__all_column_stat c left join oceanbase.__all_histogram_stat h on c.tenant_id = h.tenant_id and c.table_id = h.table_id and c.partition_id = h.partition_id and c.column_id = h.column_id where c.histogram_type != 0 and h.endpoint_num is null);警告
修正内部表
__all_column_stat存在风险。请勿私自修改内部表,请联系 OceanBase 数据库技术支持团队协助处理。