mirror of
https://github.com/moby/moby.git
synced 2022-11-09 12:21:53 -05:00
Merge pull request #2004 from mavenugo/ec
endpoint_cnt store updates should not create an object
This commit is contained in:
commit
2b1a999d11
2 changed files with 10 additions and 5 deletions
|
@ -138,6 +138,15 @@ func (ec *endpointCnt) setCnt(cnt uint64) error {
|
||||||
}
|
}
|
||||||
|
|
||||||
func (ec *endpointCnt) atomicIncDecEpCnt(inc bool) error {
|
func (ec *endpointCnt) atomicIncDecEpCnt(inc bool) error {
|
||||||
|
store := ec.n.getController().getStore(ec.DataScope())
|
||||||
|
if store == nil {
|
||||||
|
return fmt.Errorf("store not found for scope %s", ec.DataScope())
|
||||||
|
}
|
||||||
|
|
||||||
|
tmp := &endpointCnt{n: ec.n}
|
||||||
|
if err := store.GetObject(datastore.Key(ec.Key()...), tmp); err != nil {
|
||||||
|
return err
|
||||||
|
}
|
||||||
retry:
|
retry:
|
||||||
ec.Lock()
|
ec.Lock()
|
||||||
if inc {
|
if inc {
|
||||||
|
@ -149,11 +158,6 @@ retry:
|
||||||
}
|
}
|
||||||
ec.Unlock()
|
ec.Unlock()
|
||||||
|
|
||||||
store := ec.n.getController().getStore(ec.DataScope())
|
|
||||||
if store == nil {
|
|
||||||
return fmt.Errorf("store not found for scope %s", ec.DataScope())
|
|
||||||
}
|
|
||||||
|
|
||||||
if err := ec.n.getController().updateToStore(ec); err != nil {
|
if err := ec.n.getController().updateToStore(ec); err != nil {
|
||||||
if err == datastore.ErrKeyModified {
|
if err == datastore.ErrKeyModified {
|
||||||
if err := store.GetObject(datastore.Key(ec.Key()...), ec); err != nil {
|
if err := store.GetObject(datastore.Key(ec.Key()...), ec); err != nil {
|
||||||
|
|
|
@ -256,6 +256,7 @@ retry:
|
||||||
if err := cs.GetObject(datastore.Key(kvObject.Key()...), kvObject); err != nil {
|
if err := cs.GetObject(datastore.Key(kvObject.Key()...), kvObject); err != nil {
|
||||||
return fmt.Errorf("could not update the kvobject to latest when trying to delete: %v", err)
|
return fmt.Errorf("could not update the kvobject to latest when trying to delete: %v", err)
|
||||||
}
|
}
|
||||||
|
logrus.Errorf("Error (%v) deleting object %v, retrying....", err, kvObject.Key())
|
||||||
goto retry
|
goto retry
|
||||||
}
|
}
|
||||||
return err
|
return err
|
||||||
|
|
Loading…
Add table
Reference in a new issue