Browse Source

Fix crash in arangodb filer when attempting to access a deleted bucket (#3587)

* Update helpers.go

* Update arangodb_store_bucket.go
gfx 2 years ago
parent
commit
bf844d8e46
2 changed files with 4 additions and 1 deletions
  1. 3 0
      weed/filer/arangodb/arangodb_store_bucket.go
  2. 1 1
      weed/filer/arangodb/helpers.go

+ 3 - 0
weed/filer/arangodb/arangodb_store_bucket.go

@@ -34,6 +34,9 @@ func (store *ArangodbStore) OnBucketDeletion(bucket string) {
 		glog.Errorf("bucket delete %s: %v", bucket, err)
 		return
 	}
+	store.mu.Lock()
+	delete(store.buckets, bucket)
+	store.mu.Unlock()
 }
 func (store *ArangodbStore) CanDropWholeBucket() bool {
 	return true

+ 1 - 1
weed/filer/arangodb/helpers.go

@@ -86,7 +86,7 @@ func (store *ArangodbStore) ensureBucket(ctx context.Context, bucket string) (bc
 	store.mu.RLock()
 	bc, ok = store.buckets[bucket]
 	store.mu.RUnlock()
-	if ok {
+	if ok && bc != nil {
 		return bc, nil
 	}
 	store.mu.Lock()