Commit Graph

3699 Commits

Author SHA1 Message Date
Eric Anderson 9679296573 RELEASING.md: Pull recent version of gh-pages before modifying 2019-05-23 12:55:37 -07:00
Carl Mastrangelo b0167b97e1
alts: don't log in Framer after close 2019-05-23 11:36:00 -07:00
ZHANG Dapeng 08843f8d59
xds: handle drop percentage for SubchannelPicker (#5765)
* xds: handle drop percentage for SubchannelPicker

* XdsCommsTest

* refactor ThreadSafeRandom

* remove hasNonDropBackends

* fix comments
2019-05-23 10:36:59 -07:00
Kun Zhang a1bc92a748
test: cover the change that added Subchannel.getInternalSubchannel() (#5774) 2019-05-23 10:36:03 -07:00
Carl Mastrangelo cdeafcf6e0
core: add discard method for Attributes 2019-05-23 10:34:04 -07:00
Chengyuan Zhang 4dcbe56354
core: create subchannelLogger outside InternalSubchannel and before calling start() (#5775) 2019-05-23 10:30:46 -07:00
Chengyuan Zhang 00d4cc29ad
all: fix lint (#5770)
* fixed lint warnings

* remove unused arg for subchannel
2019-05-23 01:05:22 -07:00
ZHANG Dapeng 54bbd372ef
xds: implement Fallback-at-Startup mode
This is the implementation of the Fallback-at-Startup mode in the design doc.

- The Fallback-After-Startup mode is not implemented.
- Drop related behavior is not implemented.
2019-05-22 17:44:39 -07:00
Carl Mastrangelo 7834a50525
alts: use new ProtocolNegotiator style for ALTS
This change does a few core things, which result in a lot of churn in other parts.  It's not as bad as it seems.

Core things:

1.  AltsProtocolNegotiator is now a shim class, same as ProtocolNegotiators
2.  The protocol negotiators are now in the new style, where there is at most 1 negotiation handler in the pipe at a time.
3.  TsiHandshakeHandler is rewritten with respect to the above.  All errors and buffering are handled by the WBAEH.
4.  TsiFrameHandler is only installed once the negotiation is successful, eliminating the state handling.


The churn in mainly in GoogleDefaultChannel and the GCE channel, which now reuse the *handlers* rather than the negotiators.  This makes it significantly easier to reason about the pipeline state.  The tests are also a source of churn, which no long need to check for most buffering and error conditions.
2019-05-22 16:33:07 -07:00
Kun Zhang f8fffeff12
api: add Subchannel.getInternalSubchannel(). (#5773)
Previously PickResult's Subchannel must be the actual implementation
returned from the Channel's Helper, and Channel would cast it to the
implementation class in order to use it.  This will be broken if
Subchannel is wrapped in the case of hierarchical LoadBalancers.

getInternalSubchannel() is the guaranteed path for the Channel to get
the InternalSubchannel implementation.  It is friendly for wrapping.

Background: #5676
2019-05-22 13:52:28 -07:00
ZHANG Dapeng 36ae0ed165
xds: temporarily use ManagedChannelBuilder.forTarget for creating resolving oob channel 2019-05-22 13:38:00 -07:00
ZHANG Dapeng b3bac95f90
xds: not sending resource_name in EDS request 2019-05-22 09:36:51 -07:00
ZHANG Dapeng 994fd7429a
xds: populate XdsLoadBalancerProvider to ServiceLoader
Also changed `XdsLoadBalancerProvider` to avoid initialization error when using `ServiceLoader`.
2019-05-22 09:35:38 -07:00
Chengyuan Zhang e237ee12a0
examples: use test certs for running example-tls (#5763)
* examples: use test certs for running example-tls

* fixed a typo

* update usage printout for trustCertCollectionFilePath is not optional

* Revert "update usage printout for trustCertCollectionFilePath is not optional"

This reverts commit 2dd6d87f64.

* put back the usage of using system default CA and put notes for it

* fixed cmd-line argument options
2019-05-22 09:05:16 -07:00
Eric Anderson 50b08eee3b
Delete protobuf-nano
Nano was dropped from upstream protobuf. See gRFC L51
2019-05-22 08:49:07 -07:00
Eric Anderson b6720c9fe6 api: Don't yet deprecate NameResolver.Listener
We think NameResolver.Listener2 may still change, so don't yet encourage
people to migrate.

Fixes #5764
2019-05-21 17:49:08 -07:00
Eric Anderson 15a453d9ef api: Fix doc for default value of idleTimeout()
It appears the docs were not updated when this was changed in d74091f5, which
was first released in v1.1.
2019-05-21 13:48:57 -07:00
ZHANG Dapeng c242fc8245
xds: fix XdsLoadStatsStoreTest.recordingDroppedRequests flaky NPE 2019-05-20 16:00:18 -07:00
Kun Zhang a2595d9e7d
api/core/grpclb: add warning about calling Subchannel.requestConnection() outside of sync-context (#5757)
The pick_first policies in core and grpclb previously would call
Subchannel.requestConnection() from data-path.  They now will schedule
that call in the sync-context to avoid the warning.  They will only
call it for the first pick of each picker, to prevent storming the
sync-context.
2019-05-20 11:39:02 -07:00
Kun Zhang 7934594dfe
api: pass Subchannel state updates to SubchannelStateListener rather than LoadBalancer (take 2) (#5722)
This is a revised version of #5503 (62b03fd), which was rolled back in f8d0868. The newer version passes SubchannelStateListener to Subchannel.start() instead of SubchannelCreationArgs, which allows us to remove the Subchannel argument from the listener, which works as a solution for #5676.

LoadBalancers that call the old createSubchannel() will get start() implicitly called with a listener that passes updates to the deprecated LoadBalancer.handleSubchannelState(). Those who call the new createSubchannel() will have to call start() explicitly.

GRPCLB code is still using the old API, because it's a pain to migrate the SubchannelPool to the new API.  Since CachedSubchannelHelper is on the way, it's easier to switch to it when it's ready. Keeping
GRPCLB with the old API would also confirm the backward compatibility.
2019-05-17 16:37:41 -07:00
Carl Mastrangelo f94b77c87f
netty: change server to new protocol negotiator model
Changes:

* PlaintextProtocolNegotiator is the same between client and server
* ServerTlsHandler is rewritten to not handle errors 
  * Also, it now sets the security level attribute, which I don't think it did previously
* NettyServerTransport now uses WBAEH, similar to the client. I don't think the buffer is needed, but it does  correctly handle errors during the startup
2019-05-16 18:15:47 -07:00
Eric Anderson bacb741aaf
examples: Use encouraged APIs and avoid over-specifying configuration
Also fix tcnative for Maven. The version had only been updated for
gradle. The wrong version would cause a crash with NoSuchMethodError.
2019-05-16 16:28:55 -07:00
ZHANG Dapeng 53f74c62ba
all: fix lint 2019-05-16 15:00:20 -07:00
Kun Zhang ae14c8d061
api: temporarily remove the warning about sync-context in requestConnection(). (#5738) (#5752)
Contrary to #5736, we will still keep the sync-context requirement of
requestConnection(), because it prevents API fragmentation.
PickFirstLoadBalancer is the only known violator.  We will fix it on
master, but we don't want to make that change on 1.21.x because the
release is soon.  We simply remove the warning in this release so that
users won't be annoyed.

This supersedes #5736
2019-05-16 13:07:10 -07:00
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