Skip to content

Moves Batch/Bulk to proxy endpoint when GW2.0 is enabled#45945

Merged
nehrao1 merged 6 commits intoAzure:mainfrom
FabianMeiswinkel:users/fabianm/TCBatchBulk
Jul 9, 2025
Merged

Moves Batch/Bulk to proxy endpoint when GW2.0 is enabled#45945
nehrao1 merged 6 commits intoAzure:mainfrom
FabianMeiswinkel:users/fabianm/TCBatchBulk

Conversation

@FabianMeiswinkel
Copy link
Copy Markdown
Member

Description

Enables Batch and bulk for GW2.0

All SDK Contribution checklist:

  • The pull request does not introduce [breaking changes]
  • CHANGELOG is updated for new features, bug fixes or other significant changes.
  • I have read the contribution guidelines.

General Guidelines and Best Practices

  • Title of the pull request is clear and informative.
  • There are a small number of commits, each of which have an informative message. This means that previously merged commits do not appear in the history of the PR. For more information on cleaning up the commits in your PR, see this page.

Testing Guidelines

  • Pull request includes test coverage for the included changes.

Copilot AI review requested due to automatic review settings July 8, 2025 21:14
@FabianMeiswinkel FabianMeiswinkel requested review from a team and kirankumarkolli as code owners July 8, 2025 21:14
@github-actions github-actions Bot added the Cosmos label Jul 8, 2025
Copy link
Copy Markdown
Contributor

Copilot AI left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Pull Request Overview

This PR enables Batch and Bulk operations to route through the new GW2.0 proxy endpoint by propagating the target endpoint through the HTTP transport serializers, store responses, and diagnostics.

  • Added an endpoint field to StoreResponse and related classes to track the target URI.
  • Updated transport serializers (HttpTransportSerializer, ResponseUtils, HttpClientUtils) and request managers (RntbdRequestManager, GatewayAddressCache, etc.) to pass the endpoint into StoreResponse.
  • Enhanced diagnostics and tests to assert that Batch/Bulk requests use the thin-client proxy endpoint.

Reviewed Changes

Copilot reviewed 24 out of 24 changed files in this pull request and generated 2 comments.

Show a summary per file
File Description
sdk/cosmos/.../HttpTransportSerializer.java Added endpoint parameter to unwrapToStoreResponse.
sdk/cosmos/.../RntbdResponse.java Extended toStoreResponse to accept an endpoint argument.
sdk/cosmos/.../RntbdRequestManager.java Propagate requestUriAsString into StoreResponse and exceptions.
sdk/cosmos/.../ResponseUtils.java Updated toStoreResponse to include endpoint.
sdk/cosmos/.../HttpTransportClient.java Call ResponseUtils.toStoreResponse(response, resourceAddress).
sdk/cosmos/.../HttpClientUtils.java Added endpoint to parseResponseAsync and its callers.
sdk/cosmos/.../GatewayAddressCache.java Pass targetEndpoint.toString() into parseResponseAsync.
sdk/cosmos/.../ThinClientStoreModel.java Updated unwrapToStoreResponse signature to include endpoint.
sdk/cosmos/.../RxGatewayStoreModel.java Updated unwrapToStoreResponse and invocation sites.
sdk/cosmos/.../RxDocumentClientImpl.java Simplified useThinClientStoreModel logic; enhanced logging.
sdk/cosmos/.../StoreResponse.java Introduced endpoint field and accessors.
sdk/cosmos/.../StoreResponseDiagnostics.java Captured endpoint in diagnostics; introduced accessor.
sdk/cosmos/.../ClientSideRequestStatistics.java Stored endpoint in gateway statistics and serializer.
sdk/cosmos/.../CosmosDiagnosticsRequestInfo.java Added endpoint to diagnostics request info.
sdk/cosmos/.../CosmosDiagnosticsContext.java Populated endpoint when building diagnostics context.
sdk/cosmos-tests/.../StoreResultDiagnosticsSerializerTests.java Updated constructor invocation for new StoreResponse signature.
sdk/cosmos-tests/.../StoreResponseTest.java Adjusted test setup to pass null endpoint.
sdk/cosmos-tests/.../TransactionalBatchResponseTests.java Updated StoreResponse instantiation.
sdk/cosmos-tests/.../CosmosBulkItemResponseTest.java Updated StoreResponse instantiation.
sdk/cosmos-tests/.../ThinClientE2ETest.java Added tests and assertions for Batch/Bulk endpoints.
sdk/cosmos-tests/.../ConsistencyWriterTest.java Adjusted StoreResponse constructor calls.
sdk/cosmos-tests/.../StoreResponseBuilder.java Updated builder to new constructor signature.
sdk/cosmos-tests/.../RxDocumentClientImplTest.java Updated mock StoreResponse instantiation.
sdk/cosmos-tests/.../RetryContextOnDiagnosticTest.java Updated mock StoreResponse instantiation.
Comments suppressed due to low confidence (3)

sdk/cosmos/azure-cosmos/src/main/java/com/azure/cosmos/implementation/directconnectivity/StoreResponse.java:297

  • Public API method getEndpoint() in StoreResponse is missing JavaDoc; please add a JavaDoc comment explaining what the endpoint represents.
    public String getEndpoint() {

sdk/cosmos/azure-cosmos/src/main/java/com/azure/cosmos/implementation/directconnectivity/StoreResponseDiagnostics.java:205

  • Public API method getEndpoint() in StoreResponseDiagnostics is missing JavaDoc; please document its purpose and return value.
    public String getEndpoint() {

sdk/cosmos/azure-cosmos-tests/src/test/java/com/azure/cosmos/implementation/ThinClientE2ETest.java:46

  • [nitpick] Constant thinClientEndpointIndicator should follow static constant naming conventions (UPPER_SNAKE_CASE); consider renaming to THIN_CLIENT_ENDPOINT_INDICATOR.
    private static final String thinClientEndpointIndicator = ":10250/";

Copy link
Copy Markdown
Member

@xinlian12 xinlian12 left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

LGTM, thanks

@nehrao1
Copy link
Copy Markdown
Member

nehrao1 commented Jul 8, 2025

Should we separate the diagnostics changes out? Iirc we were going to update contacted endpoint to reflect thin client endpoint instead of gateway - but looks like the changes here introduce a new endpoint to the diagnostics altogether

EDIT: Discussed offline, LGTM

@nehrao1
Copy link
Copy Markdown
Member

nehrao1 commented Jul 8, 2025

/azp run java - cosmos - tests

@azure-pipelines
Copy link
Copy Markdown

Azure Pipelines successfully started running 1 pipeline(s).

@FabianMeiswinkel
Copy link
Copy Markdown
Member Author

/azp run java - cosmos - spark

@azure-pipelines
Copy link
Copy Markdown

Azure Pipelines successfully started running 1 pipeline(s).

@github-actions
Copy link
Copy Markdown
Contributor

github-actions Bot commented Jul 9, 2025

API Change Check

APIView identified API level changes in this PR and created the following API reviews

com.azure:azure-cosmos

@nehrao1 nehrao1 merged commit da19e1a into Azure:main Jul 9, 2025
28 checks passed
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

Projects

None yet

Development

Successfully merging this pull request may close these issues.

4 participants