Skip to content

Commit

Permalink
etcdserver, backend: only warn if exceeding max quota
Browse files Browse the repository at this point in the history
  • Loading branch information
Anthony Romano committed Mar 17, 2017
1 parent ae2e96e commit ee92272
Show file tree
Hide file tree
Showing 2 changed files with 12 additions and 14 deletions.
17 changes: 12 additions & 5 deletions etcdserver/quota.go
Original file line number Diff line number Diff line change
Expand Up @@ -16,7 +16,15 @@ package etcdserver

import (
pb "github.com/coreos/etcd/etcdserver/etcdserverpb"
"github.com/coreos/etcd/mvcc/backend"
)

const (
// DefaultQuotaBytes is the number of bytes the backend Size may
// consume before exceeding the space quota.
DefaultQuotaBytes = int64(2 * 1024 * 1024 * 1024) // 2GB
// MaxQuotaBytes is the maximum number of bytes suggested for a backend
// quota. A larger quota may lead to degraded performance.
MaxQuotaBytes = int64(8 * 1024 * 1024 * 1024) // 8GB
)

// Quota represents an arbitrary quota against arbitrary requests. Each request
Expand Down Expand Up @@ -57,11 +65,10 @@ func NewBackendQuota(s *EtcdServer) Quota {
}
if s.Cfg.QuotaBackendBytes == 0 {
// use default size if no quota size given
return &backendQuota{s, backend.DefaultQuotaBytes}
return &backendQuota{s, DefaultQuotaBytes}
}
if s.Cfg.QuotaBackendBytes > backend.MaxQuotaBytes {
plog.Warningf("backend quota %v exceeds maximum quota %v; using maximum", s.Cfg.QuotaBackendBytes, backend.MaxQuotaBytes)
return &backendQuota{s, backend.MaxQuotaBytes}
if s.Cfg.QuotaBackendBytes > MaxQuotaBytes {
plog.Warningf("backend quota %v exceeds maximum recommended quota %v", s.Cfg.QuotaBackendBytes, MaxQuotaBytes)
}
return &backendQuota{s, s.Cfg.QuotaBackendBytes}
}
Expand Down
9 changes: 0 additions & 9 deletions mvcc/backend/backend.go
Original file line number Diff line number Diff line change
Expand Up @@ -43,15 +43,6 @@ var (
plog = capnslog.NewPackageLogger("github.com/coreos/etcd", "mvcc/backend")
)

const (
// DefaultQuotaBytes is the number of bytes the backend Size may
// consume before exceeding the space quota.
DefaultQuotaBytes = int64(2 * 1024 * 1024 * 1024) // 2GB
// MaxQuotaBytes is the maximum number of bytes suggested for a backend
// quota. A larger quota may lead to degraded performance.
MaxQuotaBytes = int64(8 * 1024 * 1024 * 1024) // 8GB
)

type Backend interface {
ReadTx() ReadTx
BatchTx() BatchTx
Expand Down

0 comments on commit ee92272

Please sign in to comment.