Why does a conditional update in Catalyst NoSQL return HTTP 200 when the condition is not met?
In Catalyst CloudScale NoSQL, HTTP 200 only means the request was processed. Whether a conditional write was applied is reported for each item in the response: the status is Success when the item was written, and ConditionMismatch or CriteriaMismatch when the condition was not met and nothing changed.
-
After a conditional update, read each item’s status in the result, for example
data.update[0].statusfromupdateItems(), instead of the HTTP status code. -
Treat a mismatch as “the item is no longer in the state I expected”, for example because another request changed it first. Don’t retry the same write blindly.
-
Build the condition on values you read, such as a version attribute, so that only one of several concurrent writers succeeds. A conditional write to a single item is applied atomically.
-
To check the item afterwards, read it with
consistent_readset to true, which reads from the master. A key that doesn’t exist returns a successful response with no items.
Note: Conditions apply to one item at a time. NoSQL has no transactions across items, and a write that times out on the client has no confirmed outcome until you read the item again.
Refer to the Update Item help page and the Query Table help page for more information.
Updated
Yes
No
Send your feedback to us
Ask AI about this answer