Browse Source

embed,etcdmain: add "--experimental-initial-corrupt-check"

Signed-off-by: Gyu-Ho Lee <gyuhox@gmail.com>
Gyu-Ho Lee 8 years ago
parent
commit
3db5ad8d57
5 changed files with 12 additions and 4 deletions
  1. 3 2
      embed/config.go
  2. 1 0
      embed/etcd.go
  3. 1 0
      etcdmain/config.go
  4. 3 1
      etcdmain/help.go
  5. 4 1
      etcdserver/config.go

+ 3 - 2
embed/config.go

@@ -171,8 +171,9 @@ type Config struct {
 
 
 	// Experimental flags
 	// Experimental flags
 
 
-	ExperimentalCorruptCheckTime time.Duration `json:"experimental-corrupt-check-time"`
-	ExperimentalEnableV2V3       string        `json:"experimental-enable-v2v3"`
+	ExperimentalInitialCorruptCheck bool          `json:"experimental-initial-corrupt-check"`
+	ExperimentalCorruptCheckTime    time.Duration `json:"experimental-corrupt-check-time"`
+	ExperimentalEnableV2V3          string        `json:"experimental-enable-v2v3"`
 }
 }
 
 
 // configYAML holds the config suitable for yaml parsing
 // configYAML holds the config suitable for yaml parsing

+ 1 - 0
embed/etcd.go

@@ -175,6 +175,7 @@ func StartEtcd(inCfg *Config) (e *Etcd, err error) {
 		StrictReconfigCheck:     cfg.StrictReconfigCheck,
 		StrictReconfigCheck:     cfg.StrictReconfigCheck,
 		ClientCertAuthEnabled:   cfg.ClientTLSInfo.ClientCertAuth,
 		ClientCertAuthEnabled:   cfg.ClientTLSInfo.ClientCertAuth,
 		AuthToken:               cfg.AuthToken,
 		AuthToken:               cfg.AuthToken,
+		InitialCorruptCheck:     cfg.ExperimentalInitialCorruptCheck,
 		CorruptCheckTime:        cfg.ExperimentalCorruptCheckTime,
 		CorruptCheckTime:        cfg.ExperimentalCorruptCheckTime,
 	}
 	}
 
 

+ 1 - 0
etcdmain/config.go

@@ -213,6 +213,7 @@ func newConfig() *config {
 	fs.StringVar(&cfg.ec.AuthToken, "auth-token", cfg.ec.AuthToken, "Specify auth token specific options.")
 	fs.StringVar(&cfg.ec.AuthToken, "auth-token", cfg.ec.AuthToken, "Specify auth token specific options.")
 
 
 	// experimental
 	// experimental
+	fs.BoolVar(&cfg.ec.ExperimentalInitialCorruptCheck, "experimental-initial-corrupt-check", cfg.ec.ExperimentalInitialCorruptCheck, "Enable to check data corruption before serving any client/peer traffic.")
 	fs.DurationVar(&cfg.ec.ExperimentalCorruptCheckTime, "experimental-corrupt-check-time", cfg.ec.ExperimentalCorruptCheckTime, "Duration of time between cluster corruption check passes.")
 	fs.DurationVar(&cfg.ec.ExperimentalCorruptCheckTime, "experimental-corrupt-check-time", cfg.ec.ExperimentalCorruptCheckTime, "Duration of time between cluster corruption check passes.")
 
 
 	// ignored
 	// ignored

+ 3 - 1
etcdmain/help.go

@@ -187,8 +187,10 @@ auth flags:
 		Specify a v3 authentication token type and its options ('simple' or 'jwt').
 		Specify a v3 authentication token type and its options ('simple' or 'jwt').
 
 
 experimental flags:
 experimental flags:
+	--experimental-initial-corrupt-check 'false'
+		enable to check data corruption before serving any client/peer traffic.
 	--experimental-corrupt-check-time '0s'
 	--experimental-corrupt-check-time '0s'
-	        duration of time between cluster corruption check passes.
+		duration of time between cluster corruption check passes.
 	--experimental-enable-v2v3 ''
 	--experimental-enable-v2v3 ''
 		serve v2 requests through the v3 backend under a given prefix.
 		serve v2 requests through the v3 backend under a given prefix.
 `
 `

+ 4 - 1
etcdserver/config.go

@@ -66,7 +66,10 @@ type ServerConfig struct {
 
 
 	AuthToken string
 	AuthToken string
 
 
-	CorruptCheckTime time.Duration
+	// InitialCorruptCheck is true to check data corruption on boot
+	// before serving any peer/client traffic.
+	InitialCorruptCheck bool
+	CorruptCheckTime    time.Duration
 }
 }
 
 
 // VerifyBootstrap sanity-checks the initial config for bootstrap case
 // VerifyBootstrap sanity-checks the initial config for bootstrap case