Commit Graph

3475 Commits

Author SHA1 Message Date
Kun Zhang cec9ee368d
api: move SubchannelPicker.requestConnection() to LoadBalancer. (#5751)
We will require Subchannel.requestConnection() to be called from
sync-context (#5722), but SubchannelPicker.requestConnection() is
currently calling it with the assumption of thread-safety.  Actually
SubchannelPicker.requestConnection() is called already from
sync-context by ChannelImpl, it makes more sense to move this method
to LoadBalancer where all other methods are sync-context'ed, rather than
making SubchannelPicker.requestConnection() sync-context'ed and fragmenting
the SubchannelPicker API because pickSubchannel() is thread-safe.

C++ also has the requestConnection() equivalent on their LoadBalancer
interface.
2019-05-16 09:50:23 -07:00
Eric Anderson f3bf250a46 core: Handle IDLE MODE race in DelayedClientTransport
We check for idle mode the first time we try newStream(), but failed to when
newStream races with reprocess(). This would normally be a very rare race,
except when you consider that AbstractChannelBuilder will call
managedChannel.enterIdle() when the network changes.

Fixes #5729
2019-05-15 16:56:46 -07:00
Eric Anderson 8fdd2072ee RELEASING.md: Document command to start making release notes
It's fine if the command changes in the future, but we do want to start making
the release notes earlier than later.
2019-05-15 16:52:33 -07:00
Chengyuan Zhang b7fb3c2e93
xds: add counts for recently issued calls in client side load reporting (#5735)
* added counts for recently issued calls in client side load reporting

* use recordCallStarted/Finished to manipulate counter instead of explicitly incr/decr methods
2019-05-15 15:52:20 -07:00
Ruben de Vries e6c8534f10 docs: add note about directExecutor in example tests. 2019-05-15 10:42:33 -07:00
Eric Anderson 2b7269b68c SECURITY.md: Add Fedora 30 package installation instructions
Fixes #5688
2019-05-14 15:37:43 -07:00
Chengyuan Zhang e483478913
xds/third_party: update xds load report proto by importing latest files from envoy repo (#5727) 2019-05-14 13:29:37 -07:00
ZHANG Dapeng 9dacc45447
xds: implement ADS request and response handling in standard mode (#5532)
Summary of PR: 
- XdsLbState now assumes standard mode only.
- Will not send CDS request. A EDS request will be sent at the constructor of `AdsStream`.
- Added a method to `LocalityStore`
  - `void updateLocalityStore(Map<Locality, LocalityInfo> localityInfoMap);`
- When a EDS response is received. `LocalityStore.updateLocalityStore()` will be called.
- `LocalityStoreImpl` maintains a map `Map<Locality, LocalityLbInfo> localityMap`.
- `LocalityStoreImpl.updateLocalityStore()` will create a child balancer for each locality, with a `ChildHelper`. Then each child balancer will call `handleResolvedAddresses()`.
- `LocalityStoreImpl.updateLocalityStore()` will update `childPickers`.
- `ChildHelper.updateBalancingState()` will update `childPickers` and then delegate to parent `helper.updateBalancingState()`.
- `XdsLbState.handleSubchannelState()` will delegate to `childBalancer.handleSubchannelState()` where the subchannel belongs to the childBalancer's locality.
2019-05-13 17:31:24 -07:00
Chengyuan Zhang 690b655f24
xds: refactor XdsLrsClient and XdsLoadReportStore for integrating backend metric data in load report (#5728)
* make ClientLoadCounter as a separate class, added unit tests for it as it now counts quite many stats

* add MetricListener class that takes in a ClientLoadCounter and updates metric counts from received OrcaLoadReport

* refactor XdsClientLoadRecorder into XdsLoadReportStore for better integrity

* move interceptPickResult implementation to XdsLrsClient, no delegated call

* added unit test annotation

* created a StatsStore interface for better modularize LrsClient and LoadReportStore

* add more tests to ClientLoadCounter to increase coverage

* added tests for add/get/remove locality counter

* refactored tests for XdsLoadReportStore, with newly added abstract base class for ClientLoadCounter, real counter data is not involved, only stubbed snapshot is needed

* comparing doubles doing arithmetic is not recommended, but we are fine here as we are manually repeating the computation exactly

* added test case for two metric listeners with the same counter, metric values should be aggregated to the same counter

* fixed exception message and comment to only refer to interface

* removed unused variables

* cleaned up unused mock init

* removed unnecessary ClusterStats comparison helper method, as we are really comparing with the object manually created, order is deterministic

* trashed stuff for backend metrics, it should be in a separate PR

* added toString test

* remove Duration dependency in LoadReportStore

* use ThreadLocalRandom to generate positive double randoms directly

* rename XdsLoadReportStore to XdsLoadStatsStore

* rename XdsLrsClient to XdsLoadReportClient

* refactor ClientLoadSnapshot to be an exact snapshoht of ClientLoadCounter, use getters for ClientLoadSnapshot and avoid touching fields directly

* renamed XdsLoadStatsManager to XdsLoadReportClient and XdsLoadReportClient to XdsLoadReportClientImpl

* make fields final in ClientLoadSnapshot

* use a constant noop client stream tracer instead of creating new one for each noop client stream tracer factory

* rename loadReportStore for abstraction
2019-05-13 15:38:26 -07:00
Carl Mastrangelo ae4d7a944a
netty: provide methods for logging protocol negotiation 2019-05-10 18:22:32 -07:00
rsgowman da79f86382 testing: Close cert files to avoid resource leak
Without this, test failures are generated within google3 for our
(firestore) integration tests.
2019-05-10 10:07:21 -07:00
Carl Mastrangelo af51e969da examples: make tls example easier to run (#5715)
* examples: make tls example easier to run

* Make the ca cert able to be verified by the server cert in openssl
* Make the port number consistent in each example (easy to copy paste wrong one)
* use correct netty-tcnative

* address comments
2019-05-10 08:03:30 +02:00
Kun Zhang 0c17c4c995
api: make LoadBalancer.Helper and Subchannel further non-thread-safe. (#5718)
I see more cases of wrapping Helper and Subchannel during the work of
XdsLoadBalancer, we will require that all methods that involve mutable
state to be called from the Synchronization Context.  We will start
logging warnings first, and make them throw in a future release.

Helper.createSubchannel() is already doing so.  This change adds
warnings to the other eligible methods.

https://github.com/grpc/grpc-java/issues/5015
2019-05-09 18:13:46 -07:00
Kun Zhang 175a423c10
api: add getters for NameResolver.Args and NameResolverRegistry in LoadBalancer.Helper (#5685)
Hierarchical LoadBalancers such as xDS will need this to create NameResolvers to resolve locality target names.
2019-05-09 15:55:18 -07:00
Eric Anderson 3aa3218fb2 Start 1.22.0 development cycle 2019-05-09 13:53:12 -07:00
Eric Anderson 980dd9671d api: Rename NameResolver.Observer to Listener2
This follows the sort of changes we've done in the past, where the '2'
implies "version 2." We can end up reclaiming the original name if we
wish in the future.

The main reason for this change is to avoid changing to Observer since
the rest of io.grpc consistently uses Listener.
2019-05-08 20:00:35 -07:00
Ran 20ba79e6e0
core: add accessor for perfmark (#5687)
* core: add accessor for perfmark

* core: update BUILD.bazel to exclude internal classes
2019-05-08 17:01:55 -07:00
Yang Song ea4e2bffec all: Upgrade OpenCensus versions. (#5657)
Also updated CensusModule to use the new helper methods ContextUtils.withValue() instead of directly manipulating the context keys. See census-instrumentation/opencensus-java#1864.
2019-05-08 16:05:37 -07:00
Kun Zhang f8d0868e1d
Revert "core: pass Subchannel state updates to SubchannelStateListener rather than LoadBalancer (#5503)" (#5684)
This reverts commit 62b03fd7e6.

Effectively reverts its follow-up commits:
dc218b6d4d
405d8c3865
44840fe813
2019-05-08 09:01:45 -07:00
Eric Anderson 1b6c131056 Revert "Examples: Add a JWT authentication example (#5154)"
This reverts commit ac52e27b2a.

See #5665. Right now it is not any more informative than the header
example, and it encourages some practices I'd rather avoid. It will get
re-added later with improvements.
2019-05-07 17:27:44 -07:00
Eric Anderson bbe5c2e094 Remove spotless plugin for gradle formatting
It is just causing trouble. When using paddedCell() it doesn't reliably
complain about failures and without paddedCell() it won't finish its
check. And when it does complain you have to guess what it wants from
you because unrelated changes are complained about at the same time.

It also caused trouble because **/*.gradle is overly aggressive; it
searchs build/ folders and bazel folders. But when trying to swap it to
per-project checks on the build.gradle I was unable to get it to fail,
even with obvious problems like using tabs.
2019-05-07 15:09:17 -07:00
Carl Mastrangelo 0a13104f4a
context: drop call to actual() in DeadlineSubject 2019-05-07 14:09:26 -07:00
Carl Mastrangelo a7660eeef7
core: factor service config state management out of ManagedChannelImpl 2019-05-07 08:36:11 -07:00
Eric Anderson 257bb546fd api: Discourage using ClientInterceptor for credentials 2019-05-06 17:03:44 -07:00
Kislay Kishore bd2f3c5b62 examples: Fix comment in RouteGuideServer.java (#5670) 2019-05-06 14:23:49 -07:00
ZHANG Dapeng 72553433b3
api: fix LoadBalancer javadoc links 2019-05-06 11:17:35 -07:00
Chengyuan Zhang 7712ef596c
xds/third_part: revert change of envoy import script (#5667)
* Revert "xds/third_party: fixed compatibility issue of regex in BSD for import.sh sed command (#5613)"

This reverts commit affce636dd.

* added comment to avoid manual change as the script is synced with internal upstream
2019-05-04 12:23:54 -07:00
Kun Zhang 63f636b4b6
api: NameResolver.Args deprecates NameResolver.Helper. (#5664)
Having two Helpers (the other being LoadBalancer.Helper) is proven to
be confusing, and the one in NameResolver is fundamentally different
from the one from LoadBalancer, as the latter mutates the states while
the former doesn't. Renaming it to Args make it less awkward to
expose it to LoadBalancer, which is needed for creating NameResolvers
for per-locality routing in the XdsLoadBalancer.
2019-05-03 16:45:38 -07:00
Carl Mastrangelo 54a9a15ac4
core: perfmark API changes 2019-05-02 15:36:48 -07:00
NickUfer 6807f39155 Removes the class `io.grpc.internal.MoreThrowables` and replaces it with
`com.google.common.base.Throwables`
2019-05-02 14:23:09 -07:00
Jihun Cho d50c8d4ec1
stub: improve error message for Client/ServerCalls (#5656) 2019-05-01 17:13:07 -07:00
Eric Anderson 97cb0554e4 travis.yml: Choose dist trusty to fix Java 8
The upgrade to Xenial broke Java 8, as Trusty contained Java 8 whereas
Xenial uses Java 11. So this "flipped" which version was necessary to be
downloaded from Java 11 to Java 8. And Java 8 is not supported by
install-jdk.sh.

Workaround as seen at:
https://travis-ci.community/t/oracle-jdk-11-and-10-are-pre-installed-not-the-openjdk-builds/785/16

I hope this is temporary.
2019-05-01 16:22:36 -07:00
Carl Mastrangelo e8be55e56f
alts: moved from containsAllOf to containsAtLeast 2019-05-01 13:50:50 -07:00
Jihun Cho f4fb7b40c5
netty: set NettyServer default socket options for all Channels (#5651) 2019-05-01 11:29:03 -07:00
Eric Anderson ab2e048f13 Lint fixes for unused and Truth and Queue 2019-04-30 22:44:00 -07:00
Kun Zhang 973885457f
core: change ClientStreamTracer.StreamInfo to a final class with a builder (#5648)
As we are now endorsing the wrapping of ClientStreamTracers by
providing ForwardingClientStreamTracer, there is a need for altering
StreamInfo, especially CallOptions before it's passed onto the
delegate.  A Builder class and a toBuilder() provides a robust way
to copy the rest of the fields.

This is a breaking change for anybody who creates StreamInfo, which is
unlikely in non-test code, because StreamInfo was added as late as
1.20.0.
2019-04-30 09:10:56 -07:00
Chengyuan Zhang 44840fe813
api: fix bugs of missing to copy customOptions when converting to a new builder, also trash hashCode/equals (#5647)
* api: fix bugs of missing out customOptions in CreateSubchannelArgs toBuider, hashCode, equals

* trash equals/hashCode for CreateSubchannelArgs as they are problematic
2019-04-29 18:40:11 -07:00
Chengyuan Zhang 405d8c3865
api: patch CreateSubchannelArgs toString() with customOptions (#5646) 2019-04-29 14:54:59 -07:00
Jihun Cho 6a32c508b8
netty: fix TCP_USER_TIMEOUT to use keepAliveTimeout instead of keepAliveTime (#5645) 2019-04-26 16:02:58 -07:00
Chengyuan Zhang dc218b6d4d
api: augment CreateSubchannelArgs with custom options (#5640)
* api: augment CreateSubchannelArgs with custom options

* added unit tests

* added ExperimentalApi anntation with tracking issue
2019-04-26 13:59:37 -07:00
Kun Zhang d530641097
core: annotate experimental API's inner classes. (#5643)
Annotations on outer class don't show on the javadoc of inner classes.
2019-04-26 11:28:48 -07:00
Eric Anderson 0604e14154 Revert "stub: Wait for onClose when blocking stub is interrupted"
This reverts commit 6d44f46f18.

This is causing a test to hang internally. I am currently expecting that
the shutdown logic of the test is broken, but it will take time to
diagnose. Thus, revert this for the moment.
2019-04-26 08:59:45 -07:00
Vladimir Gordiychuk f631b3d249 stub: release server-streaming reference on request after method call 2019-04-26 08:58:42 -07:00
Carl Mastrangelo 53a3f12666
api: expose if waitForReady has been set on CallOptions 2019-04-25 10:56:40 -07:00
Carl Mastrangelo ce6358e57f
core: add getService to MethodDescriptor 2019-04-24 17:45:41 -07:00
Carl Mastrangelo 0c304b1863
interop-testing: remove Truth method named() 2019-04-24 16:05:08 -07:00
Carl Mastrangelo 4b2e60a06b
core: remove scopeid overloads of perfmark 2019-04-24 15:07:43 -07:00
Chengyuan Zhang ea70de601c
xds: xds LRS client implementation with client load stats (#5588)
* Implement LRS client with backoff. No load data is invovled yet, only for load reporting interval updates. Unit test with load report interval update and streamClosed retry.

* use a separate stopwatch to manage actual load report interval

* refactor XdsLrsClientTest

* LRS response will only receive exactly one cluster name for grpc use case

* add more XdsLrsClientTest

* change class modifier

* fixed class comment

* renamed TRAFFICDIRECTOR_HOSTNAME_FIELD

* removed self-implemented Duration util methods, instead use methods in com.google.protobuf.util.Durations

* starting LrsStream's stopwatch inside LrsStream's start method

* fixed bug of using the wrong stopwatch for XdsLrsClient retrying

* removed try-catch around request StreamObserver

* polished code by eliminating unnecessary operations

* log an error instead of crash the thread when receiving LRS response for different cluster name

* created a XdsLoadStatsManager interface, XdsLrsClient implements it

* added XdsLoadStatsStore component in XdsLrsClient

* specify thread safety in XdsLoadStatsManager

* fixed style and convention issues

* added test case for verifying recorded load data by manually crafting load data

* added thread-safety in interface specification

* minor polish with adding debug logs to LRS client
2019-04-24 13:58:51 -07:00
Eric Anderson 2936242160 xds: Add missing RunWith annotation to test 2019-04-23 17:36:46 -07:00
Jihun Cho 67ef8c3466
netty: not using reflection to create NioEventLoopGroup (#5630) 2019-04-23 16:45:19 -07:00