Skip to content

Commit e954b8a

Browse files
authored
Merge pull request MicrosoftDocs#84303 from markjbrown/multi-master-LWW-update
Update articles to clarify LWW support
2 parents 063ff01 + 1018508 commit e954b8a

File tree

2 files changed

+13
-15
lines changed

2 files changed

+13
-15
lines changed

articles/cosmos-db/conflict-resolution-policies.md

+4-4
Original file line numberDiff line numberDiff line change
@@ -4,7 +4,7 @@ description: This article describes the conflict categories and conflict resolut
44
author: markjbrown
55
ms.service: cosmos-db
66
ms.topic: conceptual
7-
ms.date: 07/23/2019
7+
ms.date: 08/05/2019
88
ms.author: mjbrown
99
ms.reviewer: sngun
1010
---
@@ -25,16 +25,16 @@ For Azure Cosmos accounts configured with multiple write regions, update conflic
2525

2626
Azure Cosmos DB offers a flexible policy-driven mechanism to resolve write conflicts. You can select from two conflict resolution policies on an Azure Cosmos container:
2727

28-
- **Last Write Wins (LWW)**: This resolution policy, by default, uses a system-defined timestamp property. It's based on the time-synchronization clock protocol. If you use the SQL API, you can specify any other custom numerical property (e.g., your own notion of a timestamp) to be used for conflict resolution. A custom numerical property is also referred to as the *conflict resolution path*.
28+
* **Last Write Wins (LWW)**: This resolution policy, by default, uses a system-defined timestamp property. It's based on the time-synchronization clock protocol. If you use the SQL API, you can specify any other custom numerical property (e.g., your own notion of a timestamp) to be used for conflict resolution. A custom numerical property is also referred to as the *conflict resolution path*.
2929

3030
If two or more items conflict on insert or replace operations, the item with the highest value for the conflict resolution path becomes the winner. The system determines the winner if multiple items have the same numeric value for the conflict resolution path. All regions are guaranteed to converge to a single winner and end up with the same version of the committed item. When delete conflicts are involved, the deleted version always wins over either insert or replace conflicts. This outcome occurs no matter what the value of the conflict resolution path is.
3131

3232
> [!NOTE]
33-
> Last Write Wins is the default conflict resolution policy. It's available for the following APIs: SQL, MongoDB, Cassandra, Gremlin and Table.
33+
> Last Write Wins is the default conflict resolution policy and uses timestamp `_ts` for the following APIs: SQL, MongoDB, Cassandra, Gremlin and Table. Custom numerical property is available only for SQL API.
3434
3535
To learn more, see [examples that use LWW conflict resolution policies](how-to-manage-conflicts.md).
3636

37-
- **Custom**: This resolution policy is designed for application-defined semantics for reconciliation of conflicts. When you set this policy on your Azure Cosmos container, you also need to register a *merge stored procedure*. This procedure is automatically invoked when conflicts are detected under a database transaction on the server. The system provides exactly once guarantee for the execution of a merge procedure as part of the commitment protocol.
37+
* **Custom**: This resolution policy is designed for application-defined semantics for reconciliation of conflicts. When you set this policy on your Azure Cosmos container, you also need to register a *merge stored procedure*. This procedure is automatically invoked when conflicts are detected under a database transaction on the server. The system provides exactly once guarantee for the execution of a merge procedure as part of the commitment protocol.
3838

3939
If you configure your container with the custom resolution option, and you fail to register a merge procedure on the container or the merge procedure throws an exception at runtime, the conflicts are written to the *conflicts feed*. Your application then needs to manually resolve the conflicts in the conflicts feed. To learn more, see [examples of how to use the custom resolution policy and how to use the conflicts feed](how-to-manage-conflicts.md).
4040

articles/cosmos-db/how-to-manage-conflicts.md

+9-11
Original file line numberDiff line numberDiff line change
@@ -4,7 +4,7 @@ description: Learn how to manage conflicts in Azure Cosmos DB
44
author: markjbrown
55
ms.service: cosmos-db
66
ms.topic: sample
7-
ms.date: 06/25/2019
7+
ms.date: 08/05/2019
88
ms.author: mjbrown
99
---
1010

@@ -14,7 +14,7 @@ With multi-region writes, when multiple clients write to the same item, conflict
1414

1515
## Create a last-writer-wins conflict resolution policy
1616

17-
These samples show how to set up a container with a last-writer-wins conflict resolution policy. The default path for last-writer-wins is the timestamp field or the `_ts` property. This may also be set to a user-defined path for a numeric type. In a conflict, the highest value wins. If the path isn't set or it's invalid, it defaults to `_ts`. Conflicts resolved with this policy do not show up in the conflict feed. This policy can be used by all APIs.
17+
These samples show how to set up a container with a last-writer-wins conflict resolution policy. The default path for last-writer-wins is the timestamp field or the `_ts` property. For SQL API, this may also be set to a user-defined path with a numeric type. In a conflict, the highest value wins. If the path isn't set or it's invalid, it defaults to `_ts`. Conflicts resolved with this policy do not show up in the conflict feed. This policy can be used by all APIs.
1818

1919
### <a id="create-custom-conflict-resolution-policy-lww-dotnet"></a>.NET SDK V2
2020

@@ -110,7 +110,6 @@ Custom conflict resolution stored procedures must be implemented using the funct
110110
> [!IMPORTANT]
111111
> Just as with any stored procedure, a custom conflict resolution procedure can access any data with the same partition key and can perform any insert, update or delete operation to resolve conflicts.
112112
113-
114113
This sample stored procedure resolves conflicts by selecting the lowest value from the `/myCustomId` path.
115114

116115
```javascript
@@ -268,7 +267,6 @@ udp_collection = self.try_create_document_collection(
268267

269268
After your container is created, you must create the `resolver` stored procedure.
270269

271-
272270
## Create a custom conflict resolution policy
273271

274272
These samples show how to set up a container with a custom conflict resolution policy. These conflicts show up in the conflict feed.
@@ -423,10 +421,10 @@ while conflict:
423421

424422
Learn about the following Azure Cosmos DB concepts:
425423

426-
* [Global distribution - under the hood](global-dist-under-the-hood.md)
427-
* [How to configure multi-master in your applications](how-to-multi-master.md)
428-
* [Configure clients for multihoming](how-to-manage-database-account.md#configure-multiple-write-regions)
429-
* [Add or remove regions from your Azure Cosmos DB account](how-to-manage-database-account.md#addremove-regions-from-your-database-account)
430-
* [How to configure multi-master in your applications](how-to-multi-master.md).
431-
* [Partitioning and data distribution](partition-data.md)
432-
* [Indexing in Azure Cosmos DB](indexing-policies.md)
424+
- [Global distribution - under the hood](global-dist-under-the-hood.md)
425+
- [How to configure multi-master in your applications](how-to-multi-master.md)
426+
- [Configure clients for multihoming](how-to-manage-database-account.md#configure-multiple-write-regions)
427+
- [Add or remove regions from your Azure Cosmos DB account](how-to-manage-database-account.md#addremove-regions-from-your-database-account)
428+
- [How to configure multi-master in your applications](how-to-multi-master.md).
429+
- [Partitioning and data distribution](partition-data.md)
430+
- [Indexing in Azure Cosmos DB](indexing-policies.md)

0 commit comments

Comments
 (0)