Commit Graph

1889 Commits (d1139d3a66303c75f914888418915a0ec3eadd97)

Author SHA1 Message Date
Gyuho Lee 38326d002e etcdserver/v2store: use "zap" logger in v2v3 tests
Signed-off-by: Gyuho Lee <gyuhox@gmail.com>
2018-05-01 16:15:09 -07:00
Gyuho Lee b3bd5887cd etcdserver: clarify server membership change logging
Signed-off-by: Gyuho Lee <gyuhox@gmail.com>
2018-05-01 15:06:29 -07:00
Gyuho Lee 200401248a
Merge pull request #9665 from gyuho/unconvert
test: integrate github.com/mdempsky/unconvert
2018-05-01 09:52:44 -07:00
Gyuho Lee eae30a6c9b etcdserver: fix "unconvert" warnings
Signed-off-by: Gyuho Lee <gyuhox@gmail.com>
2018-04-30 15:32:16 -07:00
Hitoshi Mitake a9225c164a etcdserver: not print password in the warning message of expensive request
Fix https://github.com/coreos/etcd/issues/9635
2018-04-30 13:44:27 -07:00
Gyuho Lee 30dd8a7dde etcdserver: support structured logging for auth
Signed-off-by: Gyuho Lee <gyuhox@gmail.com>
2018-04-27 14:19:51 -07:00
Gyuho Lee 0e565c8960 etcdserver: use structured logging in "advertiseMatchesCluster"
Signed-off-by: Gyuho Lee <gyuhox@gmail.com>
2018-04-27 11:40:30 -07:00
Gyuho Lee f7f6fdeb52 etcdserver: support structured logger for discovery, compactor
Signed-off-by: Gyuho Lee <gyuhox@gmail.com>
2018-04-26 14:36:22 -07:00
Gyuho Lee dca3f5e3ad
Merge pull request #9626 from yudai/fix_set_inexist_dir
etcdserver: Fix v2v3api set to create parent directly if not exists
2018-04-26 11:50:27 -07:00
Iwasaki Yudai 3c25465855 etcdserver: Fix v2v3api set to create parent directly if not exists
When a new file is created under an non existent directly,
the v2 API automatically create the parent directly.
This commit aligns the behaviour of v2v3 emulation to comply with the v2
API.
2018-04-25 17:36:59 -07:00
Gyuho Lee 3ea7a5d0bd etcdserver: add "LoggerCore" field for Raft logger
Signed-off-by: Gyuho Lee <gyuhox@gmail.com>
2018-04-25 10:16:54 -07:00
Gyuho Lee 4f45f5d9dd
Merge pull request #9591 from gyuho/election
*: add --initial-election-tick-advance to configure election fast-forward on bootstrap
2018-04-23 10:17:49 -07:00
Gyuho Lee 83f7f174da etcdserver: print server configuration duration fields in string
Signed-off-by: Gyuho Lee <gyuhox@gmail.com>
2018-04-20 13:11:11 -07:00
Gyuho Lee 5f8abdc227 etcdserver: log auto compaction on server start
Signed-off-by: Gyuho Lee <gyuhox@gmail.com>
2018-04-20 11:58:36 -07:00
Gyuho Lee f205b22434 etcdserver: fix snapshot panic message
Signed-off-by: Gyuho Lee <gyuhox@gmail.com>
2018-04-20 11:20:17 -07:00
Gyuho Lee 21d2e2ab6e etcdserver: add more tick fast-forward logs
Signed-off-by: Gyuho Lee <gyuhox@gmail.com>
2018-04-19 17:45:23 -07:00
Gyuho Lee 4bec0d7d67 etcdserver: add "InitialElectionTickAdvance"
Signed-off-by: Gyuho Lee <gyuhox@gmail.com>
2018-04-19 17:45:23 -07:00
Gyuho Lee 8296ce0930 rafthttp: add/fix debugging lines
Signed-off-by: Gyuho Lee <gyuhox@gmail.com>
2018-04-19 13:18:57 -07:00
Maciej Borsz 46bc966aa7 etcdserver: add is_leader prometheus metric that is 1 on the leader.
Before this change, we had now way to find a leader using /metrics
endpoint. This commit adds a metric to do that.
2018-04-19 11:47:40 +02:00
Gyuho Lee d0847f4f25 *: clean up/fix server structured logs
Signed-off-by: Gyuho Lee <gyuhox@gmail.com>
2018-04-18 12:54:43 -07:00
Gyuho Lee a47c18ff5b embed: clean up initial server start logs
Signed-off-by: Gyuho Lee <gyuhox@gmail.com>
2018-04-17 14:24:08 -07:00
Gyuho Lee bdbed26f64 etcdserver: support structured logging
Signed-off-by: Gyuho Lee <gyuhox@gmail.com>
2018-04-16 17:36:00 -07:00
Gyuho Lee 041b9069a2 *: configure server logger
- Add/Document "logger" to support structured logging.
  - This makes functional tests run easier, since zap logger
    provides built-in log redirect to files.
  - "etcd --logger-option=zap" to enable structured logging.
- Current "capnslog" will still be used as "default".
  - We may switch the default or deprecate "capnslog" in v3.5.
  - Either way, will clearly be documented.

Signed-off-by: Gyuho Lee <gyuhox@gmail.com>
2018-04-16 17:36:00 -07:00
Gyuho Lee 03cf9c45f8 etcdserver: fix typo in "adjustTicks"
Signed-off-by: Gyuho Lee <gyuhox@gmail.com>
2018-04-13 14:53:51 -07:00
disksing 10bf0283be etcdserver/stats: make all fields guarded by mutex. 2018-04-12 10:43:11 +08:00
disksing ba59bb2c2b etcdserver/stats: fix stats data race. 2018-04-11 21:37:09 +08:00
Gyuho Lee efe981e618 Revert "etcdserver: handle raft Propose error in v2 applier"
This reverts commit b38e138baf.
2018-04-10 18:38:01 -07:00
Gyuho Lee b38e138baf etcdserver: handle raft Propose error in v2 applier
Handle "raft.ErrProposalDropped" as in v3 applier.

Signed-off-by: Gyuho Lee <gyuhox@gmail.com>
2018-04-10 16:01:14 -07:00
Gyuho Lee 744c73e019 etcdserver: fix "lease_expired_total" metrics
Signed-off-by: Gyuho Lee <gyuhox@gmail.com>
2018-04-10 13:57:17 -07:00
nolouch 3c52342b37 etcdserver: handle proposal error when processing internal raft request
Signed-off-by: Gyuho Lee <gyuhox@gmail.com>
2018-04-09 14:44:57 -07:00
Gyuho Lee 11818b5f40 etcdserverpb: document "Hash" and "HashKV" more clearly
Explain where the computation happens (e.g. "Hash" for all buckets
and "HashKV" for "key" bucket).

Signed-off-by: Gyuho Lee <gyuhox@gmail.com>
2018-04-03 11:50:20 -07:00
Gyuho Lee c841de1f62 etcdserver: add "CORS" field to "ServerConfig"
Signed-off-by: Gyuho Lee <gyuhox@gmail.com>
2018-03-27 06:25:44 -07:00
Gyuho Lee 29db853317 etcdserver: replace "hostWhitelist" with "AccessController"
Signed-off-by: Gyuho Lee <gyuhox@gmail.com>
2018-03-27 06:25:44 -07:00
Gyuho Lee a994fdedb3
Merge pull request #9450 from hexfusion/gw_naming
etcdserver: improve Lease http path naming for gRPC gateway
2018-03-26 00:06:50 -07:00
Gyuho Lee 9af05a45d4 etcdserver: move "unsafe" flags to bottom
Signed-off-by: Gyuho Lee <gyuhox@gmail.com>
2018-03-23 19:44:24 -07:00
Sam Batschelet cd92d4a987 etcdserver: improve Lease http path naming for gRPC gateway with additional_bindings. 2018-03-22 07:38:03 -04:00
Hitoshi Mitake b0ed5c1dd8
Merge pull request #8680 from mitake/auth-cleanup
*: don't use a string literal directly in grpc metadata
2018-03-20 18:19:23 +09:00
Gyuho Lee 4cb0d167d6 v3rpc: clean up "maintenanceServer.Status" call
Signed-off-by: Gyuho Lee <gyuhox@gmail.com>
2018-03-17 02:41:54 -07:00
Gyuho Lee 14558027bc *: fix "raftIndex" comment as "committed index"
Signed-off-by: Gyuho Lee <gyuhox@gmail.com>
2018-03-15 19:40:12 -04:00
Gyuho Lee 509cf414f7 etcdserver: remove duplicate "setAppliedIndex" calls
Signed-off-by: Gyuho Lee <gyuhox@gmail.com>
2018-03-15 19:35:44 -04:00
Gyuho Lee 4f754c1850 etcdserver: clean up with "RaftStatusGetter"
Signed-off-by: Gyuho Lee <gyuhox@gmail.com>
2018-03-15 19:30:08 -04:00
Hitoshi Mitake b1dd19a7aa *: don't use string literals directly in grpc metadata
Current etcd code uses the string literals ("token", "authorization")
as field names of grpc and swappger metadata for passing token. It is
difficult to maintain so this commit introduces new constants for the
purpose.
2018-03-15 14:17:34 +09:00
Hitoshi Mitake 752963beea *: unify type of key and rangeEnd in AuthRoleRevokePermissionRequest
Fix https://github.com/coreos/etcd/issues/9424
2018-03-14 14:38:20 +09:00
Gyuho Lee 9680b8a157 etcdserver: adjust election ticks on restart
Signed-off-by: Gyuho Lee <gyuhox@gmail.com>
2018-03-10 19:09:38 -08:00
Gyuho Lee edec229e10 etcdserver: make "advanceTicks" method
Signed-off-by: Gyuho Lee <gyuhox@gmail.com>
2018-03-10 18:50:50 -08:00
Gyuho Lee 29d9543850 rafthttp: add "ActivePeers" to "Transport"
Signed-off-by: Gyuho Lee <gyuhox@gmail.com>
2018-03-10 18:50:47 -08:00
Sam Batschelet 7e14e11548
Merge pull request #9408 from qinix/fix-proto-code-style
etcdserverpb: fix protobuf code style
2018-03-09 08:34:15 -05:00
Eric Zhang 67c66884e3 etcdserverpb: fix protobuf code style 2018-03-09 14:20:52 +08:00
Iwasaki Yudai db21941d1d *: enforce max lease TTL with 9,000,000,000 seconds
math.MaxInt64 / time.Second is 9,223,372,036. 9,000,000,000 is easier to
remember/document.
2018-03-08 10:17:12 -08:00
Gyuho Lee 78918848bd etcdserver: support Raft Pre-Vote
Signed-off-by: Gyuho Lee <gyuhox@gmail.com>
2018-03-06 09:55:55 -08:00
revol.cai 3534df14b4 Documentation: trevisions -> revisions 2018-03-05 20:14:37 +08:00
Gyuho Lee 85533a6305 api/v3election: error on missing "leader" field
Signed-off-by: Gyuho Lee <gyuhox@gmail.com>
2018-03-01 16:16:45 -08:00
Gyuho Lee 3648649277 etcdserver: add "HostWhitelist" to "ServerConfig"
Signed-off-by: Gyuho Lee <gyuhox@gmail.com>
2018-02-28 18:25:28 -08:00
Gyuho Lee 811566f2f2 *: fix "v2store" imports
Signed-off-by: Gyuho Lee <gyuhox@gmail.com>
2018-02-26 17:11:40 -08:00
Gyuho Lee 33d8126c6b *: regenerate proto
Signed-off-by: Gyuho Lee <gyuhox@gmail.com>
2018-02-26 17:11:40 -08:00
Gyuho Lee d493cd3bbd etcdserver: fix proto import paths
Signed-off-by: Gyuho Lee <gyuhox@gmail.com>
2018-02-26 17:11:40 -08:00
Gyuho Lee 69f7e11506 *: move "error" to "etcdserver/v2error"
Signed-off-by: Gyuho Lee <gyuhox@gmail.com>
2018-02-26 17:11:40 -08:00
Gyuho Lee 8a518b01c4 *: revert "internal/mvcc" change
Signed-off-by: Gyuho Lee <gyuhox@gmail.com>
2018-02-26 17:11:40 -08:00
Gyuho Lee 9b5d6edc4b *: revert "internal/raftsnap"
Signed-off-by: Gyuho Lee <gyuhox@gmail.com>
2018-02-26 17:11:40 -08:00
Gyuho Lee 0e12e888e0 *: move "internal/store" to "etcdserver/v2store"
Signed-off-by: Gyuho Lee <gyuhox@gmail.com>
2018-02-26 17:11:40 -08:00
Gyuho Lee dd2f3b0de8 *: revert "internal/lease" change
Signed-off-by: Gyuho Lee <gyuhox@gmail.com>
2018-02-26 17:11:40 -08:00
Gyuho Lee bb95d190c1 *: revert "internal/auth" change
Signed-off-by: Gyuho Lee <gyuhox@gmail.com>
2018-02-26 17:11:40 -08:00
Gyuho Lee 0850ccbf45 *: revert "internal/version" change
Signed-off-by: Gyuho Lee <gyuhox@gmail.com>
2018-02-26 17:11:40 -08:00
Gyuho Lee 0e65660548 *: revert "internal/discovery" change
Signed-off-by: Gyuho Lee <gyuhox@gmail.com>
2018-02-26 17:11:40 -08:00
Gyuho Lee 19010a7182 *: revert "internal/alarm" change
Signed-off-by: Gyuho Lee <gyuhox@gmail.com>
2018-02-26 17:11:40 -08:00
Gyuho Lee 6bbe107225 *: revert "internal/compactor" package change
Signed-off-by: Gyuho Lee <gyuhox@gmail.com>
2018-02-26 17:11:40 -08:00
Gyuho Lee 69357adf33 etcdserver: enable "CheckQuorum" when starting with "ForceNewCluster"
We enable "raft.Config.CheckQuorum" by default in other
Raft initial starts. So should start with "ForceNewCluster".

Signed-off-by: Gyuho Lee <gyuhox@gmail.com>
2018-02-23 00:26:42 -08:00
Sam Batschelet fcd71b47d5
Merge pull request #9298 from hexfusion/v3
*: replace grpc-gateway endpoint with /v3
2018-02-13 17:17:57 -05:00
Gyuho Lee a9804cdf75 *: regenerate proto with typo fix "acquisition"
Signed-off-by: Gyuho Lee <gyuhox@gmail.com>
2018-02-12 09:25:26 -08:00
Sam Batschelet 488ee99ae8 *: replace grpc-gateway endpoint with stable /v3 2018-02-11 19:07:36 -05:00
Xiang b83244bd35 etcdserver: improve request took too long warning 2018-02-06 12:15:52 -08:00
Xiang 142bff89f4 v3rpc: add jitter to progress notification 2018-02-05 10:37:12 -08:00
Gyuho Lee eecbba7927 etcdserver: move "etcdserver/auth" to "etcdserver/v2auth"
Signed-off-by: Gyuho Lee <gyuhox@gmail.com>
2018-02-02 15:05:56 -08:00
Iwasaki Yudai 6b775cd786 *: Add dbSizeInUse to StatusResposne
Existing dbSize shows physically allocated DB size and the backend
(boltdb) won't shrink it after a compaction until a user runs the defrag command.
The new dbSizeInUse shows the DB size that excludes free pages created
by compactions so that users can see the actual DB usage. dbSize >=
dbSizeInUse is always true.
Note that dbSizeInUse shows a page-based size and not byte level usage.
2018-02-01 12:15:23 -08:00
Gyuho Lee 37546f74ab *: move "version" to "internal/version"
Signed-off-by: Gyuho Lee <gyuhox@gmail.com>
2018-01-29 10:00:20 -08:00
Gyuho Lee 264f8f6577 *: regenerate proto
Signed-off-by: Gyuho Lee <gyuhox@gmail.com>
2018-01-28 23:43:15 -08:00
Hitoshi Mitake 6c91766490 *: move "auth" to "internal/auth" 2018-01-29 14:57:35 +09:00
Gyuho Lee 2c91007591 *: regenerate proto
Signed-off-by: Gyuho Lee <gyuhox@gmail.com>
2018-01-26 11:21:40 -08:00
Gyuho Lee 80d15948bc *: move "mvcc" to "internal/mvcc"
Signed-off-by: Gyuho Lee <gyuhox@gmail.com>
2018-01-26 11:14:41 -08:00
Gyuho Lee 349a377a67 *: move "lease" to "internal/lease"
Signed-off-by: Gyuho Lee <gyuhox@gmail.com>
2018-01-26 11:09:29 -08:00
Gyuho Lee 880835c02c *: move "store" to "internal/store"
Signed-off-by: Gyuho Lee <gyuhox@gmail.com>
2018-01-26 11:06:22 -08:00
Gyuho Lee 0365a9dee8 etcdserver: clarify warnings on backend open taking >10 seconds
If db file is 10 GiB, it can take more than 1-second.

Signed-off-by: Gyuho Lee <gyuhox@gmail.com>
2018-01-26 10:19:21 -08:00
Gyuho Lee 432581c7d0 *: move "discovery" to "internal/discovery"
Signed-off-by: Gyuho Lee <gyuhox@gmail.com>
2018-01-25 15:41:17 -08:00
Gyuho Lee 46b9844ca5 *: move "alarm,compactor" to "internal/*"
Signed-off-by: Gyuho Lee <gyuhox@gmail.com>
2018-01-25 15:26:21 -08:00
Gyuho Lee ce45c83f29 etcdserver: add detailed errors in "ValidateClusterAndAssignIDs"
Signed-off-by: Gyuho Lee <gyuhox@gmail.com>
2018-01-25 11:22:10 -08:00
Gyuho Lee 2b10bcccee etcdserver: add error details on DNS resolution failure on advertise URLs
Signed-off-by: Gyuho Lee <gyuhox@gmail.com>
2018-01-25 10:35:36 -08:00
dvonthenen db822ed38f *: add alarm/health information in endpoint status
Update to remove raftIndex and document the Alarms() interface

Fix formatting

Fix typo
2018-01-24 13:12:48 -08:00
Gyuho Lee dee39bf786 internal/raftsnap: move "raftsnap" to internal
Signed-off-by: Gyuho Lee <gyuhox@gmail.com>
2018-01-24 10:36:04 -08:00
Gyuho Lee 6a70a931d3 etcdserver: rename "snap" to "raftsnap" package
Signed-off-by: Gyuho Lee <gyuhox@gmail.com>
2018-01-24 10:26:07 -08:00
dvonthenen 25cdf4ed92 *: expose Raft Applied Index through to "etcdctl endpoint status"
Fixed based on feedback

Fixed spacing

Fix gofmt
2018-01-22 07:37:21 -08:00
Gyuho Lee d0eff45256 etcdserver/api/v3rpc: debug-log client disconnect on TLS, http/2 stream CANCEL
Signed-off-by: Gyuho Lee <gyuhox@gmail.com>
2018-01-19 12:26:56 -08:00
Gyuho Lee 1b4502114f etcdserver/api/etcdhttp: remove "errors" field in /health
Signed-off-by: Gyuho Lee <gyuhox@gmail.com>
2018-01-17 15:18:32 -08:00
Jordan Liggitt f77e54eb13
api/etcdhttp: change /health type back to string for backwards compatibility 2018-01-15 01:57:55 -05:00
Sahdev P. Zala 3b7e2ce0ca StatusFromError: handle return value of the function
status.FromError can return nil, false. We are handling the return values
most places in code but some places we aren't. Fixing it herewith.

Fixes #9117
2018-01-08 22:28:20 -05:00
Xiang Li 44e1f6f019
Merge pull request #9105 from spzala/getrevision
etcdserver/api/v3rpc: debug user cancellation and log warning for rest
2018-01-08 10:07:57 -08:00
Sahdev P. Zala a66d7c3ba5 etcdserver/api/v3rpc: debug user cancellation and log warning for rest
The context error with cancel code is typically for user cancellation which
should be at debug level. For other error codes we should display a warning.

Fixes #9085
2018-01-08 11:03:13 -05:00
Gyuho Lee 65464838ba
Merge pull request #9065 from gyuho/watch-id-2
*: allow user-provided watch ID to mvcc
2018-01-05 15:08:10 -08:00
Gyuho Lee 5b2f5150d9 etcdserver/api/v3rpc: set grpclog once
Signed-off-by: Gyuho Lee <gyuhox@gmail.com>
2018-01-02 10:12:49 -08:00
Gyuho Lee 9e11ef3ad5 etcdserver,embed: discard gRPC info logs when debug is off
Signed-off-by: Gyuho Lee <gyuhox@gmail.com>
2018-01-02 09:29:07 -08:00
Gyuho Lee 9a50255515 etcdserver/api/v3rpc: log stream error with debug level
Signed-off-by: Gyuho Lee <gyuhox@gmail.com>
2018-01-02 07:44:07 -08:00
Gyuho Lee 33c732b97c api/v3rpc: add watch ID to "watchStream.Watch"
Signed-off-by: Gyuho Lee <gyuhox@gmail.com>
2017-12-31 13:20:41 -08:00
Gyuho Lee 652841c411 *: regenerate proto
Signed-off-by: Gyuho Lee <gyuhox@gmail.com>
2017-12-31 13:20:40 -08:00
Gyuho Lee 9bbfa23183 etcdserverpb: add "watch_id" to "WatchCreateRequest"
Signed-off-by: Gyuho Lee <gyuhox@gmail.com>
2017-12-31 13:20:40 -08:00
Gyuho Lee b3ec44ca99 etcdserver/api: add 3.3.0 as compatible server capability
Signed-off-by: Gyuho Lee <gyuhox@gmail.com>
2017-12-20 13:34:12 -08:00
Sam Batschelet eb65f26182 Documentation/dev-guide: Update TimeToLive documentation. 2017-12-20 15:39:37 -05:00
Gyuho Lee 497412c588 clientv3: call other APIs with default gRPC call options
Signed-off-by: Gyuho Lee <gyuhox@gmail.com>
2017-12-20 10:58:05 -08:00
Gyuho Lee f87760998b clientv3: call KV/Txn APIs with default gRPC call options
Signed-off-by: Gyuho Lee <gyuhox@gmail.com>
2017-12-20 10:58:05 -08:00
Gyuho Lee 85af65eca9 etcdserver: log lease revoke error
Signed-off-by: Gyuho Lee <gyuhox@gmail.com>
2017-12-14 21:45:20 -08:00
Gyuho Lee bcd5390b35 *: regenerate protobuf, grpc-gateway
Signed-off-by: Gyuho Lee <gyuhox@gmail.com>
2017-12-07 21:31:13 -08:00
Joe Betz 4cacbf19dd
metrics: Add server_version metric 2017-12-01 15:25:46 -08:00
Gyu-Ho Lee 6bd41f36ff api/v3rpc: log grpc stream send/recv errors in server-side
Signed-off-by: Gyu-Ho Lee <gyuhox@gmail.com>
2017-11-29 17:34:05 -08:00
Gyu-Ho Lee e0dfc4368f etcdserver: CheckInitialHashKV when "InitialCorruptCheck==true"
etcdserver: only compare hash values if any

It's possible that peer has higher revision than local node.
In such case, hashes will still be different on requested
revision, but peer's header revision is greater.

etcdserver: count mismatch only when compact revisions are same

Signed-off-by: Gyu-Ho Lee <gyuhox@gmail.com>
2017-11-22 21:20:14 -08:00
Gyu-Ho Lee 3db5ad8d57 embed,etcdmain: add "--experimental-initial-corrupt-check"
Signed-off-by: Gyu-Ho Lee <gyuhox@gmail.com>
2017-11-22 15:27:14 -08:00
Hitoshi Mitake f649132a5a auth, etcdserver: follow the correct usage of context
The keys of context shouldn't be string. They should be a struct of
their own type.

Fix https://github.com/coreos/etcd/issues/8826
2017-11-21 15:31:19 +09:00
Gyu-Ho Lee 08434d0665 etcdserver/corrupt: document data corrupt checking in checkHashKV
Signed-off-by: Gyu-Ho Lee <gyuhox@gmail.com>
2017-11-20 15:04:50 -08:00
Gyu-Ho Lee 1ce3a41e69 etcdserver/corrupt: add "getPeerHashKVs" method
Signed-off-by: Gyu-Ho Lee <gyuhox@gmail.com>
2017-11-20 15:04:45 -08:00
Gyu-Ho Lee f6f0fb12e0 etcdserver/corrupt: set dial timeout for peer clientv3
Preliminary commit for initial hash checking.
Dial timeout when other nodes have not been booted.

Signed-off-by: Gyu-Ho Lee <gyuhox@gmail.com>
2017-11-20 15:02:57 -08:00
Gyu-Ho Lee cbe8c7eda7
Merge pull request #8880 from gyuho/v3beta-endpoint
*: replace grpc-gateway endpoint with /v3beta
2017-11-16 09:42:19 -08:00
Frederic Branczyk 627cffd6f8
*: initialize gRPC server metrics with zero values 2017-11-15 11:21:29 +01:00
Gyu-Ho Lee ab526e8814 *: regenerate proto, swagger specs
Signed-off-by: Gyu-Ho Lee <gyuhox@gmail.com>
2017-11-15 01:22:09 -08:00
Gyu-Ho Lee ce6bb4f1c9 etcdserver: replace /v3alpha with /v3beta in proto definitions
Signed-off-by: Gyu-Ho Lee <gyuhox@gmail.com>
2017-11-15 01:19:53 -08:00
Gyu-Ho Lee 75110dd839 *: fix naked returns
Signed-off-by: Gyu-Ho Lee <gyuhox@gmail.com>
2017-11-10 18:46:15 -08:00
tylerauerbeck 527d03e0d2 etcdserver: update metrics to use promhttp
Update api/etcdhttp/metrics.go to use promhttp.Handler() instead of prometheus.Handler()

fixes #8729
2017-11-10 09:47:49 -08:00
tamal c0c19465fc *: upgrade grpc-gateway to v1.3 2017-11-08 18:38:41 -08:00
Gyu-Ho Lee f48fe8ecda api/v3rpc: do not convert server context error to grpc/*status.statusError
Signed-off-by: Gyu-Ho Lee <gyuhox@gmail.com>
2017-11-06 17:32:23 -08:00
Gyu-Ho Lee ba233e2f4d etcdserver: preallocate slice in apply
Signed-off-by: Gyu-Ho Lee <gyuhox@gmail.com>
2017-11-06 09:13:12 -08:00
Gyu-Ho Lee 5d98710b2e api/v3rpc: deprecate grpc.Errorf
It's been deprecated as of grpc/grpc-go v1.6.x.

Signed-off-by: Gyu-Ho Lee <gyuhox@gmail.com>
2017-11-04 22:08:17 -07:00
Gyu-Ho Lee 2feb8ba545 v3rpc/rpctypes: use codes.FailedPrecondition for ErrGRPCNotLeader
Changes ErrGRPCNotLeader error code to FailedPrecondition,
to disable retry with unavailable.

Signed-off-by: Gyu-Ho Lee <gyuhox@gmail.com>
2017-10-20 14:28:17 -07:00
Gyu-Ho Lee 1109c6c321 etcdserver/api/etcdhttp: document package in doc.go
It was missing from godoc.

Signed-off-by: Gyu-Ho Lee <gyuhox@gmail.com>
2017-10-06 10:47:47 -07:00
Gyu-Ho Lee 0199bdc266 *: fix 'ineffassign' issues
Signed-off-by: Gyu-Ho Lee <gyuhox@gmail.com>
2017-10-03 10:14:33 -07:00
fanmin shi bcef78c665 Merge pull request #8563 from fanminshi/make_auto_compaction_granular
*: support auto-compaction with finer granularity
2017-09-29 11:18:51 -07:00
fanmin shi 733de98cfb *: modify etcd flags to support finner compaction retention 2017-09-28 17:22:44 -07:00
Gyu-Ho Lee 32e15d790f api/rpc: accept grpc.ServerOption's for keepalive policy
Signed-off-by: Gyu-Ho Lee <gyuhox@gmail.com>
2017-09-28 10:55:00 -07:00
Xiang Li 554298d429 Merge pull request #8594 from mitake/auth-priority
RFC: etcdserver: swap priority of cert CN and username + password
2017-09-26 08:41:30 -07:00
Xiang 35e285674b etcdserver: make tick duration calculation clear 2017-09-23 15:43:12 -07:00
Xiang 230323255a etcdserver: make dial timeout longer 2017-09-22 14:56:41 -07:00
Hitoshi Mitake 1296281b27 etcdserver: swap priority of cert CN and username + password 2017-09-22 15:53:47 +09:00
Gyu-Ho Lee 9553afbb24 Merge pull request #8533 from gyuho/grpc
*: upgrade grpclog to LoggerV2
2017-09-12 03:53:04 -07:00
Gyu-Ho Lee 18ba4d60ec v3rpc/rpctypes: use grpc.status for errors
grpc.Code, grpc.ErrorDesc, grpc.Errorf have been deprecated.

Signed-off-by: Gyu-Ho Lee <gyuhox@gmail.com>
2017-09-11 09:20:03 -07:00
Gyu-Ho Lee 0b2d8a6c96 *: fix minor typos
Signed-off-by: Gyu-Ho Lee <gyuhox@gmail.com>
2017-09-11 07:33:35 -07:00
Gyu-Ho Lee f37ff4a4e2 v3rpc: use grpclog.LoggerV2 for grpc logs
grpclog.Logger has been deprecated.

Signed-off-by: Gyu-Ho Lee <gyuhox@gmail.com>
2017-09-08 15:25:36 -07:00
Gyu-Ho Lee 9a726b424d *: fix leaky context creation with cancel
Signed-off-by: Gyu-Ho Lee <gyuhox@gmail.com>
2017-09-07 13:39:42 -07:00
Gyu-Ho Lee f65aee0759 *: replace 'golang.org/x/net/context' with 'context'
Signed-off-by: Gyu-Ho Lee <gyuhox@gmail.com>
2017-09-07 13:39:42 -07:00
Anthony Romano 8091be6e97 v2v3: ServerV2 backed by clientv3 2017-08-31 11:47:40 -07:00
Anthony Romano 758c3c09fd etcdserver: refactor v2 request processing
Makes interfaces more reusable.
2017-08-31 11:47:40 -07:00
Anthony Romano 1d3afd4bb5 etcdhttp, v2http, etcdserver: use etcdserver.{Server,ServerV2} interfaces 2017-08-31 11:47:40 -07:00
fanmin shi d2ca782277 v3rpc: limit recv size using MaxRecvMsgSize and send using MaxSendMsgSize
grpc 1.3 uses MaxMsgSize() to limit received message size. However, grpc 1.4 introduces a 4mb default limit on send message size. In etcd, server shouldn't be limit size of message that it can be sent. Hence, set maximum size of send message using MaxSendMsgSize().
2017-08-22 14:31:01 -07:00
Anthony Romano 31381da53a etcdserver: raise alarm on cluster corruption
Fixes #7125
2017-08-22 09:59:59 -07:00
Anthony Romano 35dffc7bc1 rpctypes,v3rpc: add Corrupt error code 2017-08-22 09:59:59 -07:00
Anthony Romano b8bcc891a6 *: regenerate gRPC assets 2017-08-22 09:59:59 -07:00
Anthony Romano 6be5f9a841 etcdserverpb: add corrupt alarm 2017-08-22 09:59:59 -07:00
Gyu-Ho Lee d25ae50c02 etcdserver: implement LeaseLeases API
Signed-off-by: Gyu-Ho Lee <gyuhox@gmail.com>
2017-08-14 14:18:56 -07:00
Gyu-Ho Lee 8005f00bcf *: regenerate proto
Signed-off-by: Gyu-Ho Lee <gyuhox@gmail.com>
2017-08-14 14:18:56 -07:00
Gyu-Ho Lee a7413bbf28 etcdserverpb: define LeaseLeases API
Signed-off-by: Gyu-Ho Lee <gyuhox@gmail.com>
2017-08-14 14:18:56 -07:00
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