Upsert/Batch: Fixes bug where RequestOptions are not honored for Upsert requests in Bulk Mode #5541
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.
Pull Request Template
Description
This pull request introduces support for passing
ItemRequestOptions, including a newAvailabilityStrategyproperty, through the batch processing pipeline in Azure Cosmos DB. This enables more granular control over request options and availability strategies at the batch operation level. The changes also add a new test to validate the use of customAvailabilityStrategyin batch upsert operations.Key changes include:
Batch Processing Pipeline Enhancements:
ItemRequestOptionsparameter (with support forAvailabilityStrategy) toBatchAsyncBatcher,BatchAsyncStreamer, and related delegate signatures, allowing request options to flow through the batch execution pipeline. [1] [2] [3] [4] [5] [6] [7] [8] [9] [10] [11] [12]ItemRequestOptions, including copying options where necessary to avoid side effects.Request Options Extension:
TransactionalBatchItemRequestOptions.FromItemRequestOptionsto include the newAvailabilityStrategyproperty, ensuring it is preserved when converting request options for batch items.Testing:
UpsertRequestOptionsTest) inCosmosAvailabilityStrategyTeststo verify that the customAvailabilityStrategyis correctly applied during upsert operations in a multi-region scenario with fault injection.ItemRequestOptionsparameter, ensuring all test code aligns with the new delegate signature. [1] [2] [3] [4] [5] [6]Solution and Project File Updates:
These changes collectively improve the flexibility and robustness of batch operations in Cosmos DB by allowing fine-grained request customization and better support for advanced availability strategies.
Type of change
Please delete options that are not relevant.
Closing issues
To automatically close an issue: closes #IssueNumber