Skip to content

Add support for BypassIntegratedCache option #24772

New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Merged
merged 4 commits into from
Jun 11, 2025
Merged

Conversation

AndrewRPorter
Copy link
Contributor

@AndrewRPorter AndrewRPorter commented Jun 11, 2025

Add support for the BypassIntegratedCache param as Azure docs point to this being a way to have requests to the dedicated gateway bypass the integrated cache: https://learn.microsoft.com/en-us/azure/cosmos-db/how-to-configure-integrated-cache?tabs=dotnet#bypass-the-integrated-cache.

This is a follow up to #23406 which added the dedicate gateway request headers and the ability to set the MaxIntegratedCacheStaleness option.

  • The purpose of this PR is explained in this or a referenced issue.
  • The PR does not update generated files.
  • Tests are included and/or updated for code changes.
  • Updates to module CHANGELOG.md are included.
  • MIT license headers are included in each file.

@github-actions github-actions bot added Community Contribution Community members are working on the issue Cosmos customer-reported Issues that are reported by GitHub users external to the Azure organization. labels Jun 11, 2025
Copy link

Thank you for your contribution @AndrewRPorter! We will review the pull request and get back to you soon.

Copy link

github-actions bot commented Jun 11, 2025

API Change Check

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

sdk/data/azcosmos

@AndrewRPorter AndrewRPorter marked this pull request as ready for review June 11, 2025 00:47
@Copilot Copilot AI review requested due to automatic review settings June 11, 2025 00:47
Copy link
Contributor

@Copilot 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

Adds the ability to bypass the integrated cache on dedicated gateway requests by introducing a new BypassIntegratedCache flag and wiring it through headers.

  • Introduced BypassIntegratedCache in DedicatedGatewayRequestOptions and corresponding HTTP constant
  • Updated toHeaders in both QueryOptions and ItemOptions to emit the bypass header when enabled
  • Extended tests and updated CHANGELOG.md to cover the new option

Reviewed Changes

Copilot reviewed 7 out of 7 changed files in this pull request and generated 1 comment.

Show a summary per file
File Description
sdk/data/azcosmos/cosmos_dedicated_gateway_request_options.go Add BypassIntegratedCache field to the options struct
sdk/data/azcosmos/cosmos_http_constants.go Define headerDedicatedGatewayBypassCache constant
sdk/data/azcosmos/cosmos_query_request_options.go Emit bypass header in QueryOptions.toHeaders
sdk/data/azcosmos/cosmos_item_request_options.go Emit bypass header in ItemOptions.toHeaders
sdk/data/azcosmos/cosmos_query_request_options_test.go Add tests for bypass behavior in query options
sdk/data/azcosmos/cosmos_item_request_options_test.go Add tests for bypass behavior in item options
sdk/data/azcosmos/CHANGELOG.md Document new bypass cache support
Comments suppressed due to low confidence (2)

sdk/data/azcosmos/cosmos_query_request_options_test.go:66

  • Consider adding a test case where DedicatedGatewayRequestOptions is non-nil but BypassIntegratedCache is false to ensure the bypass header isn't set when explicitly disabled.
func TestQueryRequestOptionsToHeaders_bypassIntegratedCacheNotSet(t *testing.T) {

sdk/data/azcosmos/CHANGELOG.md:7

  • [nitpick] Add a period after the sentence and consider splitting into two for clarity, e.g.: '* Added support for BypassIntegratedCache option. See [PR 24772]...' to match the project's changelog style.
* Added support for BypassIntegratedCache option See [PR 24772](https://github.com/Azure/azure-sdk-for-go/pull/24772)

Copy link
Member

@Pilchie Pilchie left a comment

Choose a reason for hiding this comment

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

LGTM - @analogrelay or @simorenoh can one of you take a look as well?

Copy link
Member

@analogrelay analogrelay left a comment

Choose a reason for hiding this comment

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

LGTM as well

@analogrelay analogrelay merged commit 2762eba into Azure:main Jun 11, 2025
12 checks passed
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
Community Contribution Community members are working on the issue Cosmos customer-reported Issues that are reported by GitHub users external to the Azure organization.
Projects
None yet
Development

Successfully merging this pull request may close these issues.

4 participants