Skip to content

Commit

Permalink
Merge branch 'master' into users/brchon/ChangeFeed/StartFromFeedRange
Browse files Browse the repository at this point in the history
  • Loading branch information
j82w authored Aug 10, 2020
2 parents 223d91d + 4411655 commit d098458
Show file tree
Hide file tree
Showing 12 changed files with 4,651 additions and 2,355 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -14,6 +14,8 @@ namespace Microsoft.Azure.Cosmos
/// </summary>
internal class BatchAsyncContainerExecutorCache : IDisposable
{
// Keeping same performance tuned value of Bulk V2.
internal const int DefaultMaxBulkRequestBodySizeInBytes = 220201;
private ConcurrentDictionary<string, BatchAsyncContainerExecutor> executorsPerContainer = new ConcurrentDictionary<string, BatchAsyncContainerExecutor>();

public BatchAsyncContainerExecutor GetExecutorForContainer(
Expand All @@ -35,7 +37,7 @@ public BatchAsyncContainerExecutor GetExecutorForContainer(
container,
cosmosClientContext,
Constants.MaxOperationsInDirectModeBatchRequest,
Constants.MaxDirectModeBatchRequestBodySizeInBytes);
DefaultMaxBulkRequestBodySizeInBytes);
if (!this.executorsPerContainer.TryAdd(containerLink, newExecutor))
{
newExecutor.Dispose();
Expand Down
17 changes: 4 additions & 13 deletions Microsoft.Azure.Cosmos/src/Routing/GatewayAddressCache.cs
Original file line number Diff line number Diff line change
Expand Up @@ -248,7 +248,7 @@ public async Task<PartitionAddressInformation> TryGetAddressesAsync(
}
}

public async Task TryUpdateAddressAsync(
public Task TryRemoveAddressesAsync(
ServerKey serverKey,
CancellationToken cancellationToken)
{
Expand All @@ -263,29 +263,20 @@ public async Task TryUpdateAddressAsync(
{
foreach (PartitionKeyRangeIdentity pkRangeId in pkRangeIds)
{
DefaultTrace.TraceInformation("Refresh addresses for collectionRid :{0}, pkRangeId: {1}, serviceEndpoint: {2}",
DefaultTrace.TraceInformation("Remove addresses for collectionRid :{0}, pkRangeId: {1}, serviceEndpoint: {2}",
pkRangeId.CollectionRid,
pkRangeId.PartitionKeyRangeId,
this.serviceEndpoint);

tasks.Add(this.serverPartitionAddressCache.GetAsync(
pkRangeId,
null,
() => this.GetAddressesForRangeIdAsync(
null,
pkRangeId.CollectionRid,
pkRangeId.PartitionKeyRangeId,
forceRefresh: true),
cancellationToken,
forceRefresh: true));
tasks.Add(this.serverPartitionAddressCache.RemoveAsync(pkRangeId));
}

// remove the server key from the map since we are updating the addresses
HashSet<PartitionKeyRangeIdentity> ignorePkRanges;
this.serverPartitionAddressToPkRangeIdMap.TryRemove(serverKey, out ignorePkRanges);
}

await Task.WhenAll(tasks);
return Task.WhenAll(tasks);
}

public async Task<PartitionAddressInformation> UpdateAsync(
Expand Down
4 changes: 2 additions & 2 deletions Microsoft.Azure.Cosmos/src/Routing/GlobalAddressResolver.cs
Original file line number Diff line number Diff line change
Expand Up @@ -135,8 +135,8 @@ public async Task UpdateAsync(

foreach (KeyValuePair<Uri, EndpointCache> addressCache in this.addressCacheByEndpoint)
{
// since we don't know which address cache contains the pkRanges mapped to this node, we do a tryUpdate on all AddressCaches of all regions
tasks.Add(addressCache.Value.AddressCache.TryUpdateAddressAsync(serverKey, cancellationToken));
// since we don't know which address cache contains the pkRanges mapped to this node, we do a tryRemove on all AddressCaches of all regions
tasks.Add(addressCache.Value.AddressCache.TryRemoveAddressesAsync(serverKey, cancellationToken));
}

await Task.WhenAll(tasks);
Expand Down

Large diffs are not rendered by default.

Original file line number Diff line number Diff line change
Expand Up @@ -17,7 +17,7 @@ FROM root]]></SqlQuery>
</Input>
<Output>
<SqlQuery><![CDATA[
SELECT VALUE STRINGEQUALS(root["StringField"], "STR", true)
SELECT VALUE StringEquals(root["StringField"], "STR", true)
FROM root]]></SqlQuery>
</Output>
</Result>
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -749,7 +749,7 @@ async Task TestSearch(Expression<Func<ToDoActivity, bool>> expression, string ex
await TestSearch(x => x.description.EndsWith("activity"), "ENDSWITH", false, 0);
await TestSearch(x => x.description.EndsWith("AcTiViTy", StringComparison.OrdinalIgnoreCase), "ENDSWITH", true, 200);

await TestSearch(x => x.description.Equals("createrandomtodoactivity", StringComparison.OrdinalIgnoreCase), "STRINGEQUALS", true, 200);
await TestSearch(x => x.description.Equals("createrandomtodoactivity", StringComparison.OrdinalIgnoreCase), "StringEquals", true, 200);

await TestSearch(x => x.description.Contains("todo"), "CONTAINS", false, 0);
await TestSearch(x => x.description.Contains("tOdO", StringComparison.OrdinalIgnoreCase), "CONTAINS", true, 200);
Expand Down
Loading

0 comments on commit d098458

Please sign in to comment.