mirror of
https://github.com/etcd-io/etcd.git
synced 2024-09-27 06:25:44 +00:00
Merge pull request #235 from xiangli-cmu/0.2
Test both of the condition if given
This commit is contained in:
commit
812fd4393e
@ -180,7 +180,9 @@ func (s *store) TestAndSet(nodePath string, prevValue string, prevIndex uint64,
|
||||
return nil, etcdErr.NewError(etcdErr.EcodeNotFile, nodePath, index, term)
|
||||
}
|
||||
|
||||
if n.Value == prevValue || n.ModifiedIndex == prevIndex {
|
||||
// If both of the prevValue and prevIndex are given, we will test both of them.
|
||||
// Command will be executed, only if both of the tests are successful.
|
||||
if (prevValue == "" || n.Value == prevValue) && (prevIndex == 0 || n.ModifiedIndex == prevIndex) {
|
||||
e := newEvent(TestAndSet, nodePath, index, term)
|
||||
e.PrevValue = n.Value
|
||||
|
||||
|
Loading…
x
Reference in New Issue
Block a user