首批通过分布式安全可靠测评,为关键业务系统打造
SS 模式下分区表上存在局部索引删分区后导致 Crash 问题
更新时间:2026-07-01 07:56
问题现象
共享存储模式下,数据表为分区表,且创建了局部索引,数据表删除中间的分区,重启后或者发生冷热 Trigger 后会导致 Core 问题。
关键诊断信息
触发条件
共享存储模式下,在分区表上创建了局部索引。
删除分区表中间的分区。
重启 OBServer/使用冷热的 Trigger 命令/修改局部索引的相关冷热策略。
事前巡检
检查是否为共享存储模式。
检查分区表上是否存在局部索引或者 LOB 列。
检查是否出现了删除分区表中间分区操作。
事后诊断
如果发生 Coredump,且堆栈结构如下即为该问题。
(gdb) bt
#0 0x00007f8665e42055 in raise () from /usr/lib64/libpthread.so.0
#1 0x000055772ede3b2e in oceanbase::common::coredump_cb (sig=11, sig_code=1, sig_addr=0x8de77, context=<optimized out>) at ./deps/oblib/src/lib/signal/ob_signal_handlers.cpp:267
#2 <signal handler called>
#3 oceanbase::share::schema::ObBasePartition::get_part_id (this=0x8de47) at ./src/share/schema/ob_schema_struct.h:2667
#4 oceanbase::storage::ObStorageCachePolicyService::cal_follow_table_partition_policy_status (this=0x7f85dd7f8030, partition=0x7f8593895970, index_partition_policy_status=0x7f85ad5e5137: oceanbase::storage::ObStorageCachePolicyStatus::MAX_STATUS, is_part=true) at ./close_modules/shared_storage/storage/shared_storage/storage_cache_policy/ob_storage_cache_service.cpp:613
#5 0x000055772df1437c in oceanbase::storage::ObStorageCachePolicyService::cal_partition_policy_status_from_table (this=0x7f85dd7f8030, partition=0x7f8593895970, table_policy=..., partition_policy_status=0x7f85ad5e5137: oceanbase::storage::ObStorageCachePolicyStatus::MAX_STATUS) at ./close_modules/shared_storage/storage/shared_storage/storage_cache_policy/ob_storage_cache_service.cpp:676
#6 oceanbase::storage::ObStorageCachePolicyService::cal_partition_policy_status (this=0x7f85dd7f8030, partition=0x7f8593895970, table_policy=..., partition_policy_status=0x7f85ad5e5137: oceanbase::storage::ObStorageCachePolicyStatus::MAX_STATUS) at ./close_modules/shared_storage/storage/shared_storage/storage_cache_policy/ob_storage_cache_service.cpp:485
#7 0x000055772df1ef7e in oceanbase::storage::ObStorageCachePolicyService::handle_partition (this=0x7f85dd7f8030, partition=0x1fe18abef000000, table_policy=..., partition_policy_need_calc=0x7f85ad5e5134: true, table_part_level=0x7f85ad5e50e4: oceanbase::share::schema::PARTITION_LEVEL_ONE, refresh_type=0x7f85ad5e55ac: oceanbase::storage::REFRESH_TYPE_NORMAL, partition_policy_status=0x7f85ad5e5137: oceanbase::storage::ObStorageCachePolicyStatus::MAX_STATUS) at ./close_modules/shared_storage/storage/shared_storage/storage_cache_policy/ob_storage_cache_service.cpp:1477
#8 oceanbase::storage::ObStorageCachePolicyService::handle_partitioned_table (this=0x7f85dd7f8030, table_schema=<optimized out>, table_policy=..., table_policy_need_calc=0x7f85ad5e5135: true, refresh_type=0x7f85ad5e55ac: oceanbase::storage::REFRESH_TYPE_NORMAL) at ./close_modules/shared_storage/storage/shared_storage/storage_cache_policy/ob_storage_cache_service.cpp:1385
#9 oceanbase::storage::ObStorageCachePolicyService::check_and_generate_tablet_tasks (this=0x7f85dd7f8030, refresh_type=0x7f85ad5e55ac: oceanbase::storage::REFRESH_TYPE_NORMAL) at ./close_modules/shared_storage/storage/shared_storage/storage_cache_policy/ob_storage_cache_service.cpp:1241
#10 0x000055772df2a437 in oceanbase::storage::ObStorageCachePolicyService::refresh_schema_policy_map (this=0x7f85dd7f8030, refresh_type=0x7f85ad5e5c17: oceanbase::storage::REFRESH_TYPE_NORMAL) at ./close_modules/shared_storage/storage/shared_storage/storage_cache_policy/ob_storage_cache_service.cpp:1900
#11 0x000055772df38be0 in oceanbase::storage::ObStorageCachePolicyService::trigger_or_refresh_tablet (this=0x7f85dd7f8030, refresh_type=0x7f85ad5e5c17: oceanbase::storage::REFRESH_TYPE_NORMAL) at ./close_modules/shared_storage/storage/shared_storage/storage_cache_policy/ob_storage_cache_service.cpp:1839
#12 oceanbase::storage::ObStorageRefreshCachePolicyTask::runTimerTask (this=0x7f85dd7f8468) at ./close_modules/shared_storage/storage/shared_storage/storage_cache_policy/ob_storage_cache_refresh_scheduler.cpp:331
#13 0x000055773b197fc3 in oceanbase::common::ObTimerTaskThreadPool::handle (this=0x7f85dd6b0e80, task_token=0x7f85d09a5fb8) at ./deps/oblib/src/lib/task/ob_timer_service.cpp:105
#14 0x000055773b1af26b in oceanbase::common::ObSimpleThreadPoolBase<oceanbase::common::ObLightyQueue>::run1 (this=0x7f85dd6b0e80) at ./deps/oblib/src/lib/thread/ob_simple_thread_pool.ipp:143
#15 0x000055773b5ba436 in oceanbase::lib::Threads::run (this=0x7f85dd6b0e80, idx=<optimized out>) at ./deps/oblib/src/lib/thread/threads.cpp:249
#16 0x000055773b5bbdaa in oceanbase::lib::Thread::run (this=0x7f858f35fd70) at ./deps/oblib/src/lib/thread/thread.cpp:177
#17 oceanbase::lib::Thread::__th_start (arg=<optimized out>) at ./deps/oblib/src/lib/thread/thread.cpp:339
#18 0x00007f8665e373fb in start_thread () from /usr/lib64/libpthread.so.0
#19 0x00007f8665c8fe83 in clone () from /usr/lib64/libc.so.6
上述 GDB 调试器中的 bt(backtrace)命令输出,显示程序崩溃时的调用栈。关键函数: ObStorageCachePolicyService::cal_follow_table_partition_policy_status,该函数的作用为给定一个分区对象(通常是索引分区),根据它所属的主表分区的策略状态,计算出该索引分区当前应该处于什么样的缓存策略状态)。
问题原因
共享存储模式下会通过冷热缓存将指定策略的表/索引/分区的数据预热到本地,冷热缓存功能在共享存储模式下是默认开启的。 对于分区表,如果表上存在局部索引,局部索引对应的分区默认情况下会保持和主表分区一致的冷热状态,为了获取主表分区的冷热状态,会通过访问 Schema 索引分区对应的主表分区。 冷热在处理索引分区时,通过 part_idx 字段找到对应的主表分区。目前 Schema 实际上没有对 part_idx 字段进行维护,因此删除中间分区后,part_idx 不会变动,也就是实际上 part_idx 不代表真实的分区 idx。在计算索引分区的状态时,通过 part_idx 获取对应数据表分区时,part_idx 会大于实际上存在的分区数,导致访问 Schema 时出现数组越界出现 Core 问题。 正常情况下,删除分区不会触发该问题。如果重启,或者使用了冷热提供的 Trigger 命令,会强制计算所有的表/索引/分区的冷热状态,此时将触发上面的越界问题。
问题的风险及影响
重启后或触发了冷热 Trigger 命令后节点无法拉起。
导致服务不可用。
影响租户
影响 OceanBase 数据库中的 MySQL 租户,对于 SYS 租户和 Oracle 租户无影响。
影响版本
OceanBase 数据库企业版 V4.4.0(oceanbase-4.4.0.0-100000562025070723)及之后版本。
解决方法
升级到问题已修复版本。目前已修复的版本包含 OceanBase 数据库企业版 V4.4.0 BP1 Hotfix4(oceanbase-4.4.0.1-101040012025092810)版本、V4.4.1 Hotfix1(oceanbase-4.4.1.0-100010052025101619)版本、V4.4.1 Hotfix2(oceanbase-4.4.1.0-100020022025102321)版本、V4.4.1 Hotfix3(oceanbase-4.4.1.0-100030042025102815)版本、V4.4.1 Hotfix4(oceanbase-4.4.1.0-100040012025111319)版本、V4.4.1 Hotfix5(oceanbase-4.4.1.0-100050012025112008)版本、V4.4.1 Hotfix6(oceanbase-4.4.1.0-100060042025120221)版本、V4.4.1 Hotfix7(oceanbase-4.4.1.0-100070032025121810)版本、V4.4.1 Hotfix8(oceanbase-4.4.1.0-100080022025122410)版本、V4.4.1 Hotfix9(oceanbase-4.4.1.0-100090032026012721)版本、V4.4.1 Hotfix10(oceanbase-4.4.1.0-100100032026020816)版本、V4.4.1 Hotfix11(oceanbase-4.4.1.0-100110052026031016)版本、V4.4.1 Hotfix12(oceanbase-4.4.1.0-100120022026032610)版本。
规避方式
使用 SS 模式时,避免在有局部索引的表上做删除中间分区的操作。
如果已经删除了分区,如果在该表上创建了局部索引,删除局部索引可以避免该问题。
尽量不要重启,不要使用冷热 Trigger 命令。并且按照本文档 解决方法 章节内容尽快升级到问题已修复版本。