67 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
Wei Fu
5e3910d96c *: fix govet-shadow lint
Signed-off-by: Wei Fu <fuweid89@gmail.com>
2023-09-19 20:24:01 +08:00
cui fliter
0c919dc212 use the more efficient strings.Builder
Signed-off-by: cui fliter <imcusg@gmail.com>
2023-05-19 10:44:58 +08:00
Benjamin Wang
5ef713c728 remove the dependency on the deprecated io/ioutil
Reference: https://go.dev/doc/go1.16#ioutil

Signed-off-by: Benjamin Wang <wachao@vmware.com>
2023-01-08 04:55:40 +08:00
Benjamin Wang
bd9f1584d4 process the scenaro of the last WAL record being partially synced to disk
We need to return io.ErrUnexpectedEOF in the error chain, so that
etcdserver can repair it automatically.

Signed-off-by: Benjamin Wang <wachao@vmware.com>
2023-01-08 04:46:51 +08:00
Piotr Tabor
007858dc97 etcd-dump-logs: Migrate from zap to log for raw
Signed-off-by: Piotr Tabor <ptab@google.com>
2022-12-30 09:22:39 +01:00
Piotr Tabor
8ec3cbc551 fixup! Add --raw mode to ./etcd-dump-log
Signed-off-by: Piotr Tabor <ptab@google.com>
2022-12-30 09:22:39 +01:00
Piotr Tabor
e571fb7baa Add --raw mode to ./etcd-dump-log
This mode allows to look at RAW protos for all entries in WAL logs in the given directory.

Signed-off-by: Piotr Tabor <ptab@google.com>
2022-12-30 09:22:34 +01:00
Piotr Tabor
14a1bf1d26 etcd-dump-logs: Make the tests work again.
The tests are subtle as they skip if the binary is not generated in the local directory.

$ go build . && go test
PASS
ok      go.etcd.io/etcd/v3/tools/etcd-dump-logs 0.769s

Signed-off-by: Piotr Tabor <ptab@google.com>
2022-12-29 13:08:24 +01:00
Benjamin Wang
971e42d631 Resolve build and test errors
Signed-off-by: Benjamin Wang <wachao@vmware.com>
2022-12-02 15:43:48 +08:00
Benjamin Wang
ff337cc993 tools/etcd-dump-logs: generate go.mod and go.sum for the tool
Add go.mod and go.sum to fix issue below,
```
$ go build
../../server/etcdserver/api/snap/snapshotter.go:33:2: missing go.sum entry for module providing package go.etcd.io/raft/v3 (imported by go.etcd.io/etcd/server/v3/etcdserver/api/snap); to add:
	go get go.etcd.io/etcd/server/v3/etcdserver/api/snap@v3.6.0-alpha.0
../../server/storage/wal/walpb/record.pb.go:14:2: missing go.sum entry for module providing package go.etcd.io/raft/v3/raftpb (imported by go.etcd.io/etcd/v3/tools/etcd-dump-logs); to add:
	go get go.etcd.io/etcd/v3/tools/etcd-dump-logs
```

Signed-off-by: Benjamin Wang <wachao@vmware.com>
2022-12-02 13:27:38 +08:00
Benjamin Wang
bb6e892763 tools/etcd-dump-logs: update tool 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 tools/etcd-dump-logs.

Signed-off-by: Benjamin Wang <wachao@vmware.com>
2022-12-02 13:12:19 +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
demoManito
0a08fa2b43 golangci: add import order check
Signed-off-by: demoManito <1430482733@qq.com>
2022-09-29 11:30:04 +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
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
Sahdev Zala
02236b2773 Doc: add installtion instructions for tools
Add missing install commands. Update benchmark to go install as go
get usage is deprecated. Also, improve overall instructions and
experience.

related #13991
2022-04-28 01:13:02 -04:00
Piotr Tabor
047e61df7a
Merge pull request #13880 from ahrtr/fix_dump_logs_panic
etcd-dump-logs will panic if there is no WAL entry after the snapshot
2022-04-06 09:25:17 +02:00
Marek Siarkowicz
804fddf921 tests: Use zaptest.NewLogger in tests 2022-04-04 13:03:15 +02:00
ahrtr
543c87cc38 etcd-dump-logs will panic if there is no WAL entry after the snapshot 2022-04-04 18:58:18 +08:00
Luiz Gustavo
b6a2d2d48a
tools: Add -wal-dir flag on etcd-dump-logs to make it compatible with ETCD_WAL_DIR variable (#13672) 2022-03-07 21:29:20 -08:00
Eng Zer Jun
e9edc5432c
*: use T.TempDir to create temporary test directory
The directory created by `T.TempDir()` and is automatically removed when
the test and all its subtests complete.

Reference: https://pkg.go.dev/testing#T.TempDir
Signed-off-by: Eng Zer Jun <engzerjun@gmail.com>
2022-01-25 00:00:46 +08:00
Marek Siarkowicz
4032d4f66a Remove CodeQL errors 2022-01-13 14:29:09 +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
Marek Siarkowicz
44b8ae145b etcdserver: Move datadir and wal to storage package 2021-08-03 12:47:37 +02:00
Piotr Tabor
aa6597384b etcd-dump-logs: Print full confState as json for debugging purposes. 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
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
0ba16d8ee1 *: Convert tabulators to whitespaces in bash scripts.
Execution of `./scripts/fix.sh` that executed:
```
find ./ -name '*.sh' | xargs sed --follow-symlinks -i 's|\t|  |g'
```
2020-10-26 10:59:40 +01:00
Piotr Tabor
e62417297d *: Rename of imports of raft (as its now a module)
% find -name '*.go' -o -name '*.md' -o -name '*.sh' | xargs sed -i --follow-symlinks 's|etcd/v3/raft|etcd/raft/v3|g'
2020-10-16 13:58:18 +02:00
Piotr Tabor
de55bb6331 pkg: Rename imports after making 'pkg' a module
find -name '*.go' | xargs sed --follow-symlinks -i 's|go.etcd.io/etcd/v3/pkg/|go.etcd.io/etcd/pkg/v3/|g'
go fmt ./...
2020-10-13 00:09:27 +02:00
Piotr Tabor
28f2b07623 *: Update references to code moved to the api/ dir.
Follow up to file-moves done in the previous commit.

The commit contains purely mechanical consequences of execution (apart
of scripts/genproto.sh):

  % find ./ -name '*.go'  | xargs sed --follow-symlinks -i 's|v3/etcdserver/api/v3rpc/rpctypes|v3/api/v3rpc/rpctypes|g'
  % find ./ -name '*.go'  | xargs sed --follow-symlinks -i 's|v3/version|v3/api/version|g'
  % find ./ -name '*.go'  | xargs sed --follow-symlinks -i 's|v3/mvcc/mvccpb|v3/api/mvccpb|g'
  % find ./ -name '*.go'  | xargs sed --follow-symlinks -i 's|v3/etcdserver/etcdserverpb|v3/api/etcdserverpb|g'
  % find ./ -name '*.go'  | xargs sed --follow-symlinks -i 's|v3/etcdserver/api/membership/membershippb|v3/api/membershippb|g'
  % find ./ -name '*.go'  | xargs sed --follow-symlinks -i 's|v3/auth/authpb|v3/api/authpb|g'

  % find ./ -name '*.proto' -o -name '*.md'  | xargs -L 1 sed --follow-symlinks -i 's|/mvcc/mvccpb/kv.proto|/api/mvccpb/kv.proto|g'
  % find ./ -name '*.proto' -o -name '*.md'  | xargs -L 1 sed --follow-symlinks -i 's|/auth/authpb/auth.proto|/api/authpb/auth.proto|g'
  % find ./ -name '*.proto' -o -name '*.md'  | xargs -L 1 sed --follow-symlinks -i 's|/etcdserver/api/membership/membershippb/membership.proto|/api/membershippb/membership.proto|g'

  I also modified manually paths in scripts/genproto.sh.

  % go fmt ./...
2020-10-06 11:56:16 +02:00
Jingyi Hu
205a656cc5
Merge pull request #11853 from viviyww/dev1
tools: fix test case errors in etcd-dump-logs
2020-09-21 09:13:31 -07:00
yangweiwei
c88d1497ee tools: fix test case errors in etcd-dump-logs
Fix test case errors in etcd-dump-logs and the error is the time zone.
When the GOST time zone is CST or PST and the test case will be failed.
So we should set UTC as the standard time zone.
2020-09-21 15:54:47 +08:00
Brandon Philips
96cce208c2 go.mod: use go.etcd.io/etcd/v3 versioning
This change makes the etcd package compatible with the existing Go
ecosystem for module versioning.

Used this tool to update package imports:
  https://github.com/KSubedi/gomove
2020-04-28 00:57:35 +00:00
Vimal K
e98479ddfe tools/etcd-dump-logs: Fixed test cases
Fixed failing test cases due to changes in previous commit
2019-09-06 20:11:41 +01:00
Vimal K
4e551d06ed tools/etcd-dump-logs: Fixed default values for -entry-type flag
The tool takes default values but it was not visible which default
values were taken. Added default values in proper place, and added a
newline at the end of output.
2019-09-06 20:11:41 +01:00
ethan
867b31e01a
etcd-dump-logs: correct logging message word
Signed-off-by: Guangming Wang <guangming.wang@daocloud.io>
2019-08-10 17:01:57 +08:00
Tobias Schottdorf
b9c051e7a7 raftpb: clean up naming in ConfChange 2019-07-23 10:40:03 +02:00
Hitoshi Mitake
5a67dd788d *: support creating a user without password
This commit adds a feature for creating a user without password. The
purpose of the feature is reducing attack surface by configuring bad
passwords (CN based auth will be allowed for the user).

The feature can be used with `--no-password` of `etcdctl user add`
command.

Fix https://github.com/coreos/etcd/issues/9590
2019-05-30 21:59:30 +09:00
Gyuho Lee
34bd797e67 *: revert module import paths
Signed-off-by: Gyuho Lee <leegyuho@amazon.com>
2019-05-28 15:39:35 -07:00
shivaramr
9150bf52d6 go modules: Fix module path version to include version number 2019-04-26 15:29:50 -07:00
Gyuho Lee
d37f1521b7 *: update import paths to "go.etcd.io/etcd"
Signed-off-by: Gyuho Lee <leegyuho@amazon.com>
2018-08-28 17:47:55 -07:00
Joe Betz
2edb954bce
lease: Checkpoint lease TTLs to prevent indefinite auto-renewal of long lived leases 2018-07-23 16:12:34 -07:00
Wenjia Zhang
7e0ae96c6a etcd-dump-logs: minor editting in README.md 2018-06-19 15:37:04 -07:00
Wenjia Zhang
854e9e1174 etcd-dump-logs: minor change in README.md 2018-06-15 15:30:11 -07:00
Wenjia Zhang
29121a8cee etcd-dump-logs: add decoder support 2018-05-31 14:29:46 -07:00
Gyuho Lee
7dabd6c255 *: rename internal packages in tools/testing
Signed-off-by: Gyuho Lee <gyuhox@gmail.com>
2018-05-21 07:45:34 -07:00
Gyuho Lee
f523b0b33f tools/etcd-dump-logs: pass zap logger to raftsnap
Signed-off-by: Gyuho Lee <gyuhox@gmail.com>
2018-05-17 13:59:29 -07:00
Gyuho Lee
fd7e7a01ad tools/etcd-dump-logs: fix minor typo
Signed-off-by: Gyuho Lee <gyuhox@gmail.com>
2018-04-30 15:30:20 -07:00