From df0228f0761d984af005a2d004322996c42a1d1c Mon Sep 17 00:00:00 2001 From: Derek Collison Date: Tue, 26 Jan 2021 14:06:50 -0800 Subject: [PATCH 1/2] Change up for banner Signed-off-by: Derek Collison --- server/server.go | 23 +++++++++++++---------- 1 file changed, 13 insertions(+), 10 deletions(-) diff --git a/server/server.go b/server/server.go index 5f2c7b2e..afe08ddb 100644 --- a/server/server.go +++ b/server/server.go @@ -1378,13 +1378,23 @@ func (s *Server) fetchAccount(name string) (*Account, error) { // Start up the server, this will block. // Start via a Go routine if needed. func (s *Server) Start() { - s.Noticef("Starting nats-server version %s", VERSION) - s.Debugf("Go build version %s", s.info.GoVersion) + s.Noticef("Starting nats-server") + gc := gitCommit if gc == "" { gc = "not set" } - s.Noticef("Git commit [%s]", gc) + + s.Noticef(" Version: %s", VERSION) + s.Noticef(" Git: [%s]", gc) + s.Debugf(" Go build: %s", s.info.GoVersion) + s.Noticef(" Name: %s", s.info.Name) + if s.sys != nil { + s.Noticef(" Node: %s", s.sys.shash) + } + s.Noticef(" ID: %s", s.info.ID) + + defer s.Noticef("Server is ready") // Check for insecure configurations. s.checkAuthforWarnings() @@ -1769,13 +1779,6 @@ func (s *Server) AcceptLoop(clr chan struct{}) { return } - s.Noticef("Server name: %s", s.info.Name) - if s.sys != nil { - s.Noticef("Server node: %s", s.sys.shash) - } - s.Noticef("Server ID: %s", s.info.ID) - s.Noticef("Server is ready") - hp := net.JoinHostPort(opts.Host, strconv.Itoa(opts.Port)) l, e := natsListen("tcp", hp) if e != nil { From 3e8d295239a6699fb2093f7062c4b4e7b7f97cb7 Mon Sep 17 00:00:00 2001 From: Derek Collison Date: Tue, 26 Jan 2021 14:07:52 -0800 Subject: [PATCH 2/2] Make sure to not go backwards on applied or commit indexes Signed-off-by: Derek Collison --- server/raft.go | 9 +++++++++ 1 file changed, 9 insertions(+) diff --git a/server/raft.go b/server/raft.go index d2ffd7e5..e05eb7f9 100644 --- a/server/raft.go +++ b/server/raft.go @@ -559,6 +559,11 @@ func (n *raft) Applied(index uint64) { n.Lock() defer n.Unlock() + // Ignore if already applied. + if index <= n.applied { + return + } + // FIXME(dlc) - Check spec on error conditions, storage n.applied = index // FIXME(dlc) - Can be more efficient here. @@ -1319,6 +1324,10 @@ func (n *raft) loadEntry(index uint64) (*appendEntry, error) { // applyCommit will update our commit index and apply the entry to the apply chan. // lock should be held. func (n *raft) applyCommit(index uint64) { + if index <= n.commit { + n.debug("Ignoring apply commit for %d, already processed", index) + return + } original := n.commit n.commit = index