Commit Graph

1685 Commits (1917e5c543d6b6e3439a4308af1920d038797113)

Author SHA1 Message Date
Gyu-Ho Lee e0843c691b Merge pull request #8322 from gyuho/health-grpc-proxy
*: add /health endpoint to grpc-proxy
2017-07-31 15:45:42 -07:00
Gyu-Ho Lee cd37ef2c1b *: expose etcdhttp.Health, define proxy health handler
Signed-off-by: Gyu-Ho Lee <gyuhox@gmail.com>
2017-07-31 14:07:54 -07:00
Anthony Romano ec4ca4408f etcdserver: support lease txn comparison 2017-07-31 13:00:04 -07:00
Anthony Romano 71e56a44b7 *: regenerate protobuf assets 2017-07-31 13:00:04 -07:00
Anthony Romano d8ca2bbffb etcdserverpb: add lease to txn comparison targets
Also shifts down fields following target_union in case there's any more
reason to expand. OK since range_end is still pre-release.
2017-07-31 13:00:04 -07:00
Gyu-Ho Lee 4267d368df api/etcdhttp: serve error information in '/health', marshal health in JSON
Signed-off-by: Gyu-Ho Lee <gyuhox@gmail.com>
2017-07-27 15:36:59 -07:00
Xiang Li 2a348fb8e9 Merge pull request #8263 from fanminshi/hash_by_rev
api: hash by rev
2017-07-26 11:22:33 -07:00
Gyu-Ho Lee 74c8050adc *: use etcdhttp.Handle* for health, prometheus handlers
Signed-off-by: Gyu-Ho Lee <gyuhox@gmail.com>
2017-07-26 06:23:55 -07:00
Gyu-Ho Lee 78432e3bd2 etcdhttp: add metrics.go for metrics, health handler
Signed-off-by: Gyu-Ho Lee <gyuhox@gmail.com>
2017-07-26 06:23:55 -07:00
Anthony Romano 16943f04e2 Merge pull request #8283 from heyitsanthony/cancel-compact-rpc
v3rpc: set Canceled=true on compacted watch
2017-07-25 19:15:18 -07:00
Anthony Romano 478ba2c4f2 etcdserver: consolidate error checking for v3_server functions
Duplicated error checking code moved into raftRequest/raftRequestOnce.
2017-07-25 14:28:39 -07:00
Anthony Romano 6fb08672d8 v3rpc: set canceled=true when stream is compacted
Fixes #8231
2017-07-25 12:36:01 -07:00
Gyu-Ho Lee 61a736a068 etcdserver: check alarms in health handler
Signed-off-by: Gyu-Ho Lee <gyuhox@gmail.com>
2017-07-18 15:51:28 -07:00
fanmin shi fbb75d24a4 v3rpc: add HashKV to server rpc 2017-07-14 16:44:00 -07:00
fanmin shi ed052ce9a3 proto: add HashKV grpc
HashKV rpc hash of all MVCC keys up to a given revision for a given node.
2017-07-14 16:41:23 -07:00
Xiang Li 0a2b580f73 Merge pull request #8238 from yudai/allow_more_streams
v3rpc: Let clients establish unlimited streams
2017-07-11 18:21:09 -07:00
Iwasaki Yudai 52101e6e93 v3rpc: Let clients establish unlimited streams
From go-grpc v1.2.0, the number of max streams per client is set to 100
by default by the server side. This change makes it impossible
for third party proxies and custom clients to establish many streams.
2017-07-11 13:02:01 -07:00
Anthony Romano e29db923bc *: move v2http handlers without /v2 prefix to etcdhttp
Lets --enable-v2=false configurations provide /metrics, /health, etc.

Fixes #8167
2017-07-07 18:35:57 -07:00
Gyu-Ho Lee a57405a958 Merge pull request #8153 from gyuho/leadership-transfer
*: expose Leadership Transfer API to clients
2017-07-06 13:00:08 -07:00
Hitoshi Mitake e0c33ef881 auth, etcdserver: allow users to know their roles and permissions
Current UserGet() and RoleGet() RPCs require admin permission. It
means that users cannot know which roles they belong to and what
permissions the roles have. This commit change the semantics and now
users can know their roles and permissions.
2017-06-26 22:20:41 -07:00
Gyu-Ho Lee 403ba1dfa7 etcdserver: expose 'transferLeadership' as 'MoveLeader'
Signed-off-by: Gyu-Ho Lee <gyuhox@gmail.com>
2017-06-23 12:51:28 -07:00
Gyu-Ho Lee b1a0ae3a3e etcdserver/api/v3rpc: add 'MoveLeader' to 'maintenanceServer'
Signed-off-by: Gyu-Ho Lee <gyuhox@gmail.com>
2017-06-23 12:51:24 -07:00
Gyu-Ho Lee 939bbd77c0 etcdserver/*: add 'ErrNotLeader'
Signed-off-by: Gyu-Ho Lee <gyuhox@gmail.com>
2017-06-23 12:46:07 -07:00
Gyu-Ho Lee 265303c19a *: regenerate proto with 'MoveLeader' RPC
Signed-off-by: Gyu-Ho Lee <gyuhox@gmail.com>
2017-06-23 12:45:53 -07:00
Gyu-Ho Lee d82f2572a4 etcdserver/etcdserverpb: define 'MoveLeader' RPC
Signed-off-by: Gyu-Ho Lee <gyuhox@gmail.com>
2017-06-23 12:43:29 -07:00
Xiang Li 0fe8fdcb29 Merge pull request #8123 from yudai/revision_compactor
Compactor: Add Revisional compactor
2017-06-22 16:34:28 -07:00
Iwasaki Yudai a3f8f47422 *: add Revision compactor 2017-06-21 15:41:07 -07:00
Anthony Romano 6ed51dc621 etcdserver, v3rpc: support nested txns 2017-06-21 14:33:15 -07:00
Anthony Romano 822473bc31 etcdserverpb: add txns to requestop/responseop 2017-06-21 14:33:15 -07:00
Gyu-Ho Lee c1e3172e3a etcdserver/api/v3rpc: add default grpc health service 2017-06-20 10:48:06 -07:00
Anthony Romano 8d7c29c732 etcdserver, etcdserverpb: Txn.Compare range_end support 2017-06-16 12:13:27 -07:00
Anthony Romano 1acc8090e3 Merge pull request #8110 from heyitsanthony/fix-test-sync-timeout
etcdserver: use RecorderStream for TestSyncTimeout to avoid missing action
2017-06-15 20:49:10 -07:00
Anthony Romano e962b0c849 Merge pull request #7909 from heyitsanthony/unptr-cfg
etcdserver, embed, integration: don't use pointer for ServerConfig
2017-06-15 20:47:30 -07:00
Gyu-Ho Lee 5e059fd8dc *: use metadata Incoming/OutgoingContext
Fix https://github.com/coreos/etcd/issues/7888.

Signed-off-by: Gyu-Ho Lee <gyuhox@gmail.com>
2017-06-15 16:41:23 -07:00
Anthony Romano aa0e6b26c0 etcdserver: use RecorderStream for TestSyncTimeout to avoid missing action 2017-06-15 13:43:53 -07:00
Anthony Romano dcf52bbfac etcdserver, embed, integration: don't use pointer for ServerConfig
ServerConfig is owned by etdcserver and unshared, so don't pass or store by
pointer. Also removes duplicated field 'snapCount'.
2017-06-15 13:02:13 -07:00
Anthony Romano 4445996a38 Merge pull request #8084 from heyitsanthony/update-protobuf
vendor: update github.com/{gogo,golang}/protobuf
2017-06-12 19:09:49 -07:00
Anthony Romano 4ebeba0e18 *: regen protofiles with latest protobuf tools 2017-06-12 15:14:43 -07:00
Anthony Romano 7ff5b05004 etcdserver: better warning when initial-cluster doesn't match advertise urls
The old error was not clear about what URLs needed to be added, sometimes
truncating the list. To make it clearer, print out the missing entries
for --initial-cluster and print the full list of initial advertise peers.

Fixes #8079 and #7927
2017-06-12 14:14:16 -07:00
Anthony Romano d173b09a1b etcdserver: use same ReadView for read-only txns
A read-only txn isn't serialized by raft, but it uses a fresh
read txn for every mvcc access prior to executing its request ops.
If a write txn modifies the keys matching the read txn's comparisons,
the read txn may return inconsistent results.

To fix, use the same read-only mvcc txn for the duration of the etcd
txn. Probably gets a modest txn speedup as well since there are
fewer read txn allocations.
2017-06-09 09:20:38 -07:00
Anthony Romano 2caae60004 Merge pull request #8062 from heyitsanthony/revert-v2machines
v2http: put back /v2/machines and mark as non-deprecated
2017-06-08 12:01:58 -07:00
Gyu-Ho Lee 45fd8279f0 etcdserver: add leaseExpired debugging metrics
Fix https://github.com/coreos/etcd/issues/8050.

Signed-off-by: Gyu-Ho Lee <gyuhox@gmail.com>
2017-06-08 10:36:25 -07:00
Anthony Romano c2dadbd9f8 v2http: put back /v2/machines and mark as non-deprecated
This reverts commit 2bb33181b6. python-etcd
seems to depend on /v2/machines and the maintainer vanished. Plus, it is
prefixed with /v2/ so it probably can't be deprecated anyway.
2017-06-08 09:39:11 -07:00
Hitoshi Mitake fa4903c83c Merge pull request #8031 from mitake/lease-revoke-auth
protecting lease revoking with auth
2017-06-08 13:34:14 +09:00
Hitoshi Mitake 0c655902f2 auth, etcdserver: protect revoking lease with auth
Currently clients can revoke any lease without permission. This commit
lets etcdserver protect revoking with write permission.

This commit adds a mechanism for generating internal token. It is used
for indicating that LeaseRevoke was issued internally so it should be
able to delete any attached keys.
2017-06-07 17:46:14 -07:00
Anthony Romano fb086ef13f v3rpc: dedup resp.Header == nil checks 2017-06-07 09:25:42 -07:00
Anthony Romano 8542f2e673 v3rpc: use map for translating errors to grpc errors
Switch statement had poor coverage, use a map instead
2017-06-06 16:55:44 -07:00
Anthony Romano 887db5a3db *: fix go tool vet -all -shadow errors 2017-06-03 21:32:36 -07:00
Anthony Romano 0c923bdf11 Merge pull request #8010 from heyitsanthony/json-txn
e2e: test txn over grpc json
2017-06-01 10:01:41 -07:00
Anthony Romano d8210da505 v3rpc: treat nil txn request op as error
Fixes #7889
2017-05-31 12:39:52 -07:00
Anthony Romano a20e667c5b Merge pull request #7967 from heyitsanthony/purge-snapdb
etcdserver: purge old snap.db files
2017-05-30 16:15:11 -07:00
fanmin shi 68a72c6b6e v3rpc: change grpc max recv size as needed. 2017-05-25 11:01:51 -07:00
fanmin shi 9e7740011b etcdserver: add --max-request-bytes flag 2017-05-25 11:01:38 -07:00
fanmin shi b003734be6 Merge pull request #7976 from fanminshi/make_maxOpsPerTxn_configurable
etcdserver: add --max-txn-ops flag
2017-05-25 10:34:17 -07:00
fanmin shi e9f464debc integration: creation of cluster now takes maxTxnOps 2017-05-24 14:48:44 -07:00
fanmin shi ae7ddfb483 etcdserver: add --max-txn-ops flag
--max-txn-ops allows users to define the maximum transaction operations
for each txn request. it defaults at 128.

Fixes #7826
2017-05-24 10:32:32 -07:00
Anthony Romano c1c9a2c96c etcdserver: close mvcc.KV on init error path
Scheduled compaction will panic if KV is not stopped before
closing the backend.
2017-05-23 10:41:37 -07:00
Anthony Romano ab16fa1f07 etcdserver: purge old snap.db files
Lots of garbage db files in #7957. Should purge.
2017-05-22 15:44:21 -07:00
Hitoshi Mitake 4cd5e7ebb2 Merge pull request #7809 from mitake/auth-watch
protect watch with auth
2017-05-20 13:23:30 +09:00
Hitoshi Mitake 939912c425 clientv3, etcdserver: support auth in Watch() 2017-05-20 11:34:45 +09:00
Anthony Romano 33c375dc44 *: fill out blank package godocs
Mostly one-liner short descriptions, but also includes some typo fixes
and some examples.
2017-05-18 09:41:13 -07:00
Xiang 32c252f003 etcdserver: more logging on snapshot close path 2017-05-17 14:48:52 -07:00
Anthony Romano f6cd4d4f5b snap, etcdserver: tighten up snapshot path handling
Computing the snapshot file path is error prone; snapshot recovery was
constructing file paths missing a path separator so the snapshot
would never be loaded. Instead, refactor the backend path handling
to use helper functions where possible.
2017-05-11 13:46:59 -07:00
fanmin shi 47f5b7c3ad Merge pull request #7876 from fanminshi/fix_7628
etcdserver: renaming db happens after snapshot persists to wal and snap files
2017-05-09 16:15:41 -07:00
fanmin shi dfdaf082c5 etcdserver: add a test to ensure renaming db happens before persisting wal and snap files 2017-05-09 14:00:22 -07:00
fanmin shi 8b7b7222dd etcdserver: renaming db happens after snapshot persists to wal and snap files
In the case that follower recieves a snapshot from leader
and crashes before renaming xxx.snap.db to db but after
snapshot has persisted to .wal and .snap, restarting
follower results loading old db, new .wal, and new .snap.
This will causes a index mismatch between snap metadata index
and consistent index from db.

This pr forces an ordering where saving/renaming db must
happen after snapshot is persisted to wal and snap file.
this guarantees wal and snap files are newer than db.
on server restart, etcd server checks if snap index > db consistent index.
if yes, etcd server attempts to load xxx.snap.db where xxx=snap index
if there is any and panic other wise.

FIXES #7628
2017-05-09 14:00:12 -07:00
Iwasaki Yudai 010ffc0692 v3rpc: remove duplicated error case for lease.ErrLeaseNotFound 2017-05-08 20:09:41 -07:00
fanmin shi e33b10a666 etcdserver: add a test to ensure config change also update ConsistIndex 2017-05-02 16:51:40 -07:00
fanmin shi 5533c3058a etcdserver: apply() sets consistIndex for any entry type
previously, apply() doesn't set consistIndex for EntryConfChange type.
this causes a misalignment between consistIndex and applied index
where EntryConfChange entry results setting applied index but not consistIndex.

suppose that addMember() is called and leader reflects that change.
1. applied index and consistIndex is now misaligned.
2. a new follower node joined.
3. leader sends the snapshot to follower
	where the applied index is the snapshot metadata index.
4. follower node saves the snapshot and database(includes consistIndex) from leader.
5. restarting follower loads snapshot and database.
6. follower checks snapshot metadata index(same as applied index) and database consistIndex,
	finds them don't match, and then panic.

FIXES #7834
2017-05-02 14:57:36 -07:00
Anthony Romano 3ce31acda4 v3client: wrap watch ctxs with blank ctx
Printing the values in ctx.String() will data race if the value
is mutable and doesn't implement String(), which seems to be common.
Instead, just return a fixed string instead of computing it; v3client
watches don't need as much flexibility for creating separate strings,
so separate ctx strings probably aren't necessary at this point.

Fixes #7811
2017-04-25 15:03:06 -07:00
Gyu-Ho Lee 327f09fcb4 etcdserver: do not block on raft stopping
Signed-off-by: Gyu-Ho Lee <gyuhox@gmail.com>
2017-04-25 13:35:43 -07:00
Gyu-Ho Lee 91f6aee4f2 etcdserver: ensure waitForApply sync with applyAll
Problem is:

`Step1`: `etcdserver/raft.go`'s `Ready` process routine sends config-change entries via `r.applyc <- ap` (https://github.com/coreos/etcd/blob/master/etcdserver/raft.go#L193-L203)

`Step2`: `etcdserver/server.go`'s `*EtcdServer.run` routine receives this via `ap := <-s.r.apply()` (https://github.com/coreos/etcd/blob/master/etcdserver/server.go#L735-L738)

`StepA`: `Step1` proceeds without sync, right after sending `r.applyc <- ap`.

`StepB`: `Step2` proceeds without sync, right after `sched.Schedule(s.applyAll(&ep,&ap))`.

`StepC`: `etcdserver` tries to sync with `s.applyAll(&ep,&ap)` by calling `rh.waitForApply()`.

`rh.waitForApply()` waits for all pending jobs to finish in `pkg/schedule`
side. However, the order of `StepA`,`StepB`,`StepC` is not guaranteed. It
is possible that `StepC` happens first, and proceeds without waiting on
apply. And the restarting member comes back as a leader in single-node
cluster, when there is no synchronization between apply-layer and
config-change Raft entry apply. Confirmed with more debugging lines below,
only reproducible with slow CPU VM (~2 vCPU).

```
~:24.005397 I | etcdserver: starting server... [version: 3.2.0+git, cluster version: to_be_decided]
~:24.011136 I | etcdserver: [DEBUG] 29b2d24047a277df waitForApply before
~:24.011194 I | etcdserver: [DEBUG] 29b2d24047a277df starts wait for 0 pending jobs
~:24.011234 I | etcdserver: [DEBUG] 29b2d24047a277df finished wait for 0 pending jobs (current pending 0)
~:24.011268 I | etcdserver: [DEBUG] 29b2d24047a277df waitForApply after
~:24.011348 I | etcdserver: [DEBUG] [0] 29b2d24047a277df is scheduling conf change on 29b2d24047a277df
~:24.011396 I | etcdserver: [DEBUG] [1] 29b2d24047a277df is scheduling conf change on 5edf80e32a334cf0
~:24.011437 I | etcdserver: [DEBUG] [2] 29b2d24047a277df is scheduling conf change on e32e31e76c8d2678
~:24.011477 I | etcdserver: [DEBUG] 29b2d24047a277df scheduled conf change on 29b2d24047a277df
~:24.011509 I | etcdserver: [DEBUG] 29b2d24047a277df scheduled conf change on 5edf80e32a334cf0
~:24.011545 I | etcdserver: [DEBUG] 29b2d24047a277df scheduled conf change on e32e31e76c8d2678
~:24.012500 I | etcdserver: [DEBUG] 29b2d24047a277df applyConfChange on 29b2d24047a277df before
~:24.013014 I | etcdserver/membership: added member 29b2d24047a277df [unix://127.0.0.1:2100515039] to cluster 9250d4ae34216949
~:24.013066 I | etcdserver: [DEBUG] 29b2d24047a277df applyConfChange on 29b2d24047a277df after
~:24.013113 I | etcdserver: [DEBUG] 29b2d24047a277df applyConfChange on 29b2d24047a277df after trigger
~:24.013158 I | etcdserver: [DEBUG] 29b2d24047a277df applyConfChange on 5edf80e32a334cf0 before
~:24.013666 W | etcdserver: failed to send out heartbeat on time (exceeded the 10ms timeout for 11.964739ms)
~:24.013709 W | etcdserver: server is likely overloaded
~:24.013750 W | etcdserver: failed to send out heartbeat on time (exceeded the 10ms timeout for 12.057265ms)
~:24.013775 W | etcdserver: server is likely overloaded
~:24.013950 I | raft: 29b2d24047a277df is starting a new election at term 4
~:24.014012 I | raft: 29b2d24047a277df became candidate at term 5
~:24.014051 I | raft: 29b2d24047a277df received MsgVoteResp from 29b2d24047a277df at term 5
~:24.014107 I | raft: 29b2d24047a277df became leader at term 5
~:24.014146 I | raft: raft.node: 29b2d24047a277df elected leader 29b2d24047a277df at term 5
```

I am printing out the number of pending jobs before we call
`sched.WaitFinish(0)`, and there was no pending jobs, so it returned
immediately (before we schedule `applyAll`).

This is the root cause to:

- https://github.com/coreos/etcd/issues/7595
- https://github.com/coreos/etcd/issues/7739
- https://github.com/coreos/etcd/issues/7802

`sched.WaitFinish(0)` doesn't work when `len(f.pendings)==0` and
`f.finished==0`. Config-change is the first job to apply, so
`f.finished` is 0 in this case.

`f.finished` monotonically increases, so we need `WaitFinish(finished+1)`.
And `finished` must be the one before calling `Schedule`. This is safe
because `Schedule(applyAll)` is the only place adding jobs to `sched`.
Then scheduler waits on the single job of `applyAll`, by getting the
current number of finished jobs before sending `Schedule`.

Or just make it be blocked until `applyAll` routine triggers on the
config-change job. This patch just removes `waitForApply`, and
signal `raftDone` to wait until `applyAll` finishes applying entries.

Confirmed that it fixes the issue, as below:

```
~:43.198354 I | rafthttp: started streaming with peer 36cda5222aba364b (stream MsgApp v2 reader)
~:43.198740 I | etcdserver: [DEBUG] 3988bc20c2b2e40c waitForApply before
~:43.198836 I | etcdserver: [DEBUG] 3988bc20c2b2e40c starts wait for 0 pending jobs, 1 finished jobs
~:43.200696 I | integration: launched 3169361310155633349 ()
~:43.201784 I | etcdserver: [DEBUG] [0] 3988bc20c2b2e40c is scheduling conf change on 36cda5222aba364b
~:43.201884 I | etcdserver: [DEBUG] [1] 3988bc20c2b2e40c is scheduling conf change on 3988bc20c2b2e40c
~:43.201965 I | etcdserver: [DEBUG] [2] 3988bc20c2b2e40c is scheduling conf change on cf5d6cbc2a121727
~:43.202070 I | etcdserver: [DEBUG] 3988bc20c2b2e40c scheduled conf change on 36cda5222aba364b
~:43.202139 I | etcdserver: [DEBUG] 3988bc20c2b2e40c scheduled conf change on 3988bc20c2b2e40c
~:43.202204 I | etcdserver: [DEBUG] 3988bc20c2b2e40c scheduled conf change on cf5d6cbc2a121727
~:43.202444 I | etcdserver: [DEBUG] 3988bc20c2b2e40c applyConfChange on 36cda5222aba364b (request ID: 0) before
~:43.204486 I | etcdserver/membership: added member 36cda5222aba364b [unix://127.0.0.1:2100913646] to cluster 425d73f1b7b01674
~:43.204588 I | etcdserver: [DEBUG] 3988bc20c2b2e40c applyConfChange on 36cda5222aba364b (request ID: 0) after
~:43.204703 I | etcdserver: [DEBUG] 3988bc20c2b2e40c applyConfChange on 36cda5222aba364b (request ID: 0) after trigger
~:43.204791 I | etcdserver: [DEBUG] 3988bc20c2b2e40c applyConfChange on 3988bc20c2b2e40c (request ID: 0) before
~:43.205689 I | etcdserver/membership: added member 3988bc20c2b2e40c [unix://127.0.0.1:2101113646] to cluster 425d73f1b7b01674
~:43.205783 I | etcdserver: [DEBUG] 3988bc20c2b2e40c applyConfChange on 3988bc20c2b2e40c (request ID: 0) after
~:43.205929 I | etcdserver: [DEBUG] 3988bc20c2b2e40c applyConfChange on 3988bc20c2b2e40c (request ID: 0) after trigger
~:43.206056 I | etcdserver: [DEBUG] 3988bc20c2b2e40c applyConfChange on cf5d6cbc2a121727 (request ID: 0) before
~:43.207353 I | etcdserver/membership: added member cf5d6cbc2a121727 [unix://127.0.0.1:2100713646] to cluster 425d73f1b7b01674
~:43.207516 I | etcdserver: [DEBUG] 3988bc20c2b2e40c applyConfChange on cf5d6cbc2a121727 (request ID: 0) after
~:43.207619 I | etcdserver: [DEBUG] 3988bc20c2b2e40c applyConfChange on cf5d6cbc2a121727 (request ID: 0) after trigger
~:43.207710 I | etcdserver: [DEBUG] 3988bc20c2b2e40c finished scheduled conf change on 36cda5222aba364b
~:43.207781 I | etcdserver: [DEBUG] 3988bc20c2b2e40c finished scheduled conf change on 3988bc20c2b2e40c
~:43.207843 I | etcdserver: [DEBUG] 3988bc20c2b2e40c finished scheduled conf change on cf5d6cbc2a121727
~:43.207951 I | etcdserver: [DEBUG] 3988bc20c2b2e40c finished wait for 0 pending jobs (current pending 0, finished 1)
~:43.208029 I | rafthttp: started HTTP pipelining with peer cf5d6cbc2a121727
~:43.210339 I | rafthttp: peer 3988bc20c2b2e40c became active
~:43.210435 I | rafthttp: established a TCP streaming connection with peer 3988bc20c2b2e40c (stream MsgApp v2 reader)
~:43.210861 I | rafthttp: started streaming with peer 3988bc20c2b2e40c (writer)
~:43.211732 I | etcdserver: [DEBUG] 3988bc20c2b2e40c waitForApply after
```

Signed-off-by: Gyu-Ho Lee <gyuhox@gmail.com>
2017-04-25 10:22:27 -07:00
Anthony Romano 2bb33181b6 v2http: remove deprecated /v2/machines path 2017-04-22 03:11:21 -07:00
Anthony Romano 393e4335b7 *: put gateway stubs into their own packages
Fixes #7773
2017-04-19 13:09:06 -07:00
Anthony Romano d24a763a12 Merge pull request #7771 from heyitsanthony/remove-2.0-version
etcdserver: remove 2.0 StatusNotFound version check
2017-04-19 00:57:19 -07:00
Hitoshi Mitake d3456b5ecd Merge pull request #7759 from mitake/fix-7724
*: simply ignore ErrAuthNotEnabled in clientv3 if auth is not enabled
2017-04-19 16:07:18 +09:00
Anthony Romano 3d8e2e1171 etcdserver: remove 2.0 StatusNotFound version check 2017-04-18 20:22:56 -07:00
Hitoshi Mitake e1306bff8f *: simply ignore ErrAuthNotEnabled in clientv3 if auth is not enabled
Fix https://github.com/coreos/etcd/issues/7724
2017-04-19 11:27:14 +09:00
Anthony Romano 714b48a4b4 etcdserver: initialize raftNode with constructor
raftNode was being initialized in start(), which was causing
hangs when trying to stop the etcd server since the stop channel
would not be initialized in time for the stop call. Instead,
setup non-configurable bits in a constructor.

Fixes #7668
2017-04-18 09:33:59 -07:00
Hitoshi Mitake ac69e63fa8 etcdserver: fill-in Auth API Header in apply layer
Replacing "etcdserver: fill a response header in auth RPCs"
The revision should be set at the time of "apply",
not in later RPC layer.

Fix https://github.com/coreos/etcd/issues/7691

Signed-off-by: Gyu-Ho Lee <gyuhox@gmail.com>
2017-04-17 14:26:26 -07:00
Gyu-Ho Lee cfbc5e5c3b Merge pull request #7706 from gyuho/wait-apply-conf-change
etcdserver: wait apply on conf change Raft entry
2017-04-13 16:54:06 -07:00
Gyu-Ho Lee 04354f32ab etcdserver: wait apply on conf change Raft entry
When apply-layer sees configuration change entry in
raft.Ready.CommittedEntries, the server should not proceed
until that entry is applied. Otherwise, follower's raft
layer advances, possibly election-timeouts, and becomes
the leader in single-node cluster, before add-node conf
change of other nodes is applied.

Fix https://github.com/coreos/etcd/issues/7595.

Signed-off-by: Gyu-Ho Lee <gyuhox@gmail.com>
2017-04-13 15:59:24 -07:00
Xiang Li 957c9cd1df Merge pull request #7734 from mitake/status-auth
etcdserver: let Status() not require authentication
2017-04-13 15:53:33 -07:00
Hitoshi Mitake 67f2e41f20 etcdserver: let Status() not require authentication
The information that can be obtained with the RPC doesn't need to be
protected.

Fix https://github.com/coreos/etcd/issues/7721
2017-04-13 17:39:09 +09:00
Anthony Romano d9ec6b4d22 *: return updated member list in v3 rpcs
Now it's possible to atomically know the new member configuration from
issuing a membership change RPC.
2017-04-12 16:24:51 -07:00
Anthony Romano 78a5eb79b5 *: add swagger and grpc-gateway assets for v3lock and v3election 2017-04-10 15:21:07 -07:00
Anthony Romano dc8115a534 v3election: Election RPC service
Fixes #7589
2017-04-07 16:36:38 -07:00
Anthony Romano 135a40751e v3rpc: force RangeEnd=nil if length is 0
gRPC will replace empty strings with nil, but for the embedded case it's
possible for []byte{} to slip in and confuse the single key / >= key
watch logic.
2017-04-07 16:36:38 -07:00
Gyu-Ho Lee 7f2d6b3ef6 clientv3,v3client: add cluster embedded client
Signed-off-by: Gyu-Ho Lee <gyuhox@gmail.com>
2017-04-04 08:14:18 -07:00
Anthony Romano 24e4c94d98 Merge pull request #7640 from heyitsanthony/etcdserver-ctx
etcdserver: ctx-ize server initiated requests
2017-04-03 09:07:28 -07:00
Anthony Romano 8ad935ef2c etcdserver: use cancelable context for server initiated requests 2017-03-31 19:19:33 -07:00
Anthony Romano 833769f59f v3rpc: return leader loss error if lease stream is canceled
Canceling the stream won't cancel the receive since it's using the internal
grpc context, not the one assigned by etcd.
2017-03-30 20:18:33 -07:00
Anthony Romano 1ff0b71b30 *: use protoc 3.2.0
Fixes #7631
2017-03-30 13:43:10 -07:00
Asko Kauppi dae2755253 Documentation: fix typos 2017-03-30 11:41:50 +03:00
Gyu-Ho Lee 0bf110e27f clientv3,v3client: maintenance to embedded client
Signed-off-by: Gyu-Ho Lee <gyuhox@gmail.com>
2017-03-28 14:12:43 -07:00
andelf 54efb460af etcdserver: fix a typo in bucket name var 2017-03-24 13:11:01 +08:00
Xiang Li 54928f5deb Merge pull request #7524 from mitake/del-and-revoke-role
auth: changes of managing roles and users
2017-03-23 15:10:10 -07:00
Anthony Romano 7ef75e373a Merge pull request #7525 from heyitsanthony/big-backend
etcdserver, backend: configure mmap size based on quota
2017-03-23 10:06:00 -07:00
Hitoshi Mitake c40b86bcde auth, etcdserver: forbid invalid auth management
If auth is enabled,
1. deleting the user root
2. revoking the role root from the user root
must not be allowed. This commit forbids them.
2017-03-23 16:47:58 +09:00
Hitoshi Mitake 5594f695bc e2e, etcdserver: fix wrong usages of ordinal
They must be "ordinary".
2017-03-21 23:50:16 +09:00
Anthony Romano effa6e0767 etcdserver: remove legacy range/txn
Needed for 3.0->3.1. Not needed for 3.1->3.2
2017-03-20 15:17:17 -07:00
Anthony Romano ae7b4ee8ed *: fix gosimple warning for fmt.Sprintf("%s") 2017-03-20 13:26:39 -07:00
Anthony Romano 8a3fee15a3 etcdserver, backend: only warn if exceeding max quota 2017-03-17 15:38:57 -07:00
Anthony Romano 5e4b008106 *: base initial mmap size on quota size 2017-03-17 15:38:49 -07:00
Anthony Romano 2f1542c06d *: use filepath.Join for files 2017-03-16 07:46:06 -07:00
Gyu-Ho Lee 80c10e150f etcdserver: remove possibly compacted entry look-up
Fix https://github.com/coreos/etcd/issues/7470.

This patch removes unnecessary term look-up in
'createMergedSnapshotMessage', which can trigger panic
if raft entry at etcdProgress.appliedi got compacted
by subsequent 'MsgSnap' messages--if a follower is
being (in this case, network latency spikes), it
could receive subsequent 'MsgSnap' requests from leader.

etcd server-side 'applyAll' routine and raft's Ready
processing routine becomes asynchronous after raft
entries are persisted. And given that raft Ready routine
takes less time to finish, it is possible that second
'MsgSnap' is being handled, while the slow 'applyAll'
is still processing the first(old) 'MsgSnap'. Then raft
Ready routine can compact the log entries at future
index to 'applyAll'. That is how 'createMergedSnapshotMessage'
tried to look up raft term with outdated etcdProgress.appliedi.

Signed-off-by: Gyu-Ho Lee <gyuhox@gmail.com>
2017-03-15 12:46:56 -07:00
Anthony Romano dea2516177 v3client: fix doc to use e.Server
Was passing embed.Etcd instead of etcdserver.EtcdServer.
2017-03-15 09:17:17 -07:00
Xiang Li df839f3b7f Merge pull request #7497 from xiang90/fix_candidate
etcdserver: candidate should wait for applying all configuration changes
2017-03-14 20:10:02 -07:00
Xiang 7f0733cf46 etcdserver: candidate should wait for applying all configuration changes 2017-03-14 17:20:20 -07:00
Anthony Romano 01d1a579bc v3client: add example and godoc New 2017-03-14 10:50:41 -07:00
Anthony Romano 47cd9d0277 v3lock: server-side api for locking 2017-03-13 15:23:26 -07:00
Anthony Romano 763a37d3f1 v3client: a bridge between an etcdserver and a clientv3 2017-03-13 15:23:26 -07:00
Anthony Romano 58da8b17ee etcdserver: support mvcc txn 2017-03-08 20:54:15 -08:00
Hitoshi Mitake f8a290e7ca *: support jwt token in v3 auth API
This commit adds jwt token support in v3 auth API.

Remaining major ToDos:
- Currently token type isn't hidden from etcdserver. In the near
  future the information should be completely invisible from
  etcdserver package.
- Configurable expiration of token. Currently tokens can be valid
  until keys are changed.

How to use:
1. generate keys for signing and verfying jwt tokens:
 $ openssl genrsa -out app.rsa 1024
 $ openssl rsa -in app.rsa -pubout > app.rsa.pub
2.  add command line options to etcd like below:
--auth-token-type jwt \
--auth-jwt-pub-key app.rsa.pub --auth-jwt-priv-key app.rsa \
--auth-jwt-sign-method RS512
3. launch etcd cluster

Below is a performance comparison of serializable read w/ and w/o jwt
token. Every (3) etcd node is executed on a single machine. Signing
method is RS512 and key length is 1024 bit. As the results show, jwt
based token introduces a performance overhead but it would be
acceptable for a case that requires authentication.

w/o jwt token auth (no auth):

Summary:
  Total:        1.6172 secs.
  Slowest:      0.0125 secs.
  Fastest:      0.0001 secs.
  Average:      0.0002 secs.
  Stddev:       0.0004 secs.
  Requests/sec: 6183.5877

Response time histogram:
  0.000 [1]     |
  0.001 [9982]  |∎∎∎∎∎∎∎∎∎∎∎∎∎∎∎∎∎∎∎∎∎∎∎∎∎∎∎∎∎∎∎∎∎∎∎∎∎∎∎∎
  0.003 [1]     |
  0.004 [1]     |
  0.005 [0]     |
  0.006 [0]     |
  0.008 [6]     |
  0.009 [0]     |
  0.010 [1]     |
  0.011 [5]     |
  0.013 [3]     |

Latency distribution:
  10% in 0.0001 secs.
  25% in 0.0001 secs.
  50% in 0.0001 secs.
  75% in 0.0001 secs.
  90% in 0.0002 secs.
  95% in 0.0002 secs.
  99% in 0.0003 secs.

w/ jwt token auth:

Summary:
  Total:        2.5364 secs.
  Slowest:      0.0182 secs.
  Fastest:      0.0002 secs.
  Average:      0.0003 secs.
  Stddev:       0.0005 secs.
  Requests/sec: 3942.5185

Response time histogram:
  0.000 [1]     |
  0.002 [9975]  |∎∎∎∎∎∎∎∎∎∎∎∎∎∎∎∎∎∎∎∎∎∎∎∎∎∎∎∎∎∎∎∎∎∎∎∎∎∎∎∎
  0.004 [0]     |
  0.006 [1]     |
  0.007 [11]    |
  0.009 [2]     |
  0.011 [4]     |
  0.013 [5]     |
  0.015 [0]     |
  0.016 [0]     |
  0.018 [1]     |

Latency distribution:
  10% in 0.0002 secs.
  25% in 0.0002 secs.
  50% in 0.0002 secs.
  75% in 0.0002 secs.
  90% in 0.0003 secs.
  95% in 0.0003 secs.
  99% in 0.0004 secs.
2017-03-06 19:46:03 -08: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
Anthony Romano 5da5b834e5 api: default to V3 capability
Fixes #7154
2017-03-02 14:02:09 -08:00
Anthony Romano 43740a8d3c Merge pull request #7318 from heyitsanthony/limit-doc
etcdserverpb, clientv3: clarify WithLimit documentation
2017-02-13 15:35:37 -08:00
Anthony Romano fb7dd0f688 etcdserverpb, clientv3: clarify WithLimit documentation
Fixes #7316
2017-02-13 12:37:44 -08:00
fanmin shi 2925f02aac Merge pull request #7305 from fanminshi/return_header_for_timetolive
lease: LeaseTimeToLive returns TTL=-1 resp on lease not found
2017-02-13 11:24:36 -08:00
fanmin shi 2ca1823a96 v3rpc: LeaseTimeToLive returns TTL=-1 resp on lease not found 2017-02-10 16:33:31 -08:00
Manjunath A Kumatagi 0914b8b707 test: Fix gosimple errors
Getting gosimple suggestion while running test script, so this PR is for fixing gosimple S1019 check.
raft/node_test.go:456:40: should use make([]raftpb.Entry, 1) instead (S1019)
raft/node_test.go:457:49: should use make([]raftpb.Entry, 1) instead (S1019)
raft/node_test.go:458:43: should use make([]raftpb.Message, 1) instead (S1019)

Refer https://github.com/dominikh/go-tools/blob/master/cmd/gosimple/README.md#checks for more information.
2017-02-09 08:01:28 -05:00
Hitoshi Mitake 0191509637 auth, etcdserver: authenticate clients based on certificate CommonName
This commit lets v3 auth mechanism authenticate clients based on
CommonName of certificate like v2 auth.
2017-01-31 17:22:12 +09:00
sharat 8a87769a09 etcdserver: use prev-lease for 'ignore_lease' writes 2017-01-25 03:05:55 +05:30
sharat 5ac4e4255a v3rpc: error for non empty lease with 'ignore_lease' 2017-01-25 03:04:07 +05:30
sharat 508c9dfe5c *: regenrate proto files with 'ignore_lease' 2017-01-25 03:01:47 +05:30
sharat a9bf593bdc *: 'ignore_lease' to detach value with PutRequest 2017-01-25 02:59:30 +05:30
Anthony Romano 7e31ddd32a etcdserverpb: rework documentation for range request 2017-01-20 16:12:09 -08:00
Anthony Romano 1a962df596 Merge pull request #7176 from heyitsanthony/bump-lread-timeout
etcdserver: use ReqTimeout for linearized read
2017-01-17 16:08:50 -08:00
Anthony Romano 5c774ff571 etcdserver: use ReqTimeout for linearized read
Fixes #7136
2017-01-17 14:55:39 -08:00
Xiang Li 699b1e5b3a Merge pull request #7160 from xiang90/snapshotcount
etcdserver: increase snapshot to 100,000
2017-01-14 16:53:44 -08:00
Xiang Li 26d99269c0 Merge pull request #6898 from mitake/auth-maintain
RFC, WIP: etcdserver: let maintenance services require root role
2017-01-14 11:22:14 -08:00
Hitoshi Mitake 9886e9448e auth, etcdserver: let maintenance services require root role
This commit lets maintenance services require root privilege. It also
moves AuthInfoFromCtx() from etcdserver to auth pkg for cleaning purpose.
2017-01-14 19:36:24 +09:00
Xiang Li c5a9d54835 etcdserver: increase snapshot to 100,000
Keep more wal entries in memory for fast follower recovery.
10,000 was a too small number that triggers quite a few snapshots.
ZK proves that 100,000 is a reasonable number for even old less prowerful
machines.

Eventually we should provide both count and max memory (for large entries).
2017-01-13 18:05:25 -08:00
Gyu-Ho Lee 8752ee52a5 etcdserver: use prev-value for ignore_value writes 2017-01-13 15:13:18 -08:00
Gyu-Ho Lee e655420d33 v3rpc: error for non-empty value with ignore_value 2017-01-13 15:13:18 -08:00
Gyu-Ho Lee 7f8b5774a4 *: regenerate proto files with 'ignore_value' 2017-01-13 15:13:18 -08:00
Gyu-Ho Lee 8eea93942d *: 'ignore_value' to detach lease with PutRequest 2017-01-13 15:13:18 -08:00
Gyu-Ho Lee ea94aea136 etcdserver/api: add 3.2 in capability 2017-01-13 14:00:03 -08:00
Hitoshi Mitake d431b64d97 etcdserver, clientv3: handle a case of expired auth token
This commit adds a mechanism of handling a case of expired auth token
to clientv3. If a server returns an error code
grpc.codes.Unauthenticated, newRetryWrapper() tries to get a new token
and use it as an option of PerRPCCredential.

Fixes https://github.com/coreos/etcd/issues/7012
2017-01-12 11:49:02 +09:00
Anthony Romano a42b399f4e Merge pull request #7094 from heyitsanthony/fix-duplicate-grant
auth: use quorum get for GetUser/GetRole for mutable operations
2017-01-05 11:28:33 -08:00
Gyu-Ho Lee 10d3b81c39 Merge pull request #7093 from gyuho/member
etcdserver: expose ErrMemberNotEnoughStarted
2017-01-04 12:09:29 -08:00
Anthony Romano f9f691ef1f auth: use quorum get for GetUser/GetRole for mutable operations
GetUser would not propagate to the minority node, causing TestCtlV2GetRoleUser to
run CreateUser instead of UpdateUser. Instead, use quorum get to fetch the
current state of auth.

Fixes #7069
2017-01-04 11:55:07 -08:00
vimalk78 5fac6b8d15 etcdserver: resume compactor only if leader 2017-01-04 05:01:14 +05:30
Gyu-Ho Lee 2b5f9e1c6b etcdserver: expose ErrNotEnoughStartedMembers
Fix https://github.com/coreos/etcd/issues/7072.
2017-01-03 15:23:06 -08:00
fanmin shi 2a1bae0c2a etcdserver: consistent naming in raftReadyHandler 2016-12-29 11:27:16 -08:00
Anthony Romano e2463569e7 v2http: submit QGET in health endpoint if no progress
Removing the periodic SYNC calls broke the health endpoint since the
raft index stops updating. Instead, don't bother monitoring the
raft index; issue a QGET directly to get a consensus response.

Fixes #6985
2016-12-28 12:20:56 -08:00
fanmin shi 89b18ff1af Merge pull request #7015 from fanminshi/fix_lease_expired_too_soon
lease: force leader to apply its pending committed index for lease op…
2016-12-27 11:26:15 -08:00
fanmin shi 2faf72f47c etcdserver: rework update committed index logic 2016-12-27 10:11:40 -08:00
Anthony Romano 17873f7be8 Merge pull request #7008 from heyitsanthony/fix-dns
retry on resolution failure for advertised peer DNS check
2016-12-27 10:03:01 -08:00
fanmin shi fef4a79528 lease: force leader to apply its pending committed index for lease operations
suppose a lease granting request from a follower goes through and followed by a lease look up or renewal, the leader might not apply the lease grant request locally. So the leader might not find the lease from the lease look up or renewal request which will result lease not found error. To fix this issue, we force the leader to apply its pending commited index before looking up lease.

FIX #6978
2016-12-22 14:24:38 -08:00
Anthony Romano 87b1d9571f v3api, rpctypes: add ErrTimeoutDueToConnectionLost
Lack of GRPC code was causing this to look like a halting error to the client.
2016-12-16 10:25:35 -08:00
Xiang Li 35fd5dc9fc Merge pull request #6903 from mitake/auth-member
protect membership change RPCs with auth
2016-12-15 08:04:31 -08:00
Hitoshi Mitake 86d7390804 auth, etcdserver: protect membership change operations with auth
This commit protects membership change operations with auth. Only
users that have root role can issue the operations.

Implements https://github.com/coreos/etcd/issues/6899
2016-12-15 22:54:20 +09:00
Anthony Romano 26a3e9a740 membership: retry for 30s on advertise url check 2016-12-14 15:56:22 -08:00
Anthony Romano 29c30b2387 etcdserver: retry for 30s on advertise url check 2016-12-14 15:56:22 -08:00
Gyu-Ho Lee eb8646a381 v3rpc: remove unused 'splitMethodName' function 2016-12-12 10:07:14 -08:00
Anthony Romano 2c06def8ca etcdserver, embed, v2http: move pprof setup to embed
Seems like a better place for prof setup since it's not specific to v2.
2016-12-09 12:37:35 -08:00
Xiang Li 2f96a68a20 etcdserver: do not send v2 sync if ttl keys do not exist 2016-12-07 14:48:15 -08:00
Anthony Romano da3b71b531 Merge pull request #6929 from heyitsanthony/ctx-lease-renew
etcdserver: use context for Renew
2016-12-07 00:05:14 -08:00
Anthony Romano be1f36d97c v3rpc, etcdserver, leasehttp: ctxize Renew with request timeout
Would retry a few times before returning a not primary error that
the client should never see. Instead, use proper timeouts and
then return a request timeout error on failure.

Fixes #6922
2016-12-06 14:09:57 -08:00
Gyu-Ho Lee 3fd1d951f8
etcdserver: time out when readStateC is blocking
Otherwise, it will block forever when the server is overloaded.

Fix https://github.com/coreos/etcd/issues/6891.
2016-12-05 15:34:46 -08:00
Anthony Romano 7079bf9a75 Merge pull request #6574 from vimalk78/auth-simpletoken-not-removed#6554
auth/simple_token.go : token not removed when etcdctl session closes …
2016-11-30 11:33:23 -08:00
Vimal Kumar dfe853ebff auth: add a timeout mechanism to simple token 2016-11-28 17:21:13 +05:30
Anthony Romano 9a20743190 v3rpc: don't close watcher if client closes send
grpc-gateway will CloseSend but still want to receive updates.
2016-11-17 15:33:37 -08:00
Gyu-Ho Lee 5e810e30cc v3rpc: replace grpc metrics w/ go-grpc-prometheus
And disable histogram
2016-11-14 15:20:09 -08:00
Gyu-Ho Lee b8b72f80f9 *: revendor, update proto files 2016-11-10 12:02:00 -08:00
fanmin shi ab6b175a2a Merge pull request #6828 from fanminshi/add_not_equal_to_compare
etcdserver, clientv3: add "!=" to txn
2016-11-09 15:27:08 -08:00
fanmin shi c2fd42b556 etcdserver, clientv3: add "!=" to txn
adding != to compare is a requested functionality from a etcd user

FIX #6719
2016-11-09 14:28:36 -08:00
Gyu-Ho Lee c817df1d32 etcdserver: increase maxGapBetweenApplyAndCommitIndex
This exists to prevent sending too many requests that
would lead into applier falling behind Raft accepting-proposal.

Based on recent benchmarks, etcd was able to process high workloads
(2 million writes with 1K concurrent clients).

The limit 1000 is too conservative to test those high workloads.
2016-11-09 09:44:11 -08:00
Gyu-Ho Lee 67082e5bd1 v3rpc: add gRPC active streamsGauge 2016-11-04 11:09:20 -07:00
Xiang Li 6a0a0a7ea1 etcdserver: make snaptest fail fast 2016-11-03 14:44:08 -07:00
Gyu-Ho Lee bbc1cdafef Merge pull request #6791 from gyuho/grpc-leader
etcdserver: translate EOF to ErrNoLeader for renew, timetolive
2016-11-02 22:54:46 -07:00
Gyu-Ho Lee cc304ac03c etcdserver: translate EOF to ErrNoLeader for renew, timetolive
Address https://github.com/coreos/etcd/issues/6754.

In case there are network errors or unexpected EOF errors
in TimeToLive http requests to leader, we translate that into
ErrNoLeader, and expects the client to retry its request.
2016-11-02 22:22:05 -07:00
Xiang Li 2fb2b463a3 Merge pull request #6786 from mitake/empty-user
auth, etcdserver: forbid adding a user with empty name
2016-11-02 22:10:58 -07:00
Hitoshi Mitake f85701a46f auth, etcdserver: forbid adding a user with empty name 2016-11-03 13:45:39 +09:00
Xiang Li c33d04fb54 etcdserver: print out warning when waiting for file lock 2016-11-01 17:55:16 -07:00
Hitoshi Mitake fdf433024f etcdserver: linearizable password checking at the API layer
For avoiding a schedule that can cause an inconsistent auth store [1],
password checking must be done in a linearizable manner.

Fixes https://github.com/coreos/etcd/issues/6675 and https://github.com/coreos/etcd/issues/6683

[1] https://github.com/coreos/etcd/issues/6675#issuecomment-255006389
2016-11-01 00:02:33 -07:00
Gyu-Ho Lee 136c02da71 Merge pull request #6738 from gyuho/raft-cleanup
etcdserver: move 'EtcdServer.send' to raft.go
2016-10-31 15:15:08 -07:00
Gyu-Ho Lee 5bd00ab1f6 *: fix minor typos 2016-10-31 09:47:15 -07:00
Gyu-Ho Lee 6ec03d3f7c etcdserver: move 'EtcdServer.send' to raft.go
Clear 'TODO'
2016-10-26 16:26:00 -07:00
Gyu-Ho Lee 1cd6fefd49 etcdserver: set sort ASCEND for empty sort order
when target is not key
2016-10-18 16:29:19 -07:00
Hitoshi Mitake 39e9b1f75a auth, etcdserver: check password at API layer
The cost of bcrypt password checking is quite high (almost 100ms on a
modern machine) so executing it in apply loop will be
problematic. This commit exclude the checking mechanism to the API
layer. The password checking is validated with the OCC like way
similar to the auth of serializable get.

This commit also removes a unit test of Authenticate RPC from
auth/store_test.go. It is because the RPC now accepts an auth request
unconditionally and delegates the checking functionality to
authStore.CheckPassword() (so a unit test for CheckPassword() is
added). The combination of the two functionalities can be tested by
e2e (e.g. TestCtlV3AuthWriteKey).

Fixes https://github.com/coreos/etcd/issues/6530
2016-10-17 14:18:21 +09:00
Xiang Li 698a789644 Merge pull request #6655 from kragniz/range_end-docs
etcdserver: document DeleteRangeRequest prefixes
2016-10-14 15:00:24 -07:00
Louis Taylor ce6276a2e8
etcdserver: document DeleteRangeRequest prefixes
There was missing info about deleting prefixes in the proto docs for
DeleteRangeRequest.

Closes #6641.
2016-10-14 21:39:03 +01:00
Louis Taylor 9df97eb441
etcdserver: increase warnApplyDuration from 10ms to 100ms
When running test suites for a client locally I'm getting spammed by log
lines such as:

    etcdserver: apply entries took too long [14.226771ms for 1 entries]

The comments in #6278 mention there were future plans of increasing the
threshold for logging these warnings, but it hadn't been done yet.
2016-10-13 17:55:50 +01:00
Gyu-Ho Lee 0c61d8804a etcdserver: make WaitGroup.Add sync with Wait 2016-10-12 13:11:35 -07:00
Xiang Li dbaa44372b etcdserver: better panic logging 2016-10-11 13:34:18 -07:00
Gyu-Ho Lee e011ea25ca etcdserver: separate EtcdServer from raftNode 2016-10-07 13:18:39 -07:00
fanmin shi ea9e857eb9 Merge pull request #6599 from fanminshi/lease_error_type_fix
Lease: Add lease errors to togRPCError()
2016-10-06 15:47:51 -07:00
Xiang Li cbbd1f0f44 Merge pull request #6598 from xiang90/cleanup
v3rpc: return nil as error explicitly
2016-10-06 15:30:04 -07:00
fanmin shi a862fd9f0f Lease: Add lease errors to togRPCError()
This allows lease's function to convert lease error to appropriate GRPC errors
2016-10-06 14:29:31 -07:00
Xiang Li 10cafe56b8 v3rpc: return nil as error explicitly 2016-10-06 14:14:43 -07:00
Gyu-Ho Lee 65ac718a11 etcdserver: use 'TTL()' on lease.Lease 2016-10-06 11:24:12 -07:00
Xiang Li f0469f7f25 Merge pull request #6570 from xiang90/lease_expire
Fix lease expire
2016-10-05 15:49:45 -07:00
Xiang Li 0f0c048e29 etcdserver: fix early lessor promotion issue
If we promote the lessor before finish applying all
entries from the last term, we might incorrectly renew
the already revoked leases.

Here is an example:

- Term 1: revoke lease A accepted by raft
- Old leader failed, new election happened
- Term 2: promote
- Term 2: keep alive A succeed. A now has 10 seconds TTL
- Term 2: revoke lease A from Term 1 got committed and applied
- Term 2: the lease A with 10 seconds TTL is revoked

To solve this, the new leader MUST apply all entries from old term
before promote its lessor to start accept renew requests.
2016-10-05 14:41:47 -07:00
Gyu-Ho Lee 9b56e51ca7 *: regenerate proto + gofmt change 2016-10-03 15:34:34 -07:00
Xiang Li dfe85b26cc Merge pull request #6571 from xiang90/log_pkg
*: set repo correctly for logging
2016-10-03 15:49:44 -05:00
Xiang Li 962433c17f *: set repo correctly for logging 2016-10-03 17:03:22 +08:00
Anthony Romano 289e3c0c63 etcdserver: use stream recorder for TestPublishRetry
Fixes #6546
2016-09-30 15:43:32 -07:00
Xiang Li ea0c65797a etcdserver: use linearizableReadNotify for txn 2016-09-28 20:47:49 +08:00