Граф коммитов

1355 Коммитов

Автор SHA1 Сообщение Дата
Tim Sander 96474e3ae4
Samples: Adds query continuation token usage (#2717)
This PR adds an example for using continuation tokens with queries in the V3 SDK. It will be referenced from the Cosmos DB query docs.
2021-09-15 12:39:08 -07:00
Sourabh Jain 3c6d747326
Public properties : Fixes public types to be upgrade safe so new content is not lost on deserialize and serialize paths. (#2712)
The current public types like ContainerProperties lose any new fields added by the service currently. If the property is not a know field is lost on the deserialize/serialize logic. This can possibly break older SDKs if new contract elements are added by the service and an update is attempted. The service might throw an exception thinking the user attempted to remove the new field when it was lost in the serialization logic.

To fix this issue a new internal dictionary is added to all the public service contract types to hold any additional properties the c# poco type is not aware of. So that in case of service contract evolution if metadata information changes, we won't loose any information.
2021-09-15 08:43:34 -07:00
Matias Quaranta f5e1ae656e
[Internal] CTL: Adds query scenario (#2701)
* polishing cf pull

* Adding check to CFP

* Refactor helper classes

* Base query

* metrics

* Add continuations to the error

* Adding 3 queries

* Changing as gauge

* remove async/await

* comments

* adding full drain
2021-09-14 15:34:58 -07:00
anujtoshniwal 9561c553f2
Client Encryption: Fixes JSON property name of ClientEncryptionKeyProperties to match backend (#2727)
Updates JSON property name of EncryptionAlgorithm to match backend.
2021-09-14 13:28:28 -07:00
Zishan Fu 9de4291ae0
[Internal] Change Feed: Adds emulator tests (#2193)
Add tests for emulator change feed fix.

Validates Incremental Change Feed by inserting and deleting documents and verifying nothing reported
Validates error message with Full Fidelity Change Feed and start from beginning.
2021-09-14 06:35:40 -07:00
Matias Quaranta c0730fc73d
Samples: Adds Change Feed Processor delegate context usage (#2730)
* Adding context

* single line

Co-authored-by: j82w <j82w@users.noreply.github.com>
2021-09-13 14:42:12 -07:00
j82w 66e9b206f2
[INTERNAL] Tests: Fixes transient test failures and add upsert tests (#2729)
Fix TestTokenCredentialFailedToRefreshAsync
Fix ClientTelemetryTests race conditions
Fix HttpClientConnectionLimitTest and add more logs
Add Upsert tests to validate session token exists.
2021-09-13 10:39:15 -07:00
j82w bfa184517c
3.21.0: Adds new SDK release (#2720)
This bumps the SDK version and updates the changelog for 3.21.0 release
2021-09-10 15:03:16 -07:00
j82w 016be1d9e9
Availability: Adds EnableTcpConnectionEndpointRediscovery to true by default (#2724)
EnableTcpConnectionEndpointRediscovery is used to enable address cache refresh on TCP connection reset notification. By refreshing the caches it helps future requests from going to the stale addresses.

ConnectionStateListener holds a cache that maps the server physical addresses to the partitionKeyRanges(Server Key -> List[PartitionKeyRangeIdentity]). ReplicatedResourceClient updates this cache when it resolves the physical addresses for the partitions. When the listener receives a notification on connection reset from the transport client, it triggers an address refresh in the GatewayAddressCache for all the partitionKeyRanges that maps to the server address received in the notification.
2021-09-10 14:56:39 -07:00
j82w 51062559fb
[INTERNAL] Diagnostics: Fixes system history to be actual json in the diagnostics (#2722)
This fixes the system usage to be actual json instead of a string which json that has been escaped.
2021-09-10 14:00:06 -07:00
leminh98 4eb8e203d3
Query: Adds PopulateIndexMetrics request options (#2612)
This PR adds the option for customer to enable PopulateIndexMetrics in query request options. This allows customer to obtain the index utilization of their query. The information is aggregated and automatically showed up in QueryMetrics once this request option is enabled. Please note that enabling this incurs overhead, so please set it only during debugging. It also adds a field called IndexMetrics to FeedResponse to expose the result to users.
2021-09-10 12:44:36 -07:00
j82w 33f3ec55d4
CosmosException: Adds diagnostics to message for 408, 500, 503, 404/1002 scenarios (#2719)
This change is being done because most users are not capturing the diagnostics for these exceptions. It is not possible to root cause or trouble shoot these issues without the diagnostics. This requires the customer to make code changes to get the additional info which causes the issue to persist for a long time.
2021-09-10 11:12:46 -07:00
leminh98 2b2988ea4b
Query: Fixes c# query parser to handle Alias in from clause (#2611)
This fixes the managed parser bug where it would throw error while parsing a valid aliased FROM clause without the AS keyword
2021-09-10 09:04:34 -07:00
j82w 55cf88efc2
[INTERNAL] C# LangVersion: Adds version 9 to all projects (#2711)
This is bumping the C# language version to 9. This matches the internal Cosmos DB projects.
2021-09-09 18:27:10 -07:00
askazakov e3c08acff8
Query: Fixes order by logic to throw original exception instead of AggregateException (#2708)
* - use GetAwaiter() to avoid AggregateException
- pass CancellationToken to Continue to avoid start continuation if not needed
- fix typo

* fix review https://github.com/Azure/azure-cosmos-dotnet-v3/pull/2708#discussion_r704337696

* fix https://github.com/Azure/azure-cosmos-dotnet-v3/pull/2708#discussion_r704408300
2021-09-09 11:12:48 -07:00
j82w 660ec97faf
Azure Active Directory(AAD): Fixes stuck requests when background refresh fails to refresh token (#2697)
1. This bug can cause requests to get stuck because the semaphore was not getting released in the scenario where multiple requests are waiting for a new token. This only occurs in scenario where the background refresh has failed to get a new token.
2. This optimizes the scenario where multiple concurrent requests are waiting on the token. It will now return the original task that is getting the token. This prevents all the requests waiting in serial to get the failure. All the requests will return the same exception.

The existing test for this scenario use .Wait which blocked the threads which also blocked all the other task to simulate concurrent requests. The tasks now use a Task.Run to prevent them from getting blocked again and wait logic was converted to an async/await.
2021-09-09 09:14:21 -07:00
j82w 8f12da0c16
[INTERNAL] Test: Fixes transient test failures caused by race conditions (#2716)
Fixed the test to wait on a flag instead of depending on a random delay. The delay would sometimes not be long enough causing it to fail the test.
2021-09-09 07:46:06 -07:00
Matias Quaranta 090af9c26a
Security: Fixes ServiceInterop.dll to be BinSkim compliant by adding /guard /Qspectre flags (#2710)
* Version bump

* dependency bump

* property rename

* test
2021-09-08 12:49:45 -07:00
Sourabh Jain 70ec89ca93
Client Telemetry : Fixes data precision and telemetry handler position (#2684)
1. Improved precision of all the metrics: So we are collecting different kind of metrics, Somewhere using conversion as a precision factor and if value needs not to be converted then using HistogramPrecisionfactor to preserve data precision.
2. Move telemetry handler before retry handler: Telemetry should be collected from the toppest layer of the operation.
3. Test cases improvement : There were chances that test cases started failing due to thread starvation or related issues. So added waiting till 30 sec.
4. Upper Case Connection Mode and Consistency : Just like Java
2021-09-08 11:04:18 -07:00
j82w c30699319f
[INTERNAL] EmulatorTests: Fixes tests to use DeleteStreamAsync to avoid throwing on test cleanup (#2709)
1. If the CreateContainerAsync fails the container delete operation throws an exception causing the test to hide the original exception.
2. Applied several Visual Studio suggestions about code formatting
2021-09-08 09:56:05 -07:00
j82w 9d5689568d
Query: Fixes query performance regression and adds mocked query benchmark (#2676)
1. Fixes a query performance regression caused by doing 2 hash lookups on all the headers. This now only does the validation for debug mode.
2. Adds a mocked query benchmark to the performance tests
2021-09-08 08:29:07 -07:00
Matias Quaranta abeb0e10a9
Samples: Fixes samples references and adds CI validation (#2700)
* Update csproj

* readonly

* Adding pipeline validation
2021-09-03 12:10:03 -07:00
j82w a591930486
Benchmark: Fixes build issues and adds gates (#2698)
The build is currently broken since it is referencing a field only available in the preview SDK. This fixes the build issue and adds gates to prevent future issues
2021-09-02 16:46:38 -07:00
j82w 43f7887d7f
Direct 3.21.0: Adds new API changes (#2687)
1. Add new system usage telemetry
2. Adds new ClientSideRequestStats interface to fix the start and end time
3. Fixes lock on client telemetry logging
4. Adds optimization to DiagnosticsHandler
5. Removes duplicate CPU collector in HA layer
2021-09-02 09:33:05 -07:00
Matias Quaranta e2ea2819cf
[Internal] Exceptions: Refactors usage of TaskCanceledException for OperationCanceledException (#2688)
* replacing for operationcanceledexception

* Add test
2021-08-27 14:36:28 -07:00
Nikhil Chaturvedi 983a5a81bf
Updating Authorization header size limit for AAD and Resource tokens (#2681)
* Updating Authorization header size limit for AAD and Resource tokens

Microsoft.Azure.Documents AuthorizationHelper allows for Resource Tokens to be upto 8*1024 characters in length, and AAD tokens to be upto 16*1024 characters in length.

This PR carries that logic over to AuthorizationHelper for Microsoft.Azure.Cosmos

* Dummy commit

* Update AuthorizationHelper.cs

Adding error trace

Co-authored-by: j82w <j82w@users.noreply.github.com>
2021-08-25 14:36:04 -07:00
Matias Quaranta f4bd8b6350
[Preview] Change Feed Processor: Adds notification APIs (#2613)
* Initial types and implementation

* Wiring through known places

* Refactor monitoring

* New tests

* public exception

* tests

* Refactoring error messaging so users get diagnostics

* Wiring through estimator

* tests

* undoing and cleaning up

* Rename of base implementation and refactor of public API

* more unit tests

* emulator tests

* docs

* adding context to exception

* contract

* undo file

* undo more

* logging always

* Addressing comments

* contract

* preview update after merge
2021-08-25 11:02:15 -07:00
Asket Agarwal cfc45ab1e1
ReadMany: Fixes ReadMany API for None Partition key values (#2661)
Currently the ReadMany API throws an ArgumentException on Pk values of PartitionKey.None
2021-08-20 09:37:06 -07:00
Matias Quaranta 60781bdd28
Change Feed: Fixes migration path from preview continuation (#2675)
* old migration code fix

* adding test
2021-08-19 09:27:35 -07:00
Matias Quaranta ad418d575b
Change Feed Processor: Adds detailed delegate context , stream, and manual checkpointing support (#2650)
* changing accessors

* Contract changes
2021-08-18 15:48:55 -07:00
Matias Quaranta f9463e5dba
[INTERNAL] Pipeline: Fixes cred scan task version (#2673)
* Suppressing entire json folder

* per file

* Upgrading CredScan

* undo suppresion

* Removing build

* enabling malware

* missing comment

Co-authored-by: j82w <j82w@users.noreply.github.com>
2021-08-18 14:04:55 -07:00
neildsh d897666c47
[INTERNAL] Query: Adds additional error info on unsupported cross partition queries for compute paths (#2672)
Adds a feature flag for DCount.
 Adds additional error info for unsupported cross partition queries. This is not used on the usual V3 paths that go through the pagination library. This is used for Compute.
1. DCount has special logic that doesn't block the query unless the flag is set to false. The flag missing will not block the query. This is necessary to avoid any breaking changes where the old SDKs did not set the flag.
2. The PartitionRoutingHelper is only used by compute and not by any of the v3 query code.
3. Adding the query plan info to the additional info is for back compatibility with the old SDKs that do the try execute instead of the get query plan call.
2021-08-17 23:18:37 -07:00
Sneha Gunda d6f21c099d
Changelog: Fixes quotes for PatchOperation (#2668)
Fixing syntax to resolve docs build HTML suggestion

Co-authored-by: j82w <j82w@users.noreply.github.com>
2021-08-12 10:18:35 -07:00
Sourabh Jain f11b763c0f
Client Telemetry : Adds more information in telemetry payload (#2642)
Related PR #2385.

In this PR, following changes have been made.

Add Preferred Region in telemetry payload
Add Time Interval In Sec in telemetry Payload
Change Request Latency Unit to milliseconds
2021-08-12 05:24:32 -07:00
j82w 950130a26b
.NET core 3.1: Refactors all projects to use latest LTS version (#2660)
.NET core 2.1 support ends this month. This is bumping all project to 3.1 which is the current LTS version.

https://dotnet.microsoft.com/platform/support/policy/dotnet-core
2021-08-09 13:10:58 -07:00
j82w 860870e12e
Changelog: Fixes status code for 2511 (#2659) 2021-08-09 10:07:45 -07:00
Sourabh Jain b007b462bf
Exception Handling: Adds inner exception stacktrace in GlobalEndpointManager (#2636)
Right now if any exceptions occurs while getting account details in globalEndpointManager, It gets rethrown without inner exception stacktrace.
So, Adding inner exception stack trace while rethrowing exception in GlobalEndpointManager.
2021-08-04 08:44:45 -07:00
Santosh Kulkarni b344afce5a
Client Encryption : Removes retry during decryption failure. (#2640)
Removes retry during decryption failure in DeserializeAndDecryptResponseAsync(). The retry logic around decryption was basically to address the problem with policy change and is handled by the caller in all cases except for ChangeFeedProcessor API set since we do not have Options to pass in the required headers. Will address this later with a better approach.
2021-08-03 09:38:09 -07:00
askazakov c0bb20a71a
OperationCanceledException: Fixes lost CancellationToken on CosmosOperationCanceledException (#2646)
* fix lost originalException CancellationToken

* test #6b268049b718df9410db31c5d5a4bca590fa52bb

* fix review https://github.com/Azure/azure-cosmos-dotnet-v3/pull/2646#discussion_r681176968

Co-authored-by: j82w <j82w@users.noreply.github.com>
2021-08-03 08:18:10 -07:00
Matias Quaranta b7cab0408c
[Documentation] Change Feed: Fixes remark on page size hint (#2647)
* note

* removing unneeded usings
2021-08-02 11:59:03 -07:00
Sourabh Jain 6a1e27a7ec
[PREVIEW] Client Telemetry : Adds the ability to send client side aggregate telemetry to Cosmos (#2385)
In this PR, We are collecting Azure VM metadata at the time of initialization of client and collecting Latency / Request Charge related metrics for each type of operation (Point, Stream, Batch, Query).

How can we Enable Client Telemetry?
If it is enabled using environment properties i.e COSMOS.CLIENT_TELEMETRY_ENABLED, then it will be enabled by default.

While creating client it can be disabled:
 CosmosClientBuilder cosmosClientBuilder =<initialize client builder>
 cosmosClientBuilder.WithTelemetryDisabled();
default Value : false

How to configure time to collect and send information to kustos?
As part of this PR, we are scheduling a Task to collect and calculate the metrics and sending this information to Kustos.
Environment Variables
Juno endpoint : COSMOS.CLIENT_TELEMETRY_ENDPOINT
default Value = blank , If it is not configured, then it won't even try to send any data but it will still keep collecting the data in background
Scheduling time : COSMOS.CLIENT_TELEMETRY_SCHEDULING_IN_SECONDS;
default Value = 600 seconds = 10 minutes

What happens if Telemetry is enabled but endpoint is not configured?
It will keep collecting the data in memory but will not send it anywhere. once URL is configured it will start sending that data to that URL.

As part of this PR, What all information we are collecting?
We are collection following information:

System Information : CPU usage and Memory Usage.
Operation Related Information : We are collecting Request Charge and Latency information for all Item/Document level operations along with batch and query.
VM Metadata
Database Account Name
How this change is going to affect performance?
Checkout Sheet 3 for final results.
Performance Testing Report
Maximum change in performance is 1.2%

Points Helpful for code review:
ClientTelemetry.cs : This file has all collection and calculation related code.
ClientTelemetryTest.cs : It cover most of the scenarios to test client telemetry
ClientTelemetryOptions.cs : Telemetry related options
2021-07-28 09:54:55 -07:00
anujtoshniwal 977916c6c5
[Client Encryption] : Adds support for PatchItem in Transactional Batch (#2634)
Adds support for PatchItem in Transactional Batch. Support for Patch via point operation already exists. Extending to Batch as well.
2021-07-28 08:24:44 -07:00
neildsh 7919dcd0aa
Query: Fixes substatus code for GROUP BY queries in PartitionRoutingHelper (#2635)
* Set correct substatus code for GROUP BY queries in PartitionRoutingHelper

* Use common test object for QueryPartitionProvider

* Remove extra method with default argument

Co-authored-by: Samer Boshra <sboshra@microsoft.com>
2021-07-24 11:34:49 -07:00
anujtoshniwal c301690028
[PREVIEW] Diagnostics : Fixes CosmosResponseFactory.CreateItemResponse to use ResponseMessage.Diagnostics instead of creating a new instance (#2626)
Use Diagnostics instead of Trace while creating ItemResponse from ResponseMessage. The other methods in the ResponseFactory are using Diagnostics except for the this one CreateItemResponse method.
2021-07-20 04:29:05 -07:00
ylabade 9e1d0f0027
Samples: Fix InvalidOperationException: Json Serializer left an open stream. (#2621) 2021-07-16 17:46:52 -07:00
neildsh 64fd5ae4f8
[Internal] Query: Adds coverage for gateway mode to the query emulator tests (#2615)
* Add coverage for gateway mode in the emulator tests

* Add more coverage for gateway mode to SanityQueryTests

Co-authored-by: j82w <j82w@users.noreply.github.com>
2021-07-14 23:28:24 -07:00
Justin English 68e57b1d37
[Internal] CTL: Adds scenario for Change feed pull (#2605)
* added a new scenario for Change feed pull

* Delete launch.json

* Delete tasks.json

* Delete launch.json

* Delete tasks.json

* Update ChangeFeedPullScenario.cs

Cleaned it up

* Update ChangeFeedPullScenario.cs

* Update ChangeFeedPullScenario.cs

* Update ChangeFeedPullScenario.cs

* Update ChangeFeedPullScenario.cs

* Update ChangeFeedPullScenario.cs

Co-authored-by: Matias Quaranta <ealsur@users.noreply.github.com>
2021-07-13 14:14:28 -07:00
Santosh Kulkarni db5f2c911b
Client Encryption: Adds ReadMany API support for encryption package. (#2572)
This PR adds ReadMany API support for encryption package.
2021-07-13 07:40:47 -07:00
neildsh c4545be4f4
[INTERNAL] Diagnostics: Adds ITrace overload to ProcessRequestAsync to get trace for a collection and PKRange refresh calls (#2603)
* Allow user to specify a real trace object in DocumentClient.ProcessRequestAsync

* Allow PartitionKeyRangeGoneRetryPolicy to use a trace other than NoOpTrace

* Added test
2021-07-09 17:20:39 -07:00
Asket Agarwal ec10c0cd1f
Diagnostics: Fixes duration for gateway diagnostics (#2599)
Fixes the duration field in the Http Request Diagnostics
2021-07-09 13:50:26 -07:00