242 Commits

Author SHA1 Message Date
Piotr Tabor
00de56a4a4 etcdserver, wal: Fix tests that were performing unintended casting of int to String.
Fixes following problems during "./etcd# go test ./..."

> go.etcd.io/etcd/v3/etcdserver/api/v2store_test
etcdserver/api/v2store/store_test.go:847:24: conversion from int to string yields a string of one rune, not a string of digits (did you mean fmt.Sprint(x)?)

> go.etcd.io/etcd/v3/wal
wal/wal_test.go:242:68: conversion from int to string yields a string of one rune, not a string of digits (did you mean fmt.Sprint(x)?)
2020-08-04 20:28:41 +02:00
kaiiak
772dfbfe35
wal: Fix format error avoid using reflect.DeepEqual with errors (#12118) 2020-07-20 19:49:57 -07:00
David Crawshaw
66cb045d47 etcdserver, et al: add --unsafe-no-fsync flag
This makes it possible to run an etcd node for testing and development
without placing lots of load on the file system.

Fixes #11930.

Signed-off-by: David Crawshaw <crawshaw@tailscale.com>
2020-05-26 09:21:49 +10:00
tangcong
02b9ad3939 wal: add TestValidSnapshotEntriesAfterPurgeWal testcase 2020-05-21 00:51:53 +08:00
tangcong
1836cbb15e wal: fix crc mismatch crash bug 2020-05-20 13:21:07 +08:00
Joe Betz
b68eea236e etcdserver/*, wal/*:Add comments, clean up error messages and tests 2020-05-14 13:34:55 -07:00
Joe Betz
bd16071846
etcdserver/*, wal/*: find valid snapshots by cross checking snap files and wal snap entries 2020-05-14 09:22:45 -07:00
Viacheslav Biriukov
50517039ae
etcdserver/*, wal/*: add Sync method 2020-05-13 08:47:47 -07:00
Viacheslav Biriukov
3d2b565f98
etcdserver/*: changes to snapshots and wal logic to fix #10219 2020-05-13 08:46:15 -07:00
Viacheslav Biriukov
9162cd613d
etcdserver/*, wal/*: changes to snapshots and wal logic to fix #10219 2020-05-13 08:42:03 -07:00
Gyuho Lee
fb77f9b1d5
Merge pull request #11814 from tedyu/dir-closer
wal: close the directory when Fsync() encounters error
2020-04-28 23:27:08 -07:00
Gyuho Lee
3b79ed8506
Merge pull request #11821 from tedyu/wal-close-all
closeAll should attempt to close all ReadCloser's
2020-04-28 20:54:13 -07:00
Ted Yu
62755f484e wal: closeAll should attempt to close all ReadCloser's
Signed-off-by: Ted Yu <yuzhihong@gmail.com>
2020-04-28 20:33:40 -07: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
Ted Yu
99eb5cdfdb wal: close the directory when Fsync() encounters error
Signed-off-by: Ted Yu <yuzhihong@gmail.com>
2020-04-25 11:08:39 -07:00
Ted Yu
9d0ecc3ba3 wal: Use known dir-path in log message
Signed-off-by: Ted Yu <yuzhihong@gmail.com>
2020-04-25 09:14:30 -07:00
Sahdev P. Zala
0d5c692eb6 wal: fix panic when decoder not set
Handle the related panic and clarify doc.
2020-04-23 15:53:05 -04:00
Gyuho Lee
c716d764d0 wal: check out of range slice in "ReadAll", "decoder"
wal: add slice bound checks in decoder

CHANGELOG-3.5: add wal slice bound check
CHANGELOG-3.5: add "decodeRecord"

Signed-off-by: Gyuho Lee <leegyuho@amazon.com>
2020-04-22 19:07:40 -07:00
Gyuho Lee
af261f1a1b wal: add "etcd_wal_writes_bytes_total"
Signed-off-by: Gyuho Lee <leegyuho@amazon.com>
2020-03-31 20:31:32 -07:00
jingyih
2fee0b153e wal: remove capnslog 2020-02-06 06:11:59 -08:00
Vimal K
adbae79565 wal : wal.Verify defer close the opened WAL files
wal.Verify() : The opened WAL files are not closed in error cases. Fixed by adding a
defer.
2019-09-04 23:38:14 +01:00
Gyuho Lee
34bd797e67 *: revert module import paths
Signed-off-by: Gyuho Lee <leegyuho@amazon.com>
2019-05-28 15:39:35 -07:00
Joshua Coutinho
a0c889d14b wal: add a test for wal cleanup, improve comments
To add test coverage of wal cleanup.
2019-05-10 22:36:26 +01:00
jcoutin
f7f7e9c762 wal: Improve cleanup for robustness and debuggability
Rename wal with '.suffix.<timestamp>' instead of delete it and call cleanup when perr in a 'defer'ed statement.
2019-05-07 21:38:40 +01:00
Joshua Coutinho
51035bfd84 wal: cleanup wal directory if creation fails
delete <data-dir>/member/wal if any operation after the rename in
wal.Create fails to avoid reading an inconsistent WAL on restart.

Fixes #10688
2019-05-04 01:58:57 +01:00
shivaramr
9150bf52d6 go modules: Fix module path version to include version number 2019-04-26 15:29:50 -07:00
Shreyas Rao
914e5edb00 wal: include logger in WAL returned by openAtIndex
Signed-off-by: Shreyas Rao <shreyas.sriganesh.rao@sap.com>
2019-04-02 13:09:10 +05:30
Shreyas Rao
bb3eb8fea9 wal: Add test for Verify
Signed-off-by: Shreyas Rao <shreyas.sriganesh.rao@sap.com>
2019-03-12 22:25:25 +05:30
shreyas-s-rao
3d6862fe0d wal: add Verify function to perform corruption check on wal contents
Signed-off-by: Shreyas Rao <shreyas.sriganesh.rao@sap.com>
2019-03-12 22:25:25 +05:30
Gyuho Lee
038fd844ac wal: update Go import paths to "go.etcd.io/etcd"
Signed-off-by: Gyuho Lee <leegyuho@amazon.com>
2018-08-28 17:47:55 -07:00
Gyuho Lee
6fabe6d5ab wal: clean up code format
Signed-off-by: Gyuho Lee <gyuhox@gmail.com>
2018-07-21 15:49:58 -07:00
Gyuho Lee
b0b966c43c wal: document, clean up fsync histogram
Signed-off-by: Gyuho Lee <gyuhox@gmail.com>
2018-05-23 14:03:28 -07:00
Gyuho Lee
567b47fc3e wal: filter file names in WAL directory by ".wal"
WAL never writes nor needs files without ".wal" suffix.
Thus, safe to filter out only ".wal" files.

Signed-off-by: Gyuho Lee <gyuhox@gmail.com>
2018-05-18 10:29:48 -07:00
Gyuho Lee
e15ce28168 wal: add missing logs, improve pipeline test coverage
Signed-off-by: Gyuho Lee <gyuhox@gmail.com>
2018-05-17 11:01:31 -07:00
Gyuho Lee
f3d9a85697 wal: add warnings on fsync, flock fail paths
Signed-off-by: Gyuho Lee <gyuhox@gmail.com>
2018-05-03 14:01:06 -07:00
Gyuho Lee
8a28e73862 wal: fix "unconvert" warnings
Signed-off-by: Gyuho Lee <gyuhox@gmail.com>
2018-04-30 15:32:16 -07:00
Gyuho Lee
fdbedacc83 wal: support structured logger
Signed-off-by: Gyuho Lee <gyuhox@gmail.com>
2018-04-16 17:36:00 -07:00
Gyuho Lee
bcd5390b35 *: regenerate protobuf, grpc-gateway
Signed-off-by: Gyuho Lee <gyuhox@gmail.com>
2017-12-07 21:31:13 -08:00
Gyu-Ho Lee
75110dd839 *: fix naked returns
Signed-off-by: Gyu-Ho Lee <gyuhox@gmail.com>
2017-11-10 18:46:15 -08:00
lorneli
7c50c06fb8 wal: tiny refactor
a. add comment of reopening file in cut function.
b. add const frameSizeBytes in decoder.
c. return directly if locked files empty in ReleaseLockTo function.
2017-09-07 02:50:37 +08:00
Anthony Romano
fe1ddab714 wal: fall back to closing wal if locked dir rename fails
Detecting windows at compile time isn't enough since etcd might be
on linux but the fs is backed by windows.

Fixes: #8178
Fixes: #6984
2017-07-20 13:30:41 -07:00
Anthony Romano
78a5eb79b5 *: add swagger and grpc-gateway assets for v3lock and v3election 2017-04-10 15:21:07 -07:00
Gyu-Ho Lee
aca2abd8fe *: use 'io.Seek*' for go1.7+
For https://github.com/coreos/etcd/issues/6174.

Signed-off-by: Gyu-Ho Lee <gyuhox@gmail.com>
2017-03-20 15:15:24 -07:00
Tess Rinearson
39c733ebe7 wal: use path/filepath instead of path
Use the path/filepath package instead of the path package. The
path package assumes slash-separated paths, which doesn't work
on Windows. But path/filepath manipulates filename paths in a way
that's compatible across OSes.
2017-03-15 17:30:23 -07:00
Gyu-Ho Lee
3d75395875 *: remove never-unused vars, minor lint fix
Signed-off-by: Gyu-Ho Lee <gyuhox@gmail.com>
2017-03-06 14:59:12 -08:00
Peter Mattis
ab03a42f06 raft: add Ready.MustSync
Add Ready.MustSync which indicates that the hard state and raft log
entries in a Ready message must be synchronously written to persistent
storage.
2017-02-13 15:13:21 -05:00
Gyu-Ho Lee
b8b72f80f9 *: revendor, update proto files 2016-11-10 12:02:00 -08:00
Gyu-Ho Lee
9b56e51ca7 *: regenerate proto + gofmt change 2016-10-03 15:34:34 -07:00
Anthony Romano
c26ebe3262 Merge pull request #6453 from vimalk78/wal-optimize-marshal-outside-lock
wal/wal.go: optimized WAL.SaveSnapshot to do Marshal outside the mutex lock
2016-10-03 11:50:11 -07:00
Gyu-Ho Lee
f5588526cc wal: set PageWriter offset in file encoder 2016-09-28 11:03:24 -07:00