From 74686691e3aaaf9b58a3f55570a2b9ea4a135715 Mon Sep 17 00:00:00 2001 From: Anthony Romano Date: Thu, 16 Mar 2017 20:20:49 -0700 Subject: [PATCH] etcdserver, backend: only warn if exceeding max quota --- etcdserver/quota.go | 17 ++++++++++++----- mvcc/backend/backend.go | 9 --------- 2 files changed, 12 insertions(+), 14 deletions(-) diff --git a/etcdserver/quota.go b/etcdserver/quota.go index 088a4696253d..87126f1564c1 100644 --- a/etcdserver/quota.go +++ b/etcdserver/quota.go @@ -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 @@ -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} } diff --git a/mvcc/backend/backend.go b/mvcc/backend/backend.go index 0a559295ceed..e70edb8f344a 100644 --- a/mvcc/backend/backend.go +++ b/mvcc/backend/backend.go @@ -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