Commit Graph
24973 Commits
Author SHA1 Message Date
Benjamin Wang d5527f23ef Merge pull request #21760 from SebTardif/fix/rafthttp-stream-resp-body-leak
rafthttp: close response body on io.ReadAll error in stream dial
2026-05-19 20:15:18 +01:00
Benjamin Wang 501eb2aa5d Merge pull request #21508 from linux-on-ibm-z/embed-tests-url-uniquify
Fix flaky test embed.TestEnableAuth which can fail due to port conflict
2026-05-19 20:15:04 +01:00
Ivan Valdes 7ee95a61a0 version: bump up to 3.7.0-beta.0
Signed-off-by: Ivan Valdes <iv@a.ki>
v3.7.0-beta.0 tests/v3.7.0-beta.0 etcdctl/v3.7.0-beta.0 etcdutl/v3.7.0-beta.0 server/v3.7.0-beta.0 client/v3.7.0-beta.0 client/pkg/v3.7.0-beta.0 pkg/v3.7.0-beta.0 api/v3.7.0-beta.0
2026-05-19 11:59:32 -07:00
Marek Siarkowicz 198400fdfa Merge pull request #21762 from serathius/security
Define THREAT_MODEL for etcd to decentivize agents reporting CVEs outside it
2026-05-19 16:42:56 +02:00
Jonathan Albrecht f254afa6f1 Add test utils to create unique urls for embed tests to fix
'listen tcp 127.0.0.1:2380: bind: address already in use'

errors when running tests.

Address review comments:
- Add Apache copyright to the new file
- Fix typo Confg -> Config
- Move server/embed/testutil/url.go -> server/embed/util_test.go
- Add a new method to apply the test URLs to the config
- Make all config functions private

Signed-off-by: Jonathan Albrecht <jonathan.albrecht@ibm.com>
2026-05-19 10:40:11 -04:00
Benjamin Wang 27d5ef1b4d Merge pull request #21761 from silentred/etcdutl-invalid-datadir
etcdutl: validate data file path instead of panic
2026-05-19 13:15:49 +01:00
Marek Siarkowicz 7d9dd73f21 Define THREAT_MODEL for etcd to decentivize agents reporting CVEs outside it
Signed-off-by: Marek Siarkowicz <siarkowicz@google.com>
2026-05-19 14:12:54 +02:00
shenmu.wy fa8df2ea93 etcdutl: validate data file path and return consistent errors instead of panic when given non-existent paths
Signed-off-by: shenmu.wy <shenmu.wy@antfin.com>
2026-05-19 17:27:03 +08:00
Andrew Liu af18caa8f5 traceutil: emit stable message name with trace_id and operation as fields
Before this change, LogWithStepThreshold formatted the log message as
  fmt.Sprintf("trace[%d] %s", rand.Int31(), t.operation)
producing a unique string on every invocation (e.g. "trace[12345678] range",
"trace[87654321] range"). In structured logging each unique message value is a
distinct cardinality entry, so a busy etcd instance generated O(ops/s) unique
event names per minute. This made grouping, alerting, and dashboard queries on
slow-trace events impractical.

After this change the message is always the stable string "trace". The random
trace identifier and the operation name are moved to structured zap fields
("trace_id" int32 and "operation" string), preserving full queryability while
reducing message cardinality from O(N) to 1.

The per-step format strings also no longer embed the trace ID inline; the ID
appears once at the top level.

Fixes #21733

Signed-off-by: Andrew Liu <andrewjliu22@gmail.com>
2026-05-17 20:54:11 -07:00
Sebastien Tardif 2e70188db0 rafthttp: close response body on io.ReadAll error in stream dial
In streamReader.dial(), when the HTTP response has status
StatusPreconditionFailed, the code reads the response body via
io.ReadAll. If io.ReadAll returns an error, the function returns
without closing resp.Body, leaking the underlying TCP connection.

Every other error path in this switch statement properly closes the
response body (via httputil.GracefulClose), but this one was missed.

Add resp.Body.Close() before returning on the io.ReadAll error path
to prevent the connection leak.

Signed-off-by: Sebastien Tardif <sebtardif@ncf.ca>
2026-05-17 13:48:51 -07:00
Marek Siarkowicz 0235df95f8 Merge pull request #21751 from fuweid/bump-to-use-official-pb
*: use google.golang.org/protobuf
2026-05-15 18:52:04 +02:00
Wei Fu faa35997ba tools: tolerate unstable protobuf snapshot string spacing
google.golang.org/protobuf intentionally varies whitespace in String output
across binaries. Update the etcd-dump-logs raw output test to accept both
snapshot line formats while keeping the rest of the output exact.

Signed-off-by: Wei Fu <fuweid89@gmail.com>
2026-05-15 10:59:56 -04:00
Wei Fu df2b18b65d *: switch to new protobuf struct
goos: linux
goarch: amd64
pkg: go.etcd.io/etcd/server/v3/etcdserver/txn
cpu: AMD Ryzen 7 5800H with Radeon Graphics
                                       │ /tmp/etcd-main-benchmark-warn-protosize.txt │ /tmp/etcd-current-benchmark-warn-protosize.txt │
                                       │                   sec/op                    │         sec/op          vs base                │
WarnOfExpensiveRequestWithProtoSize-16                                   3.530µ ± 1%              2.785µ ± 2%  -21.12% (p=0.000 n=10)

                                       │ /tmp/etcd-main-benchmark-warn-protosize.txt │ /tmp/etcd-current-benchmark-warn-protosize.txt │
                                       │                    B/op                     │          B/op           vs base                │
WarnOfExpensiveRequestWithProtoSize-16                                  1.822Ki ± 0%             1.315Ki ± 0%  -27.81% (p=0.000 n=10)

                                       │ /tmp/etcd-main-benchmark-warn-protosize.txt │ /tmp/etcd-current-benchmark-warn-protosize.txt │
                                       │                  allocs/op                  │       allocs/op         vs base                │
WarnOfExpensiveRequestWithProtoSize-16                                    15.00 ± 0%               28.00 ± 0%  +86.67% (p=0.000 n=10)

Signed-off-by: Wei Fu <fuweid89@gmail.com>
2026-05-15 10:59:37 -04:00
Wei Fu 2df115140b *: re-generate pb file by google.golang.org/protobuf
Signed-off-by: Wei Fu <fuweid89@gmail.com>
2026-05-15 06:36:35 -04:00
Wei Fu 7e0e973499 scripts/genproto.sh: update to use google.golang.org/protobuf
Signed-off-by: Wei Fu <fuweid89@gmail.com>
2026-05-15 06:35:23 -04:00
dependabot[bot] 52ec2dab32 build(deps): bump dependabot/fetch-metadata from 3.0.0 to 3.1.0
Bumps [dependabot/fetch-metadata](https://github.com/dependabot/fetch-metadata) from 3.0.0 to 3.1.0.
- [Release notes](https://github.com/dependabot/fetch-metadata/releases)
- [Commits](https://github.com/dependabot/fetch-metadata/compare/ffa630c65fa7e0ecfa0625b5ceda64399aea1b36...25dd0e34f4fe68f24cc83900b1fe3fe149efef98)

---
updated-dependencies:
- dependency-name: dependabot/fetch-metadata
  dependency-version: 3.1.0
  dependency-type: direct:production
  update-type: version-update:semver-minor
...

Signed-off-by: dependabot[bot] <support@github.com>
2026-05-15 05:09:21 +00:00
dependabot[bot] 90eb18e40d build(deps): bump antithesishq/antithesis-trigger-action
Bumps [antithesishq/antithesis-trigger-action](https://github.com/antithesishq/antithesis-trigger-action) from 0.10 to 0.11.
- [Release notes](https://github.com/antithesishq/antithesis-trigger-action/releases)
- [Commits](https://github.com/antithesishq/antithesis-trigger-action/compare/f6221e2ba819fe0ac3e36bd67a281fa439a03fba...72e1bc49d6a5f66c9b892e2b311844e00d342554)

---
updated-dependencies:
- dependency-name: antithesishq/antithesis-trigger-action
  dependency-version: '0.11'
  dependency-type: direct:production
  update-type: version-update:semver-minor
...

Signed-off-by: dependabot[bot] <support@github.com>
2026-05-15 05:09:18 +00:00
Marek Siarkowicz 4c79458a6d Merge pull request #21649 from ivanvc/auto-update-devcontainer
Use Dependabot to bump the devcontainer tag
2026-05-15 07:08:29 +02:00
Ivan Valdes e4f7f03d4e scripts: rewrite coverage test execution
Use the new test functions, simplify generating the coverage files and
merge at a single level by generating less coverage files.

Signed-off-by: Ivan Valdes <ivan@vald.es>
2026-05-14 15:17:42 -07:00
Marek Siarkowicz c85940aa2a Merge pull request #21746 from Jefftree/range-stream-large-values
add RangeStream test for values exceeding chunk target
2026-05-14 17:00:48 +02:00
Fu Wei ebda1e8c40 Merge pull request #21747 from Jefftree/etcdctl-stream-flag
etcdctl: add --stream flag to get command
2026-05-14 10:57:52 -04:00
Jefftree c5d1b8a020 tests/integration: add RangeStream test for values exceeding chunker target
Signed-off-by: Jefftree <jeffrey.ying86@live.com>
2026-05-14 10:10:58 -04:00
Jefftree 695442b44e etcdctl: add --stream flag to get command
Signed-off-by: Jefftree <jeffrey.ying86@live.com>
2026-05-14 09:55:11 -04:00
Marek Siarkowicz 3bdaa056aa Merge pull request #21748 from Jefftree/fix-rangestream-skip
fix TestKVGet skip masking non-stream coverage
2026-05-14 09:15:38 +02:00
Jefftree 5efa4a8e04 tests/common: fix TestKVGet skip masking non-stream coverage and stale wantResponses
Signed-off-by: Jefftree <jeffrey.ying86@live.com>
2026-05-13 19:25:28 -04:00
Benjamin Wang 9c420dfa0e Merge pull request #21743 from silentred/changelog-20260512
Update ChangeLog for PR_21719
2026-05-13 12:47:09 +01:00
Marek Siarkowicz 053fc705d9 Merge pull request #21711 from robin-vidal/fix/sc2268-shellcheck-test-lib
scripts: fix SC2268 shellcheck warning in test_lib.sh
2026-05-13 08:57:08 +02:00
Marek Siarkowicz 7237b0e296 Merge pull request #21745 from fuweid/gogo-part-11-12
tests: avoid protobuf value copies
2026-05-13 08:52:06 +02:00
shenmu.wy 41f3f7dfad Update ChangeLog for PR_21719 https://github.com/etcd-io/etcd/pull/21719
Signed-off-by: shenmu.wy <shenmu.wy@antfin.com>
2026-05-13 08:55:56 +08:00
Wei Fu d8ecc81643 *: update test case to use pointer instead of copying pb
Signed-off-by: Wei Fu <fuweid89@gmail.com>
2026-05-12 10:50:49 -04:00
Wei Fu fe079c317d tests/robustness: use pointer for toWatchEvent
Also using String() instead of %+v for proto struct

Signed-off-by: Wei Fu <fuweid89@gmail.com>
2026-05-12 10:19:54 -04:00
Benjamin Wang f4f0a23876 Merge pull request #21741 from fuweid/gogo-part-8-9-10
*: using pointer for KeyValue/InternalRaftRequest and in proxy path
2026-05-12 14:53:04 +01:00
Marek Siarkowicz 93e4b4f5d0 Merge pull request #21227 from nwnt/refactor-range-tests-for-readability
Refactor range kv tests
2026-05-12 11:42:43 +02:00
Nont a5161279ea Refactor range kv tests
Signed-off-by: Nont <9658731+nwnt@users.noreply.github.com>
2026-05-12 03:52:32 -05:00
Wei Fu c790e524da server/proxy/grpcproxy: clone or copy instead of assignment copy
Signed-off-by: Wei Fu <fuweid89@gmail.com>
2026-05-11 16:23:26 -04:00
Wei Fu 5c39d30b09 server/etcdserver: use pointer for InternalRaftRequest in raft request path
Switch EtcdServer.raftRequestOnce, EtcdServer.raftRequest, and
EtcdServer.processInternalRaftRequestOnce to take *etcdserverpb.InternalRaftRequest.

Signed-off-by: Wei Fu <fuweid89@gmail.com>
2026-05-11 16:21:44 -04:00
Wei Fu 7b03df8879 mvcc: use pointer for KeyValue in restore path
switch revKeyValue.kv from mvccpb.KeyValue to *mvccpb.KeyValue and
unmarshal into a newly allocated KeyValue in restoreChunk.

this removes gogopb-by-value usage in restore/index rebuild and keeps
pb handling aligned with pointer-based paths.

Signed-off-by: Wei Fu <fuweid89@gmail.com>
2026-05-11 16:15:49 -04:00
Fu Wei a3ad21881f Merge pull request #21734 from fuweid/gogo-part-7-kv-events 2026-05-11 16:11:36 -04:00
Wei Fu 50a472ee61 mvcc/watch: switch gogopb kv/event paths to pointer slices
stop passing mvcc gogopb structs around by value in txn/watch paths.

- change mvcc interfaces/results to pointer forms:
  - RangeResult.KVs: []mvccpb.KeyValue -> []*mvccpb.KeyValue
  - TxnWrite.Changes: []mvccpb.KeyValue -> []*mvccpb.KeyValue
  - watch event batches: []mvccpb.Event -> []*mvccpb.Event
- update txn rpc assembly to reuse pointers directly instead of &slice[i] copies
- update watch send/filter pipeline (mvcc, v3rpc, grpcproxy) to pointer events
- update sendFragments to build per-fragment WatchResponse explicitly (avoid proto struct value copy)
  - add TestWatchResponseProtoFieldCount to catch future WatchResponse field additions
- adjust compare/filter helpers to pointer args
- update affected mvcc/watch tests accordingly

Signed-off-by: Wei Fu <fuweid89@gmail.com>
2026-05-11 14:51:50 -04:00
Marek Siarkowicz a56d526df4 Merge pull request #21738 from AwesomePatrol/fix-etcd-k8s-feature-gate
Remove obsolete k8s feature gate
2026-05-11 15:46:07 +02:00
Aleksander Mistewicz 3e1583e97d Remove obsolete k8s feature gate
It was deleted in https://github.com/kubernetes/kubernetes/pull/138907

Signed-off-by: Aleksander Mistewicz <amistewicz@google.com>
2026-05-11 15:03:02 +02:00
Marek Siarkowicz 05f32d1124 Merge pull request #21723 from srri/srichards-add-cluster-version
etcdserver: set etcd_cluster_version version metric in Recover()
2026-05-11 10:15:45 +02:00
Fu Wei 0369e327b9 Merge pull request #21719 from silentred/test-member-update-learner
bugfix: MemberUpdate implicitly and unexpectedly promotes a learner
2026-05-10 17:02:29 -04:00
Benjamin Wang 76af2fe955 Merge pull request #21730 from fuweid/gogo-part-6-wal
wal: use pointer for WAL.start/openAtIndex snapshot state
2026-05-10 20:34:53 +01:00
Wei Fu d441ad6dc1 wal: use pointer for WAL.start/openAtIndex snapshot state
keep WAL snapshot tracking on pointer form as well:
- change WAL.start from walpb.Snapshot to *walpb.Snapshot
- in openAtIndex, normalize nil input to &walpb.Snapshot{} and store pointer start
- keep ReadAll math/error path on getters (GetIndex/GetTerm) for pointer-safe access
- update WAL test fixture to pass start as pointer

Signed-off-by: Wei Fu <fuweid89@gmail.com>
2026-05-10 09:43:11 -04:00
Marek Siarkowicz e8380010d9 Merge pull request #21718 from Jefftree/rangestream-gofail-delay
add beforeRangeStreamChunk gofail point
2026-05-08 18:56:10 +02:00
Benjamin Wang e8a9571ef1 Merge pull request #21717 from fuweid/gogo-part-5-cmdline
etcdctl/ctlv3/command: use pointer for gogopb responses
2026-05-08 17:52:55 +01:00
Steven Richards f55d8a0619 etcdserver: set etcd_cluster_version version metric in Recover()
Fixes #18805

On startup, during a rolling deployment of etcd 3.6.0 we see
Host 1: starting etcd server - cluster-version: to_be_decided
Host 1: set cluster version from store - cluster-version: 3.6
...
Host 2: starting etcd server - cluster-version: to_be_decided
Host 2: set cluster version from store - cluster-version: 3.6
...

And so on. However, once the rolling-deploy is complete, we find that
the cluster_version metric is not being emitted:

root@etcd-host-2:/# curl -s localhost:2379/metrics | grep
"server_version"
'server_version' label with current version.
etcd_server_version{server_version="3.6.0"} 1
root@etcd-host-2:/# curl -s localhost:2379/metrics | grep
"cluster_version"
root@etcd-host-2:/#

It appears we are missing the call to actually set the metric once we
determine it in the recover() path, via applySnapshot().

Signed-off-by: Steven Richards <steven.richards@slack-corp.com>
2026-05-08 09:49:49 -07:00
Wei FuandJordan Liggitt 32a860bd4a etcdctl/ctlv3/command: use pointer for gogopb responses
switch ctlv3 command printer/watch paths to pointer-based gogopb response
handling, and read protobuf-backed fields via GetXXX() just in case input
is nil.

In tests/framework/e2e/etcdctl.go, txn output is decoded into
command.TxnResponseJSON and converted with ToProto(), instead of hand-building
ResponseOp variants before json.Unmarshal.

Co-authored-by: Jordan Liggitt <liggitt@google.com>
Signed-off-by: Wei Fu <fuweid89@gmail.com>
2026-05-08 11:15:16 -04:00
shenmu.wy 7c528e8566 bugfix: MemberUpdate a learner overrides its IsLearner to false
Signed-off-by: shenmu.wy <shenmu.wy@antfin.com>
2026-05-08 23:14:28 +08:00