首批通过分布式安全可靠测评,为关键业务系统打造
主备库断网后弱读备库报错误代码 -4121
更新时间:2026-05-09 07:56
适用版本
OceanBase 数据库 V2.x 和 V3.x 版本。
问题描述
主备库断网修复后,对备库进行弱读,查询慢甚至超时,OBServer 日志中查询报如下错误。
fail to detect master rs(ret=-4121, ret='OB_RPC_SEDN_ERROR')
问题原因
系统租户配置参数 max_stale_time_for_weak_consistency 默认为 5 秒,如果断网超过 5 秒后进行弱读,将出现上述现象及报错。
解决方法
登录 OceanBase 数据库备集群系统租户,修改系统租户级配置参数 max_stale_time_for_weak_consistency 为 8 小时(远超过当前断网时长即可),然后检查单调读配置参数 enable_monotonic_weak_read 是否关闭,确保其值为 false。
具体命令如下:
obclient [oceanbase]> alter system set max_stale_time_for_weak_consistency='8h';
Query OK, 0 rows affected (0.018 sec)
obclient [oceanbase]> show parameters like 'enable_monotonic_weak_read';
返回结果如下:
+------+----------+-----------+----------+----------------------------+-----------+-------+-------------------------------------------------------------------+---------+--------+---------+-------------------+
| zone | svr_type | svr_ip | svr_port | name | data_type | value | info | section | scope | source | edit_level |
+------+----------+-----------+----------+----------------------------+-----------+-------+-------------------------------------------------------------------+---------+--------+---------+-------------------+
| z2 | observer | 127.x.x.x | 3882 | enable_monotonic_weak_read | NULL | False | specifies observer supportting atomicity and monotonic order read | TENANT | TENANT | DEFAULT | DYNAMIC_EFFECTIVE |
| z1 | observer | 127.x.x.x | 2882 | enable_monotonic_weak_read | NULL | False | specifies observer supportting atomicity and monotonic order read | TENANT | TENANT | DEFAULT | DYNAMIC_EFFECTIVE |
| z3 | observer | 127.x.x.x | 4882 | enable_monotonic_weak_read | NULL | False | specifies observer supportting atomicity and monotonic order read | TENANT | TENANT | DEFAULT | DYNAMIC_EFFECTIVE |
+------+----------+-----------+----------+----------------------------+-----------+-------+-------------------------------------------------------------------+---------+--------+---------+-------------------+
3 rows in set (0.052 sec)