You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
Copy file name to clipboardExpand all lines: articles/cosmos-db/conflict-resolution-policies.md
+4-4
Original file line number
Diff line number
Diff line change
@@ -4,7 +4,7 @@ description: This article describes the conflict categories and conflict resolut
4
4
author: markjbrown
5
5
ms.service: cosmos-db
6
6
ms.topic: conceptual
7
-
ms.date: 07/23/2019
7
+
ms.date: 08/05/2019
8
8
ms.author: mjbrown
9
9
ms.reviewer: sngun
10
10
---
@@ -25,16 +25,16 @@ For Azure Cosmos accounts configured with multiple write regions, update conflic
25
25
26
26
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:
27
27
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*.
29
29
30
30
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.
31
31
32
32
> [!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.
34
34
35
35
To learn more, see [examples that use LWW conflict resolution policies](how-to-manage-conflicts.md).
36
36
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.
38
38
39
39
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).
Copy file name to clipboardExpand all lines: articles/cosmos-db/how-to-manage-conflicts.md
+9-11
Original file line number
Diff line number
Diff line change
@@ -4,7 +4,7 @@ description: Learn how to manage conflicts in Azure Cosmos DB
4
4
author: markjbrown
5
5
ms.service: cosmos-db
6
6
ms.topic: sample
7
-
ms.date: 06/25/2019
7
+
ms.date: 08/05/2019
8
8
ms.author: mjbrown
9
9
---
10
10
@@ -14,7 +14,7 @@ With multi-region writes, when multiple clients write to the same item, conflict
14
14
15
15
## Create a last-writer-wins conflict resolution policy
16
16
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.
@@ -110,7 +110,6 @@ Custom conflict resolution stored procedures must be implemented using the funct
110
110
> [!IMPORTANT]
111
111
> 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.
112
112
113
-
114
113
This sample stored procedure resolves conflicts by selecting the lowest value from the `/myCustomId` path.
0 commit comments