Skip to content

Commit

Permalink
[Cosmos DB] Release 4.5.0 (#884)
Browse files Browse the repository at this point in the history
* Bumping SDK

* temporary fix

* test

* package bump
  • Loading branch information
ealsur authored Feb 12, 2024
1 parent 8f97c7a commit 7e39fae
Show file tree
Hide file tree
Showing 4 changed files with 29 additions and 2 deletions.
2 changes: 1 addition & 1 deletion build/common.props
Original file line number Diff line number Diff line change
Expand Up @@ -3,7 +3,7 @@
<!-- Extensions can have independent versions and only increment when released -->
<Version>3.0.0$(VersionSuffix)</Version>
<ExtensionsVersion>5.0.0$(VersionSuffix)</ExtensionsVersion> <!-- WebJobs.Extensions -->
<CosmosDBVersion>4.4.2$(VersionSuffix)</CosmosDBVersion>
<CosmosDBVersion>4.5.0$(VersionSuffix)</CosmosDBVersion>
<HttpVersion>3.2.0$(VersionSuffix)</HttpVersion>
<MobileAppsVersion>3.0.0$(VersionSuffix)</MobileAppsVersion>
<SendGridVersion>3.0.3$(VersionSuffix)</SendGridVersion>
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -61,6 +61,14 @@ public async Task<CosmosDBTriggerMetrics> GetMetricsAsync()
partitionCount = partitionWorkList.Count;
remainingWork = partitionWorkList.Sum(item => item.EstimatedLag);
}
catch (CosmosException cosmosException) when (cosmosException.StatusCode == HttpStatusCode.Gone)
{
// Temporary handling of split issue described in https://github.com/Azure/azure-cosmos-dotnet-v3/issues/4285
// This happens if the main instance is not running, potentially using Consumption Plan
// In this case, we return a positive value to make the Scale Controller consider spinning at least a single instance
partitionCount = 1;
remainingWork = 1;
}
catch (Exception e) when (e is CosmosException || e is InvalidOperationException)
{
if (!TryHandleCosmosException(e))
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -19,7 +19,7 @@
<WarningsAsErrors />
</PropertyGroup>
<ItemGroup>
<PackageReference Include="Microsoft.Azure.Cosmos" Version="3.35.4" />
<PackageReference Include="Microsoft.Azure.Cosmos" Version="3.38.1" />
<PackageReference Include="Microsoft.Azure.WebJobs" Version="3.0.37" />
<PackageReference Include="Microsoft.CSharp" Version="4.5.0" />
<PackageReference Include="Microsoft.Extensions.Azure" Version="1.1.0" />
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -163,5 +163,24 @@ public async Task GetMetrics_HandlesExceptions()
warning = _loggerProvider.GetAllLogMessages().Single(p => p.Level == Microsoft.Extensions.Logging.LogLevel.Warning);
Assert.Equal("CosmosDBTrigger Exception message: Uh oh again.", warning.FormattedMessage);
}

[Fact]
public async Task GetMetrics_HandleSplit()
{
_estimatorIterator
.SetupSequence(m => m.HasMoreResults)
.Returns(true)
.Returns(false);

_estimatorIterator
.Setup(m => m.ReadNextAsync(It.IsAny<CancellationToken>()))
.ThrowsAsync(new CosmosException("Partition is gone", HttpStatusCode.Gone, 1002, string.Empty, 0));

var metrics = await _cosmosDbMetricsProvider.GetMetricsAsync();

Assert.Equal(1, metrics.PartitionCount);
Assert.Equal(1, metrics.RemainingWork);
Assert.NotEqual(default(DateTime), metrics.Timestamp);
}
}
}

0 comments on commit 7e39fae

Please sign in to comment.