Commit Graph

1062 Commits (030865abe3327815db0586e03198dc5782c1f3ed)

Author SHA1 Message Date
Caleb Champlin 82778ed478 Add refresh parameter to allow TTL refreshes without firing watch/wait responses 2016-02-08 10:37:37 -07:00
Anthony Romano fe7cfe4d3d rafthttp: plumb local peer URLs through transport 2016-02-05 16:44:41 -08:00
Xiang Li bc3fc4ea33 *: add etcdserver namespace for rpc error 2016-02-05 15:13:24 -08:00
Xiang Li e44e753e66 pkg/idutil: reduce conflict rate from 1% to 0.005%
Perviously, we only use 8bits from member identification
in id generation. The conflict rate is A(256,3)/256^3, which
is around 1%. Now we use 16bites to reduce the rate to 0.005%.

We can attach the full member id into id generation if needed...
2016-02-04 13:25:18 -08:00
Gyu-Ho Lee 2d197ac9e8 *: add kv Hash method (for testing purpose) 2016-02-03 12:52:39 -08:00
Hitoshi Mitake f7d35a1ef8 etcdserver: update comments in a generated file
On the latest master branch, etcdserver/etcdserverpb/etcdserver.pb.go
is changed when scripts/genproto.sh is executed. The content only has
changes for comment. Therefore it is not important but the change is
annoying when we update the proto file.
2016-02-04 00:45:16 +09:00
Xiang Li 3ed404633a v3rpc: add compacted field from wresp 2016-02-02 23:24:15 -08:00
Anthony Romano 2919be91b9 Merge pull request #4387 from heyitsanthony/integration-cluster-speedup
integration: decrease timeout for isMemberBootstrapped
2016-02-02 14:45:18 -08:00
Anthony Romano 9ae8d85049 integration: decrease timeout for isMemberBootstrapped
Spending seconds(!) when it would fail anyway.

integration/TestV3 (before): 100.670
integration/TestV3 (after): 29.571
2016-02-02 14:34:58 -08:00
Xiang Li 6f72b31316 integration: add test promote and move lease tests to lease_test.go 2016-02-02 13:45:11 -08:00
Anthony Romano c5c5063efe etcdserver: reject v3 txns with duplicate put keys
An API check to support PR #4363; bad requests didn't return an error.
2016-02-02 12:32:33 -08:00
Xiang Li bef7887c0d clientv3/integration: add basic lease test 2016-02-01 12:59:44 -08:00
Xiang Li 220fba32a3 Merge pull request #4353 from xiang90/lease
clientv3: initial lease
2016-02-01 10:40:44 -08:00
Xiang Li f2c24dec05 clientv3: initial lease 2016-02-01 09:55:32 -08:00
Anthony Romano 20461ab11a *: fix many typos 2016-01-31 21:42:39 -08:00
Gyu-Ho Lee 57dedd8c89 Revert "*: TestKVRange to clientv3/integration, fix rev" 2016-01-29 18:20:56 -08:00
Anthony Romano f6031b9d11 Merge pull request #4349 from heyitsanthony/v3-client-conntls
V3 client TLS
2016-01-29 17:05:38 -08:00
Anthony Romano 4634874d99 etcdmain, integration, v3rpc: consolidate grpc server setup 2016-01-29 16:38:11 -08:00
Gyu-Ho Lee 69abdf8144 *: TestKVRange to clientv3/integration, fix rev
For https://github.com/coreos/etcd/issues/4338.
And resp.Header.Revision should be from the one in storage
when we just do range, because there is no storage data
change.
2016-01-29 16:12:21 -08:00
Anthony Romano 082a6c304e etcdserver/test: use recorderstream in TestApplyRepeat
was racing when waiting for the node commit

fixes #4333
2016-01-28 17:19:06 -08:00
Heungsub Lee c4a0159601 documentation: fix typo "a etcd" -> "an etcd"
"a" is not a correct article for "etcd".
2016-01-28 19:19:32 +09:00
Xiang Li a3b7876a3c clientv3: use retryConnection 2016-01-27 22:31:15 -08:00
Anthony Romano 14255854d8 Merge pull request #4298 from heyitsanthony/fix-testapplysnapshot-race
etcdserver/test: synchronously wait on TestApplySnapshotAndCommittedE…
2016-01-26 21:18:09 -08:00
Anthony Romano 64596f0c49 etcdserver/test: synchronously wait on TestApplySnapshotAndCommittedEntries
Replaces the RecorderBuffered with a RecorderStream so Wait will block
waiting for updates to the etcdserver store.

Fixes #4296
2016-01-26 21:03:03 -08:00
Xiang Li 36cc8446c7 *: finish member api implementation 2016-01-26 18:09:14 -08:00
Gyu-Ho Lee ad15bdcb07 etcdserver: update gRPC, proto interface 2016-01-26 17:41:19 -08:00
Anthony Romano 4c024b305f Merge pull request #4290 from heyitsanthony/fix-apply-noents
etcdserver: don't try to apply empty message list
2016-01-26 14:11:54 -08:00
Anthony Romano bd02d668c8 etcdserver: don't try to apply empty message list
If all messages have been applied, don't apply an empty messages list;
otherwise appliedi will update to 0 and etcd will panic.

Fixes #4278
2016-01-26 11:56:37 -08:00
Xiang Li 179a8f9768 Merge pull request #4289 from xiang90/member_api
etcdserver: initial member api proto
2016-01-26 10:16:44 -08:00
Xiang Li 864fc197c1 etcdserver: initial member api proto 2016-01-26 09:56:50 -08:00
Xiang Li 59c6735c3c Merge pull request #4282 from xiang90/range_invalid
etcdserver: check invalid range in txn
2016-01-25 22:23:55 -08:00
Xiang Li dd1bbaa293 Merge pull request #4281 from mitake/remove-cached-auth-flag
etcdserver, auth: not cache a flag of auth status
2016-01-25 21:55:44 -08:00
Xiang Li a56387bc3e Merge pull request #4284 from xiang90/max_txn
v3rpc: check max ops in txn
2016-01-25 21:16:01 -08:00
Xiang Li c8bf77c722 v3rpc: check max ops in txn 2016-01-25 21:04:19 -08:00
Xiang Li 128b5e7387 etcdserver: check invalid range in txn 2016-01-25 20:21:17 -08:00
Anthony Romano 12f6b8e72d etcdserver: complete stopWithDelay on server shutdown
Was causing goroutine leaks on my machine.
2016-01-25 19:45:29 -08:00
Hitoshi Mitake b2d2c79a2f etcdserver, auth: not cache a flag of auth status
This commit removes a flag that indicates auth is enabled or disabled
because it doesn't have an invalidation mechanism.

Fixes https://github.com/coreos/etcd/issues/3601 and https://github.com/coreos/etcd/issues/3964
2016-01-26 11:46:25 +09:00
Xiang Li ef6320e638 etcdserver: make cluster checking interval shorter 2016-01-25 08:16:05 +08:00
Xiang Li 1aa312fcce *: lease forwarding should resue transport 2016-01-25 06:56:07 +08:00
Xiang Li 5e2dbadbc0 leasehttp: move lease/http.go to its own pkg 2016-01-25 06:09:54 +08:00
Anthony Romano 9572197aee etcdserver: return error when putting a key with a bad lease id 2016-01-22 20:47:31 -08:00
Anthony Romano 2e157530a0 etcdhttp, lease, v3api: forward keepalives to leader
keepalives don't go through raft so let follower peers announce
keepalives to the leader through the peer http handler
2016-01-22 12:40:40 -08:00
Anthony Romano 9113a27bde lease: grant consistent lease IDs
When raft broadcasts a Grant to all nodes, all nodes must
agree on the same lease ID. Otherwise, attaching a key to
a lease will fail since the lease ID is node-dependent.
2016-01-22 09:43:39 -08:00
Anthony Romano ccfd68a251 etcdserver: support Revision option in v3 RangeRequest 2016-01-17 21:45:22 -08:00
Anthony Romano 8df3f0c545 etcdserver: support 'More' flag for v3 RangeRequest 2016-01-17 21:45:22 -08:00
Gyu-Ho Lee b6077f9d57 *: fix minor typos 2016-01-14 01:28:29 -08:00
Hitoshi Mitake 588f655b4e etcdmain: add an option for pprof
This commit adds a new option for activating profiling based on pprof
in etcd process.
 - -enable-pprof: boolean type option which activates profiling

For example, if a client URL is http://localhost:12379, users and
developers access heap profiler with this URL:
http://localhost:12379/debug/pprof/heap
2016-01-13 16:12:26 +09:00
Anthony Romano efa9cd7e0c Merge pull request #4184 from heyitsanthony/v3-rangereq-sort
etcdserver: support sorted range requests in v3 api
2016-01-12 10:26:52 -08:00
Anthony Romano 82eeffbd58 etcdserver: support sorted range requests in v3 api
Fixes #4166
2016-01-12 10:08:30 -08:00
Xiang Li 6b1d9fb7ce *: stop lessor when etcdserver is stopped 2016-01-12 10:06:11 -08:00
Xiang Li 59bf83c7f4 *: now lease keepAlive works on leader 2016-01-09 22:12:02 -08:00
Xiang Li f5753f2f51 *: support lease Attach
Now we can attach keys to leases. And revoking the lease removes all
the attached keys of that lease.
2016-01-09 11:01:58 -08:00
Xiang Li 2566699a48 *: revoke expired leases 2016-01-08 13:37:58 -08:00
Xiang Li 7de0e9130c Merge pull request #4167 from xiang90/lease_promote
*: expose Lessor Promote and Demote interface
2016-01-08 10:38:08 -08:00
Gyu-Ho Lee f76166a041 *: fix minor typos 2016-01-08 00:21:19 -08:00
Xiang Li f5fa9b5384 *: expose Lessor Promote and Demote interface 2016-01-07 18:18:20 -08:00
Xiang Li 99bee2fd29 Merge pull request #4162 from xiang90/lease
*: add support for lease create and revoke
2016-01-07 16:58:59 -08:00
Xiang Li d9ca929a33 *: add support for lease create and revoke
Basic support for lease operations like create and revoke.
We still need to:
1. attach keys to leases in KV implmentation if lease field is set
2. leader periodically removes expired leases
3. leader serves keepAlive requests and follower forwards keepAlive
requests to leader.
2016-01-07 16:39:39 -08:00
Gyu-Ho Lee 5842177172 etcdserver/api/v3rpc: fill in KV ResponseHeader 2016-01-07 12:18:31 -08:00
Xiang Li 43a777b7a2 *: get snapshot from backend
We should get snapshot from backend, not just KV.
We plan to store the lease data into backend too.
2016-01-06 22:40:23 -08:00
Xiang Li 1714290f4e storage: support recovering from backend
We want the KV to support recovering from backend to avoid
additional pointer swap. Or we have to do coordination between
etcdserver and API layer, since API layer might have access to
kv pointer and use a closed kv.
2016-01-06 21:16:55 -08:00
Gyu-Ho Lee 366e7a879f *: fill in WatchResponse.Header
Related to coreos#3848.
2016-01-06 15:12:53 -08:00
Xiang Li 5dd3f91903 *: make backend outside kv
KV and lease will share the same backend. Thus we need to make
backend outside KV.
2016-01-05 19:55:29 -08:00
Xiang Li 1e61243fd7 Merge pull request #4134 from xiang90/lease
lease: modify API and persist lease to disk
2016-01-05 10:30:52 -08:00
Xiang Li 09b420f08c *: move leaseID typedef to lease pkg 2016-01-05 10:18:17 -08:00
Anthony Romano 838328b057 etcdserver: fix racey WaitSchedule() tests to wait for recorder actions
Fixes #4119
2016-01-05 09:39:18 -08:00
Anthony Romano 384cc76299 pkg/testutil: make Recorder an interface
Provides two implementations of Recorder-- one that is non-blocking
like the original version and one that provides a blocking channel
to avoid busy waiting or racing in tests when no other synchronization
is available.
2016-01-05 09:39:18 -08:00
Anthony Romano e1bf726bc1 *: split out etcdserver's test mockup objects to live in interfaces' packages 2016-01-05 09:39:13 -08:00
Anthony Romano 21a6ade53d storage: change type of WatchIDs from int64 to WatchID 2016-01-04 19:52:22 -08:00
Gyu-Ho Lee 556d4a6932 *: remove CancelFunc return for Watch. Use Cancel for watch. 2016-01-04 16:17:55 -08:00
Xiang Li 4336278b44 *: support put with lease 2016-01-04 15:54:06 -08:00
Gyu-Ho Lee 6540f47dfa *: WatchResponse for multiple Events with WatchID
storage/storagepb: remove watchID from Event

storage: add WatchResponse to watcher.go to wrap events, watchID

storage: watchableStore to use WatchResponse

storage: kv_test with WatchResponse

etcdserver/api/v3rpc: watch to receive storage.WatchResponse type
2016-01-03 16:32:48 -08:00
Xiang Li eda0eefc25 *: support watcher cancellation inside watchStream 2016-01-03 00:20:21 -08:00
Xiang Li ec12686233 v3api: add support for sending watcher control response 2016-01-02 22:31:22 -08:00
Xiang Li ee0b3f42ed *: rename watcher to watchStream
Watcher vs Watching in storage pkg is confusing. Watcher should be named
as watchStream since it contains a channel as stream to send out events.
Then we can rename watching to watcher, which actually watches on a key
and send watched events through watchStream.

This commits renames watcher to watchStram.
2016-01-02 16:03:57 -08:00
Xiang Li ac330bb7c9 *: update watch related proto
1. Add watch/cancel request
2. Add necessary fields in response to return watch error
3. Add watch_id into watch response
2016-01-01 10:22:21 -08:00
Gyu-Ho Lee 8f03c600b5 etcdserver/api/v3rpc: watch.go with events slice 2015-12-31 19:25:15 -08:00
Gyu-Ho Lee 8da6e76588 etcdserver/etcdserverpb: rpc WatchResponse with events slice 2015-12-31 19:24:46 -08:00
Xiang Li 1dc0e664f0 *: fix proto and regenerate all go files 2015-12-30 20:11:19 -08:00
Gyu-Ho Lee f19a07289a Merge pull request #4098 from gyuho/merge_log
*: use merge logger for repeating etcdserver error logs
2015-12-29 21:23:30 -07:00
Anthony Romano 8346a7c052 Merge pull request #4094 from heyitsanthony/send-merged-done-nowait
etcdserver: respect done channel when sleeping for snapshot backoff
2015-12-29 20:18:08 -08:00
Gyu-Ho Lee 8f943f2f45 etcdserver/etcdhttp: use MergeLogger to log etcdserver errors
Related https://github.com/coreos/etcd/issues/3812.
2015-12-29 20:00:52 -08:00
Anthony Romano 942b5570bd Merge pull request #4096 from heyitsanthony/serialize-applier-snapmerge
etcdserver: serialize snapshot merger with applier
2015-12-29 19:37:11 -08:00
Anthony Romano 4cd86ae1ef etcdserver: serialize snapshot merger with applier
Avoids inconsistent snapshotting by only attempting to
create a snapshot after an apply completes.

Fixes #4061
2015-12-29 18:38:39 -08:00
Anthony Romano c7c3bda8b9 etcdserver: respect done channel when sleeping for snapshot backoff 2015-12-29 13:23:41 -08:00
Xiang Li 9d9680121c etcdserver/etcdserverpb: make rpc.proto updated 2015-12-29 12:58:14 -08:00
Xiang Li d9d7137ea3 Merge pull request #4092 from xiang90/api
*: update api proto
2015-12-29 12:46:12 -08:00
Xiang Li 1a0201a31a *: update api proto 2015-12-29 12:31:53 -08:00
Xiang Li 150e646b05 etcdserver: always check if the data dir is writable before starting etcd 2015-12-29 11:29:01 -08:00
Xiang Li aef55342d1 etcdsever: avoid creating member dir before finishing validate bootstrap
This commit fixes the issue of creating member dir before validating
the configuration. When member dir exists, it indicates the local etcd
process is a valid etcd member. So we should only create member dir
after we finish configuration validation, joining validation or
discovery validation.
2015-12-28 23:20:27 -08:00
Xiang Li eae52a3138 Revert "etcdserver: always remove member directory when bootstrap fails"
This reverts commit a7e443d641.
2015-12-28 23:16:08 -08:00
Gyu-Ho Lee a7e443d641 etcdserver: always remove member directory when bootstrap fails
This removes member directory when bootstrap fails including joining existing
cluster and forming a new cluster. This fixes https://github.com/coreos/etcd/issues/3827.
2015-12-28 22:56:03 -08:00
Xiang Li 72e115ee6e Merge pull request #4062 from xiang90/fix_snap
*: fix snapshot sending cycle
2015-12-23 17:10:10 -08:00
Anthony Romano d7ad721ede etcdserver: stop if removed along with multiple conf changes
shouldstop would get clobbered when several conf changes are in an apply
2015-12-23 16:29:21 -08:00
Xiang Li 4be152bb4f rework 2015-12-23 16:21:16 -08:00
Xiang Li 9a51d40940 fix comment 2015-12-23 14:10:39 -08:00
Xiang Li ab31ba0d29 *: fix snapshot sending cycle 2015-12-23 13:58:57 -08:00
Xiang Li d6d12b4d86 etcdserver: move unti out of server.go
etcdserver file is messy enough. Let's make it be less messy.
2015-12-22 15:17:14 -08:00
Anthony Romano aca0c466ed etcdserver: asynchronously notify applier when raft writes finish
The raft loop would block on the applier's done channel after
persisting the raft messages; the latency could cause dropped network
messages. Instead, asynchronously notify the applier with a buffered
channel when the raft writes complete.
2015-12-22 14:15:14 -08:00
Anthony Romano 9d05a0d959 etcdserver: apply v3 database updates outside server event loop
raft's applyc writes block on the server loop's database IO since
the next applyc read must wait on the db operation to finish.
Instead, stream applyc to a run queue outside the server loop.
2015-12-22 14:15:09 -08:00
Anthony Romano 7e00325fe9 etcdserver: refactor server.go select loop
splits out the apply case into smaller functions
2015-12-22 12:13:39 -08:00
Gyu-Ho Lee 0ff822bf22 etcdserver/auth: fix shadowed variables from go tool
Fixes for https://github.com/coreos/etcd/issues/3954.
2015-12-12 09:20:26 -08:00
Gyu-Ho Lee 40b11038f2 etcdserver: fixes shadowed variables for go tool vet
Fix for https://github.com/coreos/etcd/issues/3954.
2015-12-12 09:13:12 -08:00
Xiang Li c4cbaf5c2a etcdsever: swap kv pointer atomically 2015-12-10 17:29:36 -08:00
Xiang Li 23bd60ccce *: rewrite snapshot sending 2015-12-08 18:21:21 -08:00
Xiang Li 0708a5e50d etcdserver: refactor a for loop in recvSnap test 2015-12-02 15:41:03 -08:00
Xiang Li 67ffeee521 Merge pull request #3946 from xiang90/fix_snap_test
etcdserver: get rid of unreliable WaitSchedule
2015-12-02 15:01:20 -08:00
Xiang Li 3ec3ffbef0 etcdserver: get rid of unreliable WaitSchedule
In this case, we know we are waiting for an action happened on
storage. We can do a busy wait instead of calling waitSchedule.

The test previously failed on CI with no observed actions.
2015-12-02 13:18:11 -08:00
ngaut e142e073e8 v3rpc: Tiny clean up
unreachable code
2015-12-02 12:30:21 +08:00
Barak Michener 452e5bffc0 etcdserver: Fix panic for v3 transaction compares on non-existent keys
Fixes #3920
2015-11-24 16:49:45 -05:00
Xiang Li b868f4b1b1 v3rpc: report eventReceived correctly 2015-11-19 22:44:46 -08:00
Xiang Li 3cf90a4dff v3rpc: do not send closing event
When a watch stream closes, both of the watcher.Chan and closec
will be closed.

If watcher.Chan is closed, we should not send out the empty event.
Sending the empty is wrong and waste a lot of CPU resources.
Instead we should just return.
2015-11-19 17:56:15 -08:00
Xiang Li c400d05d0a Merge pull request #3892 from xiang90/fix_snapshot_handling
etcdserver: handle incoming v3 snapshot correctly
2015-11-19 12:18:18 -08:00
Xiang Li a07e4bb6e2 etcdserver: handle incoming v3 snapshot correctly
1. we should update all kv reference (including the
on in snapStore).

2. we should first restore a new KV and then close
the old one asynchronously.
2015-11-18 16:07:41 -08:00
Gyu-Ho Lee 81229dbea9 *: add missing package descriptions
This adds and updates package descriptions in etcd projects.
And also deletes some duplicate LICENSE statements.
2015-11-17 20:54:10 -08:00
Xiang Li b4abe5b584 etcdserver: start real txn for txn request
We should open real txn for applying txn requests. Or the intermediate
state might be observed by reader.

This also fixes #3803. Same consistent(raft) index per multiple indenpendent
operations confuses consistentStore.
2015-11-16 21:11:27 -08:00
Xiang Li a1616afc5d auth: use canonical path for pre-defined guest role 2015-11-15 17:58:09 -08:00
Xiang Li ff36b9d9bc Merge pull request #3700 from xiang90/metrics_hi
Replace Summary with Histogram for all metrics
2015-11-10 10:06:45 -08:00
Xiang Li ae2f69b41e etcdserver: rename processInternalRaftReq to processInternalRaftRequest
We have a structure called InternalRaftRequest. Making the function
shorter by calling it processInternalRaftReq seems to be random and
reduce the readability. So we just use the full name.
2015-11-09 13:37:36 -08:00
Hitoshi Mitake 2c8ffa6bcb etcdserver: correct error log for strict reconfig checking
This commit fixes an error log caused by the strict reconfig checking
option.

Before:
14:21:38 etcd2 | 2015-11-05 14:21:38.870356 E | etcdhttp: got unexpected response error (etcdserver: re-configuration failed due to not enough started members)

After:
log
13:27:33 etcd2 | 2015-11-05 13:27:33.089364 E | etcdhttp: etcdserver: re-configuration failed due to not enough started members

The error is not an unexpected thing therefore the old message is
incorrect.
2015-11-06 11:03:42 +09:00
Yicheng Qin 0874c44cdc etcdserver: fix snapshot index in creation log line
The snapshot is created at appliedi instead of snapi.
2015-11-05 14:02:09 -08:00
Xiang Li 08f0d94019 Merge pull request #3809 from xiang90/rpc_kv
*: refactor kv rpc implementation
2015-11-04 19:05:48 -08:00
Yicheng Qin ec3c2d23a3 *: update feature maps to adopt v2.3.0 2015-11-04 14:30:35 -08:00
Yicheng Qin 3d15526c35 Merge pull request #3796 from yichengq/fix-get-version
etcdserver: not reuse connections for peer transport
2015-11-04 11:39:14 -08:00
Xiang Li c37bd2385a *: refactor kv rpc implementation 2015-11-04 11:36:17 -08:00
Yicheng Qin 4ccbcb91c8 rafthttp: add functions to create listener and roundTripper
This moves the code to create listener and roundTripper for raft communication
to the same place, and use explicit functions to build them. This prevents
possible development errors in the future.
2015-11-04 11:12:46 -08:00
Yicheng Qin 32819f6b3f etcdserver: use roundTripper to request peerURL
It uses roundTripper instead of Transport because roundTripper is
sufficient for its requirements.
2015-11-04 10:49:42 -08:00
Xiang Li 1a3f7f7fa4 *: rename etcd service to kv service in gRPC 2015-11-04 10:05:49 -08:00
Xiang Li 10de2e6dbe *: serve watch service
Implement watch service and hook it up
with grpc server in etcdmain.
2015-11-03 15:58:34 -08:00
Xiang Li c160085f44 *: add v3 watch service 2015-11-03 14:21:24 -08:00
Yicheng Qin 0eee88a3d9 etcdserver: use timeout transport as peer transport
This pairs with remote timeout listeners.

etcd uses timeout listener, and times out the accepted connections
if there is no activity. So the idle connections may time out easily.
Becaus timeout transport doesn't reuse connections, it prevents using
timeouted connection.

This fixes the problem that etcd fail to get version of peers.
2015-11-03 07:58:03 -08:00
Xiang Li fe165de1d1 Merge pull request #3794 from yichengq/fix-proxy-term
etcdmain: fix parsing discovery error
2015-11-02 17:33:47 -08:00
Yicheng Qin 9757dcd3a2 etcdmain: fix parsing discovery error
The discovery error is wrapped into a struct now, and cannot be compared
to predefined errors. Correct the comparison behavior to fix the
problem.
2015-11-02 17:23:06 -08:00
Jonathan Boulle ee522025b3 etcdserver: restructure auth.Store and auth.User
This attempts to decouple password-related functions, which previously
existed both in the Store and User structs, by splitting them out into a
separate interface, PasswordStore.  This means that they can be more
easily swapped out during testing.

This also changes the relevant tests to use mock password functions
instead of the bcrypt-backed implementations; as a result, the tests are
much faster.

Before:
```
	github.com/coreos/etcd/etcdserver/auth		31.495s
	github.com/coreos/etcd/etcdserver/etcdhttp	91.205s
```

After:
```
	github.com/coreos/etcd/etcdserver/auth		1.207s
	github.com/coreos/etcd/etcdserver/etcdhttp	1.207s
```
2015-10-30 16:33:40 -07:00
Yicheng Qin 7d757bbc8a etcdserver: extend wait timeout in TestPublishRetry
It fixes the failure in semaphore CI:
```
--- FAIL: TestPublishRetry (0.00s)
		server_test.go:1108: len(action) = 1, want >= 2
```
2015-10-28 12:07:00 -07:00
Yicheng Qin 099d8674c4 Merge pull request #3746 from yichengq/load-storage
etcdserver: fix recovering snapshot from disk
2015-10-27 14:42:41 -07:00
Yicheng Qin 263b270708 etcdserver: commit v3 storage before releasing WAL
This ensures that v3 storage could always find the following log entries
when restart.
2015-10-26 21:06:08 -07:00
Xiang Li a8e6e71bf9 *: fix various data races detected by race detector 2015-10-26 20:49:37 -07:00
Yicheng Qin 15ed6d8268 etcdserver: save consistent index into v3 storage
This helps to recover consistent index when restart in the future.
2015-10-24 09:27:24 -07:00
Yicheng Qin cacc0d6432 etcdserver: restore KV snapshot when receiving snapshot
When a slow follower receives the snapshot sent from the leader, it
should rename the snapshot file to the default KV file path, and
restore KV snapshot.

Have tested it manually and it works pretty well.
2015-10-23 08:43:26 -07:00
Yicheng Qin de669be6d6 Merge pull request #3683 from yichengq/raft-block
etcdserver: fix raft state machine may block
2015-10-20 09:44:34 -07:00
Yicheng Qin ab5df57ecf etcdserver: fix raft state machine may block
When snapshot store requests raft snapshot from etcdserver apply loop,
it may block on the channel for some time, or wait some time for KV to
snapshot. This is unexpected because raft state machine should be unblocked.

Even worse, this block may lead to deadlock:
1. raft state machine waits on getting snapshot from raft memory storage
2. raft memory storage waits snapshot store to get snapshot
3. snapshot store requests raft snapshot from apply loop
4. apply loop is applying entries, and waits raftNode loop to finish
messages sending
5. raftNode loop waits peer loop in Transport to send out messages
6. peer loop in Transport waits for raft state machine to process message

Fix it by changing the logic of getSnap to be asynchronously creation.
2015-10-20 09:19:34 -07:00
Hitoshi Mitake 1b0c65c299 etcdserver: don't allow methods other than GET in /debug/vars
Currently, /debug/vars seems to allow all types of methods e.g. PUT,
POST, etc. However, this path is a readonly stuff so it should allow
GET only.
2015-10-20 17:19:42 +09:00
Xiang Li 32dd4d5de3 Merge pull request #3657 from xiang90/fix_remove
etcdserver: skip updating attr if the member does not exist
2015-10-19 13:35:57 -07:00
Xiang Li d90a47656e etcdserver: use Histogram for proposal_durations 2015-10-17 12:48:25 -07:00
Yicheng Qin 1f21ccf166 rafthttp: support sending v3 snapshot message
Use snapshotSender to send v3 snapshot message. It puts raft snapshot
message and v3 snapshot into request body, then sends it to the target peer.
When it receives http.StatusNoContent, it knows the message has been
received and processed successfully.

As receiver, snapHandler saves v3 snapshot and then processes the raft snapshot
message, then respond with http.StatusNoContent.
2015-10-13 23:11:28 -07:00
Yicheng Qin 207c92b627 rafthttp: build transport inside pkg instead of passed-in
rafthttp has different requirements for connections created by the
transport for different usage, and this is hard to achieve when giving
one http.RoundTripper. Pass into pkg the data needed to build transport
now, and let rafthttp build its own transports.
2015-10-11 21:42:37 -07:00
Yicheng Qin 233e717e2f rafthttp: expose struct to set configuration
transport takes too many arguments and the new function is unable to
read. Change the way to set fields in transport struct directly.
2015-10-11 09:02:16 -07:00
Xiang Li 98e30ca7c2 etcdserver: skip updating attr if the member does not exist 2015-10-08 14:07:16 -07:00
Yicheng Qin f74ff9b867 Merge pull request #3644 from mitake/test-race
etcdserver, test: don't access testing.T in time.AfterFunc()'s own go…
2015-10-07 08:34:58 -07:00