blob: f19f365cfcd6e94ffba4d57f89ac25ec0a309899 [file] [log] [blame]
khenaidoobf6e7bb2018-08-14 22:27:29 -04001/*
2 * Copyright 2018-present Open Networking Foundation
3
4 * Licensed under the Apache License, Version 2.0 (the "License");
5 * you may not use this file except in compliance with the License.
6 * You may obtain a copy of the License at
7
8 * http://www.apache.org/licenses/LICENSE-2.0
9
10 * Unless required by applicable law or agreed to in writing, software
11 * distributed under the License is distributed on an "AS IS" BASIS,
12 * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
13 * See the License for the specific language governing permissions and
14 * limitations under the License.
15 */
khenaidoocfee5f42018-07-19 22:47:38 -040016package kvstore
17
18import (
khenaidoocfee5f42018-07-19 22:47:38 -040019 "context"
20 "errors"
khenaidoocfee5f42018-07-19 22:47:38 -040021 "fmt"
Stephane Barbarie260a5632019-02-26 16:12:49 -050022 "github.com/opencord/voltha-go/common/log"
khenaidoob9203542018-09-17 22:56:37 -040023 v3Client "go.etcd.io/etcd/clientv3"
Stephane Barbarie260a5632019-02-26 16:12:49 -050024 v3Concurrency "go.etcd.io/etcd/clientv3/concurrency"
khenaidoob9203542018-09-17 22:56:37 -040025 v3rpcTypes "go.etcd.io/etcd/etcdserver/api/v3rpc/rpctypes"
khenaidoo5c11af72018-07-20 17:21:05 -040026 "sync"
khenaidoocfee5f42018-07-19 22:47:38 -040027)
28
29// EtcdClient represents the Etcd KV store client
30type EtcdClient struct {
Stephane Barbariec53a2752019-03-08 17:50:10 -050031 ectdAPI *v3Client.Client
32 leaderRev v3Client.Client
33 keyReservations map[string]*v3Client.LeaseID
34 watchedChannels sync.Map
35 writeLock sync.Mutex
36 lockToMutexMap map[string]*v3Concurrency.Mutex
khenaidoobdcb8e02019-03-06 16:28:56 -050037 lockToSessionMap map[string]*v3Concurrency.Session
Stephane Barbariec53a2752019-03-08 17:50:10 -050038 lockToMutexLock sync.Mutex
khenaidoocfee5f42018-07-19 22:47:38 -040039}
40
41// NewEtcdClient returns a new client for the Etcd KV store
42func NewEtcdClient(addr string, timeout int) (*EtcdClient, error) {
khenaidoocfee5f42018-07-19 22:47:38 -040043 duration := GetDuration(timeout)
44
45 c, err := v3Client.New(v3Client.Config{
46 Endpoints: []string{addr},
47 DialTimeout: duration,
48 })
49 if err != nil {
50 log.Error(err)
51 return nil, err
52 }
Stephane Barbariec53a2752019-03-08 17:50:10 -050053
khenaidoocfee5f42018-07-19 22:47:38 -040054 reservations := make(map[string]*v3Client.LeaseID)
khenaidoobdcb8e02019-03-06 16:28:56 -050055 lockMutexMap := make(map[string]*v3Concurrency.Mutex)
56 lockSessionMap := make(map[string]*v3Concurrency.Session)
Stephane Barbarie260a5632019-02-26 16:12:49 -050057
Stephane Barbariec53a2752019-03-08 17:50:10 -050058 return &EtcdClient{ectdAPI: c, keyReservations: reservations, lockToMutexMap: lockMutexMap,
59 lockToSessionMap: lockSessionMap}, nil
khenaidoocfee5f42018-07-19 22:47:38 -040060}
61
khenaidooacc718f2019-08-21 16:21:07 -040062// IsConnectionUp returns whether the connection to the Etcd KV store is up. If a timeout occurs then
63// it is assumed the connection is down or unreachable.
64func (c *EtcdClient) IsConnectionUp(timeout int) bool {
65 // Let's try to get a non existent key. If the connection is up then there will be no error returned.
66 if _, err := c.Get("non-existent-key", timeout); err != nil {
67 return false
68 }
69 return true
70}
71
khenaidoocfee5f42018-07-19 22:47:38 -040072// List returns an array of key-value pairs with key as a prefix. Timeout defines how long the function will
73// wait for a response
Stephane Barbarie260a5632019-02-26 16:12:49 -050074func (c *EtcdClient) List(key string, timeout int, lock ...bool) (map[string]*KVPair, error) {
khenaidoocfee5f42018-07-19 22:47:38 -040075 duration := GetDuration(timeout)
76
77 ctx, cancel := context.WithTimeout(context.Background(), duration)
Stephane Barbarie260a5632019-02-26 16:12:49 -050078
khenaidoocfee5f42018-07-19 22:47:38 -040079 resp, err := c.ectdAPI.Get(ctx, key, v3Client.WithPrefix())
80 cancel()
81 if err != nil {
82 log.Error(err)
83 return nil, err
84 }
85 m := make(map[string]*KVPair)
86 for _, ev := range resp.Kvs {
Stephane Barbarieef6650d2019-07-18 12:15:09 -040087 m[string(ev.Key)] = NewKVPair(string(ev.Key), ev.Value, "", ev.Lease, ev.Version)
khenaidoocfee5f42018-07-19 22:47:38 -040088 }
89 return m, nil
90}
91
92// Get returns a key-value pair for a given key. Timeout defines how long the function will
93// wait for a response
Stephane Barbarie260a5632019-02-26 16:12:49 -050094func (c *EtcdClient) Get(key string, timeout int, lock ...bool) (*KVPair, error) {
khenaidoocfee5f42018-07-19 22:47:38 -040095 duration := GetDuration(timeout)
96
97 ctx, cancel := context.WithTimeout(context.Background(), duration)
Stephane Barbarie260a5632019-02-26 16:12:49 -050098
khenaidoocfee5f42018-07-19 22:47:38 -040099 resp, err := c.ectdAPI.Get(ctx, key)
100 cancel()
101 if err != nil {
102 log.Error(err)
103 return nil, err
104 }
105 for _, ev := range resp.Kvs {
106 // Only one value is returned
Stephane Barbarieef6650d2019-07-18 12:15:09 -0400107 return NewKVPair(string(ev.Key), ev.Value, "", ev.Lease, ev.Version), nil
khenaidoocfee5f42018-07-19 22:47:38 -0400108 }
109 return nil, nil
110}
111
112// Put writes a key-value pair to the KV store. Value can only be a string or []byte since the etcd API
113// accepts only a string as a value for a put operation. Timeout defines how long the function will
114// wait for a response
Stephane Barbarie260a5632019-02-26 16:12:49 -0500115func (c *EtcdClient) Put(key string, value interface{}, timeout int, lock ...bool) error {
khenaidoocfee5f42018-07-19 22:47:38 -0400116
117 // Validate that we can convert value to a string as etcd API expects a string
118 var val string
119 var er error
120 if val, er = ToString(value); er != nil {
121 return fmt.Errorf("unexpected-type-%T", value)
122 }
123
124 duration := GetDuration(timeout)
125
126 ctx, cancel := context.WithTimeout(context.Background(), duration)
Stephane Barbarie260a5632019-02-26 16:12:49 -0500127
khenaidoocfee5f42018-07-19 22:47:38 -0400128 c.writeLock.Lock()
129 defer c.writeLock.Unlock()
130 _, err := c.ectdAPI.Put(ctx, key, val)
131 cancel()
132 if err != nil {
133 switch err {
134 case context.Canceled:
khenaidoo5c11af72018-07-20 17:21:05 -0400135 log.Warnw("context-cancelled", log.Fields{"error": err})
khenaidoocfee5f42018-07-19 22:47:38 -0400136 case context.DeadlineExceeded:
khenaidoo5c11af72018-07-20 17:21:05 -0400137 log.Warnw("context-deadline-exceeded", log.Fields{"error": err})
khenaidoocfee5f42018-07-19 22:47:38 -0400138 case v3rpcTypes.ErrEmptyKey:
khenaidoo5c11af72018-07-20 17:21:05 -0400139 log.Warnw("etcd-client-error", log.Fields{"error": err})
khenaidoocfee5f42018-07-19 22:47:38 -0400140 default:
khenaidoo5c11af72018-07-20 17:21:05 -0400141 log.Warnw("bad-endpoints", log.Fields{"error": err})
khenaidoocfee5f42018-07-19 22:47:38 -0400142 }
143 return err
144 }
145 return nil
146}
147
148// Delete removes a key from the KV store. Timeout defines how long the function will
149// wait for a response
Stephane Barbarie260a5632019-02-26 16:12:49 -0500150func (c *EtcdClient) Delete(key string, timeout int, lock ...bool) error {
khenaidoocfee5f42018-07-19 22:47:38 -0400151
152 duration := GetDuration(timeout)
153
154 ctx, cancel := context.WithTimeout(context.Background(), duration)
Stephane Barbarie260a5632019-02-26 16:12:49 -0500155
khenaidoocfee5f42018-07-19 22:47:38 -0400156 defer cancel()
157
158 c.writeLock.Lock()
159 defer c.writeLock.Unlock()
160
khenaidoocfee5f42018-07-19 22:47:38 -0400161 // delete the keys
khenaidoo1ce37ad2019-03-24 22:07:24 -0400162 if _, err := c.ectdAPI.Delete(ctx, key, v3Client.WithPrefix()); err != nil {
163 log.Errorw("failed-to-delete-key", log.Fields{"key": key, "error": err})
khenaidoocfee5f42018-07-19 22:47:38 -0400164 return err
165 }
khenaidoo1ce37ad2019-03-24 22:07:24 -0400166 log.Debugw("key(s)-deleted", log.Fields{"key": key})
khenaidoocfee5f42018-07-19 22:47:38 -0400167 return nil
168}
169
170// Reserve is invoked to acquire a key and set it to a given value. Value can only be a string or []byte since
171// the etcd API accepts only a string. Timeout defines how long the function will wait for a response. TTL
172// defines how long that reservation is valid. When TTL expires the key is unreserved by the KV store itself.
173// If the key is acquired then the value returned will be the value passed in. If the key is already acquired
174// then the value assigned to that key will be returned.
175func (c *EtcdClient) Reserve(key string, value interface{}, ttl int64) (interface{}, error) {
176 // Validate that we can convert value to a string as etcd API expects a string
177 var val string
178 var er error
179 if val, er = ToString(value); er != nil {
180 return nil, fmt.Errorf("unexpected-type%T", value)
181 }
182
183 // Create a lease
184 resp, err := c.ectdAPI.Grant(context.Background(), ttl)
185 if err != nil {
186 log.Error(err)
187 return nil, err
188 }
189 // Register the lease id
190 c.writeLock.Lock()
191 c.keyReservations[key] = &resp.ID
192 c.writeLock.Unlock()
193
194 // Revoke lease if reservation is not successful
195 reservationSuccessful := false
196 defer func() {
197 if !reservationSuccessful {
198 if err = c.ReleaseReservation(key); err != nil {
khenaidoo1ce37ad2019-03-24 22:07:24 -0400199 log.Error("cannot-release-lease")
khenaidoocfee5f42018-07-19 22:47:38 -0400200 }
201 }
202 }()
203
204 // Try to grap the Key with the above lease
205 c.ectdAPI.Txn(context.Background())
206 txn := c.ectdAPI.Txn(context.Background())
207 txn = txn.If(v3Client.Compare(v3Client.Version(key), "=", 0))
208 txn = txn.Then(v3Client.OpPut(key, val, v3Client.WithLease(resp.ID)))
209 txn = txn.Else(v3Client.OpGet(key))
210 result, er := txn.Commit()
211 if er != nil {
212 return nil, er
213 }
214
215 if !result.Succeeded {
216 // Verify whether we are already the owner of that Key
217 if len(result.Responses) > 0 &&
218 len(result.Responses[0].GetResponseRange().Kvs) > 0 {
219 kv := result.Responses[0].GetResponseRange().Kvs[0]
220 if string(kv.Value) == val {
221 reservationSuccessful = true
222 return value, nil
223 }
224 return kv.Value, nil
225 }
226 } else {
227 // Read the Key to ensure this is our Key
Stephane Barbarie260a5632019-02-26 16:12:49 -0500228 m, err := c.Get(key, defaultKVGetTimeout, false)
khenaidoocfee5f42018-07-19 22:47:38 -0400229 if err != nil {
230 return nil, err
231 }
232 if m != nil {
233 if m.Key == key && isEqual(m.Value, value) {
234 // My reservation is successful - register it. For now, support is only for 1 reservation per key
235 // per session.
236 reservationSuccessful = true
237 return value, nil
238 }
239 // My reservation has failed. Return the owner of that key
240 return m.Value, nil
241 }
242 }
243 return nil, nil
244}
245
246// ReleaseAllReservations releases all key reservations previously made (using Reserve API)
247func (c *EtcdClient) ReleaseAllReservations() error {
248 c.writeLock.Lock()
249 defer c.writeLock.Unlock()
250 for key, leaseID := range c.keyReservations {
251 _, err := c.ectdAPI.Revoke(context.Background(), *leaseID)
252 if err != nil {
khenaidoo5c11af72018-07-20 17:21:05 -0400253 log.Errorw("cannot-release-reservation", log.Fields{"key": key, "error": err})
khenaidoocfee5f42018-07-19 22:47:38 -0400254 return err
255 }
256 delete(c.keyReservations, key)
257 }
258 return nil
259}
260
261// ReleaseReservation releases reservation for a specific key.
262func (c *EtcdClient) ReleaseReservation(key string) error {
263 // Get the leaseid using the key
khenaidoo2c6a0992019-04-29 13:46:56 -0400264 log.Debugw("Release-reservation", log.Fields{"key": key})
khenaidoocfee5f42018-07-19 22:47:38 -0400265 var ok bool
266 var leaseID *v3Client.LeaseID
267 c.writeLock.Lock()
268 defer c.writeLock.Unlock()
269 if leaseID, ok = c.keyReservations[key]; !ok {
khenaidoofc1314d2019-03-14 09:34:21 -0400270 return nil
khenaidoocfee5f42018-07-19 22:47:38 -0400271 }
272 if leaseID != nil {
273 _, err := c.ectdAPI.Revoke(context.Background(), *leaseID)
274 if err != nil {
275 log.Error(err)
276 return err
277 }
278 delete(c.keyReservations, key)
279 }
280 return nil
281}
282
283// RenewReservation renews a reservation. A reservation will go stale after the specified TTL (Time To Live)
284// period specified when reserving the key
285func (c *EtcdClient) RenewReservation(key string) error {
286 // Get the leaseid using the key
287 var ok bool
288 var leaseID *v3Client.LeaseID
289 c.writeLock.Lock()
290 defer c.writeLock.Unlock()
291 if leaseID, ok = c.keyReservations[key]; !ok {
292 return errors.New("key-not-reserved")
293 }
294
295 if leaseID != nil {
296 _, err := c.ectdAPI.KeepAliveOnce(context.Background(), *leaseID)
297 if err != nil {
khenaidoo5c11af72018-07-20 17:21:05 -0400298 log.Errorw("lease-may-have-expired", log.Fields{"error": err})
khenaidoocfee5f42018-07-19 22:47:38 -0400299 return err
300 }
301 } else {
302 return errors.New("lease-expired")
303 }
304 return nil
305}
306
307// Watch provides the watch capability on a given key. It returns a channel onto which the callee needs to
308// listen to receive Events.
309func (c *EtcdClient) Watch(key string) chan *Event {
310 w := v3Client.NewWatcher(c.ectdAPI)
311 channel := w.Watch(context.Background(), key, v3Client.WithPrefix())
312
313 // Create a new channel
314 ch := make(chan *Event, maxClientChannelBufferSize)
315
316 // Keep track of the created channels so they can be closed when required
317 channelMap := make(map[chan *Event]v3Client.Watcher)
318 channelMap[ch] = w
319 //c.writeLock.Lock()
320 //defer c.writeLock.Unlock()
khenaidoocfee5f42018-07-19 22:47:38 -0400321
Stephane Barbariec53a2752019-03-08 17:50:10 -0500322 channelMaps := c.addChannelMap(key, channelMap)
323
khenaidooba6b6c42019-08-02 09:11:56 -0400324 // Changing the log field (from channelMaps) as the underlying logger cannot format the map of channels into a
325 // json format.
326 log.Debugw("watched-channels", log.Fields{"len": len(channelMaps)})
khenaidoocfee5f42018-07-19 22:47:38 -0400327 // Launch a go routine to listen for updates
328 go c.listenForKeyChange(channel, ch)
329
330 return ch
331
332}
333
Stephane Barbariec53a2752019-03-08 17:50:10 -0500334func (c *EtcdClient) addChannelMap(key string, channelMap map[chan *Event]v3Client.Watcher) []map[chan *Event]v3Client.Watcher {
335 var channels interface{}
336 var exists bool
337
338 if channels, exists = c.watchedChannels.Load(key); exists {
339 channels = append(channels.([]map[chan *Event]v3Client.Watcher), channelMap)
340 } else {
341 channels = []map[chan *Event]v3Client.Watcher{channelMap}
342 }
343 c.watchedChannels.Store(key, channels)
344
345 return channels.([]map[chan *Event]v3Client.Watcher)
346}
347
348func (c *EtcdClient) removeChannelMap(key string, pos int) []map[chan *Event]v3Client.Watcher {
349 var channels interface{}
350 var exists bool
351
352 if channels, exists = c.watchedChannels.Load(key); exists {
353 channels = append(channels.([]map[chan *Event]v3Client.Watcher)[:pos], channels.([]map[chan *Event]v3Client.Watcher)[pos+1:]...)
354 c.watchedChannels.Store(key, channels)
355 }
356
357 return channels.([]map[chan *Event]v3Client.Watcher)
358}
359
360func (c *EtcdClient) getChannelMaps(key string) ([]map[chan *Event]v3Client.Watcher, bool) {
361 var channels interface{}
362 var exists bool
363
364 channels, exists = c.watchedChannels.Load(key)
365
khenaidoodaefa372019-03-15 14:04:25 -0400366 if channels == nil {
367 return nil, exists
368 }
369
Stephane Barbariec53a2752019-03-08 17:50:10 -0500370 return channels.([]map[chan *Event]v3Client.Watcher), exists
371}
372
khenaidoocfee5f42018-07-19 22:47:38 -0400373// CloseWatch closes a specific watch. Both the key and the channel are required when closing a watch as there
374// may be multiple listeners on the same key. The previously created channel serves as a key
375func (c *EtcdClient) CloseWatch(key string, ch chan *Event) {
376 // Get the array of channels mapping
377 var watchedChannels []map[chan *Event]v3Client.Watcher
378 var ok bool
379 c.writeLock.Lock()
380 defer c.writeLock.Unlock()
381
Stephane Barbariec53a2752019-03-08 17:50:10 -0500382 if watchedChannels, ok = c.getChannelMaps(key); !ok {
khenaidoo5c11af72018-07-20 17:21:05 -0400383 log.Warnw("key-has-no-watched-channels", log.Fields{"key": key})
khenaidoocfee5f42018-07-19 22:47:38 -0400384 return
385 }
386 // Look for the channels
387 var pos = -1
388 for i, chMap := range watchedChannels {
389 if t, ok := chMap[ch]; ok {
390 log.Debug("channel-found")
391 // Close the etcd watcher before the client channel. This should close the etcd channel as well
392 if err := t.Close(); err != nil {
khenaidoo5c11af72018-07-20 17:21:05 -0400393 log.Errorw("watcher-cannot-be-closed", log.Fields{"key": key, "error": err})
khenaidoocfee5f42018-07-19 22:47:38 -0400394 }
395 close(ch)
396 pos = i
397 break
398 }
399 }
Stephane Barbariec53a2752019-03-08 17:50:10 -0500400
401 channelMaps, _ := c.getChannelMaps(key)
khenaidoocfee5f42018-07-19 22:47:38 -0400402 // Remove that entry if present
403 if pos >= 0 {
Stephane Barbariec53a2752019-03-08 17:50:10 -0500404 channelMaps = c.removeChannelMap(key, pos)
khenaidoocfee5f42018-07-19 22:47:38 -0400405 }
Stephane Barbariec53a2752019-03-08 17:50:10 -0500406 log.Infow("watcher-channel-exiting", log.Fields{"key": key, "channel": channelMaps})
khenaidoocfee5f42018-07-19 22:47:38 -0400407}
408
409func (c *EtcdClient) listenForKeyChange(channel v3Client.WatchChan, ch chan<- *Event) {
khenaidoo8f474192019-04-03 17:20:44 -0400410 log.Debug("start-listening-on-channel ...")
khenaidoocfee5f42018-07-19 22:47:38 -0400411 for resp := range channel {
412 for _, ev := range resp.Events {
413 //log.Debugf("%s %q : %q\n", ev.Type, ev.Kv.Key, ev.Kv.Value)
Stephane Barbarieef6650d2019-07-18 12:15:09 -0400414 ch <- NewEvent(getEventType(ev), ev.Kv.Key, ev.Kv.Value, ev.Kv.Version)
khenaidoocfee5f42018-07-19 22:47:38 -0400415 }
416 }
khenaidoo8f474192019-04-03 17:20:44 -0400417 log.Debug("stop-listening-on-channel ...")
khenaidoocfee5f42018-07-19 22:47:38 -0400418}
419
420func getEventType(event *v3Client.Event) int {
421 switch event.Type {
422 case v3Client.EventTypePut:
423 return PUT
424 case v3Client.EventTypeDelete:
425 return DELETE
426 }
427 return UNKNOWN
428}
429
430// Close closes the KV store client
431func (c *EtcdClient) Close() {
432 c.writeLock.Lock()
433 defer c.writeLock.Unlock()
434 if err := c.ectdAPI.Close(); err != nil {
khenaidoo5c11af72018-07-20 17:21:05 -0400435 log.Errorw("error-closing-client", log.Fields{"error": err})
khenaidoocfee5f42018-07-19 22:47:38 -0400436 }
437}
khenaidoobdcb8e02019-03-06 16:28:56 -0500438
439func (c *EtcdClient) addLockName(lockName string, lock *v3Concurrency.Mutex, session *v3Concurrency.Session) {
440 c.lockToMutexLock.Lock()
441 defer c.lockToMutexLock.Unlock()
442 c.lockToMutexMap[lockName] = lock
443 c.lockToSessionMap[lockName] = session
444}
445
446func (c *EtcdClient) deleteLockName(lockName string) {
447 c.lockToMutexLock.Lock()
448 defer c.lockToMutexLock.Unlock()
449 delete(c.lockToMutexMap, lockName)
450 delete(c.lockToSessionMap, lockName)
451}
452
453func (c *EtcdClient) getLock(lockName string) (*v3Concurrency.Mutex, *v3Concurrency.Session) {
454 c.lockToMutexLock.Lock()
455 defer c.lockToMutexLock.Unlock()
456 var lock *v3Concurrency.Mutex
457 var session *v3Concurrency.Session
458 if l, exist := c.lockToMutexMap[lockName]; exist {
459 lock = l
460 }
461 if s, exist := c.lockToSessionMap[lockName]; exist {
462 session = s
463 }
464 return lock, session
465}
466
Stephane Barbariec53a2752019-03-08 17:50:10 -0500467func (c *EtcdClient) AcquireLock(lockName string, timeout int) error {
khenaidoobdcb8e02019-03-06 16:28:56 -0500468 duration := GetDuration(timeout)
469 ctx, cancel := context.WithTimeout(context.Background(), duration)
Kent Hagerman0ab4cb22019-04-24 13:13:35 -0400470 defer cancel()
khenaidoobdcb8e02019-03-06 16:28:56 -0500471 session, _ := v3Concurrency.NewSession(c.ectdAPI, v3Concurrency.WithContext(ctx))
Stephane Barbariec53a2752019-03-08 17:50:10 -0500472 mu := v3Concurrency.NewMutex(session, "/devicelock_"+lockName)
khenaidoobdcb8e02019-03-06 16:28:56 -0500473 if err := mu.Lock(context.Background()); err != nil {
khenaidoo2c6a0992019-04-29 13:46:56 -0400474 cancel()
khenaidoobdcb8e02019-03-06 16:28:56 -0500475 return err
476 }
477 c.addLockName(lockName, mu, session)
khenaidoobdcb8e02019-03-06 16:28:56 -0500478 return nil
479}
480
Stephane Barbariec53a2752019-03-08 17:50:10 -0500481func (c *EtcdClient) ReleaseLock(lockName string) error {
khenaidoobdcb8e02019-03-06 16:28:56 -0500482 lock, session := c.getLock(lockName)
483 var err error
484 if lock != nil {
485 if e := lock.Unlock(context.Background()); e != nil {
486 err = e
487 }
488 }
489 if session != nil {
490 if e := session.Close(); e != nil {
491 err = e
492 }
493 }
494 c.deleteLockName(lockName)
495
496 return err
Stephane Barbariec53a2752019-03-08 17:50:10 -0500497}