Merge branch 'tds' of github.com:tgruben/privilosa into tds

This commit is contained in:
Todd Gruben 2021-03-24 10:44:31 -05:00
commit e46a41638f
2 changed files with 10 additions and 4 deletions

View file

@ -484,7 +484,7 @@ func (per *DBPerShard) DeleteFieldFromStore(index, field, fieldPath string) (err
per.Mu.Lock()
defer func() {
if fieldPath != "" {
panicOn(os.RemoveAll(fieldPath))
_ = os.RemoveAll(fieldPath)
}
per.Mu.Unlock()
}()
@ -498,11 +498,12 @@ func (per *DBPerShard) DeleteFieldFromStore(index, field, fieldPath string) (err
}
for _, dbs := range dbi.Shard {
for _, w := range dbs.W {
err := w.DeleteField(index, field, fieldPath)
panicOn(err)
if e := w.DeleteField(index, field, fieldPath); e != nil && err == nil {
err = errors.Wrap(e, "DeleteFieldFromStore()")
}
}
}
return
return err
}
func (per *DBPerShard) DeleteFragment(index, field, view string, shard uint64, frag *fragment) error {

View file

@ -66,6 +66,11 @@ func (l *leasedKV) Start(initValue string) error {
func (l *leasedKV) create(initValue string) (<-chan *clientv3.LeaseKeepAliveResponse, error) {
ctx, cancel := context.WithCancel(context.Background())
if l.cancel != nil {
l.cancel()
}
l.cancel = cancel
leaseResp, err := l.cli.Grant(ctx, l.ttlSeconds)