1065 Commits

Author SHA1 Message Date
Benjamin Wang
abef537a90
Merge pull request #14515 from spongecaptain/btree-generics
upate:use google/btree in the genric way
2022-09-27 16:44:13 +08:00
wathenjiang
319db38b0a update: add benchmark test
benchmark result:
(1) master branch
$ go test -bench='BenchmarkIndexPut$' -count=5
goos: darwin
goarch: amd64
pkg: go.etcd.io/etcd/server/v3/storage/mvcc
cpu: Intel(R) Core(TM) i7-9750H CPU @ 2.60GHz
BenchmarkIndexPut-12             1000000              2591 ns/op
BenchmarkIndexPut-12             1000000              2531 ns/op
BenchmarkIndexPut-12             1000000              2536 ns/op
BenchmarkIndexPut-12             1000000              2546 ns/op
BenchmarkIndexPut-12             1000000              2538 ns/op
PASS
ok      go.etcd.io/etcd/server/v3/storage/mvcc  167.439s

$ go test -bench='BenchmarkIndexGet$' -count=5
goos: darwin
goarch: amd64
pkg: go.etcd.io/etcd/server/v3/storage/mvcc
cpu: Intel(R) Core(TM) i7-9750H CPU @ 2.60GHz
BenchmarkIndexGet-12             1000000              2021 ns/op
BenchmarkIndexGet-12             1000000              2029 ns/op
BenchmarkIndexGet-12             1000000              2044 ns/op
BenchmarkIndexGet-12             1000000              1973 ns/op
BenchmarkIndexGet-12             1000000              2027 ns/op
PASS
ok      go.etcd.io/etcd/server/v3/storage/mvcc  177.815s

(2) google/btree in the generic way
$ go test -bench='BenchmarkIndexPut$' -count=5
goos: darwin
goarch: amd64
pkg: go.etcd.io/etcd/server/v3/storage/mvcc
cpu: Intel(R) Core(TM) i7-9750H CPU @ 2.60GHz
BenchmarkIndexPut-12             1000000              2477 ns/op
BenchmarkIndexPut-12             1000000              2380 ns/op
BenchmarkIndexPut-12             1000000              2360 ns/op
BenchmarkIndexPut-12             1000000              2396 ns/op
BenchmarkIndexPut-12             1000000              2382 ns/op
PASS
ok      go.etcd.io/etcd/server/v3/storage/mvcc  165.841s

$ go test -bench='BenchmarkIndexGet$' -count=5
goos: darwin
goarch: amd64
pkg: go.etcd.io/etcd/server/v3/storage/mvcc
cpu: Intel(R) Core(TM) i7-9750H CPU @ 2.60GHz
BenchmarkIndexGet-12             1000000              1985 ns/op
BenchmarkIndexGet-12             1000000              1914 ns/op
BenchmarkIndexGet-12             1000000              1900 ns/op
BenchmarkIndexGet-12             1000000              1905 ns/op
BenchmarkIndexGet-12             1000000              1894 ns/op
PASS
ok      go.etcd.io/etcd/server/v3/storage/mvcc  177.573s

Signed-off-by: wathenjiang <wathenjiang@tencent.com>
2022-09-27 14:33:02 +08:00
Spongecaptain
c53dfc7c5b upate:use google/btree in the genric way
Signed-off-by: wathenjiang <wathenjiang@tencent.com>
2022-09-27 10:16:15 +08:00
Benjamin Wang
1c20ed2cc5
Merge pull request #14521 from lovehhf/remove_pick_peer_url
membership: Remove PickPeerURL Method
2022-09-27 02:10:35 +08:00
Hongfei Huang
f6d808736c membership: Remove PickPeerURL Method
PickPeerURL only used by unit test

Signed-off-by: Hongfei Huang <853885165@qq.com>
2022-09-26 23:21:10 +08:00
Kafuu Chino
f1d4935e91 *: avoid closing a watch with ID 0 incorrectly
Signed-off-by: Kafuu Chino <KafuuChinoQ@gmail.com>

add test
2022-09-26 20:30:33 +08:00
Benjamin Wang
434c7c4309
Merge pull request #14506 from SimFG/main
wal: Fix the `walWriteBytes` metric
2022-09-26 09:36:07 +08:00
SimFG
5702765729 wal: Fix the walWriteBytes metric
Signed-off-by: SimFG <1142838399@qq.com>
2022-09-22 19:23:06 +08:00
Benjamin Wang
9097e61b40 etcdserve: revert the etcdserver side change for the data loss on one node cluster
Since the raft side change has been merged, so we need to revert the etcdserver
side change.
Refer to
  https://github.com/etcd-io/etcd/pull/14413
  https://github.com/etcd-io/etcd/pull/14400

Signed-off-by: Benjamin Wang <wachao@vmware.com>
2022-09-22 15:19:20 +08:00
Benjamin Wang
7f10dccbaf Bump go 1.19: update all the dependencies and go.sum files
1. run ./scripts/fix.sh;
2. cd tools/mod; gofmt -w . & go mod tidy;

Signed-off-by: Benjamin Wang <wachao@vmware.com>
2022-09-22 08:47:46 +08:00
Benjamin Wang
cd0b1d0c66 Bump go 1.19: upgrade go version to 1.19 in all go.mod files
Signed-off-by: Benjamin Wang <wachao@vmware.com>
2022-09-22 08:47:46 +08:00
Marek Siarkowicz
026794495f
Merge pull request #14494 from demoManito/remove/redundant-type-conversion
etcd: remove redundant type conversion
2022-09-21 11:34:19 +02:00
Benjamin Wang
2441a24cee
Merge pull request #14493 from demoManito/style/format-import-order
etcd: format import order
2022-09-21 06:03:31 +08:00
demoManito
f67ec10779 etcd: format import order
golang CodeReviewComments:
https://github.com/golang/go/wiki/CodeReviewComments#imports

Signed-off-by: demoManito <1430482733@qq.com>
2022-09-20 18:41:39 +08:00
demoManito
a9c3d56508 etcd: remove redundant type conversion
Signed-off-by: demoManito <1430482733@qq.com>
2022-09-20 11:26:02 +08:00
Benjamin Wang
5344085338
Merge pull request #14491 from ahrtr/bump_jwt_4.4.2
etcd: Bump golang-jwt/jwt/ version to 4.4.2
2022-09-20 10:18:44 +08:00
Sahdev Zala
ad4a465383
Merge pull request #14492 from cmurphy/bump-golang-x-net
*: Update golang.org/x/net to latest
2022-09-19 22:11:43 -04:00
Colleen Murphy
7ea2a3d7cb *: Update golang.org/x/net to latest
Update golang.org/x/net to address CVE-2022-27664.

Signed-off-by: Colleen Murphy <colleen.murphy@suse.com>
2022-09-19 16:01:45 -07:00
Benjamin Wang
159ed15afc
Merge pull request #14479 from demoManito/fix/declaring-empty-slice
etcd: modify declaring empty slices
2022-09-20 05:22:59 +08:00
Benjamin Wang
09db6ec1d7 etcd: Bump golang-jwt/jwt/ version to 4.4.2
github.com/golang-jwt/jwt adds go mod support startig from 4.0.0,
and it's backwards-compatible with existing v3.x.y tags.

Signed-off-by: Benjamin Wang <wachao@vmware.com>
2022-09-20 04:06:47 +08:00
Hitoshi Mitake
c793f18238
Merge pull request #14322 from mitake/watch-auth-err
*: handle auth invalid token and old revision errors in watch
2022-09-19 23:33:49 +09:00
Hitoshi Mitake
2dcfa83094 *: handle auth invalid token and old revision errors in watch
Signed-off-by: Hitoshi Mitake <h.mitake@gmail.com>
2022-09-17 21:51:36 +09:00
Sahdev Zala
cdf4228673
Merge pull request #14308 from dusk125/main
server/etcdmain: add configurable cipher list to gRPC proxy listener
2022-09-16 12:15:08 -04:00
demoManito
72cf0cc04a etcd: modify declaring empty slices
declare an empty slice to var s []int replace  s :=[]int{}, https://github.com/golang/go/wiki/CodeReviewComments#declaring-empty-slices

Signed-off-by: demoManito <1430482733@qq.com>
2022-09-16 14:41:14 +08:00
Benjamin Wang
b7ba0542f6
Merge pull request #14422 from kkkkun/remove-redundant-code
remove redundant log messsages
2022-09-16 12:18:43 +08:00
kkkkun
c4582aaaee remove redundant log messages
Signed-off-by: kkkkun <scuzk373x@gmail.com>
2022-09-16 11:45:43 +08:00
lovehhf
3b585e94fc mvcc: Remove unused revisions and change comment rev to modified
Signed-off-by: Hongfei Huang <853885165@qq.com>
2022-09-14 23:36:54 +08:00
Benjamin Wang
1d95b82b19
Merge pull request #14421 from vsvastey/usr/vsvastey/open-with-max-index-test-fix
testing: fix TestOpenWithMaxIndex cleanup
2022-09-08 06:41:36 +08:00
Vladimir Sokolov
a4f140c9fa testing: fix TestOpenWithMaxIndex cleanup
A WAL object was closed by defer, however the WAL was rewritten afterwards,
so defer closed already closed WAL but not the new one. It caused a data
race between writing file and cleaning up a temporary test directory,
which led to a non-deterministic bug.

Fixes #14332

Signed-off-by: Vladimir Sokolov <vsvastey@gmail.com>
2022-09-07 21:30:16 +03:00
Benjamin Wang
3dc5348d94
Merge pull request #14419 from ahrtr/alarm_list_ci
Move consistent_index forward when executing alarmList operation
2022-09-06 03:50:58 +08:00
Benjamin Wang
cc840336f0 move consistent_index forward when executing alarmList operation
The alarm list is the only exception that doesn't move consistent_index
forward. The reproduction steps are as simple as,

```
etcd --snapshot-count=5 &
for i in {1..6}; do etcdctl  alarm list; done
kill -9 <etcd_pid>
etcd
```

Signed-off-by: Benjamin Wang <wachao@vmware.com>
2022-09-05 10:05:55 +08:00
Benjamin Wang
2a10049e47 fix the potential data loss for clusters with only one member
For a cluster with only one member, the raft always send identical
unstable entries and committed entries to etcdserver, and etcd
responds to the client once it finishes (actually partially) the
applying workflow.

When the client receives the response, it doesn't mean etcd has already
successfully saved the data, including BoltDB and WAL, because:
   1. etcd commits the boltDB transaction periodically instead of on each request;
   2. etcd saves WAL entries in parallel with applying the committed entries.
Accordingly, it may run into a situation of data loss when the etcd crashes
immediately after responding to the client and before the boltDB and WAL
successfully save the data to disk.
Note that this issue can only happen for clusters with only one member.

For clusters with multiple members, it isn't an issue, because etcd will
not commit & apply the data before it being replicated to majority members.
When the client receives the response, it means the data must have been applied.
It further means the data must have been committed.
Note: for clusters with multiple members, the raft will never send identical
unstable entries and committed entries to etcdserver.

Signed-off-by: Benjamin Wang <wachao@vmware.com>
2022-08-30 15:29:20 +08:00
Allen Ray
c52108942b
Merge branch 'main' into main 2022-08-29 12:07:27 -04:00
Abirdcfly
08a9d1da07
chore: remove duplicate word in comments
Signed-off-by: Abirdcfly <fp544037857@gmail.com>
2022-08-27 13:39:48 +08:00
Hitoshi Mitake
9c8326bb50
Merge pull request #14358 from vivekpatani/main
server/auth: refresh cache on each NewAuthStore
2022-08-27 11:13:59 +09:00
Benjamin Wang
dc4b810195
Merge pull request #14388 from niconorsk/fix/notify-systemd-when-cluster-ready-times-out
etcdmain: Honour ExperimentalWaitClusterReadyTimeout in startEtcd
2022-08-26 18:34:52 +08:00
Nicolai Moore
e15bdd9df1 etcdmain: Honour ExperimentalWaitClusterReadyTimeout in startEtcd
When we can't reach quorum, we were waiting forever and never sending
the systemd notify message. As a result, systemd would eventually time out
and restart the etcd process which likely would make the unhealthy cluster
in an even worse state

Improves #13785

Signed-off-by: Nicolai Moore <niconorsk@gmail.com>
2022-08-26 18:06:50 +10:00
Vitalii Levitskii
be58a2539c Added client-auto-sync-interval argument to the grpc-proxy
Signed-off-by: Vitalii Levitskii <vitalii@uber.com>
2022-08-25 15:33:38 +03:00
vivekpatani
ae608da7e6 server,test: refresh cache on each NewAuthStore
- permissions were incorrectly loaded on restarts.
- https://github.com/etcd-io/etcd/issues/14355

Signed-off-by: vivekpatani <9080894+vivekpatani@users.noreply.github.com>
2022-08-23 20:11:47 -07:00
Benjamin Wang
1851316519
Merge pull request #14266 from stefanmonkey/feat/grpc-logging
Add logging grpc request and response content with grpc-proxy mode
2022-08-19 05:52:16 +08:00
Benjamin Wang
27ffd7e1cf
Merge pull request #14351 from spacewander/rca
chore: log when an invalid watch request is received
2022-08-18 09:45:29 +08:00
Benjamin Wang
74506738b8 Refactor the keepAliveListener and keepAliveConn
Only `net.TCPConn` supports `SetKeepAlive` and `SetKeepAlivePeriod`
by default, so if you want to warp multiple layers of net.Listener,
the `keepaliveListener` should be the one which is closest to the
original `net.Listener` implementation, namely `TCPListener`.

Signed-off-by: Benjamin Wang <wachao@vmware.com>
2022-08-18 04:24:05 +08:00
Sam Batschelet
76a5902efa server/etcdmain: add configurable cipher list to gRPC proxy listener
Signed-off-by: Allen Ray <alray@redhat.com>
2022-08-17 10:56:27 -04:00
spacewander
508ce517e0 update according to the review
Signed-off-by: spacewander <spacewanderlzx@gmail.com>
2022-08-17 09:25:37 +08:00
spacewander
bebefd8b80 chore: log when an invalid watch request is received
As protobuf doesn't have required field, user may send an empty
WatchRequest by mistake. Currently, etcd will ignore the invalid request
and keep the stream opening. If we don't reject the invalid request by
closing the stream, it would be better to leave a log there.

This commit also fixes a typo in the comment.

Signed-off-by: spacewander <spacewanderlzx@gmail.com>
2022-08-16 11:33:01 +08:00
Benjamin Wang
fff5d00ccf
Merge pull request #14149 from lavacat/main-txn-panic
server: don't panic in readonly serializable txn
2022-08-14 05:41:57 +08:00
Benjamin Wang
cb5f358b5f
Merge pull request #14330 from chaochn47/auth_test_logging
logging RoleGrantPermission key and range end
2022-08-11 06:39:56 +08:00
Chao Chen
ccd4efc3b3 logging RoleGrantPermission key and range end
Signed-off-by: Chao Chen <chaochn@amazon.com>
2022-08-10 14:51:25 -07:00
stefanbo
6a04f7fbd6 With go-grpc-middleware, add grpc_zap to logging grpc request and response content in grpc-proxy mode In our test environment, it may be very useful to debug who delete etcd's key with grpc-proxy mode
inspired by https://github.com/grpc-ecosystem/go-grpc-middleware

Signed-off-by: stefanbo <stefan_bo@163.com>

Update flag name

1. add changelog
2. update flag name to `experimental-enable-grpc-debug`

Signed-off-by: stefan bo <stefan_bo@163.com>

Update CHANGELOG-3.6.md

Signed-off-by: stefan bo <stefan_bo@163.com>

change flag name

Signed-off-by: stefan bo <stefan_bo@163.com>
2022-08-10 16:10:05 +08:00
Bogdan Kanivets
43bb9d5c22 server: don't panic in readonly serializable txn
Problem: We pass grpc context down to applier in readonly serializable txn.
This context can be cancelled for example due to timeout.
This will trigger panic inside applyTxn

Solution: Only panic for transactions with write operations

fixes https://github.com/etcd-io/etcd/issues/14110

Signed-off-by: Bogdan Kanivets <bkanivets@apple.com>
2022-08-09 00:46:50 -07:00