d820cd2b56
etcdserver: change the snapshot + compact into sync operation
...
Signed-off-by: Clement <gh.2lgqz@aleeas.com >
2024-07-05 01:27:30 +08:00
60e3f45469
Adds all feature_gate from component-base.
...
We'll likely use most of the feature_gate package from component-base.
Also this commit moves the pkg from server/internal/pkg to pkg/.
Signed-off-by: Baek <seungtackbaek@google.com >
2024-06-15 05:34:58 +00:00
69ebaaebca
featuregate: adds EtcdServer.FeatureEnabled interface.
...
The interface can be used throughout the etcd server binary to check if
the feature is enabled or not.
Note that this commit also copies necessary FeatureGate interface from
k8s component-base.
Signed-off-by: Baek <seungtackbaek@google.com >
2024-06-15 05:34:58 +00:00
9431e3a952
dependency: bump google.golang.org/grpc from 1.63.2 to 1.64.0
...
Reference:
- https://github.com/etcd-io/etcd/pull/18034
Signed-off-by: Chun-Hung Tseng <henrybear327@gmail.com >
2024-05-20 22:45:14 +02:00
0232686cac
etcdserver: add server range duration metrics
...
Signed-off-by: Daniel Tripp <38776199+thedtripp@users.noreply.github.com >
Co-authored-by: Ravi Hari <RaviHari@users.noreply.github.com >
2024-05-18 19:01:09 +00:00
36414cb0b8
Merge pull request #17930 from jamesreprise/bootstraped
...
Fix typo bootstrapedCluster
2024-05-03 18:07:49 +01:00
13c0f75b7d
Merge pull request #17877 from tjungblu/17872_status
...
add quota to endpoint status response
2024-05-03 13:03:23 +01:00
ccb4ef76e3
typo: bootstrapedCluster -> bootstrappedCluster
...
Signed-off-by: James Williams <james.williams@griffin.com >
2024-05-03 11:34:55 +01:00
030066cdb2
Chore: Use chain interceptors from grpc package
...
Signed-off-by: Marcus Efraimsson <marcus.efraimsson@gmail.com >
2024-05-01 22:26:50 +02:00
d31caaec4a
Merge pull request #17793 from mneverov/fix-quorum-check
...
Fix remove member failed.
2024-04-30 19:52:14 +01:00
09f7d7ab92
Merge pull request #17875 from ivanvc/fix-deprecation-comments-added-with-var-naming-lint-rule
...
Fix deprecation comments from addressing var-naming work
2024-04-30 19:51:37 +01:00
dafadd13c1
all: don't convert byte slice to string when using verb %s
...
This is unnecessary, as the documentation for 'go doc fmt' says:
%s the uninterpreted bytes of the string or slice
Signed-off-by: Jes Cok <xigua67damn@gmail.com >
2024-04-25 23:34:52 +08:00
bdcff246cb
add quota to endpoint status response
...
This adds the configured backend quota bytes to the endpoint status response.
related discussion in #17821
Signed-off-by: Thomas Jungblut <tjungblu@redhat.com >
2024-04-25 16:44:20 +02:00
242f5d60a8
Fix deprecation comments from addressing var-naming work
...
The deprecation tag/comment must to be followed by an empty line.
Signed-off-by: Ivan Valdes <ivan@vald.es >
2024-04-24 14:40:59 -07:00
379a8b79fb
fix version order when calling IsValidClusterVersionChange in UpdateCapability.
...
Signed-off-by: Siyuan Zhang <sizhang@google.com >
2024-04-23 09:31:19 -07:00
b6b7a1a3b6
refactor IsValidVersionChange.
...
Signed-off-by: Siyuan Zhang <sizhang@google.com >
2024-04-22 10:27:54 -07:00
c2982e15f3
Revert checking connected since inclusively.
...
Signed-off-by: Max Neverov <neverov.max@gmail.com >
2024-04-18 11:26:28 +02:00
c64c996c03
Revert quorum calculation: (active - 1) < 1+((len(m)-1)/2)
calculates quorum after a member is deleted.
...
Signed-off-by: Max Neverov <neverov.max@gmail.com >
2024-04-17 07:55:24 +02:00
3b16aae947
Fix remove member failed.
...
Signed-off-by: Max Neverov <neverov.max@gmail.com >
2024-04-17 07:55:24 +02:00
09769c4be7
Merge pull request #17642 from fuweid/fix-17506
...
*: LeaseTimeToLive returns error if leader changed
2024-04-02 14:55:41 +02:00
d43738a49b
server/storage: address golangci var-naming issues
...
Signed-off-by: Ivan Valdes <ivan@vald.es >
2024-03-27 10:12:42 -07:00
d3bb6f688b
*: LeaseTimeToLive returns error if leader changed
...
The old leader demotes lessor and all the leases' expire time will be
updated. Instead of returning incorrect remaining TTL, we should return
errors to force client retry.
Signed-off-by: Wei Fu <fuweid89@gmail.com >
2024-03-26 18:55:01 +08:00
bc31162cc2
all: call Close() after reading http.Response.Body
...
As the doc of http.Response.Body says:
// The http Client and Transport guarantee that Body is always
// non-nil, even on responses without a body or responses with
// a zero-length body. It is the caller's responsibility to
// close Body.
Signed-off-by: Jes Cok <xigua67damn@gmail.com >
2024-03-25 12:17:47 +08:00
97029d768a
Merge pull request #17614 from ivanvc/address-etcdserver-var-naming-lint-rule
...
etcdserver: address var naming lint rule
2024-03-19 22:40:03 +01:00
14523bdc21
etcdserver: rename MemberId() to MemberID() to address var-naming
...
Signed-off-by: Ivan Valdes <ivan@vald.es >
2024-03-18 17:18:29 -07:00
c613b78e6c
etcdserver: address golangci var-naming issues
...
Signed-off-by: Ivan Valdes <ivan@vald.es >
2024-03-18 17:17:07 -07:00
8b9909e20d
Merge pull request #17585 from ivanvc/address-api-var-naming-lint-rule
...
api: address golangci var-naming issues
2024-03-16 11:23:46 +00:00
2190b0f1c6
api: address golangci var-naming issues
...
Signed-off-by: Ivan Valdes <ivan@vald.es >
2024-03-15 20:37:53 -07:00
405862e807
Fix event loss after compaction
...
Signed-off-by: Chao Chen <chaochn@amazon.com >
2024-03-15 14:22:37 -07:00
6103504d4b
Fix progress notification for watch that doesn't get any events
...
When implementing the fix for progress notifications
(https://github.com/etcd-io/etcd/pull/15237 ) we made a incorrect
assumption that that unsynched watches will always get at least one event.
Unsynched watches include not only slow watchers, but also newly created
watches that requested current or older revision. In case that non of the events
match watch filter, those newly created watches might become synched
without any event going through.
Signed-off-by: Marek Siarkowicz <siarkowicz@google.com >
2024-03-11 12:11:09 +01:00
46d59a2e68
etcdserver: skip when detect a removed peer
...
Signed-off-by: Dat Tien Nguyen <phongtomfapp@gmail.com >
2024-03-04 21:22:19 +07:00
3565a822de
Add VerifyTxConsistency to backend.
...
Signed-off-by: Siyuan Zhang <sizhang@google.com >
Update server/storage/backend/verify.go
Co-authored-by: Benjamin Wang <benjamin.wang@broadcom.com >
Update server/storage/backend/verify.go
Co-authored-by: Benjamin Wang <benjamin.wang@broadcom.com >
2024-02-22 11:31:16 -08:00
32ee8b877a
etcdserver: drain leaky goroutines before test completed
...
If pending changes aren't committed before test completed, it might cause
data race when we don't drain all the background goroutines.
```bash
$ cd server
$ go test -race -v -run TestApplyRepeat ./etcdserver
...
panic: Log in goroutine after TestApplyRepeat has completed: 2024-02-03T17:06:13.262+0800 DEBUG bbolt Committing transaction 2
goroutine 81 [running]:
testing.(*common).logDepth(0xc000502820, {0xc0001b0460, 0x41}, 0x3)
/usr/local/go/src/testing/testing.go:1022 +0x6d4
testing.(*common).log(...)
/usr/local/go/src/testing/testing.go:1004
testing.(*common).Logf(0xc000502820, {0x1421ad7, 0x2}, {0xc000603520, 0x1, 0x1})
/usr/local/go/src/testing/testing.go:1055 +0xa5
go.uber.org/zap/zaptest.testingWriter.Write({{0x15f1f90?, 0xc000502820?}, 0xda?}, {0xc000119800, 0x42, 0x400})
/home/fuwei/go/pkg/mod/go.uber.org/zap@v1.26 .0/zaptest/logger.go:130 +0x11e
go.uber.org/zap/zapcore.(*ioCore).Write(0xc0000b55c0, {0xff, {0xc1679e614f9fd7a4, 0x73a3657, 0x1cc2400}, {0x1422b2d, 0x5}, {0xc0001a0330, 0x18}, {0x0, ...}, ...}, ...)
/home/fuwei/go/pkg/mod/go.uber.org/zap@v1.26 .0/zapcore/core.go:99 +0x193
go.uber.org/zap/zapcore.(*CheckedEntry).Write(0xc000115930, {0x0, 0x0, 0x0})
/home/fuwei/go/pkg/mod/go.uber.org/zap@v1.26 .0/zapcore/entry.go:253 +0x2f0
go.uber.org/zap.(*SugaredLogger).log(0xc0001960f8, 0xff, {0x1437885, 0x19}, {0xc0006034e0, 0x1, 0x1}, {0x0, 0x0, 0x0})
/home/fuwei/go/pkg/mod/go.uber.org/zap@v1.26 .0/sugar.go:316 +0x130
go.uber.org/zap.(*SugaredLogger).Debugf(...)
/home/fuwei/go/pkg/mod/go.uber.org/zap@v1.26 .0/sugar.go:171
go.etcd.io/bbolt.(*Tx).Commit(0xc0001aa9a0)
/home/fuwei/go/pkg/mod/go.etcd.io/bbolt@v1.4.0-alpha.0/tx.go:173 +0x206
go.etcd.io/etcd/server/v3/storage/backend.(*batchTx).commit(0xc00019b180, 0x0)
/home/fuwei/go/src/go.etcd.io/etcd/server/storage/backend/batch_tx.go:269 +0xdf
go.etcd.io/etcd/server/v3/storage/backend.(*batchTxBuffered).unsafeCommit(0xc00019b180, 0x0)
/home/fuwei/go/src/go.etcd.io/etcd/server/storage/backend/batch_tx.go:378 +0x425
go.etcd.io/etcd/server/v3/storage/backend.(*batchTxBuffered).commit(0xc00019b180, 0x80?)
/home/fuwei/go/src/go.etcd.io/etcd/server/storage/backend/batch_tx.go:355 +0x78
go.etcd.io/etcd/server/v3/storage/backend.(*batchTxBuffered).Commit(0xc00019b180)
/home/fuwei/go/src/go.etcd.io/etcd/server/storage/backend/batch_tx.go:342 +0x35
go.etcd.io/etcd/server/v3/storage/backend.(*backend).run(0xc000478180)
/home/fuwei/go/src/go.etcd.io/etcd/server/storage/backend/backend.go:426 +0x2c7
created by go.etcd.io/etcd/server/v3/storage/backend.newBackend in goroutine 80
/home/fuwei/go/src/go.etcd.io/etcd/server/storage/backend/backend.go:227 +0xbfd
FAIL go.etcd.io/etcd/server/v3/etcdserver 0.129s
FAIL
```
This patch also drains goroutines related to raftNode and watch store.
Signed-off-by: Wei Fu <fuweid89@gmail.com >
2024-02-03 18:58:17 +08:00
16a5e1da71
Added a error log when learner is not sync with etcd leader.
...
Signed-off-by: ishan16696 <ishan.tyagi@sap.com >
2024-01-30 15:42:11 +05:30
40f22e9319
Merge pull request #17176 from YaoC/fix-learner-metric
...
server: fix learner metric incorrect issue
2024-01-12 17:37:46 +01:00
f7ab7adf29
server: fix learner metric incorrect issue
...
Signed-off-by: YaoC <chengyao09@hotmail.com >
2024-01-12 09:36:33 +00:00
28f4c6fef6
dependency: bump github.com/grpc-ecosystem/grpc-gateway/v2 from 2.18.1 to 2.19.0
...
Signed-off-by: Sharath Sivakumar <mailssr9@gmail.com >
2024-01-09 16:26:47 +01:00
a2eb17c809
Merge pull request #17199 from serathius/dont-flock
...
Don't flock snapshot files
2024-01-08 15:03:29 +01:00
3471ef133d
Add an e2e test and robustness failpoint around recovering from snapshot backend
...
Signed-off-by: Marek Siarkowicz <siarkowicz@google.com >
2024-01-04 15:25:24 +01:00
7f8346b3f2
Don't flock snapshot files
...
Signed-off-by: Marek Siarkowicz <siarkowicz@google.com >
2024-01-04 14:53:44 +01:00
d39d86a214
Improve logs around recovering from snapshot backend
...
Signed-off-by: Marek Siarkowicz <siarkowicz@google.com >
2023-12-20 16:26:27 +01:00
1e8d66ef95
Add beforeOpenSnapshotBackend failpoint
...
Signed-off-by: Marek Siarkowicz <siarkowicz@google.com >
2023-12-20 15:36:54 +01:00
67f17166bf
Safeguard lease operations by double checking the leadership
...
1. ignore old leader's leases revoking request
2. double check current member's leadership before perform lease renew request
3. etcdserve: ensure current member's leadership before performing lease checkpoint request
Signed-off-by: Benjamin Wang <benjamin.ahrtr@gmail.com >
2023-12-15 17:53:36 +00:00
36b2523669
added some log messages for better diagnosis
...
Signed-off-by: Benjamin Wang <benjamin.ahrtr@gmail.com >
2023-12-13 18:43:22 +00:00
9f82390ae9
server: refine TestProcessIgnoreMismatchMessage
...
Signed-off-by: Neil Shen <overvenus@gmail.com >
2023-12-07 20:32:43 +08:00
fb769c4306
server: ignore raft messages if member id mismatch
...
Ignore Raft messages when the `To` field mismatches the local member ID.
In cases where incorrect Raft messages are dispatched, potentially due
to a malfunctioning switch, this proactive check prevents panics,
such as "tocommit is out of range".
Signed-off-by: Neil Shen <overvenus@gmail.com >
2023-12-07 11:57:45 +08:00
8578e07117
server: disable redirects in peer communication
...
Disable following redirects from peer HTTP communication on the client's side.
Etcd server may run into SSRF (Server-side request forgery) when adding a new
member. If users provide a malicious peer URL, the existing etcd members may be
redirected to another unexpected internal URL when getting the new member's
version.
Signed-off-by: Ivan Valdes <ivan@vald.es >
2023-12-04 13:53:28 -08:00
bc697bc26e
Revert "Switch to validating v3 when v2 and v3 are synchronized"
...
This reverts commit 4fe46f9203
.
Signed-off-by: Marek Siarkowicz <siarkowicz@google.com >
2023-12-03 18:12:09 +01:00
03d551243b
Merge pull request #17015 from serathius/extract-membership-applier
...
Extract membership applier
2023-11-27 19:59:21 +01:00
62b772c321
Merge pull request #17021 from serathius/test-applyconfstate
...
Test ApplyConfState after restart
2023-11-27 13:19:50 +01:00