Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
1 change: 1 addition & 0 deletions sdk/cosmos/azure-cosmos/CHANGELOG.md
Original file line number Diff line number Diff line change
Expand Up @@ -7,6 +7,7 @@
#### Breaking Changes

#### Bugs Fixed
* Fixed an issue where `emptyPageDiagnosticsEnabled` in `CosmosQueryRequestOptions` was being overridden. This caused empty page diagnostics to be logged (with INFO level) even when the flag was set to false - See [PR 37199](https://github.com/Azure/azure-sdk-for-java/pull/37199)

#### Other Changes

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -646,10 +646,7 @@ <T> CosmosPagedFlux<T> readAllItems(Class<T> classType) {
<T> CosmosPagedFlux<T> readAllItems(CosmosQueryRequestOptions options, Class<T> classType) {
return UtilBridgeInternal.createCosmosPagedFlux(pagedFluxOptions -> {
CosmosAsyncClient client = this.getDatabase().getClient();
CosmosQueryRequestOptions nonNullOptions = options != null ? options : new CosmosQueryRequestOptions();
CosmosQueryRequestOptions requestOptions = clientAccessor.shouldEnableEmptyPageDiagnostics(client) ?
queryOptionsAccessor.withEmptyPageDiagnosticsEnabled(nonNullOptions, true)
: nonNullOptions;
CosmosQueryRequestOptions requestOptions = options != null ? options : new CosmosQueryRequestOptions();

QueryFeedOperationState state = new QueryFeedOperationState(
client,
Expand Down Expand Up @@ -946,11 +943,8 @@ <T> CosmosPagedFlux<T> queryItemsInternal(
<T> Function<CosmosPagedFluxOptions, Flux<FeedResponse<T>>> queryItemsInternalFunc(
SqlQuerySpec sqlQuerySpec, CosmosQueryRequestOptions cosmosQueryRequestOptions, Class<T> classType) {
CosmosAsyncClient client = this.getDatabase().getClient();
CosmosQueryRequestOptions nonNullOptions =
CosmosQueryRequestOptions options =
cosmosQueryRequestOptions != null ? cosmosQueryRequestOptions : new CosmosQueryRequestOptions();
CosmosQueryRequestOptions options = clientAccessor.shouldEnableEmptyPageDiagnostics(client) ?
queryOptionsAccessor.withEmptyPageDiagnosticsEnabled(nonNullOptions, true)
: nonNullOptions;

Function<CosmosPagedFluxOptions, Flux<FeedResponse<T>>> pagedFluxOptionsFluxFunction = (pagedFluxOptions -> {
String spanName = this.queryItemsSpanName;
Expand Down Expand Up @@ -982,11 +976,9 @@ <T> Function<CosmosPagedFluxOptions, Flux<FeedResponse<T>>> queryItemsInternalFu
Mono<SqlQuerySpec> sqlQuerySpecMono, CosmosQueryRequestOptions cosmosQueryRequestOptions, Class<T> classType) {
Function<CosmosPagedFluxOptions, Flux<FeedResponse<T>>> pagedFluxOptionsFluxFunction = (pagedFluxOptions -> {
CosmosAsyncClient client = this.getDatabase().getClient();
CosmosQueryRequestOptions nonNullOptions =
CosmosQueryRequestOptions options =
cosmosQueryRequestOptions != null ? cosmosQueryRequestOptions : new CosmosQueryRequestOptions();
CosmosQueryRequestOptions options = clientAccessor.shouldEnableEmptyPageDiagnostics(client) ?
queryOptionsAccessor.withEmptyPageDiagnosticsEnabled(nonNullOptions, true)
: nonNullOptions;

String spanName = this.queryItemsSpanName;

QueryFeedOperationState state = new QueryFeedOperationState(
Expand Down Expand Up @@ -1556,13 +1548,8 @@ public <T> CosmosPagedFlux<T> readAllItems(
CosmosQueryRequestOptions options,
Class<T> classType) {
CosmosAsyncClient client = this.getDatabase().getClient();
final CosmosQueryRequestOptions requestOptions = options == null
? queryOptionsAccessor.withEmptyPageDiagnosticsEnabled(
new CosmosQueryRequestOptions(),
clientAccessor.shouldEnableEmptyPageDiagnostics(client))
: clientAccessor.shouldEnableEmptyPageDiagnostics(client)
? queryOptionsAccessor.withEmptyPageDiagnosticsEnabled(options, true)
: options;
final CosmosQueryRequestOptions requestOptions = options == null ? new CosmosQueryRequestOptions() : options;

requestOptions.setPartitionKey(partitionKey);

return UtilBridgeInternal.createCosmosPagedFlux(pagedFluxOptions -> {
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -269,7 +269,6 @@ CosmosQueryRequestOptions clone(
UUID getCorrelationActivityId(CosmosQueryRequestOptions queryRequestOptions);
CosmosQueryRequestOptions setCorrelationActivityId(CosmosQueryRequestOptions queryRequestOptions, UUID correlationActivityId);
boolean isEmptyPageDiagnosticsEnabled(CosmosQueryRequestOptions queryRequestOptions);
CosmosQueryRequestOptions withEmptyPageDiagnosticsEnabled(CosmosQueryRequestOptions queryRequestOptions, boolean emptyPageDiagnosticsEnabled);
<T> Function<JsonNode, T> getItemFactoryMethod(CosmosQueryRequestOptions queryRequestOptions, Class<T> classOfT);
CosmosQueryRequestOptions setItemFactoryMethod(CosmosQueryRequestOptions queryRequestOptions, Function<JsonNode, ?> factoryMethod);
String getQueryNameOrDefault(CosmosQueryRequestOptions queryRequestOptions, String defaultQueryName);
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -687,21 +687,6 @@ boolean isQueryPlanRetrievalDisallowed() {

boolean isEmptyPageDiagnosticsEnabled() { return this.emptyPageDiagnosticsEnabled; }

CosmosQueryRequestOptions setEmptyPageDiagnosticsEnabled(boolean emptyPageDiagnosticsEnabled) {
this.emptyPageDiagnosticsEnabled = emptyPageDiagnosticsEnabled;
return this;
}

CosmosQueryRequestOptions withEmptyPageDiagnosticsEnabled(boolean emptyPageDiagnosticsEnabled) {
if (this.emptyPageDiagnosticsEnabled == emptyPageDiagnosticsEnabled)
{
return this;
}

return new CosmosQueryRequestOptions(this)
.setEmptyPageDiagnosticsEnabled(emptyPageDiagnosticsEnabled);
}

Function<JsonNode, ?> getItemFactoryMethod() { return this.itemFactoryMethod; }

CosmosQueryRequestOptions setItemFactoryMethod(Function<JsonNode, ?> factoryMethod) {
Expand Down Expand Up @@ -789,11 +774,6 @@ public boolean isEmptyPageDiagnosticsEnabled(CosmosQueryRequestOptions queryRequ
return queryRequestOptions.isEmptyPageDiagnosticsEnabled();
}

@Override
public CosmosQueryRequestOptions withEmptyPageDiagnosticsEnabled(CosmosQueryRequestOptions queryRequestOptions, boolean emptyPageDiagnosticsEnabled) {
return queryRequestOptions.withEmptyPageDiagnosticsEnabled(emptyPageDiagnosticsEnabled);
}

@Override
@SuppressWarnings("unchecked")
public <T> Function<JsonNode, T> getItemFactoryMethod(
Expand Down