35 Commits

Author SHA1 Message Date
Wei Fu
aa97484166 *: enable goimports in verify-lint
Signed-off-by: Wei Fu <fuweid89@gmail.com>
2023-09-21 21:14:09 +08:00
chenyahui
c0aa3b613b Use any instead of interface{}
Signed-off-by: chenyahui <cyhone@qq.com>
2023-09-17 17:41:58 +08:00
lan.tian
0f975acf2f
update typo in raft.go
Signed-off-by: lan.tian <lance5890@163.com>
2023-07-24 15:48:55 +08:00
Chao Chen
6cdc9ae4fe server/etcdserver/raft.go:
1. rename confChangeCh to raftAdvancedC
2. rename waitApply to confChanged
3. add comments and test assertion

Signed-off-by: Chao Chen <chaochn@amazon.com>
2023-06-26 22:42:44 -07:00
Benjamin Wang
ad3b6ee4c6 etcdserver: wait for raft is notified on confChange before responding to client
Signed-off-by: Benjamin Wang <wachao@vmware.com>
2023-06-26 13:40:51 -07:00
Chao Chen
6d79b86219 Enable failpoint by default in integration tests
Signed-off-by: Chao Chen <chaochn@amazon.com>
2023-06-21 23:13:46 -07:00
caojiamingalan
e2b8e86624 etcdserver: correct the old name of notifyc in comments
The old name(raftDone) of the channel(notifyc) which indicates the apply has been
completed is left unchanged in the comments, resulting in confusion when reading
the source code.

Signed-off-by: caojiamingalan <alan.c.19971111@gmail.com>
2023-01-27 10:02:22 +08:00
Piotr Tabor
9e1abbab6e Fix goimports in all existing files. Execution of ./scripts/fix.sh
Signed-off-by: Piotr Tabor <ptab@google.com>
2022-12-29 09:41:31 +01:00
Benjamin Wang
faff80a2b3 etcdserve: format the source code
gofmt -w ./server

Signed-off-by: Benjamin Wang <wachao@vmware.com>
2022-12-02 13:00:59 +08:00
Benjamin Wang
e9aa275b36 etcdserver: update etcdserver to use the new raft module go.etcd.io/raft/v3
Just replaced all go.etcd.io/etcd/raft/v3 with go.etcd.io/raft/v3
under directory server.

Signed-off-by: Benjamin Wang <wachao@vmware.com>
2022-12-02 09:33:45 +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
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
mind1949
2b0596f859 server/etcdserver: check if raftNode has been stopped
Signed-off-by: mind1949 <lianjie1949@gmail.com>
2022-07-23 08:49:07 +08:00
Piotr Tabor
63b2f63cc1 Rename package alising "apply2" -> apply. 2022-05-20 14:32:04 +02:00
Marek Siarkowicz
d039f016c5 server: Move Storage interface to storage package 2021-10-08 12:01:53 +02:00
Marek Siarkowicz
83a325ac46 server: Move all functions needed for storage bootstrap to storage package
This is prerequestite to move storage bootstrap, splitted to separate PR
to make it easier to review.
2021-08-03 13:09:15 +02:00
Marek Siarkowicz
ef6c276fae etcdserver: Move server bootstraping to one file 2021-07-12 15:37:21 +02:00
Marek Siarkowicz
9824cc96ed etcdserver: Fix typos in bootstrap 2021-07-08 13:37:19 +02:00
Marek Siarkowicz
e1fa356fac etcdserver: Refactor standalone boostrap 2021-07-08 13:34:31 +02:00
Marek Siarkowicz
244e5c2cce etcdserver: Unify memory storage boostrap 2021-07-07 23:36:37 +02:00
Marek Siarkowicz
a72d4462fe etcdserver: Create boostrap wal functions 2021-07-07 23:36:35 +02:00
Marek Siarkowicz
e75dfde4cb etcdserver: Move raft node start to just before newRaftNode 2021-07-07 23:26:37 +02:00
Marek Siarkowicz
08935247a8 etcdserver: Create raftnode based on boostrapRaft struct 2021-07-07 17:38:56 +02:00
Marek Siarkowicz
554777bba4 etcdserver: Extract boostrapRaft struct 2021-07-07 17:30:27 +02:00
Marek Siarkowicz
880673c4a0 etcdserver: Extract raftConfig function 2021-07-07 17:22:34 +02:00
Marek Siarkowicz
41ed74824e server: Simplify passing logger setup by passing only logger 2021-05-14 13:14:48 +02:00
Piotr Tabor
a70386a1a4 Simplify membership interface: Does not pass the 'unused' token. 2021-04-27 17:17:31 +02:00
Piotr Tabor
3bb7acc8cf Migrate dependencies pkg/foo -> client/pkg/foo 2021-04-07 00:38:47 +02:00
wpedrak
dac6e37ea1 *: over 20 staticcheck fixes 2021-03-18 15:06:17 +01:00
Piotr Tabor
a84bd093b0 Integration with grpc-settable logger. 2021-03-16 22:50:41 +01:00
Piotr Tabor
1e7c1805d8 Unify logic of building raft-loggers for etcd.
1. We had the same code copied 3 times.
2. For no good reason the code was not reusing existing logger if this one is given.
2021-03-14 16:02:50 +01:00
Piotr Tabor
fd7fed1511 Move config (ServerConfig) out of etcdserver package.
Motivation:
  - ServerConfig is part of 'embed' public API, while etcdserver is more 'internal'
  - EtcdServer is already too big and config is pretty wide-spread leaf
if we were to split etcdserver (e.g. into pre & post-apply part).
2021-03-11 20:56:22 +01:00
Piotr Tabor
aaf423e962 server: Update imports.
find -name '*.go' | xargs sed -i --follow-symlinks 's|etcd/v3/|etcd/server/v3/|g'
2020-10-26 13:02:32 +01:00
Piotr Tabor
4a5e9d1261 server: Move server files to 'server' directory.
26  git mv mvcc wal auth etcdserver etcdmain proxy embed/ lease/ server
   36  git mv go.mod go.sum server
2020-10-26 12:57:19 +01:00