Remove debug print statements

This commit is contained in:
Preetha Appan
2018-04-10 08:16:50 -05:00
parent 5194f5d6c7
commit 37f80a9bdb
4 changed files with 5 additions and 38 deletions

View File

@@ -89,9 +89,7 @@ func (d *AutopilotDelegate) PromoteNonVoters(conf *autopilot.Config, health auto
return nil, fmt.Errorf("failed to get raft configuration: %v", err)
}
servers := autopilot.PromoteStableServers(conf, health, future.Configuration().Servers)
d.server.logger.Printf("ALEX: PROMOTENONVOTER: %+v %+v", conf, health)
return servers, nil
return autopilot.PromoteStableServers(conf, health, future.Configuration().Servers), nil
}
func (d *AutopilotDelegate) Raft() *raft.Raft {

View File

@@ -958,11 +958,9 @@ func TestLeader_Reelection(t *testing.T) {
}
// Shutdown the leader
s1.logger.Println("-------------------------------- LEADER SHUTDOWN --------------------------------------")
leader.Shutdown()
// Wait for new leader to elect
testutil.WaitForLeader(t, nonLeader.RPC)
s1.logger.Println("-------------------------------- GOT LEADER --------------------------------------")
}
@@ -1041,26 +1039,6 @@ func TestLeader_RollRaftServer(t *testing.T) {
TestJoin(t, s5, s4)
servers[0] = s5
// Make sure all the dead servers are removed and we're back to 3 total peers
for _, s := range servers {
retry.Run(t, func(r *retry.R) {
addrs := 0
ids := 0
future := s.raft.GetConfiguration()
if err := future.Error(); err != nil {
r.Fatal(err)
}
for _, server := range future.Configuration().Servers {
if string(server.ID) == string(server.Address) {
addrs++
} else {
ids++
}
fmt.Println("*** server ID before all are 3 ***", server.ID)
}
})
}
// Kill the last v2 server, now minRaftProtocol should be 3
s3.Shutdown()

View File

@@ -1080,8 +1080,6 @@ func (s *Server) setupRaft() error {
s.config.RaftConfig.LocalID = raft.ServerID(s.config.NodeID)
}
s.logger.Printf("ALEX: NOMAD.SETUP_RAFT: node ID %q", s.config.NodeID)
// Build an all in-memory setup for dev mode, otherwise prepare a full
// disk-based setup.
var log raft.LogStore

View File

@@ -193,18 +193,13 @@ func (r *Raft) runFollower() {
if r.configurations.latestIndex == 0 {
if !didWarn {
r.logger.Printf("[WARN] raft: no known peers, aborting election")
//didWarn = true
didWarn = true
}
} else if r.configurations.latestIndex == r.configurations.committedIndex &&
!hasVote(r.configurations.latest, r.localID) {
if !didWarn {
r.logger.Printf("[WARN] raft: not part of stable configuration, aborting election: %v == %v && !%v", r.configurations.latestIndex, r.configurations.committedIndex, hasVote(r.configurations.latest, r.localID))
r.logger.Printf("ALEX: local ID: %v", r.localID)
for _, srv := range r.configurations.latest.Servers {
r.logger.Printf("ALEX: %+v", srv)
}
//didWarn = true
r.logger.Printf("[WARN] raft: not part of stable configuration, aborting election")
didWarn = true
}
} else {
r.logger.Printf(`[WARN] raft: Heartbeat timeout from %q reached, starting election`, lastLeader)
@@ -500,8 +495,6 @@ func (r *Raft) leaderLoop() {
// of peers.
stepDown := false
r.logger.Printf("ALEX: local ID as LEADER: %v", r.localID)
lease := time.After(r.conf.LeaderLeaseTimeout)
for r.getState() == Leader {
select {