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
kv, sql/row: don't always convert ConditionFailedError to dupe key error
KV returns a `ConditionFailedError` when an existing row does not match
the expected value in a CPut. Up until now, the SQL layer has mostly
only used CPut with an empty expected value to verify that no row exists
with the key. For this reason, `ConvertBatchError` always converts
`ConditionFailedError` to a duplicate key error. (The one exception is
backfill of a unique index, which uses CPutAllowingIfNotExists with a
non-empty expected value.)
In the new UPDATE and DELETE fast paths, the SQL layer will now use CPut
with a non-empty expected value to verify that a certain row already
exists. If this verification fails, we don't want to return a dupe key
error, but rather undo the write and continue without an error. We need
`ConvertBatchError` to be aware of the difference.
This commit changes `ConvertBatchError` to only convert
`ConditionFailedError` to a dupe key error if the original request was a
CPut with an empty expected value (or the caller is backfill of a unique
index). If the original request had a non-empty expected value, we leave
it as a `ConditionFailedError` for the new fast path nodes to handle.
Epic: None
Release note: None
0 commit comments