Commit Graph

210 Commits (9ecbf5d2d1541b8178f6e459cc3746eaffbb9907)

Author SHA1 Message Date
Anthony Romano 5bd9b9614f tcpproxy: display endpoints, not pointers, in ready to proxy string
The switch to *net.SRV for endpoints caused the ready string to emit
pointers instead of endpoint strings.

Fixes #7942
2017-05-17 10:51:35 -07:00
Anthony Romano 713e006bc6 adpater: adapters for lock and election services 2017-05-10 12:51:05 -07:00
Anthony Romano fd01db9e60 grpcproxy, etcdmain: add lock and election services to proxy 2017-05-10 12:19:09 -07:00
Anthony Romano c232814003 etcdmain, tcpproxy: srv-priority policy
Adds DNS SRV weighting and priorities to gateway.

Partially addresses #4378
2017-05-08 11:35:18 -07:00
Anthony Romano 6dd8fb6f24 Revert "Merge pull request #7732 from heyitsanthony/lease-err-ka"
This reverts commit fbbc4a4979, reversing
changes made to f254e38385.

Fixes #7851
2017-05-02 09:36:16 -07:00
Anthony Romano b5384ac1c0 grpcproxy: use new lease interface 2017-04-24 23:49:44 -07:00
Gyu-Ho Lee 7adf4d7c94 grpcproxy/adapter: add Cluster API support
Signed-off-by: Gyu-Ho Lee <gyuhox@gmail.com>
2017-04-04 08:13:30 -07:00
Gyu-Ho Lee 5c642ae314 grpcproxy/adapter: add maintenance API support
Signed-off-by: Gyu-Ho Lee <gyuhox@gmail.com>
2017-03-28 09:09:06 -07:00
Gyu-Ho Lee caa73c176f proxy/grpcproxy: add chanStream helper
Prelimiary work for maintenance API in adapter

Signed-off-by: Gyu-Ho Lee <gyuhox@gmail.com>
2017-03-27 11:24:02 -07:00
Anthony Romano b2a465e354 grpcproxy/cache: only check compaction revision for historical revisions
Since the current revision is 0, it'll always be less than the compaction
revision. If the proxy sees a compaction, it would always reject the
current revision requests since it's less than the compaction revision.
Instead, check if the revision is historical before trying to reject on
compaction revision.

Fixes #7599
2017-03-24 13:20:46 -07:00
Anthony Romano b025cdd097 adapter, integration: split out grpc adapters from grpcproxy package
Break cyclic dependency:
clientv3/naming <-> integration <-> v3client <-> grpcproxy <-> clientv3/naming
2017-03-13 15:23:26 -07:00
Gyu-Ho Lee f862b47e92 grpcproxy: configure register to Cluster API
Signed-off-by: Gyu-Ho Lee <gyuhox@gmail.com>
2017-03-09 02:40:13 -08:00
Anthony Romano 28e9ba365a grpcproxy: return closing error when stream is canceled from conn close
Fixes #6630
2017-03-01 16:46:13 -08:00
Gyu-Ho Lee 72a531e8b2 grpcproxy: add 'register' address
For https://github.com/coreos/etcd/issues/6902.
2017-02-22 16:47:48 -08:00
Anthony Romano 25403970f5 Merge pull request #7361 from heyitsanthony/fix-gateway-goroutine
tcpproxy: don't use range variable in reactivate goroutine
2017-02-21 13:26:53 -08:00
Anthony Romano 8b097f279d tcpproxy: don't use range variable in reactivate goroutine
Ends up trying to reactivate only the last endpoint.
2017-02-21 12:39:49 -08:00
Anthony Romano 29a6fd65ad grpcproxy: only return ctx error in chan stream if recvc is empty
Since select{} won't prioritize, ctx.Done() can sometimes override
a pending message on recvc. Loop if recvc has messages instead.

Fixes #7340
2017-02-21 10:53:58 -08:00
fanmin shi ba52bd07ba grpcproxy: add lease coalescing support 2017-02-16 11:50:50 -08:00
fanmin shi 05b82f2022 grpcproxy: refactor chan stream out of watch_client_adapter 2017-02-16 11:41:21 -08:00
Anthony Romano 80de75431e grpcproxy: support forcing leader as available
Leadership timeout can sometimes take too long, such as in test cases.
However, it is possible to infer a leader is available based on RPCs
that must go through consensus. Therefore, have a way to update the
leadership status off the watch path.
2017-02-15 16:49:41 -08:00
Anthony Romano 36f5b713bf grpcproxy: don't wait for ctx.Done() to close kv donec
Causes a goroutine leak in ActiveConnection.Close() tests. Channel is
vestigial since removing ccache; revisit if kv ever needs goroutines.
2017-02-15 00:16:25 -08:00
Anthony Romano 49a0a63fc3 grpcproxy: split out leadership detection code
Move out of watch code since will be shared with lease code. Also assumes
leader does not exist unless watch can be successfully created.
2017-02-15 00:16:25 -08:00
Anthony Romano 853f68071b grpcproxy: respect CompactRevision in watcher
CompactRevision wasn't sent over watch stream, causing TestKVCompact to hang.
2017-02-13 15:43:41 -08:00
Anthony Romano c22ba766d5 grpcproxy: support CountOnly
TestKVRange from client integration tests was failing.
2017-02-10 16:06:24 -08:00
Anthony Romano 1fe2a9b124 Revert "Merge pull request #7139 from heyitsanthony/proxy-rlock"
This reverts commit 304606ab0b, reversing
changes made to 7dfe503f1c.
2017-02-10 14:37:48 -08:00
Anthony Romano d159353d51 Merge pull request #7268 from heyitsanthony/proxy-test-clientv3
test: add proxy tests for clientv3 integration tests
2017-02-02 20:31:05 -08:00
Anthony Romano e42fa18ccf grpcproxy: don't use WithRequireLeader for watch event stream
Ohterwise leader loss will reject all stream creation.
2017-02-02 09:32:25 -08:00
sharat 9def4cb9fe *: Use http.Request.WithContext instead of Cancel 2017-02-02 22:50:07 +05:30
sharat 2fce80e4c0 grpcproxy: handle 'IgnoreLease' field in PutRequest 2017-01-25 03:14:31 +05:30
Anthony Romano 8c0282ab24 grpcproxy, etcdmain, integration: add close channel to kv proxy
ccache launches goroutines that need to be explicitly stopped.

Fixes #7158
2017-01-18 11:51:16 -08:00
Gyu-Ho Lee 0f8060bede grpcproxy: handle 'IgnoreValue' field in PutRequest 2017-01-13 15:13:18 -08:00
Anthony Romano 9fa6c95054 grpcproxy: use ccache for key cache
groupcache needs a write lock and has no way to expire keys; ccache can
do this, though.

Also removes the key count metric, since there's no way to efficiently
calculate it using ccache.
2017-01-13 10:00:57 -08:00
Anthony Romano e179225f28 grpcproxy: tear down watch when client context is done
If client closes but all watch streams are not canceled, the outstanding
watch will wait until it is canceled, causing watch server to potentially
wait forever to close.

Fixes #7102
2017-01-04 16:23:27 -08:00
Anthony Romano 9b5eb1ae5a grpcproxy, etcdmain, integration: return done channel with WatchServer
Makes it possible to synchronously close the watch server.

Fixes #7078
2016-12-30 12:09:48 -08:00
Gyu-Ho Lee 7e74b3f846 grpcproxy: remove unused field 'wbs *watchBroadcasts' 2016-12-12 10:07:14 -08:00
Gyu-Ho Lee a98de7efa7
grpcproxy: fix minor typo 2016-12-07 17:08:46 -08:00
Anthony Romano 91ff6f30b5 grpcproxy: fix deadlock in watchbroadcast
Calling empty() in watchbroadcast methods was trying to
lock the rwmutex when it was already held.

Fixes #6937
2016-12-05 15:06:44 -08:00
Anthony Romano 62398954e4 grpcproxy: lock store when getting size
Fixes data race in proxy integration tests.
2016-12-05 13:29:57 -08:00
Xiang Li 0cb680800e grpcproxy: add cache related metrics 2016-12-02 15:29:42 -08:00
Xiang Li 1f954dc9f4 Merge pull request #6926 from xiang90/metrics
grpcproxy: add richer metrics for watch
2016-12-02 14:13:43 -08:00
Xiang Li a686c994cd grpcproxy: add richer metrics for watch 2016-12-02 11:13:30 -08:00
Anthony Romano 60908c64a6 grpcproxy: fix race between coalesce and bcast on nextrev
coalesce was locking the target coalesce broadcast object but not the source
broadcast object resulting in a data race on the source's nextrev.
2016-11-30 16:50:29 -08:00
Anthony Romano d680b8b5fb grpcproxy: fix race between watch ranges delete() and broadcasts empty()
Checking empty() wasn't grabbing the broadcasts lock so the race detector
flags it as a data race with coalesce(). Instead, just return the number
of remaining watches following delete() and get rid of empty().
2016-11-28 15:53:41 -08:00
Anthony Romano 7618fdd1d6 grpcproxy: fix deadlock on watch broadcasts stop
Holding the WatchBroadcasts lock and waiting on donec was
causing a deadlock with the coalesce loop. Was causing
TestV3WatchSyncCancel to hang.
2016-11-18 16:55:26 -08:00
Anthony Romano 1358a9d460 grpcproxy: copy range request before storing in cache
Reused Range requests would have Serialized overwritten with 'true'.

Was failing on TestV3LeaseSwitch.
2016-11-15 14:35:00 -08:00
Anthony Romano 98a7c642d4 grpcproxy: watch next revision should be start revision when not 0
The create header revision is the current etcd revision. For watches with
rev=0, the next revision is hdr.rev+1. For watches with rev=n, the next
revision should be n.

Fixes TestDoubleBarrier timeouts.
2016-11-14 16:46:02 -08:00
Anthony Romano 90ea3fbadc grpcproxy: do not resend create event after leader loss
Only set CreateNotify if no watch responses have been received.
2016-11-14 10:43:06 -08:00
Anthony Romano e40da39143 grpcproxy: only coalesce watchers that have received create response
Current watchers may have nextrev=0; check response count instead.
2016-11-14 09:19:02 -08:00
Anthony Romano 6604306398 grpcproxy: support prevKV watcher
Makes all server watchers PrevKV, discards if client watcher is not PrevKV.
2016-11-11 14:22:06 -08:00
Anthony Romano 395cf7de51 grpcproxy: reject invalid watch ranges 2016-11-11 10:14:35 -08:00
Anthony Romano ec459c2185 grpcproxy: rework watcher organization
The single watcher / group watcher distinction limited and
complicated watcher coalescing more than necessary. Reworked:

Each server watcher is represented by a WatchBroadcast, each
client "Watcher" attaches to some WatchBroadcast. WatchBroadcasts
hold all WatchBroadcast instances for a range. WatchRanges holds
all WatchBroadcasts for the proxy.

WatchProxyStreams represent a grpc watch stream between the proxy and
a client. When a client requests a new watcher through its grpc stream,
the ProxyStream will allocate a Watcher and WatchRanges assigns it to
some WatchBroadcast based on its range.

Coalescing is done by WatchBroadcasts when it receives an update
notification from a WatchBroadcast.

Supports leader failure detection so watches on a bad member
can migrate to other members. Coincidentally, Fixes #6303.
2016-11-11 10:14:35 -08:00
Anthony Romano a4dcceb8aa grpcproxy: update cache based on txn response
Fixes more hangs in TestSTMConflict.
2016-11-09 12:11:38 -08:00
Anthony Romano bf08a6142c grpcproxy: invalidate comparison keys after txn
If the txn comparison block makes claims about a key's current
state, then it may say a key has been updated. Future range/txn
operations may expect this update to eventually be propagated through
the cluster and show up in serialized requests. To avoid spinning
forever on txn/serialized range loops, invalidate the comparison keys.
2016-11-04 09:46:43 -07:00
Anthony Romano 8ec4215279 grpcproxy: reliably track rid in watchergroups
Couldn't find watcher group from rid on server stream close, leading to
the watcher group sending on a closed channel.

Also got rid of send closing the watcher stream if the buffer is full,
this could lead to a send after close while broadcasting to all receivers.
Instead, if a send times out then the server stream is canceled.

Fixes #6739
2016-11-02 14:42:02 -07:00
Anthony Romano 7ef17d3e97 grpcproxy: add SetHeader support to ServerStream
Fixes #6726
2016-11-01 13:28:02 -07:00
Anthony Romano 06e2ce116c Merge pull request #6704 from heyitsanthony/proxy-broadcast-race
grpcproxy: fix race on watcher revision
2016-10-24 09:17:29 -07:00
Anthony Romano bd1985d84b grpcproxy: fix race on watcher revision
Was racing between broadcast setting the watchgroup revision
and joining single watchers.
2016-10-21 16:09:39 -07:00
Anthony Romano 65eb3038fe grpcproxy: respect {min,max}{create,mod} revision
Mutexes were breaking in proxy integration tests.
2016-10-21 15:02:00 -07:00
Xiang Li 962433c17f *: set repo correctly for logging 2016-10-03 17:03:22 +08:00
Anthony Romano 6ac284a577 grpcproxy: use valid progress notification in broadcast test 2016-09-29 10:45:25 -07:00
Gyu-Ho Lee 78cfc8db95 grpcproxy: implement 'LeaseTimeToLive' 2016-09-09 08:14:46 +09:00
Xiang Li 56cfe40184 grpcproxy: fix a data race 2016-09-03 07:53:18 -07:00
Xiang Li b56ee178d5 grpcproxy: handle overloaded stream 2016-09-03 07:49:20 -07:00
Xiang Li 0d07154926 Merge pull request #6340 from xiang90/fix_double_create
grpcproxy: fix double create event
2016-09-02 16:37:29 -07:00
Xiang Li 805d4cbd93 grpcproxy: fix double create event 2016-09-02 16:02:46 -07:00
Xiang Li eded62e60c grpcproxy: stop watchers in watch groups 2016-09-02 16:01:11 -07:00
Xiang Li 8cd47c4348 grpcproxy: fix more issues in watch path 2016-09-02 15:13:21 -07:00
Xiang Li 51b4d6b7a8 grpcproxy: support cancel watcher
We do not wait for the cancellation from actual etcd server,
but generate it at the proxy side. The rule is to return the
latest rev that the watcher has seen. This should be good
enough for most use cases if not all.
2016-09-02 12:36:47 -07:00
Anthony Romano d3ecebd14e grpcproxy: shut down watcher proxy when client context is done 2016-09-01 15:20:50 -07:00
Xiang Li 9ef0f5ef8a grpcproxy: fix stream closing issue 2016-09-01 09:35:56 -07:00
Xiang Li b982c80c14 grpcproxy: fix data race 2016-08-31 16:52:04 -07:00
Gyu-Ho Lee 86bf2bc443 grpcproxy: fix recursive Context method 2016-08-29 11:37:35 -07:00
Xiang Li c8bbb8c53e grpc-proxy: invalidate cache entries when there is a put/delete 2016-08-19 12:52:19 -07:00
Gyu-Ho Lee a4ef36c8bf proxy/grpcproxy: fix nil-map assign to 'singles' 2016-08-15 15:48:45 -07:00
Gyu-Ho Lee f14fd43548 proxy/httpproxy: fix httputil.RequestCanceler 2016-08-14 14:37:08 -07:00
Gyu-Ho Lee 19b35c939a proxy/grpcproxy: fix spell 'gropu' to 'group' 2016-08-13 20:55:15 -07:00
Xiang Li 57c68ab1db grpcproxy: handle create event 2016-08-02 20:51:30 -07:00
Anthony Romano 2b4c37f54a grpcproxy: don't leak goroutines on watch proxy shutdown 2016-07-25 09:34:36 -07:00
Anthony Romano 418bb5e176 grpcproxy: bind clientv3.Watcher on initialization 2016-07-25 09:34:36 -07:00
Anthony Romano 4fa9363aca grpcproxy: client watch adapter 2016-07-25 09:34:36 -07:00
Gyu-Ho Lee abbefc9e25 grpcproxy: define 'watchergroups' in pointer
To avoid copying mutex lock values
2016-07-22 16:54:11 -07:00
Anthony Romano 768ccb8c10 grpcproxy: respect prev_kv flag 2016-07-20 15:58:33 -07:00
Anthony Romano 54df540c2c grpcproxy: wrapper from pb.KVServer to pb.KVClient 2016-07-20 15:40:33 -07:00
Xiang Li 783675f91c grpcproxy: do not send duplicate events to watchers 2016-07-19 10:14:57 -07:00
Xiang Li a61862acc7 Merge pull request #5977 from xiang90/b_proxy
grpcproxy: return interface
2016-07-18 19:12:43 -07:00
Xiang Li 5271cf0160 grpcproxy: return interface 2016-07-18 16:47:58 -07:00
Xiang Li 7bfe75cbf3 Merge pull request #5963 from xiang90/p_filter
grpcproxy: add filter to watcher
2016-07-18 14:56:10 -07:00
Xiang Li e1892e264d grpcproxy: add auth 2016-07-18 14:26:22 -07:00
Xiang Li fd24340903 grpcproxy: add maintenance proxy 2016-07-18 13:31:03 -07:00
Xiang Li 58aa3483c3 grpcproxy: add filter to watcher 2016-07-18 13:02:34 -07:00
Xiang Li 3f74e9db0d *: add lease proxy 2016-07-18 12:06:59 -07:00
Xiang Li bdfbd26e94 *: add cluster proxy 2016-07-16 12:15:32 -07:00
Xiang Li 5f3aa43899 grpcproxy: initial watch proxy 2016-07-15 14:30:45 -07:00
Gyu-Ho Lee 244b1d7d20 tcpproxy: add start logging line 2016-07-06 14:21:26 -07:00
Xiang Li b7d0497c47 Merge pull request #5807 from xiang90/gproxy
*: initial implementation of grpc-proxy
2016-06-29 13:28:57 -07:00
Xiang Li 6d8c647db8 *: initial implementation of grpc-proxy 2016-06-29 12:06:04 -07:00
mqliang 2e2f405b1e proxy:replace c with client to improve readability 2016-06-29 11:30:03 +08:00
mqliang f28a87d835 proxy: implement compaction 2016-06-29 11:28:10 +08:00
Anthony Romano 74b13aab61 grpcproxy: fix go vet warnings 2016-06-17 11:41:49 -07:00
mqliang 5676c5cf26 proxy: serve range request from proxy cache if set serializable 2016-06-15 14:12:36 +08:00