执行sQL出现4016内部错误

【 使用环境 】生产环境
【 OB or 其他组件 】4.3.5
【 使用版本 】4.3.5
【问题描述】执行SQL出现4016内部错误
【复现路径】执行SQL
【附件及日志】
observer.log.20250725144452091:[2025-07-25 14:42:06.263986] WDIAG [SQL.JO] generate_subquery_paths (ob_join_order.cpp:9848) [994956][T1004_L0_G0][T1004][YB420AE136E2-00062E8459E573AB-0-0] [lt=15][errcode=-4016] failed to get best plan(ret=-4016)
observer.log.20250725144452091:[2025-07-25 14:42:06.264012] WDIAG [SQL.JO] generate_normal_subquery_paths (ob_join_order.cpp:9806) [994956][T1004_L0_G0][T1004][YB420AE136E2-00062E8459E573AB-0-0] [lt=26][errcode=-4016] failed to generate subquery path(ret=-4016)
observer.log.20250725144452091:[2025-07-25 14:42:06.264022] WDIAG [SQL.OPT] generate_plan_tree (ob_log_plan.cpp:6603) [994956][T1004_L0_G0][T1004][YB420AE136E2-00062E8459E573AB-0-0] [lt=7][errcode=-4016] failed to generate the access path for the single-table query(ret=-4016, get_optimizer_context().get_query_ctx()->get_sql_stmt()=WITH
observer.log.20250725144452091:[2025-07-25 14:42:06.264044] WDIAG [SQL.OPT] generate_raw_plan_for_plain_select (ob_select_log_plan.cpp:5250) [994956][T1004_L0_G0][T1004][YB420AE136E2-00062E8459E573AB-0-0] [lt=21][errcode=-4016] failed to generate plan tree for plain select(ret=-4016)
observer.log.20250725144452091:[2025-07-25 14:42:06.264050] WDIAG [SQL.OPT] generate_raw_plan (ob_log_plan.cpp:10963) [994956][T1004_L0_G0][T1004][YB420AE136E2-00062E8459E573AB-0-0] [lt=6][errcode=-4016] fail to generate normal raw plan(ret=-4016)
observer.log.20250725144452091:[2025-07-25 14:42:06.264055] WDIAG [SQL.OPT] generate_plan (ob_log_plan.cpp:10920) [994956][T1004_L0_G0][T1004][YB420AE136E2-00062E8459E573AB-0-0] [lt=4][errcode=-4016] fail to generate raw plan(ret=-4016)
observer.log.20250725144452091:[2025-07-25 14:42:06.264062] WDIAG [SQL.OPT] optimize (ob_optimizer.cpp:65) [994956][T1004_L0_G0][T1004][YB420AE136E2-00062E8459E573AB-0-0] [lt=6][errcode=-4016] failed to perform optimization(ret=-4016)
observer.log.20250725144452091:[2025-07-25 14:42:06.264092] WDIAG [SQL] optimize_stmt (ob_sql.cpp:3846) [994956][T1004_L0_G0][T1004][YB420AE136E2-00062E8459E573AB-0-0] [lt=28][errcode=-4016] Failed to optimize logical plan(ret=-4016)
observer.log.20250725144452091:[2025-07-25 14:42:06.264098] WDIAG [SQL] generate_plan (ob_sql.cpp:3481) [994956][T1004_L0_G0][T1004][YB420AE136E2-00062E8459E573AB-0-0] [lt=5][errcode=-4016] Failed to optimizer stmt(ret=-4016)
observer.log.20250725144452091:[2025-07-25 14:42:06.264119] WDIAG [SQL] generate_physical_plan (ob_sql.cpp:3268) [994956][T1004_L0_G0][T1004][YB420AE136E2-00062E8459E573AB-0-0] [lt=13][errcode=-4016] failed to generate plan(ret=-4016)
observer.log.20250725144452091:[2025-07-25 14:42:06.264134] WDIAG [SQL] handle_physical_plan (ob_sql.cpp:5162) [994956][T1004_L0_G0][T1004][YB420AE136E2-00062E8459E573AB-0-0] [lt=15][errcode=-4016] Failed to generate plan(ret=-4016, result.get_exec_context().need_disconnect()=false)
observer.log.20250725144452091:[2025-07-25 14:42:06.264141] WDIAG [SQL] handle_text_query (ob_sql.cpp:2823) [994956][T1004_L0_G0][T1004][YB420AE136E2-00062E8459E573AB-0-0] [lt=5][errcode=-4016] fail to handle physical plan(ret=-4016)
observer.log.20250725144452091:[2025-07-25 14:42:06.264159] WDIAG [SQL] stmt_query (ob_sql.cpp:232) [994956][T1004_L0_G0][T1004][YB420AE136E2-00062E8459E573AB-0-0] [lt=13][errcode=-4016] fail to handle text query(stmt=WITH
observer.log.20250725144452091:[2025-07-25 14:42:06.264181] WDIAG [SERVER] after_func (ob_query_retry_ctrl.cpp:1066) [994956][T1004_L0_G0][T1004][YB420AE136E2-00062E8459E573AB-0-0] [lt=17][errcode=-4016] [RETRY] check if need retry(v={force_local_retry:false, stmt_retry_times:0, local_retry_times:0, err_:-4016, err_:“OB_ERR_UNEXPECTED”, retry_type:0, client_ret:-4016}, need_retry=false)
observer.log.20250725144452091:[2025-07-25 14:42:06.264193] WDIAG [SERVER] do_process (obmp_query.cpp:780) [994956][T1004_L0_G0][T1004][YB420AE136E2-00062E8459E573AB-0-0] [lt=10][errcode=-4016] run stmt_query failed, check if need retry(ret=-4016, cli_ret=-4016, retry_ctrl_.need_retry()=0, sql=WITH
observer.log.20250725144452091:[2025-07-25 14:42:06.264207] WDIAG [SQL] move_to_sqlstat_cache (ob_sql_stat_record.cpp:360) [994956][T1004_L0_G0][T1004][YB420AE136E2-00062E8459E573AB-0-0] [lt=11][errcode=0] the key is not valid which at plan cache mgr(ret=0, ret=“OB_SUCCESS”)
observer.log.20250725144452091:[2025-07-25 14:42:06.264226] WDIAG [SERVER] do_process (obmp_query.cpp:919) [994956][T1004_L0_G0][T1004][YB420AE136E2-00062E8459E573AB-0-0] [lt=16][errcode=-4016] query failed(ret=-4016, session={this:0xfffb34f44378, id:3221610234, deser:false, tenant:“YSGZ”, tenant_id:1004, effective_tenant:“YSGZ”, effective_tenant_id:1004, database:“ysgz_ggsj”, user:“root@%”, consistency_level:3, session_state:2, autocommit:true, tx:null}, sql=WITH
observer.log.20250725144452091:[2025-07-25 14:42:06.264286] INFO [SERVER] send_error_packet (obmp_packet_sender.cpp:380) [994956][T1004_L0_G0][T1004][YB420AE136E2-00062E8459E573AB-0-0] [lt=23] sending error packet(ob_error=-4016, client error=-4016, extra_err_info=NULL, lbt()=“0x11decf64 0xccb717c 0xcc67e10 0x1169e188 0x1168f5dc 0x1168a0d0 0x11687b88 0x1167901c 0xc9f4d30 0x1c4a20b8 0xfffe99f388cc 0xfffe99e7a1ec”)
observer.log.20250725144452091:[2025-07-25 14:42:06.264335] INFO [SERVER] send_error_packet (obmp_packet_sender.cpp:583) [994956][T1004_L0_G0][T1004][YB420AE136E2-00062E8459E573AB-0-0] [lt=18] dump txn free route audit_record(value=5, session->get_sessid()=3221610234, session->get_proxy_sessid()=783968154618687361)
observer.log.20250725144452091:[2025-07-25 14:42:06.264912] WDIAG [SQL.PC] common_free (ob_lib_cache_object_manager.cpp:141) [994956][T1004_L0_G0][T1004][YB420AE136E2-00062E8459E573AB-0-0] [lt=18][errcode=0] set logical del time(cache_obj->get_logical_del_time()=14099356799232, cache_obj->added_lc()=false, cache_obj->get_object_id()=54962, cache_obj->get_tenant_id()=1004, lbt()=“0x11decf64 0xea1fdb0 0x116a634c 0x116995dc 0x1168f5dc 0x1168a0d0 0x11687b88 0x1167901c 0xc9f4d30 0x1c4a20b8 0xfffe99f388cc 0xfffe99e7a1ec”)
observer.log.20250725144452091:[2025-07-25 14:42:06.265105] WDIAG [SERVER.OMT] process_one (ob_worker_processor.cpp:89) [994956][T1004_L0_G0][T1004][YB420AE136E2-00062E8459E573AB-0-0] [lt=5][errcode=-4016] process request fail(ret=-4016)
observer.log.20250725144452091:[2025-07-25 14:42:06.265113] WDIAG [SERVER.OMT] process (ob_worker_processor.cpp:157) [994956][T1004_L0_G0][T1004][YB420AE136E2-00062E8459E573AB-0-0] [lt=5][errcode=-4016] process request fail(ret=-4016)

【备注】基于 LLM 和开源文档 RAG 的论坛小助手已开放测试,在发帖时输入 [@论坛小助手] 即可召唤小助手,欢迎试用!

2 个赞

根据您的描述,您的问题可能与 SQL 执行过程中的内部错误有关。推荐使用 obdiag 工具进行日志采集和根因分析,这有助于我们更准确地定位问题所在。

日志采集场景: SQL 执行出错
日志采集命令: obdiag gather scene run --scene=observer.sql_err --env “{db_connect=’-h127.0.0.1 -P2881 -utest@test -p****** -Dtest’, trace_id=‘Yxx’}”

根因分析场景: 事务其他错误
根因分析命令: obdiag rca run --scene=transaction_other_error

请您先运行上述日志采集命令,并将生成的日志文件提供给我们。这将帮助我们更好地了解问题的具体情况。同时,为了进一步确定问题,请您回答以下几个问题:

  1. 您可以提供具体的错误日志吗?包括错误发生的时间、错误码等详细信息。
  2. 这个 SQL 语句是否每次执行都会报错?
  3. 这个 SQL 语句是在什么情况下执行的?例如,是在某个特定的应用程序中执行的,还是通过命令行执行的?
  4. 您能否提供执行该 SQL 语句的完整 SQL 语句?
  5. 在错误发生前,是否有任何系统变更或维护操作?
  6. 您的 OceanBase 环境配置如何?包括硬件配置和软件版本等信息。

感谢您的配合,我们会尽快帮您解决问题。

附上敏捷诊断工具 obdiag 使用帮助链接

1 个赞

麻烦参考小助手的使用obdiag收集下相关信息


执行不了哇

1 个赞

使用obd 安装一个obdiag 就不需要绑定信息了比较方便

1 个赞

没用obd

你是不是用的root用户安装的obdiag,然后用admin用户去执行的obdiag指令

1 个赞

语句有问题

分享感谢

学习打卡 :+1: :+1: :+1: :smiling_face_with_three_hearts: