Skip to content

.NET: support hierarchial partition key on CosmosDB Actor Storage - #425

Closed
Korolev Dmitry (DeagleGross) wants to merge 27 commits into
mainfrom
dmkorolev/partition-key
Closed

.NET: support hierarchial partition key on CosmosDB Actor Storage#425
Korolev Dmitry (DeagleGross) wants to merge 27 commits into
mainfrom
dmkorolev/partition-key

Conversation

@DeagleGross

@DeagleGrossKorolev Dmitry (DeagleGross) commented Aug 15, 2025

Copy link
Copy Markdown
Contributor

Support more complex partition key on cosmosdb. Updated packages as well.

Also fixes#356 where test projects for CosmosDB were removed. I've added them back (recreated to make build on new VS work) and also set the CosmosDB emulator in the CI.

Fixes#305

Contribution Checklist

  • The code builds clean without any errors or warnings
  • The PR follows the Contribution Guidelines
  • All unit tests pass, and I have added new tests where possible
  • I didn't break anyone 😄

@eavanvalkenburgEduard van Valkenburg (eavanvalkenburg) added the .NET Usage: [Issues, PRs], Target: .Net label Aug 15, 2025

CopilotAI left a comment

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Pull Request Overview

This PR introduces support for hierarchical partition keys in CosmosDB Actor Storage by changing from a single partition key (/actorId) to a composite partition key using both /actorType and /actorKey. The changes also update Aspire packages to their latest versions.

  • Implements hierarchical partition key support for better data distribution and query performance
  • Updates composite indexing to align with the new partition key structure
  • Updates Aspire package versions to 9.4.1

Reviewed Changes

Copilot reviewed 3 out of 3 changed files in this pull request and generated 1 comment.

FileDescription
LazyCosmosContainer.csUpdates partition key configuration from single /actorId to hierarchical /actorType and /actorKey, and adjusts composite indexing accordingly
CosmosTestFixture.csUpdates test fixture to use the new hierarchical partition key configuration
Directory.Packages.propsUpdates Aspire package versions from 9.3.1/9.4.0 to 9.4.1

Tip: Customize your code reviews with copilot-instructions.md. Create the file or learn how to get started.

….Agents.Runtime.Storage.CosmosDB.Tests/CosmosTestFixture.cs
@adityamandaleeka

Copy link
Copy Markdown
Member

Aspire 9.4 for the win! Looks good, is this something we can test at all or does the SDK abstract this away entirely when you're querying?

@DeagleGross

Copy link
Copy Markdown
ContributorAuthor

Isthis something we can test at all or does the SDK abstract this away entirely when you're querying?

I dont think there is an easy way to test hierarchial partition keys in terms of performance: we would need to generate synthetic data; fill it in db and do the perf queries - so I think we can avoid it at this moment honestly.

SDK is abstracting the partition keys, because it allows querying and posting data as before without any changes.

@DeagleGross

Copy link
Copy Markdown
ContributorAuthor

skipping 3 tests from the cosmos suite - the tests are stable and passed the run for 3 times in a row already.
Ready to be merged

@DeagleGross

Copy link
Copy Markdown
ContributorAuthor

is a part of #402 as well and merged already!

Sign up for freeto join this conversation on GitHub. Already have an account? Sign in to comment

Labels

.NETUsage: [Issues, PRs], Target: .Net

Projects

None yet

Development

Successfully merging this pull request may close these issues.

.NET: Implement hierarchical partition keys for Cosmos storage impl

4 participants

@DeagleGross@adityamandaleeka@eavanvalkenburg