Skip to content

Commit af11d2b

Browse files
committed
more specific on doc updates
1 parent 5936058 commit af11d2b

1 file changed

Lines changed: 12 additions & 10 deletions

File tree

sdk/cosmos/azure_data_cosmos_driver/docs/ErrorCodesAndRetries.md

Lines changed: 12 additions & 10 deletions
Original file line numberDiff line numberDiff line change
@@ -12,16 +12,18 @@ The Rust driver retries writes by default for retryable status codes. This is sa
1212

1313
### Idempotency Requirements
1414

15-
For write retries to be safe, customers must use ETag preconditions (`If-Match` headers) on replace and upsert operations. Without ETags, a retried write could silently overwrite a concurrent update. This is a best practice regardless of retries — ETags protect against lost updates from concurrent writers.
16-
17-
| Operation | Idempotent? | Retry safe? |
18-
|-----------|-------------|-------------|
19-
| Create | Yes (409 on duplicate) | Always |
20-
| Delete | Yes (404 on duplicate) | Always |
21-
| Replace / Upsert | With ETag precondition | Yes — 412 on stale ETag prevents silent overwrites |
22-
| Replace / Upsert | Without ETag | No — risk of lost update on retry |
23-
| Patch | Yes (operation-level idempotency) | Always |
24-
| Stored Procedure | No | **Never** — retries disabled |
15+
Write retries are not strictly idempotent — the initial attempt and a retry may return different status codes (e.g., create returns 201 on success, then 409 on retry). What makes retries "safe" is that the final state of the resource is the same regardless of how many times the operation is executed, and the non-2xx status codes are deterministic signals the application can handle.
16+
17+
For replace and upsert operations, customers must use ETag preconditions (`If-Match` headers) to enable optimistic locking. Without ETags, there is no concurrency control — concurrent writers or retried writes can silently overwrite each other.
18+
19+
| Operation | Idempotent? | Retry safe? | Initial attempt | On retry (duplicate) | App must handle |
20+
|-----------|-------------|-------------|-----------------|----------------------|-----------------|
21+
| Create | Yes | Always | 201 Created | 409 Conflict | 409 |
22+
| Delete | Yes | Always | 204 No Content | 404 Not Found | 404 |
23+
| Replace / Upsert | With ETag | Yes | 200 OK | 412 Precondition Failed (if concurrent update) | 412 |
24+
| Replace / Upsert | Without ETag | No | 200 OK | 200 OK (silent overwrite — no concurrency control) ||
25+
| Patch | Yes | Always | 200 OK | 200 OK (operation-level idempotency) ||
26+
| Stored Procedure | No | **Never** | Varies | Undefined (side effects may repeat) | N/A — retries disabled |
2527

2628
## Status Code Handling
2729

0 commit comments

Comments
 (0)