Skip to content
Merged
Show file tree
Hide file tree
Changes from 9 commits
Commits
Show all changes
63 commits
Select commit Hold shift + click to select a range
1228ccf
1st round of changes to support subpartitioning for ChangeFeed
philipthomas-MSFT Jan 18, 2022
d3c1b52
name change and moved a method to FeedRangePartitionKey
philipthomas-MSFT Jan 18, 2022
c41fa0e
support for prefix partition change feed and query including unit and…
philipthomas-MSFT Feb 10, 2022
12fd6c1
splitting out unit tests from emulator tests
philipthomas-MSFT Mar 22, 2022
f512155
1st round of changes to support subpartitioning for ChangeFeed
philipthomas-MSFT Jan 18, 2022
38c8c26
name change and moved a method to FeedRangePartitionKey
philipthomas-MSFT Jan 18, 2022
f8f56c9
support for prefix partition change feed and query including unit and…
philipthomas-MSFT Feb 10, 2022
17fd955
splitting out unit tests from emulator tests
philipthomas-MSFT Mar 22, 2022
086f23d
Merge branch 'users/philipthomas/subpartitioning' of https://github.c…
philipthomas-MSFT Mar 22, 2022
4b0ef1c
Merge branch 'master' into users/philipthomas/subpartitioning
philipthomas-MSFT Sep 1, 2022
6c2cdb2
moved logic to choose for prefix partition query and change feed
philipthomas-MSFT Sep 1, 2022
b7853b3
additional conditional to check for MultiHash partitionkeydefinition …
philipthomas-MSFT Sep 1, 2022
2f77385
removed unnecessary using
philipthomas-MSFT Sep 1, 2022
21214c5
cleanup
philipthomas-MSFT Sep 1, 2022
34b368c
unnecessary using
philipthomas-MSFT Sep 1, 2022
b837983
removed PREVIEW from proj
philipthomas-MSFT Sep 1, 2022
5e572f1
unit tests for ResolveFeedRangeBasedOnPrefixContainerAsync
philipthomas-MSFT Sep 1, 2022
21c5d41
change access modifier
philipthomas-MSFT Sep 1, 2022
3726bdb
since I changed to static, needed to fix tests
philipthomas-MSFT Sep 1, 2022
3e08d67
dealing with some testing nits
philipthomas-MSFT Sep 1, 2022
5b963c1
removed Console.Writeline
philipthomas-MSFT Sep 1, 2022
7c0d3b1
slight change in test use containerProperties and partitionKeyDefinition
philipthomas-MSFT Sep 2, 2022
90bf0c5
Merge branch 'master' into users/philipthomas/subpartitioning
NaluTripician Jan 9, 2023
b35d60f
Merge branch 'master' of https://github.com/Azure/azure-cosmos-dotnet…
NaluTripician Jan 9, 2023
ced7c65
Merge branch 'master' into users/philipthomas/subpartitioning
NaluTripician Jan 9, 2023
edca934
Merge branch 'users/philipthomas/subpartitioning' of https://github.c…
NaluTripician Jan 9, 2023
5186ff4
big fix for resolve feedrange, changes to error behavior, added addit…
NaluTripician Feb 2, 2023
ff71ffe
Merge branch 'master' into users/philipthomas/subpartitioning
NaluTripician Feb 2, 2023
9b531c6
test changes
NaluTripician Feb 3, 2023
3ad5309
Merge branch 'master' into users/philipthomas/subpartitioning
NaluTripician Feb 3, 2023
df167b7
ran updateContracts.ps1
NaluTripician Feb 3, 2023
48f7eb5
Merge branch 'users/philipthomas/subpartitioning' of https://github.c…
NaluTripician Feb 3, 2023
756a123
reverting to 3ad5309e9e22a7376e836cfdbe11fa2438a59133
NaluTripician Feb 3, 2023
739eb2a
Ran Update Contracts
NaluTripician Feb 7, 2023
22b3e6d
ran updateContracts.ps1
NaluTripician Feb 7, 2023
52c2d06
Merge branch 'master' into users/philipthomas/subpartitioning
NaluTripician Feb 7, 2023
a00e86e
UpdateContracts.ps1
NaluTripician Feb 7, 2023
bb2f9d3
updatecontracts
NaluTripician Feb 7, 2023
9701c3b
removed bad check from test, removed changes from updatecontracts.ps1
NaluTripician Feb 7, 2023
f47bcca
Merge branch 'users/philipthomas/subpartitioning' of https://github.c…
NaluTripician Feb 7, 2023
df318a9
revert UpdateContracts changes
NaluTripician Feb 7, 2023
27a81f0
Reverting to 756a123160d14c424c5e11c4f3520094115aa5d4
NaluTripician Feb 7, 2023
618c4af
removed accidental change from changelog
NaluTripician Feb 7, 2023
d11561b
removed unwanted change from Directory.build.props
NaluTripician Feb 7, 2023
92562bd
added test clean up
NaluTripician Feb 9, 2023
919076b
Merge branch 'master' into users/philipthomas/subpartitioning
NaluTripician Feb 10, 2023
2828c72
Merge branch 'master' into users/philipthomas/subpartitioning
NaluTripician Feb 13, 2023
7ccb272
Merge branch 'master' into users/philipthomas/subpartitioning
NaluTripician Feb 15, 2023
b56470e
removed console.writelines
NaluTripician Feb 16, 2023
49b61dd
Merge branch 'users/philipthomas/subpartitioning' of https://github.c…
NaluTripician Feb 16, 2023
bc737dc
updates to query test
NaluTripician Feb 16, 2023
0d81811
removed preview flag
NaluTripician Feb 27, 2023
b9ca602
Merge branch 'master' into users/philipthomas/subpartitioning
NaluTripician Feb 27, 2023
7301873
ran UpdateContrats.ps1
NaluTripician Feb 27, 2023
d24428b
Merge branch 'master' into users/philipthomas/subpartitioning
NaluTripician Feb 27, 2023
8fe7529
Merge branch 'master' into users/philipthomas/subpartitioning
NaluTripician Feb 27, 2023
63da8c8
Merge branch 'master' into users/philipthomas/subpartitioning
NaluTripician Mar 1, 2023
db06f92
Merge branch 'master' into users/philipthomas/subpartitioning
NaluTripician Mar 2, 2023
c098777
no longer recread feedRange for queries unless using prefix pk
NaluTripician Mar 3, 2023
87416c3
Merge branch 'master' into users/philipthomas/subpartitioning
NaluTripician Mar 3, 2023
73771ba
simplified if statement
NaluTripician Mar 6, 2023
6500636
fixed bug
NaluTripician Mar 6, 2023
416c823
Merge branch 'master' into users/philipthomas/subpartitioning
NaluTripician Mar 6, 2023
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
29 changes: 29 additions & 0 deletions Microsoft.Azure.Cosmos/src/FeedRange/FeedRange.cs
Original file line number Diff line number Diff line change
Expand Up @@ -5,6 +5,8 @@
namespace Microsoft.Azure.Cosmos
{
using System;
using System.Threading;
using System.Threading.Tasks;

/// <summary>
/// Represents a unit of feed consumption that can be used as unit of parallelism.
Expand Down Expand Up @@ -43,5 +45,32 @@ public static FeedRange FromPartitionKey(PartitionKey partitionKey)
{
return new FeedRangePartitionKey(partitionKey);
}

#if PREVIEW
/// <summary>
/// Creates a partition key or effective partition key feed range.
/// </summary>
/// <param name="container">The container.</param>
/// <param name="partitionKey">The partition key.</param>
/// <param name="cancellationToken">The cancellation token.</param>
/// <returns>A <see cref="Task{TResult}"/> representing the result of the asynchronous operation.</returns>
public
#else
internal
#endif
async static Task<FeedRange> CreateFromPartitionKeyAsync(
Container container,
PartitionKey partitionKey,
CancellationToken cancellationToken = default)
{
ContainerProperties containerProperties = await container.ReadContainerAsync(cancellationToken: cancellationToken).ConfigureAwait(false);
Documents.PartitionKeyDefinition partitionKeyDefinition = containerProperties.PartitionKey;

return FeedRangeEpk.IsPrefixPartitionKey(partitionKey: partitionKey, partitionKeyDefinition: partitionKeyDefinition) switch
{
true => FeedRangeEpk.CreateFromPartitionKey(partitionKey: partitionKey, partitionKeyDefinition: partitionKeyDefinition),
false => FeedRangePartitionKey.CreateFromPartitionKey(partitionKey),
};
}
}
}
14 changes: 14 additions & 0 deletions Microsoft.Azure.Cosmos/src/FeedRange/FeedRanges/FeedRangeEpk.cs
Original file line number Diff line number Diff line change
Expand Up @@ -109,5 +109,19 @@ public override int GetHashCode()
^ this.Range.IsMinInclusive.GetHashCode()
^ this.Range.IsMaxInclusive.GetHashCode();
}

internal static FeedRangeEpk CreateFromPartitionKey(
Documents.PartitionKeyDefinition partitionKeyDefinition,
PartitionKey partitionKey)
{
return new FeedRangeEpk(partitionKey.InternalKey.GetEPKRangeForPrefixPartitionKey(partitionKeyDefinition));
}

internal static bool IsPrefixPartitionKey(
PartitionKey partitionKey,
Documents.PartitionKeyDefinition partitionKeyDefinition)
{
return !(partitionKey.InternalKey?.Components?.Count >= partitionKeyDefinition.Paths?.Count);
}
}
}
Original file line number Diff line number Diff line change
Expand Up @@ -81,5 +81,15 @@ internal override TResult Accept<TResult>(IFeedRangeTransformer<TResult> transfo
{
return transformer.Visit(this);
}

/// <summary>
/// Creates a feed range that span only a single <see cref="PartitionKey"/> value.
/// </summary>
/// <param name="partitionKey">The partition key value to create a feed range from.</param>
/// <returns>The feed range that spans the partition.</returns>
internal static FeedRange CreateFromPartitionKey(PartitionKey partitionKey)
{
return new FeedRangePartitionKey(partitionKey);
}
}
}
2 changes: 1 addition & 1 deletion Microsoft.Azure.Cosmos/src/Microsoft.Azure.Cosmos.csproj
Original file line number Diff line number Diff line change
Expand Up @@ -174,7 +174,7 @@
<PropertyGroup>
<DefineConstants Condition=" '$(SignAssembly)' == 'true' ">$(DefineConstants);SignAssembly</DefineConstants>
<DefineConstants Condition=" '$(DelaySign)' == 'true' ">$(DefineConstants);DelaySignKeys</DefineConstants>
<DefineConstants>$(DefineConstants);DOCDBCLIENT;COSMOSCLIENT;NETSTANDARD20</DefineConstants>
<DefineConstants>$(DefineConstants);DOCDBCLIENT;COSMOSCLIENT;NETSTANDARD20;PREVIEW</DefineConstants>
</PropertyGroup>

</Project>
Loading