108 Commits

Author SHA1 Message Date
Xiang Li
4a72d3a8bb etcdserver: refactore member.go 2015-05-21 09:19:29 -07:00
Xiang Li
6296054ff6 etcdhttp: version endpoint also returns cluster version. 2015-05-13 15:48:10 -07:00
Xiang Li
6699107f61 *: add cluster version and cluster version detection.
Cluster version is the min major.minor of all members in
the etcd cluster. Cluster version is set to the min version
that a etcd member is compatible with when first bootstrapp.

During a rolling upgrades, the cluster version will be updated
automatically.

For example:

```
Cluster [a:1, b:1 ,c:1] -> clusterVersion 1

update a -> 2, b -> 2

after a detection

Cluster [a:2, b:2 ,c:1] -> clusterVersion 1, since c is still 1

update c -> 2

after a detection

Cluster [a:2, b:2 ,c:2] -> clusterVersion 2
```

The API/raft component can utilize clusterVersion to determine if
it can accept a client request or a raft RPC.

We choose polling rather than pushing since we want to use the same
logic for cluster version detection and (TODO) cluster version checking.

Before a member actually joins a etcd cluster, it should check the version
of the cluster. Push does not work since the other members cannot push
version info to it before it actually joins. Moreover, we do not want our
raft RPC system (which is doing the heartbeat pushing) to coordinate cluster version.
2015-04-29 11:31:59 -07:00
Barak Michener
92dca0af0f *: remove shadowing of variables from etcd and add travis test
We've been bitten by this enough times that I wrote a tool so that
it never happens again.
2015-02-17 16:31:42 -05:00
Jonathan Boulle
f1ed69e883 *: switch to line comments for copyright
Build tags are not compatible with block comments.
Also adds copyright header to a few places it was missing.
2015-01-26 09:53:30 -08:00
Yicheng Qin
190fd446f9 pkg/types: add URLs tests 2015-01-15 10:24:23 -08:00
Xiang Li
1ebad5e42c etcdhttp: support member/leader endpoint 2015-01-06 08:52:33 -08:00
Brian Waldon
9a728a127a dep: bump golang.org/x/net/context
Move from code.google.com/p/go.net/context to
golang.org/x/net/context before bumping to latest.
2014-11-20 10:19:12 -08:00
Xiang Li
d6f40acc86 etcdserver: add ID() function to the Server interface. 2014-11-13 11:37:06 -08:00
Xiang Li
5967794009 *: support updating advertise-peer-url
Users might want to update the peerurl of the etcd member in several cases.
For example, if the IP address of the physical machine etcd running on is
changed, user need to update the adversite-pee-rurl accordingly.
This commit makes etcd support updating the advertise-peer-url of its members.
2014-11-11 12:07:03 -08:00
Yicheng Qin
1e05cd75c7 etcdserver: refactor sender
1. restrict the number of inflight connections to remote member
2. support stop
2014-11-06 14:04:14 -08:00
Jonathan Boulle
55c92ad456 *: create ID type
This creates a simple ID type (wrapped around uint64) to provide for
standard serialization/deserialization to a string (i.e. base 16
encoded). This replaces strutil so now that package is removed.
2014-10-31 10:34:07 -07:00
Brian Waldon
435611cf0d etcdserver/etcdhttp: break apart http.go 2014-10-25 11:28:52 -07:00
Yicheng Qin
338f59db74 Merge pull request #1401 from unihorn/186
etcdhttp: parse quorum field from http request
2014-10-24 15:54:40 -07:00
Yicheng Qin
0e1d1646fd etcdhttp: parse quorum field from http request 2014-10-24 15:44:39 -07:00
Yicheng Qin
cb59a46576 Merge pull request #1396 from unihorn/185
etcdhttp: trim StoreKeysPrefix from error in serveKeys
2014-10-24 14:48:31 -07:00
Jonathan Boulle
9a465b9cf5 etcdhttp: add /version endpoint 2014-10-24 14:47:37 -07:00
Yicheng Qin
34dcbb4679 etcdhttp: trim StoreKeysPrefix from error in serveKeys
It returns error messaage like this now:
'{"errorCode":100,"message":"Key not found","cause":"/1/pants","index":10}'

The commit trims '/1' prefix from cause field if exists.

This is a hack to make it display well. It is correct because all error causes
that contain Path puts Path at the head of the string.
2014-10-24 14:12:53 -07:00
Jonathan Boulle
543e12074a etcdserver/member: change JSON fields to lowerCamelCase 2014-10-24 12:03:17 -07:00
Jonathan Boulle
7ef468b315 etcdhttp: remove /v2/admin/members/x serving 2014-10-24 12:03:17 -07:00
Jonathan Boulle
9b679de9dd etcdserver/etcdhttp: use container for admin/members endpoint 2014-10-24 12:03:17 -07:00
Xiang Li
ed29259801 etcdserver: fix member endpoint on peerurl 2014-10-23 17:18:01 -07:00
Xiang Li
d8258c38be Merge pull request #1374 from xiangli-cmu/cluster_on_peerurl
etcdserver: add member endpoint to peerurl
2014-10-23 16:08:45 -07:00
Jonathan Boulle
af42f4a56b etcdserver: sort Members() in Cluster 2014-10-23 15:57:27 -07:00
Xiang Li
02551c277d etcdserver: add member endpoint to peerurl 2014-10-23 15:55:00 -07:00
Yicheng Qin
8eee8c260e etcdserver: rebase on master and code clean 2014-10-23 13:58:55 -07:00
Yicheng Qin
89572b5fd7 etcdserver: refactor cluster and clusterStore
Integrate clusterStore into cluster, and let cluster become the source of
cluster info.
2014-10-23 13:27:54 -07:00
Xiang Li
8d6bb4a471 etcdserver: support GET on admin endpoint 2014-10-23 10:53:55 -07:00
Xiang Li
63fa2a626a etcdserver: admin PUT returns the json representation of the newly created member 2014-10-22 17:19:28 -07:00
Xiang Li
7be0f4b618 etcdserver: admin endpoint accepts json body 2014-10-22 16:19:48 -07:00
Xiang Li
6d9eb57555 etcdhttp: test bad url for POST on admin endopint 2014-10-22 14:27:08 -07:00
Xiang Li
d00152765a etcdserver: etcdserver generates the ID when adding new member.
When adding new member, the etcdserver generates the ID based on the current time
and the given peerurls. We include time to add the uniqueness, since the node with
same peerurls should be able to (add, then remove) several times.
2014-10-22 13:15:56 -07:00
Barak Michener
13656eb4e7 Merge pull request #1340 from barakmich/better_ids2
etcdserver: Calculate IDs based on PeerURLs and --initial-cluster-name
2014-10-22 14:49:49 -04:00
Yicheng Qin
7498234e40 etcdserver: record removed member to check incoming message 2014-10-22 11:09:35 -07:00
Barak Michener
ad0b7b7dbb Add cluster name to etcd flags 2014-10-22 13:52:42 -04:00
Yicheng Qin
06b196e345 etcdhttp: writeEvent -> writeKeyEvent 2014-10-21 16:10:49 -07:00
Yicheng Qin
ca73f25615 etcdhttp: parseRequest -> parseKeyRequest 2014-10-21 16:10:49 -07:00
Yicheng Qin
2ff3cac653 etcdserver/etcdhttp: store location adjustment
Detailed adjustment:
/_etcd/machines/* -> /0/members/*
/* -> /1/*

And it keeps key path returned to user the same as before.
2014-10-21 16:10:19 -07:00
Xiang Li
894e678ad6 etcdserver: checking clusterID 2014-10-21 11:05:24 -07:00
Xiang Li
a44849deec Merge pull request #1286 from coreos/clusterid
*: generate clusterid
2014-10-20 19:07:03 -07:00
Jonathan Boulle
b3d5333cb3 *: fix various formatting issues 2014-10-20 17:55:18 -07:00
Xiang Li
ea6bcacfe4 *: generate clusterid 2014-10-20 15:00:54 -07:00
Jonathan Boulle
7a4d42166b *: add license header to all source files 2014-10-17 15:41:22 -07:00
Jonathan Boulle
e0801360d3 godep: update clockwork dependency 2014-10-17 10:05:29 -07:00
Jonathan Boulle
ec18e46641 etcdserver/etcdhttp: switch to using fake clock 2014-10-17 10:05:29 -07:00
Jonathan Boulle
c28907ba95 etcdserver: fix race and improve stats interfaces 2014-10-16 23:05:48 -07:00
Jonathan Boulle
c30b82b596 etcdserver: fix data race in retrieving self stats 2014-10-16 23:05:48 -07:00
Jonathan Boulle
9b9e72e2a3 etcdhttp: add tests for ServeStats/ServeLeader 2014-10-16 10:43:49 -07:00
Jonathan Boulle
97ae531eda etcdserver: split out storestats and serverstats 2014-10-16 10:43:49 -07:00
Jonathan Boulle
8168fed825 etcdserver: add ServerStats and LeaderStats
This adds the remaining two stats endpoints: `/v2/stats/self`, for
various statistics on the EtcdServer, and `/v2/stats/leader`, for
statistics on a leader's followers.

By and large most of the stats code is copied across from 0.4.x, updated
where necessary to integrate with the new decoupling of raft from
transport.

This does not satisfactorily resolve the question of name vs ID. In the
old world, names were unique in the cluster and transmitted over the
wire, so they could be used safely in all statistics. In the new world,
a given EtcdServer only knows its own name, and it is instead IDs that
are communicated among the cluster members. Hence in most places here we
simply substitute a string-encoded ID in place of name, and only where
possible do we retain the actual given name of the EtcdServer.
2014-10-16 10:43:44 -07:00