Skip to content

Commit

Permalink
cluster: fix panic when minResolvedTS is not initialized (#8965)
Browse files Browse the repository at this point in the history
close #8964

Signed-off-by: Ryan Leung <[email protected]>
  • Loading branch information
rleungx authored Jan 2, 2025
1 parent c2d4854 commit 0bfa31f
Showing 1 changed file with 2 additions and 1 deletion.
3 changes: 2 additions & 1 deletion server/cluster/cluster.go
Original file line number Diff line number Diff line change
Expand Up @@ -2283,7 +2283,8 @@ func (c *RaftCluster) CheckAndUpdateMinResolvedTS() (uint64, bool) {
newMinResolvedTS = s.GetMinResolvedTS()
}
}
oldMinResolvedTS := c.minResolvedTS.Load().(uint64)
// Avoid panic when minResolvedTS is not initialized.
oldMinResolvedTS, _ := c.minResolvedTS.Load().(uint64)
if newMinResolvedTS == math.MaxUint64 || newMinResolvedTS <= oldMinResolvedTS {
return oldMinResolvedTS, false
}
Expand Down

0 comments on commit 0bfa31f

Please sign in to comment.