---
title: OceanBase 数据库 V3.x 版本集群中参数 _partition_balance_strategy 为 auto 时创建表名中有 _t 或 _数字的原因和解决方法-OceanBase数据库使用指南
description: 了解OceanBase数据库在实际应用中关于OceanBase 数据库 V3.x 版本集群中参数 _partition_balance_strategy 为 auto 时创建表名中有 _t 或 _数字的原因和解决方法相关的常见问题和使用技巧，帮助您快速解决OceanBase 数据库 V3.x 版本集群中参数 _partition_balance_strategy 为 auto 时创建表名中有 _t 或 _数字的原因和解决方法的难题。
---
切换语言

- 中文站 - 简体中文
- International - English
- 日本站 - 日本語

划线反馈

# OceanBase 数据库 V3.x 版本集群中参数 _partition_balance_strategy 为 auto 时创建表名中有 _t 或 _数字的原因和解决方法

更新时间：2026-06-26 07:26

适用版本： V3.1.x、V3.2.x 内容类型：Troubleshoot  

## 问题现象

1. OCP 日志告警提示，rootservice 线程 `leaderCoord thread hang`。

   **OCP 告警内容：**

   ```shell
   告警概述：alarm_template_id=0:ob_cluster=xxxx:server_type=rootservice:error_code=-1:keyword= OBServer rootservice 日志

   ```

   ```shell
   告警详情：[OBServer rootservice 日志] 集群：xxx，主机：xxx.xxx.xxx.xxx，日志类型：rootservice，日志文件：/home/admin/oceanbase/log/rootservice.log，日志级别：ERROR，关键字=，错误码=-1，日志详情=[2024-09-10 17:59:56.238049] ERROR [RS] check_alert (ob_rs_reentrant_thread.cpp:117) [82245][0][Y0-0000000000000000-0-0] [lt=6] [dc=0] rs_monitor_check : thread hang(thread_name="LeaderCoord", last_run_timestamp=1725953758472269, last_run_interval=8637765774, check_interval=664000000, schedule_interval=64000000) BACKTRACE:0xfc4cbf0 0x57f66af 0x595a8f1 0x595a51f 0x595a1ec 0x8659a1f 0x8447286 0x84471a7 0x84474f0 0x8447a45 0x82435d2 0xfda760e 0xfda6f52 0x6cc23fe 0xfb21fb3 0xfb21e0f 0xfdc2f3f

   ```
 2. rootservice 日志打印大量 ERROR 日志，包含 `leaderCoord thread hang`，`Rootbanlance thread hang`。

   **rootservice.log ERROR 日志：**

   ```shell
   [2024-09-10 15:49:56.224777] ERROR [RS] check_alert (ob_rs_reentrant_thread.cpp:117) [82245][0][Y0-0000000000000000-0-0] [lt=6] [dc=0] rs_monitor_check : thread hang(thread_name="LeaderCoord", last_run_timestamp=1725953758472269, last_run_interval=837752503, check_interval=664000000, schedule_interval=64000000) BACKTRACE:0xfc4cbf0 0x57f66af 0x595a8f1 0x595a51f 0x595a1ec 0x8659a1f 0x8447286 0x84471a7 0x84474f0 0x8447a45 0x82435d2 0xfda760e 0xfda6f52 0x6cc23fe 0xfb21fb3 0xfb21e0f 0xfdc2f3f
   [2024-09-10 15:49:56.224807] ERROR [RS] check_alert (ob_rs_reentrant_thread.cpp:117) [82245][0][Y0-0000000000000000-0-0] [lt=25] [dc=0] rs_monitor_check : thread hang(thread_name="RootBalance", last_run_timestamp=1725953808018997, last_run_interval=788205808, check_interval=610000000, schedule_interval=10000000) BACKTRACE:0xfc4cbf0 0x57f66af 0x595a8f1 0x595a51f 0x595a1ec 0x8659a1f 0x8447286 0x84471a7 0x84474f0 0x8447a45 0x82435d2 0xfda760e 0xfda6f52 0x6cc23fe 0xfb21fb3 0xfb21e0f 0xfdc2f3f
   [2024-09-10 15:50:56.224858] ERROR [RS] check_alert (ob_rs_reentrant_thread.cpp:117) [82245][0][Y0-0000000000000000-0-0] [lt=16] [dc=0] rs_monitor_check : thread hang(thread_name="LeaderCoord", last_run_timestamp=1725953758472269, last_run_interval=897752583, check_interval=664000000, schedule_interval=64000000) BACKTRACE:0xfc4cbf0 0x57f66af 0x595a8f1 0x595a51f 0x595a1ec 0x8659a1f 0x8447286 0x84471a7 0x84474f0 0x8447a45 0x82435d2 0xfda760e 0xfda6f52 0x6cc23fe 0xfb21fb3 0xfb21e0f 0xfdc2f3f
   [2024-09-10 15:50:56.224884] ERROR [RS] check_alert (ob_rs_reentrant_thread.cpp:117) [82245][0][Y0-0000000000000000-0-0] [lt=20] [dc=0] rs_monitor_check : thread hang(thread_name="RootBalance", last_run_timestamp=1725953808018997, last_run_interval=848205885, check_interval=610000000, schedule_interval=10000000) BACKTRACE:0xfc4cbf0 0x57f66af 0x595a8f1 0x595a51f 0x595a1ec 0x8659a1f 0x8447286 0x84471a7 0x84474f0 0x8447a45 0x82435d2 0xfda760e 0xfda6f52 0x6cc23fe 0xfb21fb3 0xfb21e0f 0xfdc2f3f

   ```

## 问题原因

创建表，表名中有 _t 或 _数字结尾的命名，并且 `_partition_balance_strategy` 为 auto，创建 partition 时，会走现在 `shardgroup` 的逻辑，目前 `shardgroup` 逻辑在比较 `map` 信息的时候发现 `rowkey` 类型不一致的时候，会走 `right to die` 的逻辑，导致 RS 的 `root balance` 线程退出

## 关键信息

触发 OCP 日志告警 rootservice 线程 `leaderCoord thread hang`，并且 rootservice 日志打印大量 WARN 日志，包含 `leaderCoord thread hang`，`Rootbanlance thread hang`。

## 问题的风险及影响

引起 RS 线程 `leaderCoord thread hang`，`Rootbanlance thread hang`，引起创建新 partition 的均衡动作，如果短时间大量创建 partition 可能会导致无法均衡，间接导致其它问题。

## 影响租户

影响 OceanBase 数据库中的 Oracle 租户和 MySQL 租户，对于 SYS 租户无影响。

## 适用版本

OceanBase 数据库 V3.x 版本。

## 解决方法及规避方式

- 解决方法：

     - 通过 RS 切 Leader 的方式，临时使 rootservice 线程恢复工作。

           1. 将 rootservice 线程 hang 住的机器进行切主，操作目的使 RS 切到正常节点。

             **切主命令：**

             ```shell
             alter tenant sys  set primary_zone = 'zone2;zone1;zone3';

             ```

             **切记不要用：**

             ```shell
             alter system switch rootservice leader zone = 'zone2';

             ```

             此命令会导致回切到原来的 RS Leader 节点。
           2. 如果切主操作完成后，发现 RS 无法正常工作了，rootservice 日志中提示 `rootservice no master` 关键字。

                    1. 执行如下命令避免回切。

                      ```shell
                      alter system set enable_auto_leader_switch = false;

                      ```
                    2. 在 admin 用户下执行如下操作。

                               1. 进入 bin 目录下。

                                 ```shell
                                 cd /home/admin/oceanbase/bin/

                                 ```
                               2. 执行切 RS 的 Leader 命令。

                                 ```shell
                                 ./ob_admin -h '源IP' -p 2882 batch_switch_rs_leader 目标 IP:2882

                                 ```
                               3. 修改 sys 租户的 primary_zone 命令。

                                 ```
                               4. 当 sys Leader 全部移到 zone2 之后，执行如下命令。

                                 ```shell
                                 alter system set enable_auto_leader_switch = true;

                                 ```
     - 彻底解决 RS 线程 `Rootbanlance thread hang` 问题。

           1. 设置配置项 `_partition_balance_strategy standard` 取值为 `standard`，不会走 `shardgroup` 逻辑，不会触发问题，命令如下。

             ```shell
             alter system set _partition_balance_strategy = "standard";

             ```

             有关配置项 `_partition_balance_strategy` 取值的详细内容参见：[如何设置副本按磁盘使用水位进行均衡的策略](https://www.oceanbase.com/knowledge-base/oceanbase-database-1000000000366655?back=kb)。
           2. 重启 OBServer。

                    - OCP 白屏重启 OBServer 方式。

                     **在 OCP 上找到对应的节点白屏处理：** 重启 OBServer 服务（停 OBServer 服务后，停 OBServer 进程，启动 OBServer）是为了业务租户的 Leader 平滑迁移，停进程是为了 thread hang 的线程得到恢复。
                    - 如果白屏不能使用，黑屏重启 OBServer 方式。

                              1. 指定 OBServer 设置为非服务状态。

                                ```shell
                                ALTER SYSTEM STOP SERVER "xxx.xxx.xxx.xx:2882";

                                ```
                              2. 在 admin 用户下执行 kill 掉 OBServer 进程。

                                找到 OBServer 进程号 pid，运行 `kill -9 ${pid}` kill 掉 OBServer 进程。
                              3. 在 admin 用户下启动 OBServer 进程。

                                           1. 进入 oceanbase 主目录。

                                             ```shell
                                             cd /home/admin/oceanbase

                                             ```
                                           2. 在当前 oceanbase 主目录下，启动 OBServer 进程。

                                             ```shell
                                             ./bin/observer

                                             ```
                              4. OBServer 启动后检查 OBServer 状态。

                                ```shell
                                ps -ef |grep observer

                                ```
 - 规避方式：

  首先修改配置项 `_partition_balance_strategy` 取值。

  ```

  方法一：改完参数之后，重启 RS 所在的 OBServer。

  方法二：改完参数之后，切 RS。

上一篇

[OBCI 新老版本混跑 ROWID 返回报错](https://www.oceanbase.com/knowledge-base/oceanbase-database-1000000000452072)

下一篇

[三节点 OBServer 启动后无法连接的原因和解决方法](https://www.oceanbase.com/knowledge-base/oceanbase-database-1000000001275789) ![有帮助](https://gw.alipayobjects.com/mdn/ob_asset/afts/img/A*y6ocSqN8cqsAAAAAAAAAAAAAARQnAQ)![无帮助](https://gw.alipayobjects.com/mdn/ob_asset/afts/img/A*BG9IQJyLHF8AAAAAAAAAAAAAARQnAQ)![反馈](https://gw.alipayobjects.com/mdn/ob_asset/afts/img/A*eTWdQKCRKHwAAAAAAAAAAAAAARQnAQ)[AI](https://www.oceanbase.com/obi) 咨询热线
