-
Notifications
You must be signed in to change notification settings - Fork 2k
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
Optimize reads/queries to Gateway and only send SessionToken when applicable #16111
Optimize reads/queries to Gateway and only send SessionToken when applicable #16111
Conversation
…into users/fabianm/MSCIInvestigation
…into users/fabianm/MSCIInvestigation
Same issue exists in .Net btw. - will port the change to .Net after check-in as well. |
sdk/cosmos/azure-cosmos/src/main/java/com/azure/cosmos/models/CosmosQueryRequestOptions.java
Show resolved
Hide resolved
...s/src/main/java/com/azure/cosmos/implementation/query/DocumentQueryExecutionContextBase.java
Show resolved
Hide resolved
sdk/cosmos/azure-cosmos/src/main/java/com/azure/cosmos/implementation/RxGatewayStoreModel.java
Show resolved
Hide resolved
sdk/cosmos/azure-cosmos/src/main/java/com/azure/cosmos/implementation/RxGatewayStoreModel.java
Show resolved
Hide resolved
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
If the account default consistency is session, client default consistency is set to be eventual, but for an individual request consistency is set to session, we need tuning; otherwise session consistency will not be met.
By default in java v4 we don't capture session tokens for non session consistency.
we should document that if the user wants to use this per request option, the user has to enable per request session capturing on the cosmos-client-builder and we should make the method for that public.
see CosmosClientBuilder:sessionCapturingOverrideEnabled()
CosmosItemRequestOption.setConsistencyLevel()
and CosmosClientBuilder:sessionCapturingOverrideEnabled()
should go hand in hand.
sdk/cosmos/azure-cosmos/src/main/java/com/azure/cosmos/implementation/RxGatewayStoreModel.java
Outdated
Show resolved
Hide resolved
sdk/cosmos/azure-cosmos/src/main/java/com/azure/cosmos/implementation/RxGatewayStoreModel.java
Outdated
Show resolved
Hide resolved
sdk/cosmos/azure-cosmos/src/main/java/com/azure/cosmos/implementation/RxGatewayStoreModel.java
Outdated
Show resolved
Hide resolved
sdk/cosmos/azure-cosmos/src/main/java/com/azure/cosmos/models/CosmosItemRequestOptions.java
Show resolved
Hide resolved
sdk/cosmos/azure-cosmos/src/test/java/com/azure/cosmos/CosmosItemTest.java
Outdated
Show resolved
Hide resolved
sdk/cosmos/azure-cosmos/src/test/java/com/azure/cosmos/CosmosItemTest.java
Outdated
Show resolved
Hide resolved
sdk/cosmos/azure-cosmos/src/test/java/com/azure/cosmos/CosmosItemTest.java
Outdated
Show resolved
Hide resolved
…into users/fabianm/MSCIInvestigation
* NOTE: If the consistency-level set on a request level here is higher than the default consistency | ||
* level set when constructing the CosmosClient instance via CosmosClientBuilder.consistencyLevel | ||
* session token capturing also needs to be enabled by calling | ||
* CosmosClientBuilder:sessionCapturingOverrideEnabled(true). |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
CosmosClientBuilder:sessionCapturingOverrideEnabled(true)
would only be needed when you set the request consistency to Session.
It is not needed if you set the request consistency to Strong nor for Bounded-Staleness.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
LGTM.
When using TransportMode==Gateway we always send the SessionToken today when the default consistency is Session even when on request level only Eventual consistency is requested. Because of the 16KB header size limitation this can make it impossible to execute queries/readFeed because the combined session token (across al pk ranges) is used. With this change the session token is only sent when appplicable - optimizing when customer opted-for lower consistency and unblocking queries with eventual consistency for accounts with large number of partitions.