Skip to content

Commit

Permalink
Delay the monitorStorageVersion goroutine until the server is fully r…
Browse files Browse the repository at this point in the history
…eady

Signed-off-by: Benjamin Wang <[email protected]>
  • Loading branch information
ahrtr committed Dec 11, 2024
1 parent 3cf550d commit 4c3ed87
Showing 1 changed file with 11 additions and 0 deletions.
11 changes: 11 additions & 0 deletions server/etcdserver/server.go
Original file line number Diff line number Diff line change
Expand Up @@ -2284,6 +2284,17 @@ func (s *EtcdServer) monitorClusterVersions() {
func (s *EtcdServer) monitorStorageVersion() {
lg := s.Logger()
monitor := serverversion.NewMonitor(lg, NewServerVersionAdapter(s))

// The field "storageVersion" in Meta bucket was introduced in 3.6.
// It doesn't exist in 3.5 and older versions. We depend on fields
// "confState" and "term" to identify 3.5, as the two fields were
// introduced in 3.5.
// But the field "confState" is only guaranteed to be populated
// after the member fully bootstraps itself. So we need to wait
// for the etcdserver ready for serve client requests here.
<-s.ReadyNotify()
lg.Info("monitorStorageVersion: start running")

for {
select {
case <-time.After(monitorVersionInterval):
Expand Down

0 comments on commit 4c3ed87

Please sign in to comment.