googleapis: DirectPath over Interconnect by shivaspeaks · Pull Request #12760 · grpc/grpc-java (original) (raw)
The following changes are made outside of the design doc specifications or assuming few things:
- Node ID Suffix and UUID Size: While the design document suggests a 64-bit integer for the UUID, this PR maintains the existing 32-bit
int(generated viaRandom().nextInt()) to remain consistent with the current implementation's ID generation logic. - Ampersand Decoding (
%26): The resolver now utilizesgetRawQuery()instead ofgetQuery()for detecting and stripping theforce-xdsflag. This approach prevents a "splitting bug" where an encoded ampersand (%26) in a parameter value would be decoded to a literal&and incorrectly interpreted as a parameter separator. - Separate Locks for Bootstrap Caching: I have introduced separate locks (
BOOTSTRAP_LOCKandFORCE_XDS_BOOTSTRAP_LOCK) for managing the standard and forced xDS bootstrap configurations. This provides logical isolation and ensures that Interconnect clients usingforce-xdscan initialize immediately without being blocked by threads waiting on potentially slow metadata server calls in the standard GCP detection path. - URI Normalization via
io.grpc.Uri: Even in the legacyjava.net.URIconstructor, we now useio.grpc.Urito perform the transformation. This ensures consistent behavior across both constructors, particularly regarding "empty" vs "absent" authorities. Using the gRPC-specific Uri class ensures that hierarchical URIs likegoogle-c2p:///svc(empty authority) are correctly reconstructed asdns:///svcorxds://.../svcrather than being mangled into invalid formats. - Flexible Query Param Value Handling and Case Sensitivity for
force-xds: The implementation treats theforce-xdsparameter key as case-sensitive to align with standard gRPC naming conventions. However, it provides flexible support for different value formats: the resolver recognizes both the standalone flag (?force-xds) and explicit key-value pairs like?force-xds=trueor?force-xds=1. To avoid misinterpretation, the logic explicitly returnsfalseonly when the value is a case-insensitive match for"false"or is exactly"0", ensuring that common truthy values liketrueor1are correctly handled as enabled