10 Commits

Author SHA1 Message Date
Wei Fu
5e3910d96c *: fix govet-shadow lint
Signed-off-by: Wei Fu <fuweid89@gmail.com>
2023-09-19 20:24:01 +08:00
Marek Siarkowicz
372042c374 refactor: Use proper variable names for urls
Signed-off-by: Marek Siarkowicz <siarkowicz@google.com>
2023-03-13 14:48:01 +01:00
Wei Fu
4a9ad47bcc tests/integration: deflake #15409
The cluster version will be initialized after the member becomes leader.
The update is handled asynchronously. It couldn't be updated if the member
has been closed and the go-runtime picks the `s.stopping` channel first.

```go
// e2a5df534c/server/etcdserver/server.go (L2170)

func (s *EtcdServer) monitorClusterVersions() {
	...
	for {
		select {
		case <-s.firstCommitInTerm.Receive():
		case <-time.After(monitorVersionInterval):
		case <-s.stopping:
			return
		}
		...
	}
}
```

Or after the `s.stopping` has been closed, the [UpdateClusterVersion][1] won't
file GoAttach successfully. For the #15409, we can see the warn log
`server has stopped; skipping GoAttach` from GoAttach:

```plain
https://github.com/etcd-io/etcd/actions/runs/4340931587/jobs/7580103902

    logger.go:130: 2023-03-06T07:36:44.253Z	WARN	default	stopping grpc server due to error	{"error": "accept tcp 127.0.0.1:2379: use of closed network connection"}
    logger.go:130: 2023-03-06T07:36:44.253Z	WARN	default	stopped grpc server due to error	{"error": "accept tcp 127.0.0.1:2379: use of closed network connection"}
    logger.go:130: 2023-03-06T07:36:44.253Z	ERROR	default	setting up serving from embedded etcd failed.	{"error": "accept tcp 127.0.0.1:2379: use of closed network connection"}
    logger.go:130: 2023-03-06T07:36:44.253Z	ERROR	default	setting up serving from embedded etcd failed.	{"error": "http: Server closed"}
    logger.go:130: 2023-03-06T07:36:44.253Z	INFO	default	skipped leadership transfer for single voting member cluster	{"local-member-id": "8e9e05c52164694d", "current-leader-member-id": "8e9e05c52164694d"}

    logger.go:130: 2023-03-06T07:36:44.253Z	WARN	default	server has stopped; skipping GoAttach

    ...
```

If the cluster version isn't updated, the minimum storage version will
be v3.5 because the [AuthStatus][2] is introduced in [v3.5][3].
The compare will fail.

To fix this issue, we should wait for cluster version to become ready
after server is ready to serve request.

[1]: <e2a5df534c/server/etcdserver/adapters.go (L45)>
[2]: <071e70cdc4>
[3]: <1b4e54c238>

Signed-off-by: Wei Fu <fuweid89@gmail.com>
2023-03-11 14:50:37 +08:00
Piotr Tabor
9abc895122 Goimports: Apply automated fixing to test files as well.
Signed-off-by: Piotr Tabor <ptab@google.com>
2022-12-29 13:04:45 +01:00
Marek Siarkowicz
431adc5878 server: Implement storage downgrades
By validating if WAL doesn't include any incompatible entries we can
implement storage downgrades.
2021-10-29 12:47:19 +02:00
Marek Siarkowicz
f5d71fa389 server: Detect when WAL includes unapplied cluster version set to higher version
This is because etcd v3.5 will panic when it encounters
ClusterVersionSet entry with version >3.5.0. For downgrades to v3.5 to
work we need to make sure this entry is snapshotted.
2021-10-29 12:47:19 +02:00
Marek Siarkowicz
ca9b720c1d tests: Move integration setup to separa framework package 2021-10-20 10:34:35 +02:00
Marek Siarkowicz
703df1c491 server: Move wal versioning functions to wal package 2021-10-08 12:01:53 +02:00
Eduardo Patrocinio
87f1dc7e40 Fix a few typos 2021-09-03 16:09:09 -04:00
Marek Siarkowicz
1b4e54c238 api: Annotate proto messages and use it to detect etcd version that generated wal
Co-authored-by: Lili Cosic <cosiclili@gmail.com>
2021-08-04 13:36:08 +02:00