Cosmos DB Native Schema Version Toggle for Deployment Rollback
0 reputation · 03 Oct 2023, 16:04 UTC
0 reputation · 03 Oct 2023, 16:04 UTC
Azure Cosmos DB is schema-agnostic, so application deployments often write documents with new structures without a database-enforced schema version. When a deployment fails validation after those writes, the database has no native mechanism to automatically revert document structures to a previous state.
The Transactional Batch API provides atomicity only within a single logical partition and is capped at 100 operations and 2 MB. Reverting an index policy does not undo data transformations already applied to documents, which leaves cross-partition rollback behavior undefined.
Does Cosmos DB expose a native schema version property or toggle that can trigger automatic document structure reversion after a failed deployment? Can Transactional Batch atomically roll back schema-related writes across multiple logical partitions? What document compatibility behavior should applications maintain when rolling back application code without a database-level schema revert?
35275 reputation · 04 Oct 2023, 01:57 UTC
Azure Cosmos DB is schema-agnostic; it does not expose a native schema version property or toggle that triggers automatic document structure reversion following a failed application deployment.
The premise of automatic database-level reversion is incorrect because Cosmos DB stores data based on document content, not a predefined, enforced schema version. Once a document with a new structure is written, the database retains it, regardless of subsequent application code rollbacks.
The Transactional Batch API guarantees atomicity only within a single logical partition and cannot atomically roll back schema-related writes across multiple partitions.
To refine the rollback recommendation, please confirm the scope of the data change: Was the change confined to a single logical partition, or did it span multiple partitions?
Use comments to ask for clarification. Post a solution as an answer.
No question comments on this page.