diff --git a/shard_controller_manager.go b/shard_controller_manager.go index e551af4..ae8427f 100644 --- a/shard_controller_manager.go +++ b/shard_controller_manager.go @@ -118,8 +118,9 @@ func (c *controllerManager) LeaderUpdated(info LeaderInfo) { if info.ShardID == 0 { c.isLeader.Store(info.LeaderID == info.ReplicaID) } - if c.isLeader.Load() { + if c.isLeader.Load() && c.agent.Status() == AgentStatus_Ready && info.LeaderID != 0 { c.agent.shardLeaderSet(info.ShardID, info.LeaderID, info.Term) + c.log.Warningf("[%05d:%05d] Leader Set: %d (term %d)", info.ShardID, info.ReplicaID, info.LeaderID, info.Term) } } diff --git a/util.go b/util.go index 7c485c9..d572c82 100644 --- a/util.go +++ b/util.go @@ -37,7 +37,6 @@ var ( NodeHostDir: "/var/lib/zongzi/raft", RaftAddress: DefaultRaftAddress, RTTMillisecond: 10, - NotifyCommit: true, WALDir: "/var/lib/zongzi/wal", Expert: config.ExpertConfig{ LogDBFactory: tan.Factory, @@ -64,6 +63,7 @@ type ( ReplicaConfig = config.Config GossipConfig = config.GossipConfig LogDBConfig = config.LogDBConfig + EngineConfig = config.EngineConfig LeaderInfo = raftio.LeaderInfo RaftEventListener = raftio.IRaftEventListener @@ -83,7 +83,11 @@ type ( ReplicaStatus string ) -var GetLogger = logger.GetLogger +var ( + GetLogger = logger.GetLogger + + GetDefaultEngineConfig = config.GetDefaultEngineConfig +) const ( LogLevelCritical = logger.CRITICAL @@ -269,6 +273,9 @@ func SetLogLevel(level LogLevel) { logger.GetLogger("rsm").SetLevel(level) logger.GetLogger("transport").SetLevel(level) logger.GetLogger("zongzi").SetLevel(level) + logger.GetLogger("tan").SetLevel(level) + logger.GetLogger("registry").SetLevel(level) + logger.GetLogger("config").SetLevel(level) } // SetLogLevelDebug sets a debug log level for most loggers.