Skip to content

CosmosDbPartitionedStorage should work with existing collections created by CosmosDbStorage #2765

Closed
@christopheranderson

Description

@christopheranderson

Is your feature request related to a problem? Please describe.

CosmosDbPartitionedStorage assumes the container (i.e. collection - V3 renamed this) it is working with is partitioned by /id. This means it can't work with non-partitioned containers. This means that folks can't migrate from the old CosmosDbStorage without a lot of hassle.

Describe the solution you'd like

CosmosDbPartitionedStorage should check to see what the partition key path is on the ContainerProperties object (which we can get from the createIfNotExists call), and check to see if it's /_pk. If it is, then we can attempt to use the PartitionKey.Empty value for partition key (which is what non-partitioned containers look like.

Describe alternatives you've considered

Doing a full migration would be interesting as well, but it'd break existing apps using the old provider. A full migration without breaking existing apps requires a process like so:

  1. All apps on old storage
  2. Some apps on new storage, using non-partitioned strategy, some on old storage
  3. All apps on new storage, using non-partitioned strategy. No old storage code is running anymore.
  4. Migrate to new partitioning scheme

This would also require some additional metadata documents that describe the state of the storage and all the stores would need to poll that document regularly. This is probably a lot of work and it still requires the proposed solution is implemented.

I think we should scope out full migration for the time being.

Additional context
N/A

[enhancement]

Metadata

Metadata

Assignees

Labels

R7Release 7 - December 10th, 2019

Type

No type

Projects

No projects

Milestone

No milestone

Relationships

None yet

Development

No branches or pull requests

Issue actions