18715 Commits

Author SHA1 Message Date
Benjamin Wang
080effc935 test: enhance StartNewProc to accept one more parameter: EtcdProcessClusterConfig
Signed-off-by: Benjamin Wang <wachao@vmware.com>
2022-11-09 16:04:22 +08:00
Benjamin Wang
49ecea5dae
Merge pull request #14633 from pavelkalinnikov/send_empty_append
raft: send empty appends when replication is paused
2022-11-09 06:51:46 +08:00
Pavel Kalinnikov
1ea13494eb raft/tracker: rename and comment MsgApp paused field
Make the field name and comment clearer on the fact that it's used both in
StateProbe and StateReplicate. The old name ProbeSent was slightly confusing,
and also triggered thinking that it's used only in StateProbe.

Signed-off-by: Pavel Kalinnikov <pavel@cockroachlabs.com>
2022-11-08 22:21:39 +00:00
Pavel Kalinnikov
467114ed87 raft/tracker: remove unused Inflights.FreeFirstOne
Signed-off-by: Pavel Kalinnikov <pavel@cockroachlabs.com>
2022-11-08 22:21:39 +00:00
Pavel Kalinnikov
4969aa81ae raft: send empty appends when replication is paused
When Inflights to a particular node is full, i.e. MaxInflightMsgs for the
append messages flow is saturated, it is still necessary to continue sending
MsgApp to ensure progress. Currently this is achieved by "forgetting" the first
in-flight message in the window, which frees up quota for one new MsgApp.

This new message is constructed in such a way that it potentially has multiple
entries, or a large entry. The effect of this is that the in-flight limitations
can be exceeded arbitrarily, for as long as the flow to this node continues
being saturated. In particular, if a follower is stuck, the leader will keep
sending entries to it.

This commit makes the MsgApp empty when Inflights is saturated, and prevents
the described leakage of Entries to slow followers.

Signed-off-by: Pavel Kalinnikov <pavel@cockroachlabs.com>
2022-11-08 22:21:39 +00:00
Pavel Kalinnikov
3bc3d2071e raft: extract Progress update on MsgApp to a method
Previously, Progress update on MsgApp send was scattered across raft.go and
tracker/progress.go. This commit better encapsulates this logic in the Progress
type.

Signed-off-by: Pavel Kalinnikov <pavel@cockroachlabs.com>
2022-11-08 22:21:38 +00:00
Pavel Kalinnikov
d5ac7b833f raft: cleanup maybeSendAppend method
- avoid large indented blocks, leave the main block unindented
- declare pb.Message inlined in the sending call

Signed-off-by: Pavel Kalinnikov <pavel@cockroachlabs.com>
2022-11-08 22:21:38 +00:00
Pavel Kalinnikov
5619953f33 raft: elaborate checks in flow control tests
Signed-off-by: Pavel Kalinnikov <pavel@cockroachlabs.com>
2022-11-08 22:21:38 +00:00
Pavel Kalinnikov
0a0f0ae719 raft/rafttest: add test for replication pausing
This commit adds a data-driven test which simulates conditions under which Raft
messages flow to a particular node is throttled while in StateReplicate. The
test demonstrates that MsgApp messages with non-empty Entries may "leak" to a
paused stream every time there is successful heartbeat exchange.

Signed-off-by: Pavel Kalinnikov <pavel@cockroachlabs.com>
2022-11-08 22:21:38 +00:00
Marek Siarkowicz
4d15f5074c
Merge pull request #14711 from clarkfw/functional-options-pattern-EtcdProcessClusterConfig-1
tests: refactor `EtcdProcessClusterConfig` using Functional Options Pattern
2022-11-08 22:47:40 +01:00
Clark
269a0beb41 tests: refactor EtcdProcessClusterConfig with Functional Options Pattern
add `DefaultConfig`, `NewConfig` and `EPClusterOption`

Signed-off-by: Clark <fwyongxing@gmail.com>
2022-11-09 03:37:42 +08:00
Marek Siarkowicz
f482f7b4a4
Merge pull request #14705 from serathius/raftapi
raft: Remove dependency on etcd api
2022-11-08 14:52:57 +01:00
Marek Siarkowicz
2a1055c7f3 raft: Remove dependency on etcd api
Signed-off-by: Marek Siarkowicz <siarkowicz@google.com>
2022-11-08 13:56:46 +01:00
Benjamin Wang
3e903d0b12
Merge pull request #14706 from ahrtr/version_20221108
etcdserver: fix log typo when checking version compatiblity
2022-11-08 18:56:10 +08:00
Benjamin Wang
2ac149b96a etcdserver: fix log typo when checking version compatiblity
Signed-off-by: Benjamin Wang <wachao@vmware.com>
2022-11-08 18:27:46 +08:00
Benjamin Wang
1f863f7961
Merge pull request #14703 from ahrtr/raft_remove_etcd_client_20221108
raft: remove the raft dependency on go.etcd.io/etcd/client/pkg/v3
2022-11-08 18:24:33 +08:00
Benjamin Wang
fe7da79594 raft: remove the raft dependency on go.etcd.io/etcd/client/pkg/v3
Signed-off-by: Benjamin Wang <wachao@vmware.com>
2022-11-08 09:20:19 +08:00
Marek Siarkowicz
554b1bd0b0
Merge pull request #14687 from serathius/random-failpoint
tests: Add triggering random go failpoints to linearizability tests
2022-11-07 20:59:39 +01:00
Benjamin Wang
f64bed6033
Merge pull request #14698 from ahrtr/raft_warn_20221107
raft: change the log from debug to warning when uncommitted size exceeds threshold
2022-11-07 19:57:33 +08:00
Benjamin Wang
3e07097d77
Merge pull request #14545 from nvanbenschoten/nvanbenschoten/simplifyAutoLeave
raft: simplify auto-leave joint config on entry application logic
2022-11-07 17:20:26 +08:00
Benjamin Wang
a671e3ebd1 raft: change the log from debug to warning when uncommitted size exceeds max threshold
Signed-off-by: Benjamin Wang <wachao@vmware.com>
2022-11-07 17:17:48 +08:00
Marek Siarkowicz
5268db50ce
Merge pull request #14677 from ahrtr/3.4.22
changelog: update 3.4.22's release date
2022-11-07 09:50:15 +01:00
Marek Siarkowicz
13dd8ef607
Merge pull request #14697 from ahrtr/hybrid_20221107
test: support mix versions testing
2022-11-07 09:49:11 +01:00
Hitoshi Mitake
0dd88467fa
Merge pull request #14659 from ahrtr/changelog_3.5_double_barrier 2022-11-07 13:01:22 +09:00
Benjamin Wang
757cf33c00 test: update e2e test cases to use e2e specfic configuration from e2e package
Afer moving `ClusterVersion` and related constants into e2e packages,
some e2e test cases are broken, so we need to update them to use the
correct definitions.

Signed-off-by: Benjamin Wang <wachao@vmware.com>
2022-11-07 10:25:04 +08:00
Benjamin Wang
86e71f026e test: update the definition of testRunner and clusterTestCases
Signed-off-by: Benjamin Wang <wachao@vmware.com>
2022-11-07 10:18:51 +08:00
Benjamin Wang
fc23d0e83a test: add ClusterContext into the common ClusterConfig
ClusterContext is used by "e2e" or "integration" to extend the
ClusterConfig. The common test cases shouldn't care about what
data is encoded or included; instead "e2e" or "integration"
framework should decode or parse it separately.

Signed-off-by: Benjamin Wang <wachao@vmware.com>
2022-11-07 10:05:45 +08:00
Marek Siarkowicz
71b40b3abf tests: Extend common test to run previous release
Signed-off-by: Marek Siarkowicz <siarkowicz@google.com>
2022-11-07 06:51:59 +08:00
Benjamin Wang
b08209447a
Merge pull request #14368 from happlins/main
clientv3: fix init client error
2022-11-07 06:36:13 +08:00
Marek Siarkowicz
219278b298 tests: Add triggering random go failpoints to linearizability tests
Signed-off-by: Marek Siarkowicz <siarkowicz@google.com>
2022-11-06 15:56:28 +01:00
Hitoshi Mitake
6bfaf8de33
Merge pull request #14695 from ahrtr/changelog_main_20221106
changelog: add item to cover the fix on adding protection on maintenance requests when auth is enabled
2022-11-06 14:49:17 +09:00
Benjamin Wang
cda14cd3f3 changelog: add item to cover the fix on adding protection on maintenance requests when auth is enabled
Signed-off-by: Benjamin Wang <wachao@vmware.com>
2022-11-06 13:25:35 +08:00
Benjamin Wang
e68acb1a95
Merge pull request #14693 from ahrtr/pipeline_failure_20221106
test: fix pipeline errors due to PRs conflict
2022-11-06 06:51:31 +08:00
Benjamin Wang
c00ede393f test: fix pipeline errors due to PRs conflict
Signed-off-by: Benjamin Wang <wachao@vmware.com>
2022-11-06 06:28:51 +08:00
Hitoshi Mitake
49db50c117
Merge pull request #14663 from ahrtr/auth_20221031
auth: check permission when performing maintainenence operations if auth is enabled
2022-11-05 23:13:29 +09:00
Benjamin Wang
d71762f4f0
Merge pull request #14683 from ahrtr/test_framework_20221104
test: refactor the framework structure to make it clearer
2022-11-05 04:30:59 +08:00
Benjamin Wang
dc0273b049 test: refactor the struct to make it clearer
Signed-off-by: Benjamin Wang <wachao@vmware.com>
2022-11-04 19:28:32 +08:00
Marek Siarkowicz
e614eec948
Merge pull request #14560 from serathius/env
tests: Pass only etcd related environment variables during e2e tests
2022-11-04 11:24:07 +01:00
Marek Siarkowicz
0dfd7264c0
Merge pull request #14681 from tbg/tbg-maintainer
(Re-) add @tbg as maintainer
2022-11-03 15:04:07 +01:00
Tobias Grieger
99d5364e57 (Re-) add @tbg as maintainer
As discussed with @serathius and @ptabor[^1].

[^1]: https://github.com/etcd-io/etcd/pull/14238#issuecomment-1268281624

Signed-off-by: Tobias Grieger <tobias.b.grieger@gmail.com>
2022-11-03 14:53:02 +01:00
Benjamin Wang
be686b1bae changelog: update 3.4.22's release date
Signed-off-by: Benjamin Wang <wachao@vmware.com>
2022-11-03 05:04:44 +08:00
Benjamin Wang
74085136b3 etcdctl: connect to the same endpoint as the target to be maintained
The client may connect to a different endpint as the target to be
maintained. When auth is enabled, the target endpoint might haven't
finished applying the authentiation request, so it might reject the
corresponding maintenance request due to permission denied.

Signed-off-by: Benjamin Wang <wachao@vmware.com>
2022-11-03 04:55:27 +08:00
Benjamin Wang
7f46da223d client: no need to getToken when dial specific endpoint for maintenance
The existing client may connect to different endpoint from the
specific endpoint to be maintained. Maintenance operations do not
go through raft at all, so it might run into issue if the server
hasn't finished applying the authentication request.

Let's work with an example. Assuming the existing client connects to
ep1, while the user wants to maintain ep2. If we getToken again, it
sends an authentication request, which goes through raft. When the
specific endpoint receives the maintenance request, it might haven't
finished previous authentication request, but the new token is already
carried in the context, so it will reject the maintenance request
due to invalid token.

We already have retry logic in `unaryClientInterceptor` and
`streamClientInterceptor`. When the token expires, it can automatically
refresh the token, so it should be safe to remove the `getToken`
logic in `maintenance.dial`

Signed-off-by: Benjamin Wang <wachao@vmware.com>
2022-11-03 04:39:42 +08:00
Benjamin Wang
f782891246 test: added auth test on maintenance API
Signed-off-by: Benjamin Wang <wachao@vmware.com>
2022-11-03 04:39:42 +08:00
Benjamin Wang
1791ab5754 test: add common functions for auth test
Signed-off-by: Benjamin Wang <wachao@vmware.com>
2022-11-03 04:39:42 +08:00
Benjamin Wang
c967715d93 auth: protect all maintainence APIs when auth is enabled
All maintenance APIs require admin privilege when auth is enabled,
otherwise, the request will be rejected. If auth isn't enabled,
then no such requirement any more.

Signed-off-by: Benjamin Wang <wachao@vmware.com>
2022-11-03 04:39:42 +08:00
Marek Siarkowicz
7ed4eda4c1
Merge pull request #14657 from fuweid/test-fix-TestDowngradeUpgradeClusterOf3
test: deflake TestDowngradeUpgradeClusterOf3 timeout
2022-11-02 16:51:24 +01:00
Wei Fu
3ddcb3ddef test: deflake TestDowngradeUpgradeClusterOf3 timeout
In the TestDowngradeUpgradeCluster case, the brand-new cluster is using
simple-config-changer, which means that entries has been committed
before leader election and these entries will be applied when etcdserver
starts to receive apply-requests. The simple-config-changer will mark
the `confState` dirty and the storage backend precommit hook will update
the `confState`.

For the new cluster, the storage version is nil at the beginning. And
it will be v3.5 if the `confState` record has been committed. And it
will be >v3.5 if the `storageVersion` record has been committed.

When the new cluster is ready, the leader will set init cluster version
with v3.6.x. And then it will trigger the `monitorStorageVersion` to
update the `storageVersion` to v3.6.x. If the `confState` record has
been updated before cluster version update, we will get storageVersion
record.

If the storage backend doesn't commit in time, the
`monitorStorageVersion` won't update the version because of `cannot
detect storage schema version: missing confstate information`.

And then we file the downgrade request before next round of
`monitorStorageVersion`(per 4 second), the cluster version will be
v3.5.0 which is equal to the `UnsafeDetectSchemaVersion`'s result.
And we won't see that `The server is ready to downgrade`.

It is easy to reproduce the issue if you use cpuset or taskset to limit
in two cpus.

So, we should wait for the new cluster's storage ready before downgrade
request.

Fixes: #14540

Signed-off-by: Wei Fu <fuweid89@gmail.com>
2022-11-02 22:50:31 +08:00
Marek Siarkowicz
e25090f3fb
Merge pull request #14678 from ahrtr/go1.19.3
bump go version to 1.19.3 to address security fixes
2022-11-02 12:12:48 +01:00
Benjamin Wang
94e0c2410b bump go version to 1.19.3 to address security fixes
FYI. https://groups.google.com/g/golang-announce/c/dRtDK7WS78g

Signed-off-by: Benjamin Wang <wachao@vmware.com>
2022-11-02 09:07:22 +08:00