Skip to content

Commit f61f49a

Browse files
chejingechengyu-lliuchengyubrother-jin
authored
unstable->3.5 (#2397)
* fix: codis-dashboard uses 100% cpu(#2332) (#2393) Co-authored-by: liuchengyu <liuchengyu@360.cn> * fix: The role displayed on the first Server in the Group area of the codis-fe is incorrect (#2350) (#2387) Co-authored-by: liuchengyu <liuchengyu@360.cn> * fix: automatic fix master-slave replication relationship after master or slave service restarted (#2373, #2038, #1950, #1967, #2351)) (#2386) Co-authored-by: liuchengyu <liuchengyu@360.cn> * feat:add 3.5.3 changelog (#2395) * add 3.5.3 changelog --------- Co-authored-by: chejinge <chejinge@360.cn> --------- Co-authored-by: Chengyu Liu <chengyu_l@126.com> Co-authored-by: liuchengyu <liuchengyu@360.cn> Co-authored-by: chejinge <chejinge@360.cn>
1 parent e93028f commit f61f49a

File tree

15 files changed

+658
-277
lines changed

15 files changed

+658
-277
lines changed

CHANGELOG.MD

Lines changed: 89 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1,3 +1,92 @@
1+
# v3.5.3
2+
3+
## New features
4+
5+
- Pika supports ACL[#2013](https://github.com/OpenAtomFoundation/pika/pull/2013) @[lqxhub](https://github.com/lqxhub)
6+
7+
- Automatically resume service when Codis dashboard coroutine panics[#2349](https://github.com/OpenAtomFoundation/pika/pull/2349)@[chengyu-l](https://github.com/chengyu-l)
8+
9+
- During the full replication process, the slave node of the pika service does not receive read traffic requests.[#2197](https://github.com/OpenAtomFoundation/pika/pull/2197) @[tedli](https://github.com/tedli)
10+
11+
- Pika cache adds bimap data type.[#2197](https://github.com/OpenAtomFoundation/pika/pull/2197) @[chejinge](https://github.com/chejinge)
12+
13+
- Delete the remaining Slots in Sharing mode. There is only DB under Pika, and there are multiple DBs under one Pika.[#2251](https://github.com/OpenAtomFoundation/pika/pull/2251) @[Mixficsol](https://github.com/Mixficsol)
14+
15+
- Pika exporter exposes cache-related data collection indicators.[#2318](https://github.com/OpenAtomFoundation/pika/pull/2318) @[dingxiaoshuai](https://github.com/dingxiaoshuai123)
16+
17+
- Pika supports separation of fast and slow commands.[#2162](https://github.com/OpenAtomFoundation/pika/pull/2162) @[dingxiaoshuai](https://github.com/dingxiaoshuai123)
18+
19+
- After pika executes bgsave, retain the unix timepoint.[#2167](https://github.com/OpenAtomFoundation/pika/pull/2167) @[hero-heng](https://github.com/hero-heng)
20+
21+
- Pika supports dynamic configuration of the disable_auto_compations parameter.[#2257](https://github.com/OpenAtomFoundation/pika/pull/2257) @[hero-heng](https://github.com/hero-heng)
22+
23+
- Pika supports Redis Stream.[#1955](https://github.com/OpenAtomFoundation/pika/pull/1955) @[KKorpse](https://github.com/KKorpse)
24+
25+
- Pika supports large key analysis tools[#2195](https://github.com/OpenAtomFoundation/pika/pull/2195) @[sjcsjc123](https://github.com/sjcsjc123)
26+
27+
- Pika supports dynamic adjustment of Pika cache parameters[#2197](https://github.com/OpenAtomFoundation/pika/pull/2197) @[chejinge](https://github.com/chejinge)
28+
29+
- Updated Pika benchmark tool to support more interface stress tests.[#2222](https://github.com/OpenAtomFoundation/pika/pull/2222)@[wangshao1](https://github.com/wangshao1)
30+
31+
- Pika Operator supports automatic expansion of pika clusters.[#2121](https://github.com/OpenAtomFoundation/pika/pull/2121)@[machinly](https://github.com/machinly/)
32+
33+
- Add the CompactRange command to support compacting keys within a certain range.[#2163](https://github.com/OpenAtomFoundation/pika/pull/2163)@[u6th9d](https://github.com/u6th9d)
34+
35+
- Add small time cost compaction policy.[#2172](https://github.com/OpenAtomFoundation/pika/pull/2172)@[u6th9d](https://github.com/u6th9d)
36+
37+
- Upgrade RocksDB version to v8.7.3.[#2157](https://github.com/OpenAtomFoundation/pika/pull/2157)@[JasirVoriya](https://github.com/JasirVoriya)
38+
39+
- Pika distributed cluster Codis proxy adds new observable indicators.[#2199](https://github.com/OpenAtomFoundation/pika/pull/2199)@[dingxiaoshuai](https://github.com/dingxiaoshuai123)
40+
41+
- Pika distributed cluster supports automatic failover.[#2386](https://github.com/OpenAtomFoundation/pika/pull/2386)@[chengyu-l](https://github.com/chengyu-l)
42+
43+
## bugfix
44+
45+
- Fixed an issue where Pika would accidentally delete dump files during full replication from the node.[#2377](https://github.com/OpenAtomFoundation/pika/pull/2377)@[wangshao1](https://github.com/wangshao1)
46+
47+
- Fixed the processing logic after the slave node receives an abnormal response packet from the master during the master-slave replication process.[#2319](https://github.com/OpenAtomFoundation/pika/pull/2319)@[wangshao1](https://github.com/wangshao1)
48+
49+
- Call disable compaction when pika executes the shutdown command to improve the process exit speed. [#2345](https://github.com/OpenAtomFoundation/pika/pull/2345) @[panlei-coder](https://github.com/panlei-coder)
50+
51+
- Fix the problem of inaccurate Codis-dashboard Redis Memory value.[#2337](https://github.com/OpenAtomFoundation/pika/pull/2337) @[Mixficsol](https://github.com/Mixficsol)
52+
53+
- The INFO command is time-consuming and optimized to reduce the frequency of disk checks. [#2197](https://github.com/OpenAtomFoundation/pika/pull/2197) @[chejinge](https://github.com/chejinge)
54+
55+
- Fixed the issue where rsync deletes temporary files with incorrect paths and fails to delete them, causing rocksdb to fail to open.[#2186](https://github.com/OpenAtomFoundation/pika/pull/2186)@[wangshao1](https://github.com/wangshao1)
56+
57+
- Fixed the problem that the compact, bgsave, and info keyspace commands did not specify the db name, resulting in some coredump commands.[#2194](https://github.com/OpenAtomFoundation/pika/pull/2194)@[u6th9d](https://github.com/u6th9d)
58+
59+
- Codis dashboard uses info replication instead of info command to search master ip to reduce the performance impact on Pika. [#2198](https://github.com/OpenAtomFoundation/pika/pull/2198) @[chenbt-hz](https://github.com/chenbt-hz)
60+
61+
- Fix Pika cache to use edge cases to solve the problem of cache and DB data inconsistency in some scenarios.[#2225](https://github.com/OpenAtomFoundation/pika/pull/2225) @[chejinge](https://github.com/chejinge)
62+
63+
- Fixed the issue where Segmentation fault would be reported when the dump folder is empty.[#2265](https://github.com/OpenAtomFoundation/pika/pull/2265) @[chenbt-hz](https://github.com/chenbt-hz)
64+
65+
- Fixed the problem that some command caches did not take effect due to flag calculation errors.[#2217](https://github.com/OpenAtomFoundation/pika/pull/2217) @[lqxhub](https://github.com/lqxhub)
66+
67+
- Fixed the problem that in master-slave replication mode, after the master instance flushdb, the slave instance cannot be accessed due to deadlock.[#2249](https://github.com/OpenAtomFoundation/pika/pull/2249)@[ForestLH](https://github.com/ForestLH)
68+
69+
- Fixed the issue where some commands did not judge the return value of RocksDB.[#2187](https://github.com/OpenAtomFoundation/pika/pull/2187)@[callme-taota](https://github.com/callme-taota)
70+
71+
- Fixed the problem that some command caches did not take effect due to flag calculation errors.[#2217](https://github.com/OpenAtomFoundation/pika/pull/2217) @[lqxhub](https://github.com/lqxhub)
72+
73+
- Fixed the problem that in master-slave replication mode, after the master instance flushdb, the slave instance cannot be accessed due to deadlock.[#2249](https://github.com/OpenAtomFoundation/pika/pull/2249)@[ForestLH](https://github.com/ForestLH)
74+
75+
- Fixed the issue where some commands did not judge the return value of RocksDB.[#2187](https://github.com/OpenAtomFoundation/pika/pull/2187)@[callme-taota](https://github.com/callme-taota)
76+
77+
- Fix the problem of info keyspace returning wrong results.[#2369](https://github.com/OpenAtomFoundation/pika/pull/2369)@[Mixficsol](https://github.com/Mixficsol)
78+
79+
- Standard function return value and initial value.[#2176](https://github.com/OpenAtomFoundation/pika/pull/2176)@[Mixficsol](https://github.com/Mixficsol)
80+
81+
- Fixed the problem of inaccurate network monitoring indicator statistics.[#2234](https://github.com/OpenAtomFoundation/pika/pull/2234)@[chengyu-l](https://github.com/chengyu-l)
82+
83+
- Fixed an issue where some parameters in configuration file loading were abnormal.[#2218](https://github.com/OpenAtomFoundation/pika/pull/2218)@[jettcc](https://github.com/jettcc)
84+
85+
- Fix Codis dashboard cpu used 100%.[#2393](https://github.com/OpenAtomFoundation/pika/pull/2393)@[chengyu-l](https://github.com/chengyu-l)
86+
87+
- Fix the problem of abnormal display of master and slave roles in Codis fe of pika.[#2387](https://github.com/OpenAtomFoundation/pika/pull/2387)@[chengyu-l](https://github.com/chengyu-l)
88+
89+
190
# v3.5.2
291

392
## New features

CHANGELOG_CN.MD

Lines changed: 81 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1,3 +1,84 @@
1+
# v3.5.3
2+
3+
## 新特性
4+
5+
- Pika 支持 ACL[#2013](https://github.com/OpenAtomFoundation/pika/pull/2013) @[lqxhub](https://github.com/lqxhub)
6+
7+
- 在 Codis dashboard 协程 panic 时自动恢复服务[#2349](https://github.com/OpenAtomFoundation/pika/pull/2349)@[chengyu-l](https://github.com/chengyu-l)
8+
9+
- 在全量复制的过程中,pika 服务的从节点不接收读流量请求 [#2197](https://github.com/OpenAtomFoundation/pika/pull/2197) @[tedli](https://github.com/tedli)
10+
11+
- Pika cache 新增 bimap数据类型[#2197](https://github.com/OpenAtomFoundation/pika/pull/2197) @[chejinge](https://github.com/chejinge)
12+
13+
- 删除 Sharing 模式残留的 Slot,Pika 下只有 DB,一个 Pika 下有多个 DB[#2251](https://github.com/OpenAtomFoundation/pika/pull/2251) @[Mixficsol](https://github.com/Mixficsol)
14+
15+
- Pika exporter 暴露 cache 相关的数据采集指标[#2318](https://github.com/OpenAtomFoundation/pika/pull/2318) @[dingxiaoshuai](https://github.com/dingxiaoshuai123)
16+
17+
- Pika 支持快慢命令分离[#2162](https://github.com/OpenAtomFoundation/pika/pull/2162) @[dingxiaoshuai](https://github.com/dingxiaoshuai123)
18+
19+
- pika 执行完成 Bgsave后, 保留 unix timepoint[#2167](https://github.com/OpenAtomFoundation/pika/pull/2167) @[hero-heng](https://github.com/hero-heng)
20+
21+
- Pika 支持动态配置 disable_auto_compations 参数[#2257](https://github.com/OpenAtomFoundation/pika/pull/2257) @[hero-heng](https://github.com/hero-heng)
22+
23+
- Pika 支持 Redis Stream[#1955](https://github.com/OpenAtomFoundation/pika/pull/1955) @[KKorpse](https://github.com/KKorpse)
24+
25+
- Pika 支持大 key 分析工具[#2195](https://github.com/OpenAtomFoundation/pika/pull/2195) @[sjcsjc123](https://github.com/sjcsjc123)
26+
27+
- Pika 支持动态调整 Pika cache 参数[#2197](https://github.com/OpenAtomFoundation/pika/pull/2197) @[chejinge](https://github.com/chejinge)
28+
29+
- 更新 Pika benchmark 工具支持更多的接口压测[#2222](https://github.com/OpenAtomFoundation/pika/pull/2222)@[wangshao1](https://github.com/wangshao1)
30+
31+
- Pika Operator 支持 pika 集群自动扩容[#2121](https://github.com/OpenAtomFoundation/pika/pull/2121)@[machinly](https://github.com/machinly/)
32+
33+
- 添加 CompactRange 命令支持对一定范围内的 key 进行 compact[#2163](https://github.com/OpenAtomFoundation/pika/pull/2163)@[u6th9d](https://github.com/u6th9d)
34+
35+
- 提升 Compaction 速度减少 Compaction 耗时[#2172](https://github.com/OpenAtomFoundation/pika/pull/2172)@[u6th9d](https://github.com/u6th9d)
36+
37+
- 升级 RocksDB 版本到 v8.7.3[#2157](https://github.com/OpenAtomFoundation/pika/pull/2157)@[JasirVoriya](https://github.com/JasirVoriya)
38+
39+
- Pika 分布式集群 Codis proxy 新增可观测指标[#2199](https://github.com/OpenAtomFoundation/pika/pull/2199)@[dingxiaoshuai](https://github.com/dingxiaoshuai123)
40+
41+
- Pika 分布式集群支持自动 failover[#2386](https://github.com/OpenAtomFoundation/pika/pull/2386)@[chengyu-l](https://github.com/chengyu-l)
42+
43+
## bugfix
44+
45+
- 修复 Pika 有从节点进行全量复制期间会误删除 dump 文件的问题[#2377](https://github.com/OpenAtomFoundation/pika/pull/2377)@[wangshao1](https://github.com/wangshao1)
46+
47+
- 修复主从复制过程中, slave 节点收到 master 异常回包后的处理逻辑[#2319](https://github.com/OpenAtomFoundation/pika/pull/2319)@[wangshao1](https://github.com/wangshao1)
48+
49+
- 在 Pika 执行 shutdown 命令时调用 disable compaction, 提升进程退出速度 [#2345](https://github.com/OpenAtomFoundation/pika/pull/2345) @[panlei-coder](https://github.com/panlei-coder)
50+
51+
- 修复 Codis-dashboard Redis Memory 值不准确的问题[#2337](https://github.com/OpenAtomFoundation/pika/pull/2337) @[Mixficsol](https://github.com/Mixficsol)
52+
53+
- INFO 命令耗时优化,降低查磁盘频率 [#2197](https://github.com/OpenAtomFoundation/pika/pull/2197) @[chejinge](https://github.com/chejinge)
54+
55+
- 修复 Rsync 删除临时文件路径不对,删除失败,导致rocksdb打开失败的问题[#2186](https://github.com/OpenAtomFoundation/pika/pull/2186)@[wangshao1](https://github.com/wangshao1)
56+
57+
- 修复 Compact ,Bgsave ,Info keyspace 命令未指定db名称,导致部分命令 coredump 的问题[#2194](https://github.com/OpenAtomFoundation/pika/pull/2194)@[u6th9d](https://github.com/u6th9d)
58+
59+
- Codis dashboard 用 info replication 替代 info 命令查寻 master ip 降低对 Pika 的性能影响 [#2198](https://github.com/OpenAtomFoundation/pika/pull/2198) @[chenbt-hz](https://github.com/chenbt-hz)
60+
61+
- 修复 Pika cache 使用边缘case,解决部分场景下 cache 和 DB 数据不一致的问题[#2225](https://github.com/OpenAtomFoundation/pika/pull/2225) @[chejinge](https://github.com/chejinge)
62+
63+
- 修复当 dump 文件夹为空时,会启动报错 Segmentation fault 的问题[#2265](https://github.com/OpenAtomFoundation/pika/pull/2265) @[chenbt-hz](https://github.com/chenbt-hz)
64+
65+
- 修复因为flag计算错误,导致的部分命令缓存没有生效问题[#2217](https://github.com/OpenAtomFoundation/pika/pull/2217) @[lqxhub](https://github.com/lqxhub)
66+
67+
- 修复主从复制模式下,主实例 flushdb 后,从实例因为死锁导致的不能访问的问题[#2249](https://github.com/OpenAtomFoundation/pika/pull/2249)@[ForestLH](https://github.com/ForestLH)
68+
69+
- 修复部分命令未对 RocksDB 的返回值进行判断的问题[#2187](https://github.com/OpenAtomFoundation/pika/pull/2187)@[callme-taota](https://github.com/callme-taota)
70+
71+
- 规范函数的返回值及初始值[#2176](https://github.com/OpenAtomFoundation/pika/pull/2176)@[Mixficsol](https://github.com/Mixficsol)
72+
73+
- 修复网络监控指标统计不准确的问题[#2234](https://github.com/OpenAtomFoundation/pika/pull/2234)@[chengyu-l](https://github.com/chengyu-l)
74+
75+
- 修复配置文件加载部分参数异常的问题[#2218](https://github.com/OpenAtomFoundation/pika/pull/2218)@[jettcc](https://github.com/jettcc)
76+
77+
- 修复 Codis dashboard cpu 100% 的问题[#2393](https://github.com/OpenAtomFoundation/pika/pull/2393)@[chengyu-l](https://github.com/chengyu-l)
78+
79+
- 修复 Codis fe pika 主从角色显示异常的问题[#2387](https://github.com/OpenAtomFoundation/pika/pull/2387)@[chengyu-l](https://github.com/chengyu-l)
80+
81+
182
# v3.5.2
283

384
## 新特性

codis/config/dashboard.toml

Lines changed: 4 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -33,9 +33,10 @@ migration_async_numkeys = 500
3333
migration_timeout = "30s"
3434

3535
# Set configs for redis sentinel.
36-
sentinel_check_server_state_interval = "5s"
37-
sentinel_check_master_failover_interval = "1s"
38-
sentinel_master_dead_check_times = 5
36+
sentinel_check_server_state_interval = "10s"
37+
sentinel_check_master_failover_interval = "2s"
38+
sentinel_master_dead_check_times = 10
39+
sentinel_check_offline_server_interval = "2s"
3940
sentinel_client_timeout = "10s"
4041
sentinel_quorum = 2
4142
sentinel_parallel_syncs = 1

codis/pkg/models/action.go

Lines changed: 3 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -11,4 +11,7 @@ const (
1111
ActionMigrating = "migrating"
1212
ActionFinished = "finished"
1313
ActionSyncing = "syncing"
14+
ActionSynced = "synced"
15+
16+
ActionSyncedFailed = "synced_failed"
1417
)

codis/pkg/models/group.go

Lines changed: 43 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -25,6 +25,38 @@ func (g *Group) GetServersMap() map[string]*GroupServer {
2525
return results
2626
}
2727

28+
// SelectNewMaster choose a new master node in the group
29+
func (g *Group) SelectNewMaster() (string, int) {
30+
var newMasterServer *GroupServer
31+
var newMasterIndex = -1
32+
33+
for index, server := range g.Servers {
34+
if index == 0 || server.State != GroupServerStateNormal {
35+
continue
36+
}
37+
38+
if newMasterServer == nil {
39+
newMasterServer = server
40+
newMasterIndex = index
41+
} else if server.DbBinlogFileNum > newMasterServer.DbBinlogFileNum {
42+
// Select the slave node with the latest offset as the master node
43+
newMasterServer = server
44+
newMasterIndex = index
45+
} else if server.DbBinlogFileNum == newMasterServer.DbBinlogFileNum {
46+
if server.DbBinlogOffset > newMasterServer.DbBinlogOffset {
47+
newMasterServer = server
48+
newMasterIndex = index
49+
}
50+
}
51+
}
52+
53+
if newMasterServer == nil {
54+
return "", newMasterIndex
55+
}
56+
57+
return newMasterServer.Addr, newMasterIndex
58+
}
59+
2860
type GroupServerState int8
2961

3062
const (
@@ -33,6 +65,13 @@ const (
3365
GroupServerStateOffline
3466
)
3567

68+
type GroupServerRole string
69+
70+
const (
71+
RoleMaster GroupServerRole = "master"
72+
RoleSlave GroupServerRole = "slave"
73+
)
74+
3675
type GroupServer struct {
3776
Addr string `json:"server"`
3877
DataCenter string `json:"datacenter"`
@@ -43,9 +82,11 @@ type GroupServer struct {
4382
} `json:"action"`
4483

4584
// master or slave
46-
Role string `json:"role"`
85+
Role GroupServerRole `json:"role"`
4786
// If it is a master node, take the master_repl_offset field, otherwise take the slave_repl_offset field
48-
ReplyOffset int `json:"reply_offset"`
87+
DbBinlogFileNum uint64 `json:"binlog_file_num"` // db0
88+
DbBinlogOffset uint64 `json:"binlog_offset"` // db0
89+
4990
// Monitoring status, 0 normal, 1 subjective offline, 2 actual offline
5091
// If marked as 2 , no service is provided
5192
State GroupServerState `json:"state"`

codis/pkg/topom/config.go

Lines changed: 5 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -50,9 +50,10 @@ migration_async_numkeys = 500
5050
migration_timeout = "30s"
5151
5252
# Set configs for redis sentinel.
53-
sentinel_check_server_state_interval = "5s"
54-
sentinel_check_master_failover_interval = "1s"
55-
sentinel_master_dead_check_times = 5
53+
sentinel_check_server_state_interval = "10s"
54+
sentinel_check_master_failover_interval = "2s"
55+
sentinel_master_dead_check_times = 10
56+
sentinel_check_offline_server_interval = "2s"
5657
sentinel_client_timeout = "10s"
5758
sentinel_quorum = 2
5859
sentinel_parallel_syncs = 1
@@ -86,6 +87,7 @@ type Config struct {
8687
SentinelCheckServerStateInterval timesize.Duration `toml:"sentinel_check_server_state_interval" json:"sentinel_client_timeout"`
8788
SentinelCheckMasterFailoverInterval timesize.Duration `toml:"sentinel_check_master_failover_interval" json:"sentinel_check_master_failover_interval"`
8889
SentinelMasterDeadCheckTimes int8 `toml:"sentinel_master_dead_check_times" json:"sentinel_master_dead_check_times"`
90+
SentinelCheckOfflineServerInterval timesize.Duration `toml:"sentinel_check_offline_server_interval" json:"sentinel_check_offline_server_interval"`
8991
SentinelClientTimeout timesize.Duration `toml:"sentinel_client_timeout" json:"sentinel_client_timeout"`
9092
SentinelQuorum int `toml:"sentinel_quorum" json:"sentinel_quorum"`
9193
SentinelParallelSyncs int `toml:"sentinel_parallel_syncs" json:"sentinel_parallel_syncs"`

codis/pkg/topom/context.go

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -40,7 +40,7 @@ func (ctx *context) getSlotMapping(sid int) (*models.SlotMapping, error) {
4040
}
4141

4242
func (ctx *context) getSlotMappingsByGroupId(gid int) []*models.SlotMapping {
43-
var slots = []*models.SlotMapping{}
43+
var slots []*models.SlotMapping
4444
for _, m := range ctx.slots {
4545
if m.GroupId == gid || m.Action.TargetId == gid {
4646
slots = append(slots, m)

codis/pkg/topom/topom.go

Lines changed: 16 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -210,12 +210,12 @@ func (s *Topom) Start(routines bool) error {
210210
}
211211
}, nil, true, 0)
212212

213-
// Check the status of the pre-offline master every 1 second
213+
// Check the status of the pre-offline master every 2 second
214214
// to determine whether to automatically switch master and slave
215215
gxruntime.GoUnterminated(func() {
216216
for !s.IsClosed() {
217217
if s.IsOnline() {
218-
w, _ := s.CheckPreOffineMastersState(5 * time.Second)
218+
w, _ := s.CheckPreOfflineMastersState(5 * time.Second)
219219
if w != nil {
220220
w.Wait()
221221
}
@@ -224,6 +224,20 @@ func (s *Topom) Start(routines bool) error {
224224
}
225225
}, nil, true, 0)
226226

227+
// Check the status of the offline master and slave every 30 second
228+
// to determine whether to automatically recover to right master-slave replication relationship
229+
gxruntime.GoUnterminated(func() {
230+
for !s.IsClosed() {
231+
if s.IsOnline() {
232+
w, _ := s.CheckOfflineMastersAndSlavesState(5 * time.Second)
233+
if w != nil {
234+
w.Wait()
235+
}
236+
}
237+
time.Sleep(s.Config().SentinelCheckOfflineServerInterval.Duration())
238+
}
239+
}, nil, true, 0)
240+
227241
gxruntime.GoUnterminated(func() {
228242
for !s.IsClosed() {
229243
if s.IsOnline() {

0 commit comments

Comments
 (0)