Closed brandond closed 4 months ago
I suspect this may have been a shortcut on the kine side, as mod(key) = "0"
usually indicates that the server expects the resource to not exist and wants to create it, and returning a conflict error is handled correctly by Kubernetes.
However, returning an error instead of executing the ELSE puts extra work on the client as it now has to explicitly GET the key instead of getting it in the the txn response - and is also technically incorrect from a compatibility standpoint.
Apparently Kubernetes CREATE txn does not put any statement in the ELSE, so this probably isn't necessary to get right to work properly with Kubernetes.
Found a single use of an update with mod(key) = "0"
transaction in Kubernetes, in GuaranteedUpdate with an empty initial state:
Was this resolved by #229?
Yes should be.
Transactions with a comparison operation of
mod("/x") = "0"
should not result in an error when the target key already exists. If the key exists and the create fails, the ELSE case of the comparison should execute.For example, in the second transaction in the following sequence of operations, kine should execute the ELSE operation and return the current value, instead of returning the conflict from the insert.
Kine does the correct thing if you specify a mod revision other than 0:
Compare that to the correct behavior of etcd, which executes the ELSE case :