问题现象
insert ignore与转储释放memtable并发场景下,insert ignore请求卡死 (线程栈可看到无进度),更多线程受到连带反应有可能造成整个 OBServer hang 住的情况。执行
insert into ignore卡住时pstack中的异常堆栈信息oceanbase::memtable::ObITransCallback::callback(int,bool,oceanbase::memtable::ObMemtable*)() oceanbase::memtable::ObTransCallbackList::callback(oceanbase::memtable::ObITransCallback const*. oceanbase::memtable::ObITransCallback const*,int,bool,bool)()#2 xxxxxx in oceanbase::memtable::ObMemtableCtx::sub_stmt_end(bool)#3 xxxxx in oceanbase::storage::ObPartitionStorage::insert_rows_(oceanbase::storage::ObPartitionStorage::ObDMLRunningCtx&,oceanbase::common::ObNewRow const*,log,oceanBase::storage::ObRowsinfo&,oceanbase::storage::ObStoreRow*,oceanbase::storage::ObPartitionStorage::RowReshape*,long&,log&)()
关键诊断信息
触发条件
业务执行的 insert ignore 与转储释放 memtable 并发,有可能会触发该问题。
问题原因
- 由于 OBServer 内核实现的缺陷,在
insert ignore与转储释放memtable并发的情况下,导致 OBServer 线程陷入一个内部数据结构的死循环,呈现 hang 死情况。在此时如果有持锁情况,有可能会造成更坏的影响,如 OBServer hang 死。
问题的风险及影响
insert ignore 请求卡死(线程栈可看到无进度),更多线程受到连带反应有可能造成整个 OBServer hang 住系统不可用。
影响的版本
OceanBase 数据库企业版本 V3.1.2 GA(oceanbase-3.1.2-20210618150922)及之后版本、V3.2.3 GA(oceanbase-3.2.3.0-20220418212020)及之后版本、V3.2.4 GA(oceanbase-3.2.4.0-100000072022102819)及之后版本。
OceanBase 数据库社区版 V3.1.4_CE_BP3 (oceanbase-ce-3.1.4-103000102023020719) 之前的版本。
解决方法及规避方式
解决方法:
升级至问题已修复版本,目前已修复如下版本: OceanBase 数据库企业版 V3.2.3 BP7 (oceanbase-3.2.3.3-107000092023011911) 及之后版本、V3.2.4 BP1 (oceanbase-3.2.4.1-101000052023010822) 及之后版本。
OceanBase 数据库社区版 V3.1.4_CE_BP3 (oceanbase-ce-3.1.4-103000102023020719) 及之后版本。
不使用 insert
ignore,使用replace语句替代, 举例如下。insert ignore into table_name(a,b) values('abc',28);用
replace替代ignore则insert replace into table_name(a,b) values('abc',28);应急手段:问题发生时可尝试 stop observer,将主切走后重启 OBServer 来应急。详细信息可以参考 停止或启动 OBServer。