5240 Commits

Author SHA1 Message Date
Yicheng Qin
2f05b24d6d rafthttp: {from, to} -> {local, remote} in stream
{from, to} nameings are confused when it both dials and receives
messages from the remote. Change it to {local, remote} for better
clarity.
2015-06-12 14:17:30 -07:00
Yicheng Qin
bcc1aadea9 rafthttp: fix the misformat logging line
before:
```
2015/06/12 20:06:19 rafthttp: dropped MsgApp from %!s(uint64=2) since
receiving buffer is full
```

after:
```
2015/06/12 13:51:38 rafthttp: dropped MsgProp from 2 since receiving
buffer is full
```
2015-06-12 14:12:49 -07:00
Yicheng Qin
ea3c7d1d31 Merge pull request #2960 from yichengq/fix-drop-flood
rafthttp: pretty print message drop info
2015-06-12 09:23:23 -07:00
Yicheng Qin
0de0e4b77c rafthttp: pretty print message drop info 2015-06-12 09:14:53 -07:00
Yicheng Qin
e46fa0a213 Merge pull request #2957 from yichengq/fix-pipeline-test
rafthttp: fix TestStopBlockedPipeline
2015-06-12 08:03:12 -07:00
Yicheng Qin
c21cc5b39b rafthttp: fix TestStopBlockedPipeline
Refactor the fake cancel implementation.

The old one may cancel other in-flight message in random, which leaves
the original target message blocked forever.
2015-06-12 07:55:12 -07:00
Yicheng Qin
29dca49cb5 rafthttp: wait 1ms before enabling cancel
CancelRequest only effects on in-flight request, so we need to wait
for Do(request) called before enabling cancel.
2015-06-12 07:55:06 -07:00
Xiang Li
d8e1950d4e Merge pull request #2963 from xiang90/fix_discovery_error
etcdmain: exit if discovery fails
2015-06-11 16:11:59 -07:00
Xiang Li
6c8b32d316 etcdmain: exit if discovery fails
Fix #2919

If discovery fails, etcd will hang there and does nothing. This
commit fixes the problem.
2015-06-11 15:45:00 -07:00
Xiang Li
3e706c745c Merge pull request #2953 from yichengq/etcdmain-plog
etcdmain: var log -> plog
2015-06-11 15:30:18 -07:00
Xiang Li
1c19eb47b5 Merge pull request #2956 from xiang90/log
all pkgs use leveled log
2015-06-11 15:29:44 -07:00
Xiang Li
2c5ab7ff8b discovery: fix infoln -> info 2015-06-11 14:22:14 -07:00
Xiang Li
8ad7ed321e *:godep log pkg 2015-06-11 14:22:14 -07:00
Xiang Li
2373fd8426 wal: fix the left logging using default log 2015-06-11 14:22:14 -07:00
Xiang Li
2db8b53c4b discovery: use leveled log 2015-06-11 14:22:14 -07:00
Xiang Li
f013a627a4 etcdserver/stats: use leveled log 2015-06-11 14:22:14 -07:00
Xiang Li
cf7cb2b8a9 etcdserver/security: use leveled log 2015-06-11 14:22:14 -07:00
Xiang Li
2f795e42d0 httptypes: use leveled log 2015-06-11 14:19:53 -07:00
Xiang Li
4b5dbeff9b pkg/pbutil: use leveled log 2015-06-11 14:19:53 -07:00
Xiang Li
865a5ffc61 pkg/osutil: use leveled log 2015-06-11 14:19:53 -07:00
Xiang Li
a45f53986f pkg/netutil: use leveled log 2015-06-11 14:19:52 -07:00
Xiang Li
69819d334a pkg/flags: use leveled log 2015-06-11 14:19:52 -07:00
Barak Michener
7bf0479e66 Merge pull request #2882 from barakmich/security_client_new
*: Add security/authorization to etcd/client and etcdctl
2015-06-11 13:40:32 -04:00
Yicheng Qin
1764837783 etcdmain: clean up plog.Printf
Put it into different log levels.
2015-06-11 10:24:02 -07:00
Yicheng Qin
ecdf0a8146 Merge pull request #2959 from yichengq/fix-update-member
rafthttp: fix TestUpdateMember
2015-06-11 10:02:13 -07:00
Yicheng Qin
1af2b4cad7 rafthttp: fix TestUpdateMember
Before this PR, it may error like this:

```
--- FAIL: TestUpdateMember-2 (0.00s)
		server_test.go:950: action =
		[{ApplyConfChange:ConfChangeUpdateNode []}
{ProposeConfChange:ConfChangeUpdateNode []}], want
[{ProposeConfChange:ConfChangeUpdateNode []}
{ApplyConfChange:ConfChangeUpdateNode []}]
```

This fixes the test by recording the proposal event in time.
2015-06-11 09:45:34 -07:00
Yicheng Qin
cd629c9b44 Merge pull request #2939 from yichengq/fix-update-attr
etcdserver: allow to update attributes of removed member
2015-06-10 16:53:39 -07:00
Yicheng Qin
8725e69cf7 etcdserver: allow to update attributes of removed member
There exist the possiblity to update attributes of removed member in
reasonable workflow:
1. start member A
2. leader receives the proposal to remove member A
2. member A sends the proposal of update its attribute to the leader
3. leader commits the two proposals
So etcdserver should allow to update attributes of removed member.
2015-06-10 16:52:18 -07:00
Xiang Li
743ac73b11 Merge pull request #2954 from xiang90/fix_test
proxy: fix test
2015-06-10 16:44:58 -07:00
Yicheng Qin
ed1c5a73d1 Merge pull request #2951 from yichengq/fix-proxy-acurls
etcdmain: fix that advertise-client-urls is required in proxy mode
2015-06-10 16:42:06 -07:00
Xiang Li
612ecbc89d proxy: fix test 2015-06-10 16:31:42 -07:00
Yicheng Qin
cf7c83b304 etcdmain: fix that advertise-client-urls is required in proxy mode
etcd proxy doesn't need to set advertise-client-urls because the flag is
not used.
2015-06-10 16:22:32 -07:00
Yicheng Qin
5a9c2851a7 etcdmain: var log -> plog
So the variable name doesn't mess up with standard package name.
2015-06-10 16:19:06 -07:00
Yicheng Qin
0a3a2720a1 Merge pull request #2923 from yichengq/rafthttp-status
rafthttp: pretty print connection error
2015-06-10 16:17:07 -07:00
Xiang Li
f64a8214f7 Merge pull request #2952 from xiang90/fileutil
fileutil: use leveled logging
2015-06-10 16:01:24 -07:00
Xiang Li
dc87454487 fileutil: return on error and send it to error chan 2015-06-10 15:59:24 -07:00
Xiang Li
e2c2f098bc fileutil: use leveled logging 2015-06-10 15:57:59 -07:00
Yicheng Qin
d92c89516b rafthttp: fix capnslog package name 2015-06-10 15:43:54 -07:00
Yicheng Qin
1dbe72bb74 rafthttp: pretty print connection error
1. print out the status change of connection with peer
2. only print the first error for repeated ones
2015-06-10 15:43:49 -07:00
Yicheng Qin
30db41e031 Procfile: use -listen-client-urls instead of -bind-addr
-bind-addr is etcd 0.4 flag, and we should deprecate it.

Moreover, this makes Procfile fit the workflow we mention in the doc,
which helps ourselves find the problem first.
2015-06-10 15:13:33 -07:00
Xiang Li
37f9534109 Merge pull request #2950 from xiang90/test_cpu
test: run with cpu = 1,2,4
2015-06-10 15:09:45 -07:00
Yicheng Qin
4e79abcfeb Merge pull request #2944 from yichengq/fix-2procs
pkg/testutil: ForceGosched -> WaitSchedule
2015-06-10 14:44:32 -07:00
Yicheng Qin
018fb8e6d9 pkg/testutil: ForceGosched -> WaitSchedule
ForceGosched() performs bad when GOMAXPROCS>1. When GOMAXPROCS=1, it
could promise that other goroutines run long enough
because it always yield the processor to other goroutines. But it cannot
yield processor to goroutine running on other processors. So when
GOMAXPROCS>1, the yield may finish when goroutine on the other
processor just runs for little time.

Here is a test to confirm the case:

```
package main

import (
	"fmt"
	"runtime"
	"testing"
)

func ForceGosched() {
	// possibility enough to sched up to 10 go routines.
	for i := 0; i < 10000; i++ {
		runtime.Gosched()
	}
}

var d int

func loop(c chan struct{}) {
	for {
		select {
		case <-c:
			for i := 0; i < 1000; i++ {
				fmt.Sprintf("come to time %d", i)
			}
			d++
		}
	}
}

func TestLoop(t *testing.T) {
	c := make(chan struct{}, 1)
	go loop(c)
	c <- struct{}{}
	ForceGosched()
	if d != 1 {
		t.Fatal("d is not incremented")
	}
}
```

`go test -v -race` runs well, but `GOMAXPROCS=2 go test -v -race` fails.

Change the functionality to waiting for schedule to happen.
2015-06-10 14:37:41 -07:00
Xiang Li
2d21904cfd test: run with cpu = 1,2,4 2015-06-10 14:26:17 -07:00
Barak Michener
a4d1a5a6e5 *: Add security/auth support to etcdctl and etcd/client
add godep for speakeasy and auth entry parsing
add security_user to client
add role to client
add role commands
add auth support to etcdclient and etcdctl(member/user)
add enable/disable to etcdctl
better error messages, read/write/readwrite
Bump go-etcd to include codec changes, add new dependency
verify the error for revoke/add if nothing changed, remove security-merging prefix
2015-06-10 16:58:10 -04:00
Xiang Li
97709b202d Merge pull request #2930 from xiang90/storage_restore
storage: initial snapshot and restore
2015-06-10 11:38:57 -07:00
Xiang Li
ba9a46aa02 storage: initial snapshot and restore
Snapshot takes an io.Writer and writes the entire backend data to
the given writer. Snapshot writes a consistent view and does not
block other storage operations.

Restore restores the in-memory states (index and book keeping) of
the storage from the backend data.
2015-06-10 11:32:10 -07:00
Yicheng Qin
1403783326 Merge pull request #2911 from yichengq/rafthttp-plog
rafthttp: use leveled logger
2015-06-09 16:16:33 -07:00
Yicheng Qin
f1e995b070 rafthttp: use leveled logger 2015-06-09 16:15:02 -07:00
Xiang Li
19ef3a0982 Merge pull request #2934 from xiang90/etcdserver_log
etcdserver: use leveled logging
2015-06-09 15:53:52 -07:00