171 Commits

Author SHA1 Message Date
Benjamin Wang
0775d36e53 raftexample: 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 contrib/raftexample.

Signed-off-by: Benjamin Wang <wachao@vmware.com>
2022-12-02 14:25:50 +08:00
Sasha Melentyev
2c9c209eb6 all: Changing Printf and friends to Print if there is no formatting
Signed-off-by: Sasha Melentyev <sasha@melentyev.io>
2022-11-15 22:11:23 +03:00
Sasha Melentyev
855aa4f7a7 all: Use ReplaceAll instead of Replace with -1 pos
Signed-off-by: Sasha Melentyev <sasha@melentyev.io>
2022-11-15 00:06:09 +03:00
Nathan VanBenschoten
0f9d7a4f95 raft: make Message.Snapshot nullable, halve struct size
This commit makes the rarely used `raftpb.Message.Snapshot` field nullable.
In doing so, it reduces the memory size of a `raftpb.Message` message from
264 bytes to 128 bytes — a 52% reduction in size.

While this commit does not change the protobuf encoding, it does change
how that encoding is used. `(gogoproto.nullable) = false` instruct the
generated proto marshaling logic to always encode a value for the field,
even if that value is empty. `(gogoproto.nullable) = true` instructs the
generated proto marshaling logic to omit an encoded value for the field
if the field is nil.

This raises compatibility concerns in both directions. Messages encoded
by new binary versions without a `Snapshot` field will be decoded as an
empty field by old binary versions. In other words, old binary versions
can't tell the difference. However, messages encoded by old binary versions
with an empty Snapshot field will be decoded as a non-nil, empty field by
new binary versions. As a result, new binary versions need to be prepared
to handle such messages.

While Message.Snapshot is not intentionally part of the external interface
of this library, it was possible for users of the library to access it and
manipulate it. As such, this change may be considered a breaking change.

Signed-off-by: Nathan VanBenschoten <nvanbenschoten@gmail.com>
2022-11-09 17:35:52 +00: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
Cenk Alti
f8b65d53ba
Add revive to the list of linters.
Part of "Enhance the static-analysis workflow" issue. #14164

Signed-off-by: Cenk Alti <cenkalti@gmail.com>
2022-08-27 13:41:14 -04:00
Ramsés Morales
a7a48168a0 Add golangci-lint config file and make target.
Here we add file `.golangci.yaml`, to have a common configuration for
static analysis. If you use the following IDEs/editors, they will read
the file:

- `vim` with vim-go.
- VSCode.

The initial configuration file is based on Kubernetes' HEAD. We removed
a custom kubernetes-linter for custom kubernetes-logging. We also
changed to Golang version 1.17 (etcd's current target Golang version)
from 1.18.

Also, we added a new target to `Makefile`: `lint`. NOTE that auto-fixing
should be part of a later commit, once we are all happy with how the
configuration file is working for us.

As expected, this change fixes two issues found by this `.golangci.yaml`
in file `contrib/lock/client/client.go`:

- Dead code, removed.
- Innefective assignment, removed.

Finally, we are updating `CONTRIBUTING.md` to mention `golangci-lint`.

We will add a GitHub-action to run `golangci-lint` in a future change.

Local testing done:

- `make build`.
- `make test`.

Both are happy.

This is the initial step to fix
https://github.com/etcd-io/etcd/issues/14164.

Signed-off-by: Ramsés Morales <ramses@gmail.com>
2022-07-28 17:55:08 -07:00
Thomas Jungblut
118ab24b39 update contrib/lock example
Updating the locking example to avoid relying on GC to break the lease.
Updating the documentation to reflect the build process better, improve
error messages and logging to not confuse first time users.

Fixes #14224

Signed-off-by: Thomas Jungblut <tjungblu@redhat.com>
2022-07-22 12:14:37 +02:00
Mustafa Elbehery
75d7bd0155 etcd-mixin: fix etcdDatabaseQuotaLowSpace alert name
Signed-off-by: Mustafa Elbehery <melbeher@redhat.com>
2022-07-20 06:11:13 +02:00
Sahdev Zala
2ef4043979
Merge pull request #14237 from Elbehery/use-last_over_time
etcd-mixin: use-last_over_time-with-etcdBackendQuotaLowSpace-alert
2022-07-19 21:43:57 -04:00
Mustafa Elbehery
0d0fc573ba etcd-mixin:use-last_over_time-with-etcdBackendQuotaLowSpace-alert
Signed-off-by: Mustafa Elbehery <melbeher@redhat.com>
2022-07-19 18:10:19 +02:00
Mustafa Elbehery
7de89e8db6 etcd-mixin:add etcdBackendHighFragmentationRatio alert
Signed-off-by: Mustafa Elbehery <melbeher@redhat.com>
:wq
2022-07-19 18:03:08 +02:00
Mustafa Elbehery
91f8eb1bd6 fix:etcd-mixin:use-predictLinear-insteadof-increase
Signed-off-by: Mustafa Elbehery <melbeher@redhat.com>
2022-07-08 16:16:54 +02:00
Benjamin Wang
8ad87be7a6 fix the DATA RACE issue of TestCloseProposerInflight 2022-06-07 18:59:00 +08:00
wjjiang
534d7b4795
use go install instead of go get 2022-05-20 23:45:14 +08:00
Piotr Tabor
fe35b5130e Fix code scanning alert: This log write receives unsanitized user input 2022-04-19 13:49:08 +02:00
David Wyrobnik
3152dc8174 contrib/raftexample: Save snapshot and WAL before hard state
Update raftexample to save the snapshot file and WAL snapshot entry
before hardstate to ensure the snapshot exists during recovery.
Otherwise if there is a failure after storing the hard state there may
be reference to a non-existent snapshot.
This PR introduces the fix from #10219 to the raftexample.
2022-04-11 23:44:54 +00:00
ahrtr
5cf6ba48de added a unit test for the method processMessages 2022-03-08 09:38:23 +08:00
ahrtr
793218ed2b update the confstate before sending snapshot
When there is a `raftpb.EntryConfChange` after creating the snapshot,
then the confState included in the snapshot is out of date. so We need
to update the confState before sending a snapshot to a follower.
2022-03-07 12:18:29 +08:00
Manuel Rüger
72c33d8b05 contrib/mixin: Generate rules, fix tests
* Add Makefile
* Make tests runnable
* Add generated rule manifest file

Signed-off-by: Manuel Rüger <manuel@rueg.eu>
2022-02-10 16:17:03 +01:00
Matthias Lisin
7460379bad contrib/mixin: add missing summary to alerts
to avoid alert messages being templated with undefined values lets
set summary for alerts that are currently missing one
2022-01-19 19:55:40 +01:00
Eng Zer Jun
2a151c8982
*: move from io/ioutil to io and os packages
The io/ioutil package has been deprecated as of Go 1.16, see
https://golang.org/doc/go1.16#ioutil. This commit replaces the existing
io/ioutil functions with their new definitions in io and os packages.

Signed-off-by: Eng Zer Jun <engzerjun@gmail.com>
2021-10-28 00:05:28 +08:00
Sam Batschelet
5991da1534
Merge pull request #13388 from grafana/mixin-rate-interval
contrib/mixin: Update dashboard promql to use $__rate_interval.
2021-10-21 08:14:25 -04:00
Tom Wilkie
fead3be933
Grafana datasource template should be labelled 'Data Source'.
Signed-off-by: Tom Wilkie <tom@grafana.com>
2021-10-20 13:42:43 +01:00
Lili Cosic
aef9131c81 contrib/mixin/mixin.libsonnet: Include gRPC method in alert description
This makes it easier for admin to determine the alert issue.
2021-10-15 15:10:52 +02:00
Sam Batschelet
0eb72bde2c contrib/mixin: omit Defragment method from etcdGRPCRequestsSlow
Signed-off-by: Sam Batschelet <sbatsche@redhat.com>
2021-10-08 16:21:46 -04:00
Ryan J. Geyer
98427d2bed contrib/mixin: Update dashboard queries to use $__rate_interval
A global query variable was introduced in Grafana 7.2 which is "almost always right" for `rate`, `irate`, and `increase` function calls in promql.
2021-10-04 15:02:11 -07:00
Sam Batschelet
b448daa698
Merge pull request #13275 from lilic/add-peer-dashboard
contrib/mixin/mixin.libsonnet: Add dashboard for peer round trip time
2021-08-05 08:27:38 -04:00
Lili Cosic
55b697c528 contrib/mixin/mixin.libsonnet: Add dashboard for peer round trip time
This helps users debug firing alerts.
2021-08-05 13:15:34 +02:00
Marek Siarkowicz
44b8ae145b etcdserver: Move datadir and wal to storage package 2021-08-03 12:47:37 +02:00
Johannes 'fish' Ziemke
7885f2a951 Mixin: Support configuring cluster label 2021-07-29 17:54:14 +02:00
Lili Cosic
85f7b3c406 contrib/mixin/mixin.libsonnet: Unify alerting description 2021-07-16 15:25:53 +02:00
Haines Chan
36bb8d293c Use method const in package http instead of literal 2021-07-08 20:00:03 +08:00
Lili Cosic
f00231951d contrib/mixin/mixin.libsonnet: Adjust gRPC failed requests
OK is not the only one that is allowed, this before also captured
context canceled, NotFound, and other non error requests.
2021-06-21 11:47:53 +02:00
Piotr Tabor
ffea1537d4 ClientV3 tests use integration.NewClient that configures proper logger. 2021-04-29 18:18:34 +02:00
Tom Wilkie
562d645ac9
Fix the mixin.
Signed-off-by: Tom Wilkie <tom@grafana.com>
2021-04-13 19:38:55 +01:00
Piotr Tabor
bad0b4d513
Merge pull request #12823 from mtulio/chore/dash-var-refresh
chore/dash-var-refresh: change default refresh to 2(time range)
2021-04-08 15:14:53 +02:00
Marco Tulio R Braga
aeeecc06cf
fix/dash-var-refresh: add const and description 2021-04-08 10:12:41 -03:00
Piotr Tabor
816d332d81
Merge pull request #12830 from ptabor/20210405-split-pkg
Split client/pkg as dedicated low-dependencies module for client
2021-04-08 00:48:41 +02:00
Piotr Tabor
3bb7acc8cf Migrate dependencies pkg/foo -> client/pkg/foo 2021-04-07 00:38:47 +02:00
Patrice Chalin
2ba69de281 Contrib lock example 2021-04-06 15:21:01 -04:00
Marco Braga
d2bc5343fb chore/dash-var-refresh: change default refresh to 2(time range) 2021-04-01 00:06:57 -03:00
Piotr Tabor
fce0c192eb Regenerate protos. 2021-03-25 00:31:44 +01:00
Piotr Tabor
3976d68ed3 raftExample: Allow closing raftexample node when snapshotting.
Fix race that made the raftExample test fail.
2021-02-26 08:56:12 +01:00
Shintaro Murakami
5ae3f879c9 raftexample: Return an appropriate applyDoneC 2021-02-24 21:28:18 +09:00
Shintaro Murakami
cb0d256a18 raftexample: Add test for adding new node to existing cluster 2021-02-22 13:44:33 +09:00
Shintaro Murakami
1b1be43d65 raftexample: New joined node have to start with RestartNode 2021-02-22 09:45:44 +09:00
Shintaro Murakami
cc2b039817 raftexample: Explicitly notify all committed entries are applied 2021-02-19 19:26:36 +09:00
Shintaro Murakami
2d25f7f3da raftexample: Implement ReportUnreachable and ReportSnapshot 2021-02-17 11:59:32 +09:00
Shintaro Murakami
1302e1edb2 raftexample: Save snapshot file before writing to wal 2021-02-16 13:30:15 +09:00