From 7b6554fd3030a21631bb23e1827f4af1d9b93a4f Mon Sep 17 00:00:00 2001 From: Chao Chen Date: Fri, 22 Oct 2021 16:36:37 -0700 Subject: [PATCH 1/2] non mutating requests pass through quotaKVServer when NOSPACE --- server/storage/quota.go | 7 ++++++- tests/integration/v3_alarm_test.go | 24 ++++++++++++++++++++++++ 2 files changed, 30 insertions(+), 1 deletion(-) diff --git a/server/storage/quota.go b/server/storage/quota.go index e15079d45..46b350653 100644 --- a/server/storage/quota.go +++ b/server/storage/quota.go @@ -127,8 +127,13 @@ func NewBackendQuota(cfg config.ServerConfig, be backend.Backend, name string) Q } func (b *BackendQuota) Available(v interface{}) bool { + cost := b.Cost(v) + // if there are no mutating requests, it's safe to pass through + if cost == 0 { + return true + } // TODO: maybe optimize Backend.Size() - return b.be.Size()+int64(b.Cost(v)) < b.maxBackendBytes + return b.be.Size()+int64(cost) < b.maxBackendBytes } func (b *BackendQuota) Cost(v interface{}) int { diff --git a/tests/integration/v3_alarm_test.go b/tests/integration/v3_alarm_test.go index 929d9b926..2fce27bf8 100644 --- a/tests/integration/v3_alarm_test.go +++ b/tests/integration/v3_alarm_test.go @@ -88,6 +88,30 @@ func TestV3StorageQuotaApply(t *testing.T) { } } + // txn with non-mutating Ops should go through when NOSPACE alarm is raised + _, err = kvc0.Txn(context.TODO(), &pb.TxnRequest{ + Compare: []*pb.Compare{ + { + Key: key, + Result: pb.Compare_EQUAL, + Target: pb.Compare_CREATE, + TargetUnion: &pb.Compare_CreateRevision{CreateRevision: 0}, + }, + }, + Success: []*pb.RequestOp{ + { + Request: &pb.RequestOp_RequestDeleteRange{ + RequestDeleteRange: &pb.DeleteRangeRequest{ + Key: key, + }, + }, + }, + }, + }) + if err != nil { + t.Fatal(err) + } + ctx, cancel := context.WithTimeout(context.TODO(), integration.RequestWaitTimeout) defer cancel() From 9c6d57918dab6b8cda8824d0eb5ee8f8c75ad958 Mon Sep 17 00:00:00 2001 From: Chao Chen Date: Fri, 22 Oct 2021 16:36:59 -0700 Subject: [PATCH 2/2] update CHANGELOG --- CHANGELOG-3.5.md | 4 ---- CHANGELOG-3.6.md | 5 +++++ 2 files changed, 5 insertions(+), 4 deletions(-) diff --git a/CHANGELOG-3.5.md b/CHANGELOG-3.5.md index eac0888c7..78015a501 100644 --- a/CHANGELOG-3.5.md +++ b/CHANGELOG-3.5.md @@ -25,10 +25,6 @@ See [code changes](https://github.com/etcd-io/etcd/compare/v3.5.0...v3.5.1) and - Endpoints self identify now as `etcd-endpoints://{id}/{authority}` where authority is based on first endpoint passed, for example `etcd-endpoints://0xc0009d8540/localhost:2079` -### tools/benchmark - -- [Add etcd client autoSync flag](https://github.com/etcd-io/etcd/pull/13416) - ### Other - Updated [base image](https://github.com/etcd-io/etcd/pull/13386) from `debian:buster-v1.4.0` to `debian:bullseye-20210927` to fix the following critical CVEs: diff --git a/CHANGELOG-3.6.md b/CHANGELOG-3.6.md index 73fdd8584..f792d3a13 100644 --- a/CHANGELOG-3.6.md +++ b/CHANGELOG-3.6.md @@ -32,6 +32,11 @@ See [code changes](https://github.com/etcd-io/etcd/compare/v3.5.0...v3.6.0). ### etcd server - Add [`etcd --log-format`](https://github.com/etcd-io/etcd/pull/13339) flag to support log format. +- Fix [non mutating requests pass through quotaKVServer when NOSPACE](https://github.com/etcd-io/etcd/pull/13435) + +### tools/benchmark + +- [Add etcd client autoSync flag](https://github.com/etcd-io/etcd/pull/13416) ### Metrics, Monitoring