19 Commits

Author SHA1 Message Date
Piotr Tabor
6f899a7b40
Merge pull request #15052 from ptabor/20221228-goimports-fix
./scripts/fix.sh: Takes care of goimports across the whole project.
2022-12-29 11:31:22 +01: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
Wei Fu
4d0b91947e chore: delete // +build buildtag by go fix
Signed-off-by: Wei Fu <fuweid89@gmail.com>
2022-12-29 14:17:05 +08:00
Sasha Melentyev
95c520976a client: Use func without format
Signed-off-by: Sasha Melentyev <sasha@melentyev.io>
2022-11-15 01:02:24 +03:00
Benjamin Wang
5746d6eb86 etcdserver: added more debug log for the purgeFile goroutine
Signed-off-by: Benjamin Wang <wachao@vmware.com>
2022-10-12 17:32:33 +08:00
Benjamin Wang
47d460b8dc add verification on nil log
Signed-off-by: Benjamin Wang <wachao@vmware.com>
2022-09-13 17:11:36 +08:00
Benjamin Wang
f6cfd465cc No need to manually remove tmp directory created by t.TempDir()
The temporary directory created by t.TempDir() can be automatically removed by
the golang testing utilities. So no need to remove it manually.

FYI.

    https://github.com/golang/go/blob/go1.16.15/src/testing/testing.go#L911-L915
    https://github.com/golang/go/blob/go1.16.15/src/testing/testing.go#L957

Signed-off-by: Benjamin Wang <wachao@vmware.com>
2022-07-21 08:20:52 +08:00
sky li (李少凯)-浪潮数据
c4e89b4186 Fix syntax errors in comments
Signed-off-by: sky li (李少凯)-浪潮数据 <lishaokai1995@126.com>
2022-07-08 09:48:13 +08:00
Benjamin Wang
ccf477d12b restrict the max size of each WAL entry to the remaining size of the file
Currently the max size of each WAL entry is hard coded as 10MB. If users
set a value > 10MB for the flag --max-request-bytes, then etcd may run
into a situation that it successfully processes a big request, but fails
to decode it when replaying the WAL file on startup.

On the other hand, we can't just remove the limitation, because if a
WAL entry is somehow corrupted, and its recByte is a huge value, then
etcd may run out of memory. So the solution is to restrict the max size
of each WAL entry as a dynamic value, which is the remaining size of
the WAL file.

Signed-off-by: Benjamin Wang <wachao@vmware.com>
2022-06-17 05:41:49 +08:00
Benjamin Wang
d23917c576 Add FileReader and FileBufReader utilities
The FileReader interface is the wrapper of io.Reader. It provides
the fs.FileInfo as well. The FileBufReader struct is the wrapper of
bufio.Reader, it also provides fs.FileInfo.

Signed-off-by: Benjamin Wang <wachao@vmware.com>
2022-06-16 15:32:16 +08:00
Marek Siarkowicz
d58f971895 tests: Use zaptest.NewLogger in places we missed 2022-05-06 12:23:20 +02:00
Marek Siarkowicz
3ffa253516 tests: Add tests for snapshot compatibility and recovery between versions 2022-04-06 16:10:38 +02: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
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
Aleksandr Razumov
3644c9d67b
client/pkg/fileutil: add missing logger to {Create,Touch}DirAll
Also populate it to every invocation.
2021-10-07 17:53:59 +03:00
Tobias Klauser
c3fe63a658 client/pkg/fileutil: use golang.org/x/sys/windows for FileLockEx
Use the FileLockEx wrapper and the corresponding LOCKFILE_* and error
constants from the golang.org/x/sys/windows package rather than
implementing these in the fileutil package.
2021-06-25 14:44:30 +02:00
Piotr Tabor
f5c26814ab Loggers to catch the e2e flake. 2021-05-14 22:42:31 +02:00
pyiyun
28a490b09c etcdserver: remove temp files in snap dir when etcdServer starting
When etcd exits abnormally, tmp files will remain in snap dir, so clean up tmp files in snap dir when etcdserver starting.

Fixes #12837
2021-04-16 20:30:04 +08:00
Piotr Tabor
0b81fdf418 Move pkg/* used by client to client/pkg. 2021-04-05 23:47:27 +02:00