Browse Source

etcdmain: check for empty AutoCompactionRetention

fanmin shi 8 years ago
parent
commit
0e1993f131
1 changed files with 4 additions and 0 deletions
  1. 4 0
      embed/etcd.go

+ 4 - 0
embed/etcd.go

@@ -132,6 +132,10 @@ func StartEtcd(inCfg *Config) (e *Etcd, err error) {
 		autoCompactionRetention time.Duration
 		h                       int
 	)
+	// AutoCompactionRetention defaults to "0" if not set.
+	if len(cfg.AutoCompactionRetention) == 0 {
+		cfg.AutoCompactionRetention = "0"
+	}
 	h, err = strconv.Atoi(cfg.AutoCompactionRetention)
 	if err == nil {
 		autoCompactionRetention = time.Duration(int64(h)) * time.Hour