瀏覽代碼

etcdmain: check for empty AutoCompactionRetention

fanmin shi 8 年之前
父節點
當前提交
0e1993f131
共有 1 個文件被更改,包括 4 次插入0 次删除
  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