Skip to content

Commit

Permalink
ensure use of new msgpack time format
Browse files Browse the repository at this point in the history
  • Loading branch information
schmichael committed Mar 20, 2024
1 parent 354a3fe commit 772d35f
Show file tree
Hide file tree
Showing 3 changed files with 18 additions and 2 deletions.
1 change: 1 addition & 0 deletions helper/raftutil/state.go
Original file line number Diff line number Diff line change
Expand Up @@ -31,6 +31,7 @@ func RaftStateInfo(p string) (store *raftboltdb.BoltStore, firstIdx uint64, last
ReadOnly: true,
Timeout: 1 * time.Second,
},
MsgpackUseNewTimeFormat: true,
}
s, err := raftboltdb.New(opts)
if err != nil {
Expand Down
3 changes: 3 additions & 0 deletions nomad/config.go
Original file line number Diff line number Diff line change
Expand Up @@ -638,6 +638,9 @@ func DefaultConfig() *Config {
c.SerfConfig.MemberlistConfig = memberlist.DefaultWANConfig()
c.SerfConfig.MemberlistConfig.BindPort = DefaultSerfPort

c.SerfConfig.MsgpackUseNewTimeFormat = true
c.SerfConfig.MemberlistConfig.MsgpackUseNewTimeFormat = true

// Disable shutdown on removal
c.RaftConfig.ShutdownOnRemove = false

Expand Down
16 changes: 14 additions & 2 deletions nomad/server.go
Original file line number Diff line number Diff line change
Expand Up @@ -1391,8 +1391,19 @@ func (s *Server) setupRaft() error {
}

// Create a transport layer
trans := raft.NewNetworkTransport(s.raftLayer, 3, s.config.RaftTimeout,
s.config.LogOutput)
logger := log.New(&log.LoggerOptions{
Name: "raft-net",
Output: s.config.LogOutput,
Level: log.DefaultLevel,
})
netConfig := &raft.NetworkTransportConfig{
Stream: s.raftLayer,
MaxPool: 3,
Timeout: s.config.RaftTimeout,
Logger: logger,
MsgpackUseNewTimeFormat: true,
}
trans := raft.NewNetworkTransportWithConfig(netConfig)
s.raftTransport = trans

// Make sure we set the Logger.
Expand Down Expand Up @@ -1442,6 +1453,7 @@ func (s *Server) setupRaft() error {
BoltOptions: &bbolt.Options{
NoFreelistSync: s.config.RaftBoltNoFreelistSync,
},
MsgpackUseNewTimeFormat: true,
})
if raftErr != nil {
return raftErr
Expand Down

0 comments on commit 772d35f

Please sign in to comment.