@@ -89,6 +89,27 @@ type AutopilotConfig struct {
8989 UpgradeVersionTag string `mapstructure:"upgrade_version_tag"`
9090}
9191
92+ func (ac * AutopilotConfig ) String () string {
93+ s := "CleanupDeadServers:%t " +
94+ "LastContactThreshold:%s " +
95+ "DeadServerLastContactThreshold:%s " +
96+ "MaxTrailingLogs:%d " +
97+ "MinQuorum:%d " +
98+ "ServerStabilizationTime:%s " +
99+ "DisableUpgradeMigration:%t " +
100+ "RedundancyZoneTag:%s " +
101+ "UpgradeVersionTag:%s"
102+ return fmt .Sprintf (s , ac .CleanupDeadServers ,
103+ ac .LastContactThreshold ,
104+ ac .DeadServerLastContactThreshold ,
105+ ac .MaxTrailingLogs ,
106+ ac .MinQuorum ,
107+ ac .ServerStabilizationTime ,
108+ ac .DisableUpgradeMigration ,
109+ ac .RedundancyZoneTag ,
110+ ac .UpgradeVersionTag )
111+ }
112+
92113// Merge combines the supplied config with the receiver. Supplied ones take
93114// priority.
94115func (to * AutopilotConfig ) Merge (from * AutopilotConfig ) {
@@ -832,24 +853,27 @@ func (b *RaftBackend) SetupAutopilot(ctx context.Context, storageConfig *Autopil
832853 // Merge the setting provided over the API
833854 b .autopilotConfig .Merge (storageConfig )
834855
856+ infoArgs := []interface {}{"config" , b .autopilotConfig }
857+
835858 // Create the autopilot instance
836859 options := []autopilot.Option {
837860 autopilot .WithLogger (b .logger ),
838861 autopilot .WithPromoter (b .autopilotPromoter ()),
839862 }
840863 if b .autopilotReconcileInterval != 0 {
841864 options = append (options , autopilot .WithReconcileInterval (b .autopilotReconcileInterval ))
865+ infoArgs = append (infoArgs , []interface {}{"reconcile_interval" , b .autopilotReconcileInterval }... )
842866 }
843867 if b .autopilotUpdateInterval != 0 {
844868 options = append (options , autopilot .WithUpdateInterval (b .autopilotUpdateInterval ))
869+ infoArgs = append (infoArgs , []interface {}{"update_interval" , b .autopilotUpdateInterval }... )
845870 }
846871 b .autopilot = autopilot .New (b .raft , NewDelegate (b ), options ... )
847872 b .followerStates = followerStates
848873 b .followerHeartbeatTicker = time .NewTicker (1 * time .Second )
849-
850874 b .l .Unlock ()
851875
852- b .logger .Info ("starting autopilot" , "config" , b . autopilotConfig , "reconcile_interval" , b . autopilotReconcileInterval )
876+ b .logger .Info ("starting autopilot" , infoArgs ... )
853877 b .autopilot .Start (ctx )
854878
855879 go b .startFollowerHeartbeatTracker ()
0 commit comments