embed: fix compaction runtime err

Handle negative value input which currently gives a runtime error.
This commit is contained in:
Sahdev P. Zala
2020-04-15 11:29:01 -04:00
parent 91b1a9182a
commit 05c441f92f
2 changed files with 3 additions and 1 deletions

View File

@@ -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))