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

2163 Коммитов

Автор SHA1 Сообщение Дата
iain 4df54559fe
[Internal] CosmosClient: Add a remarks section to AllowBulkExecution (#3987)
## Description

Add a remarks section to AllowBulkExecution explaining that it is not
recommended to be used with Resource Token authentication

## Type of change

Documentation fix

Fixes https://github.com/Azure/azure-cosmos-dotnet-v3/issues/1783
Closes #1783

---------

Co-authored-by: iain holmes <iaholmes@microsoft.com>
Co-authored-by: Ruben Bartelink <ruben@bartelink.com>
Co-authored-by: Kiran Kumar Kolli <kirankk@microsoft.com>
2024-10-06 10:31:41 -07:00
Jake 0481ed565f
Benchmark: Adds a workload to insert and read the inserted item. (#4482)
# Pull Request Template

## Description

Adds a new benchmark to simulate users inserting a document and
immediately reading it. This with the
https://github.com/Azure/azure-cosmos-dotnet-v3/pull/4478 will test
replication latency between different geo regions, and how SDK handles
various error scenarios.

## Type of change

Please delete options that are not relevant.

- [] Bug fix (non-breaking change which fixes an issue)
- [x] New feature (non-breaking change which adds functionality)
- [] Breaking change (fix or feature that would cause existing
functionality to not work as expected)
- [] This change requires a documentation update

## Closing issues

To automatically close an issue: closes #IssueNumber

Co-authored-by: jakewilley_microsoft <--global>
Co-authored-by: Kiran Kumar Kolli <kirankk@microsoft.com>
2024-10-05 22:18:52 -07:00
Jan Hyka 814e33b71f
[Client encryption]: Address code styling errors and warnings (#4747)
# Pull Request Template

## Description

Cleanup of code styling issues in Cosmos.Encryption.Custom.* projects as
set up by editorconfig.

## Type of change

Please delete options that are not relevant.

- [] Bug fix (non-breaking change which fixes an issue)

## Closing issues

Contributes to #4678

---------

Co-authored-by: Juraj Blazek <jublazek@microsoft.com>
Co-authored-by: juraj-blazek <53177060+juraj-blazek@users.noreply.github.com>
Co-authored-by: Santosh Kulkarni <66682828+kr-santosh@users.noreply.github.com>
Co-authored-by: Kiran Kumar Kolli <kirankk@microsoft.com>
2024-10-05 20:48:57 -07:00
Sourabh Jain ad1bcd8fcd
Open Telemetry : Adds query text in attribute (#4664)
## Description

1. Added `db.query.text` attribute to record queries in Traces.
2. Introduced new `QueryTextMode`, which will have valid values as
        a) `None` :Do not show query.
        b) `ParameterizedOnly` : Print parameterized query only.
        b) `All`
3. It can be set as part of `CosmosClientTelemetryOptions` and
`RequestOptions` (i.e. `QueryRequestOptions` and
`ChangeFeedRequestOptions`)

## Type of change

- [] New feature (non-breaking change which adds functionality)

---------

Co-authored-by: Kiran Kumar Kolli <kirankk@microsoft.com>
Co-authored-by: Justine Cocchi <jucocchi@microsoft.com>
2024-10-05 20:10:18 -07:00
Jan Hyka 50c401e555
[Client encryption]: Drop allocations on MDE Encryption path (#4740)
# Pull Request Template

## Description

On Encryption path we are switching to MDE API with offsets. This allows
reducing of allocations.
To sustain compatibility, enhanced API is backward implemented to
obsoleted local copy of encryption algorithm. No performance
optimizations on obsoleted code paths.

## Type of change

Please delete options that are not relevant.

- [] Bug fix (non-breaking change which fixes an issue)

## Closing issues

Contributes to #4678

---------

Co-authored-by: Juraj Blazek <jublazek@microsoft.com>
Co-authored-by: juraj-blazek <53177060+juraj-blazek@users.noreply.github.com>
Co-authored-by: Santosh Kulkarni <66682828+kr-santosh@users.noreply.github.com>
Co-authored-by: Kiran Kumar Kolli <kirankk@microsoft.com>
2024-10-05 19:18:04 -07:00
Kiran Kumar Kolli e9e5e1f42d
[INTERNAL] CI: Fixes Moving flaky tests into separate groups (#4752)
[INTERNAL] CI: Moving flaky tests into separate groups
2024-10-05 18:09:01 -07:00
Kiran Kumar Kolli b609d45165
[INTERNAL] CI: Fixes Weekend rolling build at 2 hour cadence (#4751)
[INTERNAL] CI: Fixes weekend rolling build at 2 hour cadence
Weekend cadence of every 2 hours, helps measuring pipeline reliability
2024-10-05 11:54:19 -07:00
Kiran Kumar Kolli f5e4adc56d
[INTERNAL] CI: Fixes adding auto-retries for tests (#4745)
[INTERNAL] CI: Fixes adding auto-retries for tests

Only the failed tests are re-run. Its still possible that that re-run
tests might see the state of the container at that time.
Test needs to be proofed in future.
2024-10-05 07:37:30 +00:00
Kiran Kumar Kolli 8772208cb9
[INTERNAL] CI : Fixes Quarantine StreamOperationsTestDirectModeAsync (#4750)
[INTERNAL] CI : Fixes Quarantine StreamOperationsTestDirectModeAsync
2024-10-04 17:26:46 -07:00
Kiran Kumar Kolli aa818fba22
[INTERNAL] CI: Fixes reducing emulator partition count to 10 (#4749)
- Tests updated to clean-up emulator for every class of tests
- It addressed tests non-graceful handling of orphaned containers
- Tests creating unnecessary higher number of partitions are optimized
2024-10-04 15:57:19 -07:00
Kiran Kumar Kolli ff429ba16d
[Internal] CI: Fixes reducing the partitions count to 20 (#4504)
Reducing the emulator PartitionCount to 20, will help boost emulator
startup times.
Current partition count is 100, its 5x reduction. 

NOTE: Why 20, emulator tests have issues at lower partition count (can
be a follow-up)

Side affect: 
- Test leaking containers or creating more containers for working-set
will result in failures.
- Preview encryption tests: Authored to be more resilient with container
per test increases overall time 2x (4M -> 8M) (still not the top
bottleneck), we can optimize it later.

Some spot check values (earlier range of 4-8minutes and also flaky)

![{B53E1D28-FE88-43CD-9C98-E2071D994F25}](https://github.com/user-attachments/assets/d9d66859-d343-4c87-b028-26a014bbc2c8)

Overall times with this change 
<img width="361" alt="{81CEBD14-A8A3-4795-89ED-8D3F8C6BA1BB}"
src="https://github.com/user-attachments/assets/e1aa4cc0-e8aa-4f5c-8ade-2c6aab75605a">
2024-10-04 11:13:38 -07:00
Philip Thomas 0bd253e260
CFP AVAD: Adds Container IsFeedRangePartOfAsync support for FeedRange (#4566)
# Pull Request Template

## Description

Details #4483 

The customer wants to validate if one **FeedRange** is a subset of
another **FeedRange**. This means checking if all the data in the y
**FeedRange** is entirely within the boundaries of the x **FeedRange**,
ensuring that no data is processed twice or skipped. It is understood
that **FeedRange** could also be represented by a **PartitionKey** or
**FeedRangeEpk**.

```txt
Feature: PartitionKey and FeedRange Validation

  Scenario: Validate if the y (FeedRange) is part of the x (PartitionKey)
    Given x represents the PartitionKey
    And y represents the FeedRange
    And both x and y have inclusive minimum and maximum boundaries (x.IsMinInclusive=true, x.IsMaxInclusive=true, y.IsMinInclusive=true, y.IsMaxInclusive=true)
    Then the scenario is valid, and both x and y include their start and end values

  Scenario: Validate NotSupportedException for incompatible boundaries between x (PartitionKey) and y (FeedRange)
    Given x represents the PartitionKey
    And y represents the FeedRange
    And x has an inclusive maximum boundary (x.IsMaxInclusive=true)
    And y has an exclusive maximum boundary (y.IsMaxInclusive=false)
    When the boundaries are compared
    Then a NotSupportedException is thrown due to incompatible boundary configurations

  Scenario: Validate minimum boundary inclusiveness for y (FeedRange) when compared to x (PartitionKey)
    Given x represents the PartitionKey
    And y represents the FeedRange
    And y has an exclusive minimum boundary (y.IsMinInclusive=false)
    And x has an inclusive minimum boundary (x.IsMinInclusive=true)
    When the boundaries are compared
    Then an error is thrown because y's minimum value must be inclusive (IsMinInclusive must be true)

  Scenario: Validate that both y's (FeedRange) minimum and maximum are exclusive when compared to x (PartitionKey)
    Given x represents the PartitionKey
    And y represents the FeedRange
    And both y's minimum and maximum values are exclusive (y.IsMinInclusive=false, y.IsMaxInclusive=false)
    When the boundaries are compared
    Then an error is thrown because y's minimum value must be inclusive (IsMinInclusive must be true)
```

| Scenario Description | x.IsMinInclusive | x.IsMaxInclusive |
y.IsMinInclusive | y.IsMaxInclusive | Expected Outcome |

|---------------------------------------------------------------------------------------------------------------|------------------|------------------|------------------|------------------|-----------------------------------------------------------------|
| Validate if the y partition key is part of the x feed range | true |
true | true | true | Scenario is valid, both x and y include their start
and end values |
| Validate NotSupportedException for incompatible boundaries | true |
true | true | false | NotSupportedException is thrown due to
incompatible boundary configurations |
| Validate minimum boundary inclusiveness for y | true | true | false |
true | Error is thrown because y's minimum value must be inclusive |
| Validate y's exclusiveness results in error | true | true | false |
false | Error is thrown because y's minimum value must be inclusive |

---
```txt
Feature: FeedRange and PartitionKey Validation

  Scenario: Validate that both x (FeedRange) and y (PartitionKey) are fully inclusive
    Given x represents the FeedRange
    And y represents the PartitionKey
    And x has inclusive minimum and maximum boundaries (x.IsMinInclusive=true, x.IsMaxInclusive=true)
    And y has inclusive minimum and maximum boundaries (y.IsMinInclusive=true, y.IsMaxInclusive=true)
    Then the scenario is valid because both x and y include their start and end values

  Scenario: Validate that x (FeedRange) has inclusive minimum and exclusive maximum while y (PartitionKey) is fully inclusive
    Given x represents the FeedRange
    And y represents the PartitionKey
    And x has inclusive minimum and exclusive maximum boundaries (x.IsMinInclusive=true, x.IsMaxInclusive=false)
    And y has inclusive minimum and maximum boundaries (y.IsMinInclusive=true, y.IsMaxInclusive=true)
    Then the scenario is valid because x and y are compatible in terms of their boundaries

  Scenario: Validate that x's (FeedRange) minimum is exclusive while y (PartitionKey) is fully inclusive
    Given x represents the FeedRange
    And y represents the PartitionKey
    And x has an exclusive minimum and inclusive maximum boundary (x.IsMinInclusive=false, x.IsMaxInclusive=true)
    And y has inclusive minimum and maximum boundaries (y.IsMinInclusive=true, y.IsMaxInclusive=true)
    Then the scenario is invalid because x's minimum value must be inclusive (IsMinInclusive must be true)

  Scenario: Validate that both x's (FeedRange) minimum and maximum are exclusive while y (PartitionKey) is fully inclusive
    Given x represents the FeedRange
    And y represents the PartitionKey
    And x has exclusive minimum and maximum boundaries (x.IsMinInclusive=false, x.IsMaxInclusive=false)
    And y has inclusive minimum and maximum boundaries (y.IsMinInclusive=true, y.IsMaxInclusive=true)
    Then the scenario is invalid because x's minimum value must be inclusive (IsMinInclusive must be true)

```

| Scenario Description | x.IsMinInclusive | x.IsMaxInclusive |
y.IsMinInclusive | y.IsMaxInclusive | Expected Outcome |

|---------------------------------------------------------------------------------------------------------------|------------------|------------------|------------------|------------------|-----------------------------------------------------------------|
| Validate that both x and y are fully inclusive | true | true | true |
true | Scenario is valid because both x and y include their start and
end values |
| Validate that x has inclusive minimum and exclusive maximum while y is
fully inclusive | true | false | true | true | Scenario is valid because
x and y are compatible in terms of their boundaries |
| Validate that x's minimum is exclusive while y is fully inclusive |
false | true | true | true | Scenario is invalid because x's minimum
value must be inclusive (IsMinInclusive must be true) |
| Validate that both x's minimum and maximum are exclusive while y is
fully inclusive | false | false | true | true | Scenario is invalid
because x's minimum value must be inclusive (IsMinInclusive must be
true) |

---
```txt
Feature: FeedRange and FeedRange Validation

  Scenario: Validate when both x (FeedRange) and y (FeedRange) have inclusive minimum and maximum boundaries
    Given x represents the FeedRange
    And y represents the FeedRange
    And both x and y have inclusive minimum and maximum boundaries (x.IsMinInclusive=true, x.IsMaxInclusive=true, y.IsMinInclusive=true, y.IsMaxInclusive=true)
    Then the scenario is valid because both x and y include their start and end values

  Scenario: Validate when x (FeedRange) has inclusive boundaries and y (FeedRange) has an exclusive maximum boundary
    Given x represents the FeedRange
    And y represents the FeedRange
    And x has inclusive minimum and maximum boundaries (x.IsMinInclusive=true, x.IsMaxInclusive=true)
    And y has an exclusive maximum boundary (y.IsMinInclusive=true, y.IsMaxInclusive=false)
    Then a NotSupportedException is thrown because y's maximum boundary is exclusive while x's is inclusive

  Scenario: Validate when x (FeedRange) has inclusive boundaries and y (FeedRange) has an exclusive minimum boundary
    Given x represents the FeedRange
    And y represents the FeedRange
    And x has inclusive minimum and maximum boundaries (x.IsMinInclusive=true, x.IsMaxInclusive=true)
    And y has an exclusive minimum boundary (y.IsMinInclusive=false, y.IsMaxInclusive=true)
    Then the scenario is invalid because y's minimum boundary must be inclusive

  Scenario: Validate when x (FeedRange) has inclusive boundaries and y (FeedRange) has both exclusive minimum and maximum boundaries
    Given x represents the FeedRange
    And y represents the FeedRange
    And x has inclusive minimum and maximum boundaries (x.IsMinInclusive=true, x.IsMaxInclusive=true)
    And y has both exclusive minimum and maximum boundaries (y.IsMinInclusive=false, y.IsMaxInclusive=false)
    Then the scenario is invalid because y's minimum boundary must be inclusive

  Scenario: Validate when x (FeedRange) has an inclusive minimum boundary and an exclusive maximum boundary, and y (FeedRange) has fully inclusive boundaries
    Given x represents the FeedRange
    And y represents the FeedRange
    And x has an inclusive minimum and exclusive maximum boundary (x.IsMinInclusive=true, x.IsMaxInclusive=false)
    And y has fully inclusive boundaries (y.IsMinInclusive=true, y.IsMaxInclusive=true)
    Then the scenario is valid because x's and y's boundaries are compatible

  Scenario: Validate when both x (FeedRange) and y (FeedRange) have inclusive minimum boundaries and exclusive maximum boundaries
    Given x represents the FeedRange
    And y represents the FeedRange
    And both x and y have inclusive minimum boundaries and exclusive maximum boundaries (x.IsMinInclusive=true, x.IsMaxInclusive=false, y.IsMinInclusive=true, y.IsMaxInclusive=false)
    Then the scenario is valid because both ranges are compatible

  Scenario: Validate when x (FeedRange) has an inclusive minimum boundary and an exclusive maximum boundary, and y (FeedRange) has an exclusive minimum boundary
    Given x represents the FeedRange
    And y represents the FeedRange
    And x has an inclusive minimum boundary and an exclusive maximum boundary (x.IsMinInclusive=true, x.IsMaxInclusive=false)
    And y has an exclusive minimum boundary but an inclusive maximum boundary (y.IsMinInclusive=false, y.IsMaxInclusive=true)
    Then the scenario is invalid because y's minimum boundary must be inclusive

  Scenario: Validate when x (FeedRange) has an inclusive minimum boundary and an exclusive maximum boundary, and y (FeedRange) has both exclusive minimum and maximum boundaries
    Given x represents the FeedRange
    And y represents the FeedRange
    And x has an inclusive minimum boundary and an exclusive maximum boundary (x.IsMinInclusive=true, x.IsMaxInclusive=false)
    And y has both exclusive minimum and maximum boundaries (y.IsMinInclusive=false, y.IsMaxInclusive=false)
    Then the scenario is invalid because y's minimum boundary must be inclusive

  Scenario: Validate when x (FeedRange) has an exclusive minimum boundary and an inclusive maximum boundary, and y (FeedRange) has fully inclusive boundaries
    Given x represents the FeedRange
    And y represents the FeedRange
    And x has an exclusive minimum boundary and an inclusive maximum boundary (x.IsMinInclusive=false, x.IsMaxInclusive=true)
    And y has fully inclusive boundaries (y.IsMinInclusive=true, y.IsMaxInclusive=true)
    Then the scenario is invalid because x's minimum boundary must be inclusive

  Scenario: Validate when x (FeedRange) has an exclusive minimum boundary and an inclusive maximum boundary, and y (FeedRange) has an exclusive maximum boundary
    Given x represents the FeedRange
    And y represents the FeedRange
    And x has an exclusive minimum boundary and an inclusive maximum boundary (x.IsMinInclusive=false, x.IsMaxInclusive=true)
    And y has an inclusive minimum but an exclusive maximum boundary (y.IsMinInclusive=true, y.IsMaxInclusive=false)
    Then the scenario is invalid because x's minimum boundary must be inclusive

  Scenario: Validate when both x (FeedRange) and y (FeedRange) have exclusive minimum boundaries and inclusive maximum boundaries
    Given x represents the FeedRange
    And y represents the FeedRange
    And both x and y have exclusive minimum boundaries and inclusive maximum boundaries (x.IsMinInclusive=false, x.IsMaxInclusive=true, y.IsMinInclusive=false, y.IsMaxInclusive=true)
    Then the scenario is invalid because both x's and y's minimum boundaries must be inclusive

  Scenario: Validate when both x (FeedRange) and y (FeedRange) have exclusive minimum and maximum boundaries
    Given x represents the FeedRange
    And y represents the FeedRange
    And both x and y have exclusive minimum and maximum boundaries (x.IsMinInclusive=false, x.IsMaxInclusive=false, y.IsMinInclusive=false, y.IsMaxInclusive=false)
    Then the scenario is invalid because both x's and y's minimum boundaries must be inclusive

  Scenario: Validate when x (FeedRange) has exclusive minimum and maximum boundaries, and y (FeedRange) has fully inclusive boundaries
    Given x represents the FeedRange
    And y represents the FeedRange
    And x has exclusive minimum and maximum boundaries (x.IsMinInclusive=false, x.IsMaxInclusive=false)
    And y has fully inclusive boundaries (y.IsMinInclusive=true, y.IsMaxInclusive=true)
    Then the scenario is invalid because x's minimum boundary must be inclusive
```

| Scenario Description | x.IsMinInclusive | x.IsMaxInclusive |
y.IsMinInclusive | y.IsMaxInclusive | Expected Outcome |

|--------------------------------------------------------------------------------------|------------------|------------------|------------------|------------------|-----------------------------------------------------------|
| Validate when both x and y have inclusive minimum and maximum
boundaries | true | true | true | true | Scenario is valid because both
x and y include their boundaries |
| Validate when x has inclusive boundaries and y has an exclusive
maximum boundary | true | true | true | false | NotSupportedException
because y's maximum is exclusive |
| Validate when x has inclusive boundaries and y has an exclusive
minimum boundary | true | true | false | true | Scenario is invalid
because y's minimum must be inclusive |
| Validate when x has inclusive boundaries and y has both exclusive
minimum and maximum boundaries | true | true | false | false | Scenario
is invalid because y's minimum must be inclusive |
| Validate when x has an inclusive minimum and exclusive maximum, and y
has fully inclusive boundaries | true | false | true | true | Scenario
is valid because x's and y's boundaries are compatible |
| Validate when both x and y have inclusive minimum and exclusive
maximum boundaries | true | false | true | false | Scenario is valid
because both ranges are compatible |
| Validate when x has an inclusive minimum and exclusive maximum, and y
has an exclusive minimum boundary | true | false | false | true |
Scenario is invalid because y's minimum must be inclusive |
| Validate when x has an inclusive minimum and exclusive maximum, and y
has both exclusive boundaries | true | false | false | false | Scenario
is invalid because y's minimum must be inclusive |
| Validate when x has an exclusive minimum and inclusive maximum, and y
has fully inclusive boundaries | false | true | true | true | Scenario
is invalid because x's minimum must be inclusive |
| Validate when x has an exclusive minimum and inclusive maximum, and y
has an exclusive maximum boundary | false | true | true | false |
Scenario is invalid because x's minimum must be inclusive |
| Validate when both x and y have exclusive minimum and inclusive
maximum boundaries | false | true | false | true | Scenario is invalid
because both x's and y's minimum must be inclusive |
| Validate when both x and y have exclusive minimum and maximum
boundaries | false | false | false | false | Scenario is invalid because
both x's and y's minimum must be inclusive |
| Validate when x has exclusive minimum and maximum boundaries, and y
has fully inclusive boundaries | false | false | true | true | Scenario
is invalid because x's minimum must be inclusive |

---
## API

```cs
Task<bool> IsFeedRangePartOfAsync(
            Cosmos.FeedRange x,
            Cosmos.FeedRange y,
            CancellationToken cancellationToken = default)
```

## Levelsetting

### Container
#### Diagram 1: Final state of PR

```mermaid
classDiagram
    class Container {
        <<abstract>>
        +IsFeedRangePartOfAsync() : Task<bool>
    }
    
    class ContainerInternal {
        +IsFeedRangePartOfAsync() : Task<bool>
    }

    class ContainerCore {
        -container : Container
        +IsFeedRangePartOfAsync() : Task<bool>
    }

    class ContainerInlineCore {
        -container : Container
        +IsFeedRangePartOfAsync() : Task<bool>
    }

    class EncryptionContainer {
        -container : Container
        +IsFeedRangePartOfAsync() : Task<bool>
    }

    class CustomEncryptionContainer {
        -container : Container
        +IsFeedRangePartOfAsync() : Task<bool>
    }

    ContainerInternal --|> Container : "is a"
    ContainerCore --|> ContainerInternal : "is a"
    ContainerInlineCore --|> ContainerCore : "is a"
    EncryptionContainer --|> Container : "is a"
    CustomEncryptionContainer --|> Container : "is a"
    ContainerCore --> Container : "has a"
    ContainerInlineCore --> Container : "has a"
    EncryptionContainer --> Container : "has a"
    CustomEncryptionContainer --> Container : "has a"

```

### FeedRange
```mermaid
classDiagram
    class FeedRange {
    <<abstract>>
    }

    class FeedRangeInternal {
        -range : Range
    }

    class FeedRangeEpk {
        -range : Range
    }

    class FeedRangePartitionKey {
        -range : Range
    }

    class FeedRangePartitionKeyRange {
        -range : Range
    }

    class Range {
        +Min : string
        +Max : string
        +IsMinInclusive : bool
        +IsMaxInclusive : bool
    }

    FeedRangeInternal --|> FeedRange : "is a"
    FeedRangeEpk --|> FeedRangeInternal : "is a"
    FeedRangePartitionKey --|> FeedRangeInternal : "is a"
    FeedRangePartitionKeyRange --|> FeedRangeInternal : "is a"
    FeedRangeInternal --> Range : "has a"
    FeedRangePartitionKeyRange --> Range : "has a"
    FeedRangePartitionKey --> Range : "has a"
    FeedRangeEpk --> Range : "has a"

```


https://learn.microsoft.com/en-us/dotnet/api/microsoft.azure.cosmos.feedrange?view=azure-dotnet

A **FeedRange** in Azure Cosmos DB represents a segment of data, often
based on partition keys, that can be processed or monitored.
**FeedRanges** are typically used in the context of change feed
processing to allow multiple workers to consume data in parallel by
splitting the container’s data into smaller, manageable pieces. Each
**FeedRange** corresponds to a specific partition key range.

**Min**: Lower boundary of a range

**Max** Upper boundary of a range

**IsMinInclusive**: Is the lower boundary inclusive or exclusive?
  - if _true_, the partition key value at Min is included in the range.
  - if _false_, the range starts just after the Min value.

**IsMaxInclusive**: Is the upper boundary inclusive or exclusive?
  - if _true_, the partition key at Max is included in the range.
  - if _false_, the range stops just before the Max value. 

**"MaxExclusive"**: The upper boundary of a range is exclusive; the
range does not include the maximum value itself.
- _IsMaxInclusive = false_ means that the upper boundary is exclusive,
so **IsMaxInclusive** is that same as the unofficial term,
"MaxExclusive".

## Examples based on unit tests

### FeedRange

A FeedRange represents a segment of data that can be processed or read
in parallel. FeedRanges can be used with or without partition keys,
depending on the context. They are especially useful in change feed
processing, where multiple workers can process different ranges in
parallel.

```cs
Container container = default;

try
{
    ContainerResponse containerResponse = await this.cosmosDatabase.CreateContainerIfNotExistsAsync(
        id: Guid.NewGuid().ToString(),
        partitionKeyPath: "/pk");

    container = containerResponse.Container;

    bool actualIsSubset = await container.IsFeedRangePartOfAsync(
        new FeedRangeEpk(new Documents.Routing.Range<string>(xMin, xMax, true, false)),
        new FeedRangeEpk(new Documents.Routing.Range<string>(yMin, yMax, true, false)),
        cancellationToken: CancellationToken.None);

    Assert.AreEqual(expected: expectedIsSubset, actual: actualIsSubset);
}
finally
{
    if (container != null)
    {
        await container.DeleteContainerAsync();
    }
}
```
### Hierarchical PartitionKey

In hierarchical partitioning, the partition key is composed of multiple
levels (or paths), which can be combined in a hierarchical manner. This
means that data is partitioned based on a combination of keys, such as
{"region": "US", "userId": "123"}, which makes the partitioning more
granular and allows for more specific partition key ranges.

```cs
Container container = default;

try
{
    ContainerProperties containerProperties = new ContainerProperties()
    {
        Id = Guid.NewGuid().ToString(),
        PartitionKeyPaths = new Collection<string> { "/pk", "/id" }
    };

    ContainerResponse containerResponse = await this.cosmosDatabase.CreateContainerIfNotExistsAsync(containerProperties);

    container = containerResponse.Container;

    PartitionKey partitionKey = new PartitionKeyBuilder()
        .Add("WA")
        .Add(Guid.NewGuid().ToString())
        .Build();

    FeedRange feedRange = FeedRange.FromPartitionKey(partitionKey);

    bool actualIsSubset = await container.IsFeedRangePartOfAsync(
        new FeedRangeEpk(new Documents.Routing.Range<string>(xMin, xMax, true, false)),
        feedRange,
        cancellationToken: CancellationToken.None);

    Assert.AreEqual(expected: expectedIsSubset, actual: actualIsSubset);
}
finally
{
    if (container != null)
    {
        await container.DeleteContainerAsync();
    }
}
```
### Partition Key

In non-hierarchical partitioning, the partition key is a single value
(or path). For instance, a partition key might be {"userId": "123"}.
Data is distributed based solely on this one-dimensional key.

```cs
Container container = default;

try
{
    ContainerResponse containerResponse = await this.cosmosDatabase.CreateContainerIfNotExistsAsync(
        id: Guid.NewGuid().ToString(),
        partitionKeyPath: "/pk");

    container = containerResponse.Container;

    PartitionKey partitionKey = new("WA");
    FeedRange feedRange = FeedRange.FromPartitionKey(partitionKey);

    bool actualIsSubset = await container.IsFeedRangePartOfAsync(
        new FeedRangeEpk(new Documents.Routing.Range<string>(xMin, xMax, true, false)),
        feedRange,
        cancellationToken: CancellationToken.None);

    Assert.AreEqual(expected: expectedIsSubset, actual: actualIsSubset);
}
finally
{
    if (container != null)
    {
        await container.DeleteContainerAsync();
    }
}
```
### Invalid FeedRangeEpk with IsMinInclusive: false throws
ArgumentOutOfRangeException

FeedRangeEpk is a more specific form of FeedRange that focuses on
effective partition keys (EPK), which represent the internal structure
of how data is distributed across partitions in Azure Cosmos DB.

FeedRangeEpk targets specific physical partitions, and these boundaries
are managed internally by Cosmos DB. These boundaries are fixed based on
the hash values of the partition keys and are not modifiable by the
user. As a result, there is no need for the notion of inclusivity,
because the partition boundary is rigid and defined by the physical
partition structure, not by a logical partition key.

``` cs
Container container = default;

try
{
    ContainerResponse containerResponse = await this.cosmosDatabase.CreateContainerIfNotExistsAsync(
        id: Guid.NewGuid().ToString(),
        partitionKeyPath: "/pk");

    container = containerResponse.Container;

    bool actualIsSubset = await container
            .IsFeedRangePartOfAsync(
                new FeedRangeEpk(new Documents.Routing.Range<string>("", "3FFFFFFFFFFFFFFF", false, true)),
                new FeedRangeEpk(new Documents.Routing.Range<string>("", "FFFFFFFFFFFFFFFF", true, false)),
                cancellationToken: CancellationToken.None));
}
catch (ArgumentOutOfRangeException exception)
{
     Console.WriteLine(exception.Message); // "IsMinInclusive must be true."
}
finally
{
    if (container != null)
    {
        await container.DeleteContainerAsync();
    }
}
```

### EnsureConsistentInclusitivy
Validates if all ranges in the list have consistent inclusivity for both
IsMinInclusive and IsMaxInclusive boundaries.
Throws an InvalidOperationException if there are inconsistencies.

```cs
List<Documents.Routing.Range<string>> ranges = new List<Documents.Routing.Range<string>>
{
    new Documents.Routing.Range<string> { IsMinInclusive = true, IsMaxInclusive = false },
    new Documents.Routing.Range<string> { IsMinInclusive = true, IsMaxInclusive = true },
    new Documents.Routing.Range<string> { IsMinInclusive = true, IsMaxInclusive = false },
    new Documents.Routing.Range<string> { IsMinInclusive = false, IsMaxInclusive = false }
};

EnsureConsistentInclusivity(ranges);
```

### IsSubset
Determines whether the y range is a subset of the x range.

```cs
Documents.Routing.Range<string> x= new Documents.Routing.Range<string>("A", "Z", true, true);
Documents.Routing.Range<string> y= new Documents.Routing.Range<string>("B", "Y", true, true);

bool isSubset = ContainerCore.IsSubset(x, y);
```

## Type of change

Please delete options that are not relevant.

- [x] New feature (non-breaking change which adds functionality)
- [x] This change requires a documentation update

## Closing issues

To automatically close an issue: closes #4483

---------

Co-authored-by: Kiran Kumar Kolli <kirankk@microsoft.com>
2024-10-04 08:28:09 -07:00
Kiran Kumar Kolli 863523a0a0
[INTERNAL] CI: Fixes CI excluding performance and codecoverage jobs (#4746)
[INTERNAL] CI: Fixes excluding performance and code coverage jobs from
CI

Performance job: ~36Minutes
Code coverage debug build: 35Minutes
Tests with-out test coverage: 18Minutes

Changes: 
- CI pipeline: Excluded performance and Codecoverage
- Rolling: Will include performance and codecoverage (no change here
same as earlier)

Overall long pole is still EmulatorTests but at-least will help us on
concurrency.


https://cosmos-db-sdk-public.visualstudio.com/cosmos-db-sdk-public/_build/results?buildId=51336&view=results
<img width="992" alt="{9E642ED1-03D5-46B2-A082-B6E9688AEAE6}"
src="https://github.com/user-attachments/assets/668e5ad4-66f5-498f-95b3-ee491336fa86">


https://cosmos-db-sdk-public.visualstudio.com/cosmos-db-sdk-public/_build/results?buildId=51339&view=results
<img width="1003" alt="{03411899-E041-4378-B2BB-511151E5095B}"
src="https://github.com/user-attachments/assets/dde4ef2e-3ec7-4b23-9ca0-0dfdbf6066d0">
2024-10-03 16:16:26 -07:00
Kiran Kumar Kolli 1e150b6fc8
Fixes `dotnet test` below issues (#4588)
[D:\a\1\s\Microsoft.Azure.Cosmos\tests\Microsoft.Azure.Cosmos.Tests\bin\Debug\net6.0\Microsoft.Azure.Cosmos.Tests.dll] UTA007: Method ClientRetryPolicy_Retry_SingleMaster_Read_PreferredLocations defined in class Microsoft.Azure.Cosmos.Client.Tests.ClientRetryPolicyTests does not have correct signature. Test method marked with the [TestMethod] attribute must be non-static, public, return-type as void  and should not take any parameter. Example: public void Test.Class1.Test(). Additionally, if you are using async-await in test method then return-type must be Task. Example: public async Task Test.Class1.Test2()
[MSTest][Discovery][D:\a\1\s\Microsoft.Azure.Cosmos\tests\Microsoft.Azure.Cosmos.Tests\bin\Debug\net6.0\Microsoft.Azure.Cosmos.Tests.dll] UTA007: Method ClientRetryPolicy_Retry_MultiMaster_Read_PreferredLocations defined in class Microsoft.Azure.Cosmos.Client.Tests.ClientRetryPolicyTests does not have correct signature. Test method marked with the [TestMethod] attribute must be non-static, public, return-type as void  and should not take any parameter. Example: public void Test.Class1.Test(). Additionally, if you are using async-await in test method then return-type must be Task. Example: public async Task Test.Class1.Test2()
[MSTest][Discovery][D:\a\1\s\Microsoft.Azure.Cosmos\tests\Microsoft.Azure.Cosmos.Tests\bin\Debug\net6.0\Microsoft.Azure.Cosmos.Tests.dll] UTA007: Method ClientRetryPolicy_Retry_MultiMaster_Write_PreferredLocations defined in class Microsoft.Azure.Cosmos.Client.Tests.ClientRetryPolicyTests does not have correct signature. Test method marked with the [TestMethod] attribute must be non-static, public, return-type as void  and should not take any parameter. Example: public void Test.Class1.Test(). Additionally, if you are using async-await in test method then return-type must be Task. Example: public async Task Test.Class1.Test2()
[MSTest][Discovery][D:\a\1\s\Microsoft.Azure.Cosmos\tests\Microsoft.Azure.Cosmos.Tests\bin\Debug\net6.0\Microsoft.Azure.Cosmos.Tests.dll] UTA007: Method ClientRetryPolicy_NoRetry_SingleMaster_Write_PreferredLocations defined in class Microsoft.Azure.Cosmos.Client.Tests.ClientRetryPolicyTests does not have correct signature. Test method marked with the [TestMethod] attribute must be non-static, public, return-type as void  and should not take any parameter. Example: public void Test.Class1.Test(). Additionally, if you are using async-await in test method then return-type must be Task. Example: public async Task Test.Class1.Test2()
[MSTest][Discovery][D:\a\1\s\Microsoft.Azure.Cosmos\tests\Microsoft.Azure.Cosmos.Tests\bin\Debug\net6.0\Microsoft.Azure.Cosmos.Tests.dll] UTA007: Method ClientRetryPolicy_NoRetry_SingleMaster_Read_NoPreferredLocations defined in class Microsoft.Azure.Cosmos.Client.Tests.ClientRetryPolicyTests does not have correct signature. Test method marked with the [TestMethod] attribute must be non-static, public, return-type as void  and should not take any parameter. Example: public void Test.Class1.Test(). Additionally, if you are using async-await in test method then return-type must be Task. Example: public async Task Test.Class1.Test2()
[MSTest][Discovery][D:\a\1\s\Microsoft.Azure.Cosmos\tests\Microsoft.Azure.Cosmos.Tests\bin\Debug\net6.0\Microsoft.Azure.Cosmos.Tests.dll] UTA007: Method ClientRetryPolicy_NoRetry_SingleMaster_Write_NoPreferredLocations defined in class Microsoft.Azure.Cosmos.Client.Tests.ClientRetryPolicyTests does not have correct signature. Test method marked with the [TestMethod] attribute must be non-static, public, return-type as void  and should not take any parameter. Example: public void Test.Class1.Test(). Additionally, if you are using async-await in test method then return-type must be Task. Example: public async Task Test.Class1.Test2()
[MSTest][Discovery][D:\a\1\s\Microsoft.Azure.Cosmos\tests\Microsoft.Azure.Cosmos.Tests\bin\Debug\net6.0\Microsoft.Azure.Cosmos.Tests.dll] UTA007: Method ClientRetryPolicy_NoRetry_MultiMaster_Read_NoPreferredLocations defined in class Microsoft.Azure.Cosmos.Client.Tests.ClientRetryPolicyTests does not have correct signature. Test method marked with the [TestMethod] attribute must be non-static, public, return-type as void  and should not take any parameter. Example: public void Test.Class1.Test(). Additionally, if you are using async-await in test method then return-type must be Task. Example: public async Task Test.Class1.Test2()
[MSTest][Discovery][D:\a\1\s\Microsoft.Azure.Cosmos\tests\Microsoft.Azure.Cosmos.Tests\bin\Debug\net6.0\Microsoft.Azure.Cosmos.Tests.dll] UTA007: Method ClientRetryPolicy_NoRetry_MultiMaster_Write_NoPreferredLocations defined in class Microsoft.Azure.Cosmos.Client.Tests.ClientRetryPolicyTests does not have correct signature. Test method marked with the [TestMethod] attribute must be non-static, public, return-type as void  and should not take any parameter. Example: public void Test.Class1.Test(). Additionally, if you are using async-await in test method then return-type must be Task. Example: public async Task Test.Class1.Test2()

There are still some more query test issues that needs attention (next follow-UpsertUser)

[MSTest][Discovery][D:\a\1\s\Microsoft.Azure.Cosmos\tests\Microsoft.Azure.Cosmos.Tests\bin\Debug\net6.0\Microsoft.Azure.Cosmos.Tests.dll] UTA001: TestClass attribute defined on non-public class Microsoft.Azure.Cosmos.Tests.Query.OrderByQueryPartitionRangePageAsyncEnumeratorTests+Implementation
[MSTest][Discovery][D:\a\1\s\Microsoft.Azure.Cosmos\tests\Microsoft.Azure.Cosmos.Tests\bin\Debug\net6.0\Microsoft.Azure.Cosmos.Tests.dll] UTA001: TestClass attribute defined on non-public class Microsoft.Azure.Cosmos.Tests.Query.QueryPartitionRangePageAsyncEnumeratorTests+Implementation
[MSTest][Discovery][D:\a\1\s\Microsoft.Azure.Cosmos\tests\Microsoft.Azure.Cosmos.Tests\bin\Debug\net6.0\Microsoft.Azure.Cosmos.Tests.dll] UTA001: TestClass attribute defined on non-public class Microsoft.Azure.Cosmos.Tests.Pagination.BufferedPartitionPartitionRangeEnumeratorTests+Implementation
[MSTest][Discovery][D:\a\1\s\Microsoft.Azure.Cosmos\tests\Microsoft.Azure.Cosmos.Tests\bin\Debug\net6.0\Microsoft.Azure.Cosmos.Tests.dll] UTA001: TestClass attribute defined on non-public class Microsoft.Azure.Cosmos.Tests.Pagination.SinglePartitionPartitionRangeEnumeratorTests+Implementation
2024-10-03 03:29:02 +00:00
Kiran Kumar Kolli 62155aa145
[Internal] UnitTest: Adds Test to Validate Regions Type Public Fields (#4730)
[INTERNAL] UnitTest: Regions type public fields validation

Broken for (Germany Central)  and (Germany Northeast). 
Needs Direct package upgrade with the fix.
2024-10-03 01:10:10 +02:00
Kiran Kumar Kolli a36d2555cc
[INTERNAL] lessmsi: Fixes the chocolatey unavailability issues (#4742)
[INTERNAL] lessmsi: Fixes the chocolatey unavailability issues

Lessmsi is pre-loaded into repo and used at rutnime to avoid availablity
issues with Chocolatey.
ref: https://github.com/activescott/lessmsi/releases/tag/v2.1.1

17% of CI pipelines and 35% of daily pipelines are impacted by his
unreliability

![image](https://github.com/user-attachments/assets/3812570e-01e9-4f24-9382-469514c66732)

```
By installing, you accept licenses for the packages.
Downloading package from source '[https://community.chocolatey.org/api/v2/'](https://community.chocolatey.org/api/v2/%27)
[NuGet] Error downloading 'lessmsi.2.1.1' from '[https://community.chocolatey.org/api/v2/package/lessmsi/2.1.1'.](https://community.chocolatey.org/api/v2/package/lessmsi/2.1.1%27.)
[NuGet] Response status code does not indicate success: 503 (Service Unavailable: Back-end server is at capacity).
[NuGet] Error downloading 'lessmsi.2.1.1' from '[https://community.chocolatey.org/api/v2/package/lessmsi/2.1.1'.](https://community.chocolatey.org/api/v2/package/lessmsi/2.1.1%27.)
[NuGet] Response status code does not indicate success: 503 (Service Unavailable: Back-end server is at capacity).
lessmsi not installed. An error occurred during installation:
Error downloading 'lessmsi.2.1.1' from '[https://community.chocolatey.org/api/v2/package/lessmsi/2.1.1'.](https://community.chocolatey.org/api/v2/package/lessmsi/2.1.1%27.)
lessmsi package files install failed with exit code 1. Performing other installation steps.
```
2024-10-02 11:49:22 -07:00
Kiran Kumar Kolli b92c605962
[INTENRAL] CodeCoverage: Fixes Upgrading code coverage task (#4743)
[INTENRAL] CodeCoverage: Fixes Upgrading code coverage task

Build warning
2024-10-02 10:05:04 -07:00
Jan Hyka e2d2ea3c12
[Client encryption]: Fixes Faster validations and string comparisons (#4739)
# Pull Request Template

## Description

1. Switch frequent constants string comparison mode to `ordinal`
2. Reduce allocations and validations complexity

## Type of change

Please delete options that are not relevant.

- [] Bug fix (non-breaking change which fixes an issue)

## Closing issues

Contributes to #4678
2024-10-01 16:13:23 -07:00
neildsh 18cc53d079
[Internal] Query: Adds an aggregate operator for CountIf. Removes debug assert from QueryPartitionProvider (#4738)
## Description

Adds an aggregate operator for CountIf. Removes debug assert from
QueryPartitionProvider that is no longer relevant

## Type of change

- [x] New feature (non-breaking change which adds functionality)
2024-09-30 22:28:03 +00:00
joegoldman2 cfa4255446
Azure.Cosmos.Operation => Azure-Cosmos-Operation-Request-Diagnostics (#4711)
Co-authored-by: Kiran Kumar Kolli <kirankk@microsoft.com>
2024-09-30 21:12:16 +00:00
joegoldman2 a4888f6ca9
reequest => request (#4736)
Co-authored-by: Kiran Kumar Kolli <kirankk@microsoft.com>
2024-09-30 09:13:38 -07:00
Philip Thomas 94de6b3df4
PatchItemAsync: Adds documentation on behavior of Replace patch operation when replacing properties that do not exist. (#4632)
# Pull Request Template

## Description

Adding documentation to Replace patch operation to describe the
following scenario:

```txt
Scenario: Replace operation on a non-existent property
   Given a Cosmos container with an item
   And the item is created with an "id", "name", and "description"
   When a Replace PatchOperation is attempted on a non-existent property "/fake/item"
   Then the operation should throw a CosmosException
   And the HTTP status code should be 400 BadRequest
```

## Type of change

Please delete options that are not relevant.

- [] Bug fix (non-breaking change which fixes an issue)
- [] New feature (non-breaking change which adds functionality)
- [] Breaking change (fix or feature that would cause existing
functionality to not work as expected)
- [] This change requires a documentation update

## Closing issues

To automatically close an issue: closes #4613

---------

Co-authored-by: Kiran Kumar Kolli <kirankk@microsoft.com>
2024-09-30 12:12:42 +00:00
Jan Hyka 9b491f2db7
[Client encryption]: Fixes benchmark results after upgrade to MDE 1.2.0 (#4727)
# Pull Request Template

## Description

Updating benchmark results after upgrade of
`Microsoft.Data.Encryption.Cryptography` dependency to version 1.2.0.

## Type of change

Please delete options that are not relevant.

- [] New feature (non-breaking change which adds functionality)

## Closing issues

Contributes to  the closure of an issue: #4675

Co-authored-by: Kiran Kumar Kolli <kirankk@microsoft.com>
2024-09-27 16:37:36 -07:00
Jan Hyka a4242a37df
[Client encryption]: Switch Newtonsoft.Json to use ArrayPool (#4726)
# Pull Request Template

## Description

Switches usages of `JsonTextReader` and `JsonTextWriter` to use
`ArrayPool<char>.Shared` for better performance and reduced memory
allocations. Arrays returned to pool are zeroed for increased data
security (at benchmarked cost of ~3.5% extra mean compared to non-zeroed
returns).

## Type of change

Please delete options that are not relevant.

- [] Bug fix (non-breaking change which fixes an issue)

## Closing issues

Contributes to #4678

Co-authored-by: Kiran Kumar Kolli <kirankk@microsoft.com>
2024-09-27 15:48:45 -07:00
juraj-blazek d8d58047ea
[Client encryption]: Update MDE dependency to v1.2.0 (#4673)
# Pull Request Template

## Description

Updates the `Microsoft.Data.Encryption.Cryptography` dependency to
version 1.2.0. This unblocks the release of stable version of the
`Microsoft.Azure.Cosmos.Encryption.Custom` package.
See also [the release
notes](https://github.com/Azure/microsoft-data-encryption-sdk/blob/main/net/release-notes/README.md)
for more information about the update.

## Type of change

Please delete options that are not relevant.

- [X] New feature (non-breaking change which adds functionality)

## Closing issues

Unblocks the closure of an issue: #4675

---------

Co-authored-by: Santosh Kulkarni <66682828+kr-santosh@users.noreply.github.com>
Co-authored-by: Jan Hyka <jahyka@microsoft.com>
Co-authored-by: Jan Hyka <38495542+JanHyka@users.noreply.github.com>
Co-authored-by: Kiran Kumar Kolli <kirankk@microsoft.com>
2024-09-27 08:34:36 +02:00
neildsh 7455b4bb85
Query: Adds deserialization of HybridSearchQueryInfo to the query plan (#4724)
## Description

Adds deserialization of HybridSearchQueryInfo to the query plan.

## Type of change

Please delete options that are not relevant.

- [x] New feature (non-breaking change which adds functionality)
2024-09-26 20:33:26 -07:00
juraj-blazek a8834148d8
[Client encryption]: Add baseline benchmarks for `Microsoft.Azure.Cosmos.Encryption.Custom` (#4679)
# Pull Request Template

## Description

Adding a `Microsoft.Azure.Cosmos.Encryption.Custom.Performance.Tests`
with `Encrypt`/`Decrypt` benchmarks for different document size.
Attaching also initial baseline report with the current memory
allocations.

## Type of change

Please delete options that are not relevant.

- [x] New feature (non-breaking change which adds functionality)

## Closing issues

Contributes to #4678

---------

Co-authored-by: Santosh Kulkarni <66682828+kr-santosh@users.noreply.github.com>
Co-authored-by: Kiran Kumar Kolli <kirankk@microsoft.com>
2024-09-27 01:17:04 +00:00
Kiran Kumar Kolli c6d907ca0e
[INTERNAL] Refractor: Fixes moving test only types to the test project (#4716)
[INTERNAL] Refractor: Fixes moving test only types to the test project

These types are not used in Friends as well
2024-09-25 12:25:20 -07:00
Philip Thomas 13dda6ffe4
Documentation: Fixes ReadItemAsync to show return ItemResponse<ToDoActivity> instead of ToDoActivity (#4712)
# Pull Request Template

## Description

Documentation shows **ReadItemAsync** is returning type _ToDoActivity_
instead of _ItemResponse<ToDoActivity>_

## Type of change

Please delete options that are not relevant.

- [] Bug fix (non-breaking change which fixes an issue)
- [] New feature (non-breaking change which adds functionality)
- [] Breaking change (fix or feature that would cause existing
functionality to not work as expected)
- [] This change requires a documentation update

## Closing issues

To automatically close an issue: closes #IssueNumber

---------

Co-authored-by: Kiran Kumar Kolli <kirankk@microsoft.com>
2024-09-24 13:43:27 -07:00
Abhijeet Mohanty b5ff17264a
Routing: Fixes `ExcludeRegions` for `ReadMany` operation. (#4713)
As title.
2024-09-24 13:40:31 -07:00
Kiran Kumar Kolli 2cc12dcfc0
[INTERNAL] Samples: Fixes upgrades to latest versions (vulnerabilities) and also warnings (#4693)
[INTERNAL] Samples: Fixes upgrades to latest versions (vulnerabilities)
and also warnings

For Cosmos pinned to latest versions
```
    <PackageReference Include="Microsoft.Azure.Cosmos" Version="3.43.0" />
```

Newtonsoft.Json and System.Text.Json: updated to patched versions
```
    <PackageReference Include="Newtonsoft.Json" Version="13.0.3" />
    <PackageReference Include="System.Text.Json" Version="8.0.4" />
```

Microsoft.NET.Sdk.Functions: Upgraded to latest 
```
    <PackageReference Include="Microsoft.NET.Sdk.Functions" Version="4.4.1" />
```

Removed transitive dependencies: Configuration and
Configuration.FileExtensions
```    
    <PackageReference Include="Microsoft.Extensions.Configuration" Version="2.2.0" />
    <PackageReference Include="Microsoft.Extensions.Configuration.FileExtensions" Version="2.2.0" />
```

ChangeFeed project: Its a migration project which has V2 CFP project
reference which has vulnerabile dependencies, which are now pinned
explicitly to patched version
```
    <PackageReference Include="System.Net.Http" Version="4.3.4" />
    <PackageReference Include="System.Net.Security" Version="4.3.2" />
```

Ref: #4674
2024-09-20 12:23:48 -07:00
Kiran Kumar Kolli 56811c9902
INTERNAL Range: Fixes Range type serialization to not allow NOT supported combinations (#4680)
* Range type serialization assumption to not allow NOT suported combinations

* Fixing incorrect conflict resolution

* Addressing the PR comments
2024-09-18 20:47:21 +00:00
Nalu Tripician 5948484baa
SDK 3.43.1 : Adds version bump and changelog (#4698)
* Changelog + version bump

* refactoed update message

* fixed version
2024-09-18 18:38:44 +00:00
Sourabh Jain 6623de9434
Open Telemetry: Fixes Operation name to follow Otel convention (#4643)
* Changed Operation name according to open telemetry convention

* fix tests

* updated baseline

* fix tests

* renamed ops name

* fixed operatio name

* reverted few files

* append prefix

* fix tests

* remove commented code

* fix activity name

* code refatot for different operation name for diagnostics

* baseline files

* fix tests

* refcator code

* fix test

* remove stream

* feediterator changes

* fix bugs

* further fixes

* typo fix

* fix test
2024-09-17 18:31:37 -07:00
Kiran Kumar Kolli 9aafc77ffa
[INTERNAL] Changelog: Adds note about Newtonsoft.Json (10.0.3) security vulnerability and upgrade to latest patched version (#4694)
* [INTERNAL] Changelog: Add note about Newtonsoft.Json (10.0.3) secuirty vulnerability and upgrade to latest patched version

* Update changelog.md

Co-authored-by: Kevin Pilch <kevinpi@microsoft.com>

---------

Co-authored-by: Kevin Pilch <kevinpi@microsoft.com>
2024-09-18 00:44:43 +05:30
Debdatta Kunda 7839885dde
ClientRetryPolicy: Adds Cross Regional Retry Logic on 429/3092 (#4691)
* Initial code changes to throw 503 on 429/3092.

* Updated client retry policy. Added more tests to cover 429/3092.

* Code changes to update direct package version. Updating the tests.

* Code changes to refactor client retry policy.

* Minor code cleanup.

* Reverting the direct version bump up change.

* Code changes to address some of the review comments.

* Code changes to move failover logic in client retry policy.

* Minor code clean up.

* Code changes to clean up some cosmetic items.

* Further clean up.

* Code changes to address review comments.

* Minor refactor to address cosmetic update.

* Code changes to address cosmetic review comment.
2024-09-17 18:17:30 +00:00
Kiran Kumar Kolli 63cd4bedf7
Adding Kevin and removing Kirill from code owners (#4689) 2024-09-16 09:47:06 -07:00
Nalu Tripician b757f8c38a
Hedging: Fixes Typo (WithAvailibilityStrategy -> WithAvailabilityStrategy) in CosmosClientBuilder (#4684)
* Update CosmosClientBuilder.cs

fixed typo

* Update DotNetPreviewSDKAPI.json
2024-09-13 18:40:17 +00:00
Debdatta Kunda c708fdaf00
Bump up the cosmos.direct package version. (#4687) 2024-09-13 17:52:34 +00:00
Kiran Kumar Kolli d4c9438178
Dependencies: Fixes Pinning System.Net.Http and System.Text.RegularExpressions to latest patched versions (#4676)
* Pinning System.Net.Http and System.Text.RegularExpressions to latest patched versions

* Fixing the unit test
2024-09-12 12:49:49 +02:00
Nalu Tripician 0fdb5e4222
SDK 3.43.0: Adds version bump and changelog (#4666)
* added project refrence

* update changelog and version bump

* contracts

* removed unreleated change

* Update changelog.md

Co-authored-by: Kiran Kumar Kolli <kirankk@microsoft.com>

* Update changelog.md

Co-authored-by: Kiran Kumar Kolli <kirankk@microsoft.com>

* update heding description

---------

Co-authored-by: Kiran Kumar Kolli <kirankk@microsoft.com>
2024-09-04 20:08:59 +00:00
Nalu Tripician cbf69c6308
added project refrence (#4661) 2024-09-04 14:36:57 -04:00
Nalu Tripician d242b8582e
Hedging: Adds Read hedging PREVIEW contracts (#4598)
* Update contracts

* removed unneeded changes

* made other contracts public

* update enable method

* comments

* contract update

* changed eneabled to internal

* fixed internal method

* Revert "fixed internal method"

This reverts commit f7da9f06c4.

* revert + change methods to internal

* fixed internal

* changed to factory creation

* disabledstrat fix

* fixed test + contracts

* xml changes

* updated comments

* Fixed Tests

* requested changes

* added client options check and one region check

* fix get

* fixed test

* fixed set

* fix client options

* updatecontracts

* requested changes

* fixed validate method

* Delete MultiRegionSetupHelpers.cs

removed file

* update contracts

* fixed merge

* fixed check
2024-08-29 09:59:44 -04:00
Nalu Tripician 6d603f54bd
[Internal] Hedging: Refactors Tests (#4641)
* test improvements

* fixed other multiregion test

* requested changes

* test fix

* adds util function for multiregion setup

* fixed util method/class

* parallelize tasks
2024-08-23 08:19:02 -07:00
Philip Thomas a1144f4f08
CF/P AVAD: Fixes Deserialization of ChangeFeedItem and ChangeFeedMetadata to support System.Text.Json and Newtonsoft.Json (#4618)
* checkin in

* support for both STJ and NSJ

* update contracts.

* name change PreviousLsn

* STJ TypeConverter support for ChangeFeedMetadata

* adding bacl StringEnumConverter

* test for Writes ChangeFeedMetadata

* removing DateTimeOffset as results are inconsistent.

* trying to get GMT, not local

* static UnixEpoch

* static qualifier in tests

* PropertyNameCaseInsensitive = false tests. copy of True tests.

* setting PropertyNameCaseInsensitive correctly for tests

* removed duplication for propertyNameCaseInsensitive tests

* remove JsonStringEnumConverter(), from tests

---------

Co-authored-by: Matias Quaranta <ealsur@users.noreply.github.com>
2024-08-21 21:42:46 +00:00
Matias Quaranta 2fbc27835f
[Internal] CODEOWNERS: Refactors owners (#4642) 2024-08-15 20:48:06 +00:00
Philip Thomas ee33928d18
CFP AVAD: Adds new FeedRange to ChangeFeedProcessorContext (#4621)
* checkin with test

* fix tests and run UpdateContracts

* Update Microsoft.Azure.Cosmos/src/ChangeFeedProcessor/FeedProcessing/ProcessorOptions.cs

Co-authored-by: Matias Quaranta <ealsur@users.noreply.github.com>

* add validation of feed range to exising tests. reemove other test.

* Update Microsoft.Azure.Cosmos/src/ChangeFeedProcessor/ChangeFeedProcessorContext.cs

Co-authored-by: Ruben Bartelink <ruben@bartelink.com>

* update summary for FeedRange.

* make validatecontext async

* adding back these tests

* remove return and asserts.

---------

Co-authored-by: Matias Quaranta <ealsur@users.noreply.github.com>
Co-authored-by: Ruben Bartelink <ruben@bartelink.com>
Co-authored-by: Kiran Kumar Kolli <kirankk@microsoft.com>
2024-08-14 15:10:23 +00:00
Matias Quaranta 7bc8e3ce88
FeedRanges: Fixes GetFeedRangesAsync throwing DocumentClientException (#4640)
* Fix

* tests

* Remove unused
2024-08-13 13:03:42 -04:00
Matias Quaranta 47596bd007
Documentation: Fixes AnalyticalStoreTimeToLiveInSeconds API documentation to list correct values (#4638)
* Updating API doc

* Wording
2024-08-12 21:30:03 +00:00
Nalu Tripician c2043ae85c
[Internal] Request Hedging: Refactors HedgeRegion diagnostics field to only show successful region (#4625)
* changed hedge region to only show sucessfull region

* added and updated tests

* discussion changes

* suggestions and test improvements

* test fix

* updated hedge context

* fix test

* no string conversion

* requested changes

* suggested changes

* remove and sort usings
2024-08-09 18:45:54 +00:00