mirror of
https://github.com/etcd-io/etcd.git
synced 2024-09-27 06:25:44 +00:00
Merge pull request #610 from metaflow/master
docs(api) added note for CAS about prevIndex=0 and `cause` meaning in server response
This commit is contained in:
commit
a9d5cc5a50
@ -437,14 +437,15 @@ This will try to compare the previous value of the key and the previous value we
|
||||
|
||||
```json
|
||||
{
|
||||
"cause": "[two != one] [0 != 8]",
|
||||
"cause": "[two != one]",
|
||||
"errorCode": 101,
|
||||
"index": 8,
|
||||
"message": "Test Failed"
|
||||
}
|
||||
```
|
||||
|
||||
which means `CompareAndSwap` failed.
|
||||
which means `CompareAndSwap` failed. `cause` explains why the test failed.
|
||||
Note: the condition prevIndex=0 always passes.
|
||||
|
||||
Let's try a valid condition:
|
||||
|
||||
@ -503,7 +504,7 @@ The error code explains the problem:
|
||||
{
|
||||
"errorCode": 101,
|
||||
"message": "Compare failed",
|
||||
"cause": "[two != one] [0 != 8]",
|
||||
"cause": "[two != one]",
|
||||
"index": 8
|
||||
}
|
||||
```
|
||||
@ -518,7 +519,7 @@ curl -L http://127.0.0.1:4001/v2/keys/foo?prevIndex=1 -XDELETE
|
||||
{
|
||||
"errorCode": 101,
|
||||
"message": "Compare failed",
|
||||
"cause": "[ != one] [1 != 8]",
|
||||
"cause": "[1 != 8]",
|
||||
"index": 8
|
||||
}
|
||||
```
|
||||
|
Loading…
x
Reference in New Issue
Block a user