Commit Graph

6473 Commits

Author SHA1 Message Date
Eric Anderson ee3ffef3ee core: In PF, disjoint update while READY should transition to IDLE
This is the same as if we received a GOAWAY. We wait for the next RPC to
begin connecting again. This is InternalSubchannel's behavior.
2024-08-22 11:23:11 -07:00
Eric Anderson f20167d602 util: Replace RR.EmptyPicker with FixedResultPicker 2024-08-22 10:29:06 -07:00
Eric Anderson 6c9f92a725 interop-testing: Move interop tests only used by test client to the test client
This removes the auth dependency and the implicit xds/orca from
AbstractInteropTest for things that weren't used in all but one case.
2024-08-22 10:28:41 -07:00
Kurt Alfred Kluever 2fe1a13cd0
Migrate from `Charsets` to `StandardCharsets`. (#11482) 2024-08-22 12:11:43 +05:30
Eng Zer Jun 66075eab85
.github/workflows: Bump action major versions from Node16 to Node20 (#11476)
GitHub began the Node16 deprecation process a year ago [1][2]. This
commit updates all workflows to use the latest Node20 actions.

[1]: https://github.blog/changelog/2023-09-22-github-actions-transitioning-from-node-16-to-node-20/
[2]: https://github.blog/changelog/2024-03-07-github-actions-all-actions-will-run-on-node20-instead-of-node16-by-default/
2024-08-22 12:01:02 +05:30
Eric Anderson 9762945f81 core: In PF, remove extraneous index.reset()
The index was just reset by updateGroups().
2024-08-21 07:16:29 -07:00
Eric Anderson 82a8d57396 core: In PF, remove useless requestConnection for CONNECTING subchannel
It doesn't do anything.

Call scheduleNextConnection() unconditionally since it is responsible
for checking if `enableHappyEyeballs == true`. It's also surprising to
check in the CONNECTING case but not the IDLE case.
2024-08-21 07:16:29 -07:00
Eric Anderson 2c93791c98 core: PF.requestConnection() is possible when READY
requestConnection() is public API, and it is allowed to be called even
if the load balancer is already READY.
2024-08-21 07:16:29 -07:00
Eric Anderson 4914ffc59a core: Avoid exception handling in PF for invalid index
It is trivial to avoid the exception from
addressIndex.getCurrentAddress(). The log message was inaccurate, as the
subchannel might have been TRANSIENT_FAILURE. The only important part of
the condition was whether the subchannel was the current subchannel.
2024-08-21 07:16:29 -07:00
Eric Anderson 33687d3983 core: Remove useless NPE check for syncContext in PF
It will never throw, because it would only throw if helper is null, but
helper is checkNotNull()ed in the constructor. It could have checked for
a null return value instead; since it hasn't been, it is clear we don't
need this check.
2024-08-21 07:16:29 -07:00
Eric Anderson 8bd97953ad core: Never have null PF Index
This prevents many null checks and combines two code paths, with no
additional allocations.
2024-08-21 07:16:29 -07:00
Eric Anderson 778a00b623 util: Remove MultiChildLB.getImmutableChildMap()
No usages actually needed a map nor a copy.
2024-08-17 08:55:22 -07:00
Eric Anderson c120e364d2 core: PF Index.size() should be number of addresses
This would impact TRANSIENT_FAILURE and refreshNameResolver() logic for
dual-stack endpoints.
2024-08-17 08:54:18 -07:00
John Cormie 6dbd1b9d5a
Add newAttachMetadataServerInterceptor() MetadataUtil (#11458) 2024-08-14 16:11:49 +00:00
sunpe 6a9bc3ba17 example: delete duplicate and unused code in KeepAliveClient.java 2024-08-14 07:24:47 -07:00
Eric Anderson ff8e413760
Remove direct dependency on j2objc
Bazel had the dependency added because of #5046, where Guava was
depending on it as compile-only and Bazel build have "unknown enum
constant" warnings. Guava now has a compile dependency on j2objc, so
this workaround is no longer needed. There are currently no version skew
issues in Gradle, which was the only usage.
2024-08-13 21:33:55 -07:00
Eric Anderson 909c4bc382 util: Remove minor convenience functions from MultiChildLB
These were once needed to be overridden (e.g., by RoundRobinLB), but
now nothing overrides them and MultiChildLB doesn't even call one of
them.
2024-08-13 21:29:08 -07:00
Eric Anderson 75012a5be2
examples: Upgrade Maven plugin versions
Upgrade Maven to 3.8.8, the oldest supported version, as the plugins required a
newer version.
2024-08-13 16:43:44 -07:00
Kannan J d5840448d4
Update README etc to reference 1.66.0 (#11472) 2024-08-13 23:52:35 +05:30
Eric Anderson c2eccca3bc cronet: Add internal API to specify Network
cl/661194496
2024-08-13 11:22:01 -07:00
Eric Anderson fd8734f341 xds: Delegate more RingHashLB address updates to MultiChildLB
Since 04474970 RingHashLB has not used
acceptResolvedAddressesInternal(). At the time that was needed because
deactivated children were part of MultiChildLB. But in 9de8e443, the
logic of RingHashLB and MultiChildLB.acceptResolvedAddressesInternal()
converged, so it can now swap back to using the base class for more
logic.
2024-08-12 16:40:00 -07:00
Eric Anderson b5989a5401 util: MultiChildLb children should always start with a NoResult picker
That's the obvious default, and all current usages use (something
equivalent to) that default.
2024-08-12 16:39:44 -07:00
Eric Anderson a6f8ebf33d Remove implicit requestConnection() on IDLE from MultiChildLB
One LB no longer needs to extend ChildLbState and one has to start, so
it is a bit of a wash. There are more LBs that need the auto-request
logic, but if we have an API where subclasses override it without
calling super then we can't change the implementation in the future.
Adding behavior on top of a base class allows subclasses to call super,
which lets the base class change over time.
2024-08-12 15:40:01 -07:00
Eric Anderson 4ab34229fb netty: Use DefaultELG with LocalChannel in test
LocalChannel is not guaranteed to be compatible with NioEventLoopGroup,
and is failing with Netty 4.2.0.Alpha3-SNAPSHOT.

See #11447
2024-08-12 15:39:12 -07:00
Eric Anderson 0d47f5bd1b
xds: WRRPicker must not access unsynchronized data in ChildLbState
There was no point to using subchannels as keys to
subchannelToReportListenerMap, as the listener is per-child. That meant
the keys would be guaranteed to be known ahead-of-time and the
unsynchronized getOrCreateOrcaListener() during picking was unnecessary.

The picker still stores ChildLbStates to make sure that updating weights
uses the correct children, but the picker itself no longer references
ChildLbStates except in the constructor. That means weight calculation
is moved into the LB policy, as child.getWeight() is unsynchronized, and
the picker no longer needs a reference to helper.
2024-08-12 11:23:37 -07:00
Eric Anderson 0d2ad89016 xds: Remove useless ExperimentalApi for WRR
A package-private class isn't visible and `@Internal` is stronger than
experimental. The only way users should use WRR is via the
weight_round_robin string, and that's already not suffixed with
_experimental.

Closes #9885
2024-08-12 11:19:56 -07:00
yifeizhuang 043ba556b8
otel tracing: add binary format, grpcTraceBinContextPropagator (#11409)
* otel tracing: add binary format, grpcTraceBinContextPropagator

* exception handling, use api base64 encoder omit padding
remove binary format abstract class in favor of binary marshaller
2024-08-12 11:16:54 -07:00
Eric Anderson d1dcfb0451 xds: Replace WrrHelper with a per-child Helper
There's no need to assume which child makes a subchannel based on the
subchannel address.
2024-08-09 16:24:51 -07:00
Eric Anderson 2f4f7f0ece util: Delete unused MultiChildLB.ChildLbState.getSubchannels() 2024-08-09 15:38:20 -07:00
Eric Anderson f866c805c2 util: SocketAddress.toString() cannot be used for equality
Some addresses are equal even though their toString is different
(InetSocketAddress ignores the hostname when it has an address). And
some addresses are not equal even though their toString might be the
same (AnonymousInProcessSocketAddress doesn't override toString()).

InetSocketAddress/InetAddress do not cache the toString() result. Thus,
even in the worst case that uses a HashSet, this should use less memory
than the earlier approach, as no strings are formatted. It probably also
significantly improves performance in the reasonably common case when an
Endpoint is created just for looking up a key, because the string
creation in the constructor isn't then amorized.
updateChildrenWithResolvedAddresses(), for example, creates n^2 Endpoint
objects for lookups.
2024-08-09 15:38:03 -07:00
Larry Safran 72a977bf7f
Dualstack example (#11451) 2024-08-08 15:59:57 -07:00
Petr Portnov | PROgrm_JARvis 40e2b165b7
Make once-set fields of `AbstractClientStream` `final` (#11389) 2024-08-08 10:48:12 +05:30
Eric Anderson 18d73a3681
CONTRIBUTING.md: Update commit guidelines
It came up in #11073, and I saw it could use a little updating. Notably,
I'm linking to a guide to what Git commit messages should look like. I
also tried to make the language less heavy-handed and demanding.
2024-08-07 16:34:11 -07:00
Kannan J 70ae83288d
Upgrade Netty to 4.1.110 and tcnative to 2.0.65 (#11444)
Upgrade Netty to 4.1.110 and tcnative to 2.0.65.
2024-08-06 20:38:08 +05:30
Kurt Alfred Kluever 06135a0745 Migrate from the deprecated `Charsets` constants (in Guava) to the `StandardCharsets` constants (in the JDK)
cl/658539667
2024-08-05 13:31:08 -07:00
Eric Anderson 9bed655c56 Revert "Netty upgrade to 4.1.110 in grpc-java (#11273)"
This reverts commit f9b072cfe2.

Changes from the release process got mixed in with the commit.
2024-08-02 15:30:31 -07:00
Eric Anderson 15456f8f0a core: In PF, pass around SubchannelData instead of Subchannel
Each usage of the subchannel immediately looked up the SubchannelData.
2024-08-02 14:23:25 -07:00
Kannan J f9b072cfe2
Netty upgrade to 4.1.110 in grpc-java (#11273)
* Bump Netty to 4.1.110.Final.
2024-08-03 01:05:44 +05:30
Eric Anderson e567b4427a
core: Don't reuse channels in PickFirstLeafLB test
PickFirstLeafLB uses channel reference equality to see if it has
re-created subchannels. The tests reusing channels breaks the expected
invariant.
2024-08-02 11:40:02 -07:00
Sergii Tkachenko c29763d886
xds: Import RLQS protos (#11418)
Imports the protos of Rate Limiting Quota Service (RLQS) and Rate
Limit Quota HTTP Filter.

Note: the list below only shows the new top-level protos, and excludes
their direct and transitional dependencies (those from import
statements).

#### RLQS Imports
- Service — envoy/service/rate_limit_quota/v3/rlqs.proto
  (Service): 7b8a304
- HTTP Filter —
  envoy/extensions/filters/http/rate_limit_quota/v3/rate_limit_quota.proto:
  49c77c4

#### CEL Imports
- Initial third-party repo setup: 99a64bd
- Parsed CEL Expression: cel/expr/syntax.proto: 99a64bd
- Parsed and type-checked CEL Expression: cel/expr/checked.proto:
  99a64bd


#### Required typed_config extensions
##### `bucket_matchers` predicate input
- `HttpAttributesCelMatchInput` —
  xds/type/matcher/v3/http_inputs.proto: 54924e0
- `HttpRequestHeaderMatchInput` —
  envoy/type/matcher/v3/http_inputs.proto: 49c77c4

##### `bucket_matchers` predicate custom_match
- `CelMatcher` — xds/type/matcher/v3/cel.proto: 54924e0
2024-08-02 10:35:29 -07:00
Kurt Alfred Kluever 00136096ed Migrate from the deprecated Charsets constants (in Guava) to the StandardCharsets constants (in the JDK).
cl/658546708
2024-08-02 09:54:05 -07:00
Eric Anderson 1f9d502261 interop-testing: Remove unused implementation deps
googleapis and rls can still be used at runtime.
2024-08-02 09:52:34 -07:00
Eric Anderson 780e4ba086 api: Move ClientStreamTracerTest from core to api
It uses nothing from core and tests an api class.
2024-08-02 09:06:04 -07:00
Eric Anderson b8e3ae9a4b android-interop-testing: Enable -Xlint:deprecation 2024-08-02 09:05:47 -07:00
Kannan J 90d0fabb1f
Introduce onResult2 in NameResolver Listener2 that returns Status
Lets the Name Resolver receive the status of the acceptance of the name resolution by the load balancer.
2024-08-02 20:40:31 +05:30
Eric Anderson 9bc1a93f6e xds: Add test that uses real DnsNR with ClusterResolverLB
This can detect failures like the UnsupportedOperationException from
ebffb0a6.
2024-08-02 07:26:11 -07:00
Larry Safran cc1cbe9871
Revert "Enable new PickFirst LB (#11348)" (#11425)
This reverts commit ccfd351a2e.
2024-08-01 11:30:36 -07:00
Larry Safran 941a1c37a3
Add dualstack interop test kokoro config (#11422) 2024-07-31 14:56:07 -07:00
Eric Anderson ebffb0a6b2 Revert "Introduce onResult2 in NameResolver Listener2 that returns Status (#11313)"
This reverts commit 9ba2f9dec5.

It causes a channel panic due to unimplemented onResult2().

```
java.lang.UnsupportedOperationException: Not implemented.
        at io.grpc.NameResolver$Listener2.onResult2(NameResolver.java:257)
        at io.grpc.internal.DnsNameResolver$Resolve.lambda$run$0(DnsNameResolver.java:334)
        at io.grpc.SynchronizationContext.drain(SynchronizationContext.java:94)
        at io.grpc.SynchronizationContext.execute(SynchronizationContext.java:126)
	at io.grpc.internal.DnsNameResolver$Resolve.run(DnsNameResolver.java:333)
```

b/356669977
2024-07-31 14:16:01 -07:00
Eric Anderson dc83446d98 xds: Stop extending RR in WRR
They share very little code, and we really don't want RoundRobinLb to be
public and non-final. Originally, WRR was expected to share much more
code with RR, and even delegated to RR at times. The delegation was
removed in 111ff60e. After dca89b25, most of the sharing has been moved
out into general-purpose tools that can be used by any LB policy.

FixedResultPicker now has equals to makes it as a EmptyPicker
replacement. RoundRobinLb still uses EmptyPicker because fixing its
tests is a larger change. OutlierDetectionLbTest was changed because
FixedResultPicker is used by PickFirstLeafLb, and now RoundRobinLb can
squelch some of its updates for ready pickers.
2024-07-31 13:32:49 -07:00