Skip to content

Commit

Permalink
Merge pull request #12035 from spzala/automated-cherry-pick-of-#11787…
Browse files Browse the repository at this point in the history
…-upstream-release-3.4

Automated cherry pick of #11787
  • Loading branch information
gyuho committed Jun 22, 2020
2 parents 493f15c + 05c441f commit 37ac222
Show file tree
Hide file tree
Showing 2 changed files with 3 additions and 1 deletion.
2 changes: 2 additions & 0 deletions embed/config_test.go
Original file line number Diff line number Diff line change
Expand Up @@ -178,9 +178,11 @@ func TestAutoCompactionModeParse(t *testing.T) {
{"revision", "1", false, 1},
{"revision", "1h", false, time.Hour},
{"revision", "a", true, 0},
{"revision", "-1", true, 0},
// periodic
{"periodic", "1", false, time.Hour},
{"periodic", "a", true, 0},
{"revision", "-1", true, 0},
// err mode
{"errmode", "1", false, 0},
{"errmode", "1h", false, time.Hour},
Expand Down
2 changes: 1 addition & 1 deletion embed/etcd.go
Original file line number Diff line number Diff line change
Expand Up @@ -812,7 +812,7 @@ func (e *Etcd) GetLogger() *zap.Logger {

func parseCompactionRetention(mode, retention string) (ret time.Duration, err error) {
h, err := strconv.Atoi(retention)
if err == nil {
if err == nil && h >= 0 {
switch mode {
case CompactorModeRevision:
ret = time.Duration(int64(h))
Expand Down

0 comments on commit 37ac222

Please sign in to comment.