Cosmos: Cutover transactional batch operation to Driver#4281
Merged
Conversation
batch operation to Drivertransactional batch operation to Driver
transactional batch operation to Drivertransactional batch operation to Driver
Member
Author
|
/azp run rust - cosmos - weekly |
|
Azure Pipelines successfully started running 1 pipeline(s). |
Contributor
There was a problem hiding this comment.
Pull request overview
This PR migrates ContainerClient::execute_transactional_batch() to the Cosmos Driver CosmosOperation execution path, aligning transactional batch with other item/query operations that have already been cut over and removing now-dead legacy header shims.
Changes:
- Add
CosmosOperation::batch()factory for transactional batch requests. - Route
execute_transactional_batch()throughdriver.execute_operation()and bridge the driver response back to SDK types. - Remove legacy SDK batch header helpers/tests and delete now-unused SDK constants/fields.
Reviewed changes
Copilot reviewed 6 out of 6 changed files in this pull request and generated no comments.
Show a summary per file
| File | Description |
|---|---|
| sdk/cosmos/azure_data_cosmos_driver/src/models/cosmos_operation.rs | Adds a driver-level batch() operation factory targeting the items feed with a partition key. |
| sdk/cosmos/azure_data_cosmos_driver/src/models/cosmos_headers.rs | Introduces request header name constants needed for driver batch request construction. |
| sdk/cosmos/azure_data_cosmos_driver/src/driver/pipeline/operation_pipeline.rs | Emits required batch headers when OperationType::Batch and adds unit tests asserting header behavior. |
| sdk/cosmos/azure_data_cosmos/src/options/mod.rs | Removes legacy BatchOptions::apply_headers() and related helpers/tests now that batch is driver-routed. |
| sdk/cosmos/azure_data_cosmos/src/constants.rs | Removes PREFER_MINIMAL constant (no longer used by the SDK crate after cutover). |
| sdk/cosmos/azure_data_cosmos/src/clients/container_client.rs | Rewrites execute_transactional_batch() to build/execute a driver operation; removes items_link field and adds apply_batch_options. |
Member
Author
|
/azp run rust - cosmos - weekly |
|
Azure Pipelines successfully started running 1 pipeline(s). |
analogrelay
approved these changes
Apr 28, 2026
analogrelay
left a comment
Member
There was a problem hiding this comment.
Love how straightforward these cutovers have become.
tvaron3
approved these changes
Apr 28, 2026
de86fdd
into
release/azure_data_cosmos-previews
31 checks passed
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
Migrates
ContainerClient::execute_transactional_batch()from the legacyCosmosRequest+BatchOptions::apply_headers()+container_connection.send()pipeline toCosmosOperation+driver.execute_operation(), matching the pattern established in #4147, #4174, and #4128.This was the last item-level operation using the old SDK pipeline for header manipulation, so the batch-specific helpers are removed as dead code.
Changes
azure_data_cosmos_driver/src/models/cosmos_operation.rsCosmosOperation::batch()factory (POST to items feed with partitionkey,
OperationType::Batch), following thecreate_itempattern.azure_data_cosmos/src/clients/container_client.rsexecute_transactional_batchto build aCosmosOperation::batch,apply options, execute through the driver, and bridge the response.
apply_batch_optionshelper that takes&BatchOptionsand wiressession token onto the operation.
items_linkfield fromContainerClient— it was only used bythe batch method's old
CosmosRequestpath.azure_data_cosmos/src/options/mod.rsBatchOptions::apply_headers().apply_content_response_on_write_header()helper (sole callerwas
BatchOptions::apply_headers).azure_data_cosmos/src/constants.rsPREFER_MINIMALconstant, which is no longer referenced in theSDK crate. The driver handles this header internally via its operation pipeline.