From 36219877274e70cfe5df6a027b2ddf5ed4b65cc8 Mon Sep 17 00:00:00 2001 From: gfx <86091021+gfxlabs@users.noreply.github.com> Date: Sun, 4 Sep 2022 21:29:52 -0500 Subject: [PATCH 1/2] Correctly pass arangodb driver Transaction ID into the context (#3586) Update arangodb_store.go --- weed/filer/arangodb/arangodb_store.go | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/weed/filer/arangodb/arangodb_store.go b/weed/filer/arangodb/arangodb_store.go index 75e65f7e0..25ef60bf0 100644 --- a/weed/filer/arangodb/arangodb_store.go +++ b/weed/filer/arangodb/arangodb_store.go @@ -121,7 +121,7 @@ func (store *ArangodbStore) BeginTransaction(ctx context.Context) (context.Conte return nil, err } - return context.WithValue(ctx, transactionKey, txn), nil + return context.WithValue(driver.WithTransactionID(ctx, txn), transactionKey, txn), nil } func (store *ArangodbStore) CommitTransaction(ctx context.Context) error { From bf844d8e4623932cbe48d1b461894ade8a65b610 Mon Sep 17 00:00:00 2001 From: gfx <86091021+gfxlabs@users.noreply.github.com> Date: Sun, 4 Sep 2022 22:32:10 -0500 Subject: [PATCH 2/2] Fix crash in arangodb filer when attempting to access a deleted bucket (#3587) * Update helpers.go * Update arangodb_store_bucket.go --- weed/filer/arangodb/arangodb_store_bucket.go | 3 +++ weed/filer/arangodb/helpers.go | 2 +- 2 files changed, 4 insertions(+), 1 deletion(-) diff --git a/weed/filer/arangodb/arangodb_store_bucket.go b/weed/filer/arangodb/arangodb_store_bucket.go index b35a5c9b3..44aeeadea 100644 --- a/weed/filer/arangodb/arangodb_store_bucket.go +++ b/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 diff --git a/weed/filer/arangodb/helpers.go b/weed/filer/arangodb/helpers.go index 35796a8f8..3f36acb0a 100644 --- a/weed/filer/arangodb/helpers.go +++ b/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()