153 Commits

Author SHA1 Message Date
Ajit Yagaty
8b6de5f85d fileutil: Sync on HFS/OSX needs to be handled differently.
A call file.Sync on OSX doesn't guarantee actual persistence on
physical drive media as the data can be cached in physical drive's
buffers. Hence calls to file.Sync need to be replaced with
fcntl(F_FULLFSYNC).
2016-04-18 21:49:04 -07:00
Gyu-Ho Lee
641a1a66e1 *: fix govet -shadow in go tip 2016-04-15 07:39:52 -07:00
Gyu-Ho Lee
7a2ef3eb00 *: regenerate proto buffers 2016-04-13 16:24:07 -07:00
mqliang
1044fbce2c etcdctlv3: update aunto generated files 2016-04-12 22:48:47 +08:00
Anthony Romano
dc17eaace7 *: rename Lease Create to Grant
Creating a lease through the client API interface union looked like
"c.Create(...)"-- the method name wasn't very descriptive.
2016-04-07 12:28:14 -07:00
Anthony Romano
bfe3a3d08e wal: fix tail corruption
On ReadAll, WAL seeks to the end of the last record in the tail. If the tail did not
end with preallocated space, the decoder would report 0 as the last offset and begin
writing at offset 0 of the tail.

Fixes #4903
2016-04-01 15:05:52 -07:00
Anthony Romano
bd832e5b0a *: migrate Godeps to vendor/ 2016-03-22 17:10:28 -07:00
Anthony Romano
0df732c052 wal: pre-create segment files
Pipeline file creation and allocation so it overlaps writes to the log.

Fixes #4773
2016-03-21 11:56:53 -07:00
Anthony Romano
24b806d2ee wal: preallocate WAL files with initial size equal to segment size
Avoids having to update file size metadata during fdatasync on common path.

Fixes #4755
2016-03-21 11:56:53 -07:00
Anthony Romano
aafe717f2f fileutil: support file extending preallocate 2016-03-21 09:42:30 -07:00
Anthony Romano
7397e14c0a fileutil, wal: refactor file locking
File lock interface was more verbose than it needed to be while
simultaneously making it difficult to support systems (e.g., Windows)
that only permit locked writes on a single fd holding the lock.
2016-03-16 15:02:15 -07:00
Xiang Li
53e7ddbc66 wal: do not call fsync when it is not necessary 2016-03-14 11:52:06 -07:00
Xiang Li
e59efe45a1 wal: support fadatasync on linux 2016-03-13 17:22:53 -07:00
Anthony Romano
20461ab11a *: fix many typos 2016-01-31 21:42:39 -08:00
Gyu-Ho Lee
71c2a9bb3c *: fix minor typos, comments 2016-01-30 18:15:56 -08:00
Gyu-Ho Lee
a35d5889f6 *: update gRPC, proto interface 2016-01-26 17:41:39 -08:00
Gyu-Ho Lee
a4de207d53 wal: fix shadowed variables
Fixes for https://github.com/coreos/etcd/issues/3954.
2015-12-12 09:38:26 -08:00
Gyu-Ho Lee
55adfcb428 wal: minor typo in wal pkg
Fixes a minor typo in wal.go.
Thanks!
2015-11-12 15:23:12 -08:00
Xiang Li
1c7f52d931 wal: use Histogram for syncDuration 2015-10-17 12:45:43 -07:00
Dmitry Smirnov
b2f4a5f587 *: fix spelling issues (codespell).
Signed-off-by: Dmitry Smirnov <onlyjob@member.fsf.org>
2015-09-11 10:22:29 +10:00
Xiang Li
ef7cf058a2 *: update gogoproto 2015-09-03 15:32:25 -07:00
Tamir Duberstein
45390b9fb8 *: regenerate proto to use local import path
Using Go-style import paths in protos is not idiomatic. Normally, this
detail would be internal to etcd, but the path from which gogoproto
is imported affects downstream consumers (e.g. cockroachdb).

In cockroach, we want to avoid including `$GOPATH/src` in our protoc
include path for various reasons. This patch puts etcd on the same
convention, which allows this for cockroach.

More information: https://github.com/cockroachdb/cockroach/pull/2339#discussion_r38663417

This commit also regenerates all the protos, which seem to have
drifted a tiny bit.
2015-09-03 13:38:28 -04:00
Xiang Li
39a4b6a5e5 pkg/fileutil: support perallocate 2015-08-06 10:10:58 -07:00
Hitoshi Mitake
ba76e27875 wal: log errors in wal.Close()
This patch adds error logging in wal.Close() if unlocking and
destroying fail. Though it is hard to handling the errors, logging
would be helpful for trouble shooting.
2015-08-05 15:03:45 +09:00
Xiang Li
581ef05bab *: resolve proto warnings 2015-06-29 18:39:46 -07:00
Xiang Li
13f44e4b79 *: update generated proto code 2015-06-29 16:45:25 -07:00
Xiang Li
f59da0e453 *:fix point-in-time backup
Backup process should be able to read all WALs until io.EOF to
generate a point-in-time backup.

Our WAL file is append-only. And the backup process will lock all
files before start reading, which can prevent the gc routine from
removing any files in the middle.
2015-06-15 11:12:28 -07:00
Xiang Li
2373fd8426 wal: fix the left logging using default log 2015-06-11 14:22:14 -07:00
Xiang Li
711451ce2d *: rename logger to plog 2015-06-02 14:58:24 -07:00
Xiang Li
185d2bced4 wal: use leveled logger 2015-06-01 13:38:50 -07:00
Xiang Li
34ac145b38 *: use namespace and subsystem in metrics
Fix #2841.

From Prometheus developer:
```
the recommended way for etcd as an open source project and under
consideration of its size would be etcd_<subsystem>_<name>.
```

We made the naming change accordingly.
2015-05-26 14:39:04 -07:00
Xiang Li
d1d7feacc9 wal: change io.EOF returned by readFull to io.ErrUnexpectedEOF
Decoder should return error for any broken block including the
one that only contains the length field. We should change io.EOF
to io.ErrUnexpectedEOF before return the error.
2015-04-23 09:53:36 -07:00
Xiang Li
aed18395c9 wal: report throughput in wal bench 2015-04-12 21:35:08 -07:00
Xiang Li
89242d4659 wal: better log msg 2015-04-09 09:54:20 -07:00
Xiang Li
53792ccbdc wal: never leave a corrupted wal file
If the process dies during wal.cut(), it might leave a corrupted wal
file. This commit solves the problem by creating a temp wal file first,
then atomically rename it to a wal file when we are sure it is vaild.
2015-04-08 15:57:20 -07:00
Yicheng Qin
44de670de7 wal: allow at most one WAL function called at one time
SaveSnap and Save are called in separate goroutines now. Allow at most
one WAL function being called at one time to protect internal fields and
guarantee execution order.
Or one possible bug is that the new cut file is started with snapshot
entry instead of crc entry.
2015-04-08 00:34:30 -07:00
Xiang Li
8bcaa2bfdf wal: reduce allocation when encoding int64 2015-03-30 20:41:31 -07:00
Xiang Li
c32cca3a4f wal: reduce allocation when encoding entries 2015-03-30 19:20:46 -07:00
Xiang Li
3e9a033cd2 wal: repair decoder needs to update its crc 2015-03-30 13:45:23 -07:00
Xiang Li
684ebd95ae wal: backup broken wal before repairing 2015-03-29 15:42:59 -07:00
Xiang Li
8b4eed29e5 wal: fix the unexpectedEOF error in the last wal.
It is safe to repair the unexpectedEOF error in the last wal. raft
will not send out message before the entry successfully comitted
into wal. Thus we can safely truncate the last entry in the wal
to repair.
2015-03-28 21:08:14 -07:00
Xiang Li
05e240b892 *: update protobuf 2015-03-25 10:14:35 -07:00
Yicheng Qin
3dd6e0b88f wal: fix missing import 2015-03-24 22:53:15 -07:00
Xiang Li
6e6669d696 wal: releastTo should work with large release index 2015-03-24 22:34:26 -07:00
Yicheng Qin
5e0077cc0c etcdserver: print out extra files in data dir instead of erroring 2015-03-24 18:56:22 -07:00
Xiang Li
b66eb3d81c wal: fix ReleaseLockTo
ReleaseLockTo should not release the lock on the WAL
segment that is right before the given index. When
restarting etcd, etcd needs to read from the WAL segment
that has a smaller index than the snapshot index.

The correct behavior is that ReleaseLockTo releases
the locks w is holding so that w only holds one lock
that has an index smaller than the given index.
2015-03-09 19:52:54 -07:00
Xiang Li
ab72c3ec88 wal: do not race reader and writer 2015-03-05 20:19:17 -08:00
Xiang Li
86429264fb wal: support auto-cut in wal
WAL should control the cut logic itself. We want to do falloc to
per allocate the space for a segmented wal file at the beginning
and cut it when it size reaches the limit.
2015-02-28 11:18:59 -08:00
Xiang Li
84485643fe *: expose wal metrics at /metrics 2015-02-28 11:06:11 -08:00
Xiang Li
fb1a28c65d *: vendor prometheus 2015-02-28 11:06:11 -08:00