This is an automated email from the ASF dual-hosted git repository.

alamb pushed a commit to branch main
in repository https://gitbox.apache.org/repos/asf/arrow-rs-object-store.git


The following commit(s) were added to refs/heads/main by this push:
     new 09adc41  Reduce lock hold time in 
DefaultObjectStoreRegistry::deregister (#792)
09adc41 is described below

commit 09adc41b05faada6b233746d866e0ab63a56f208
Author: Krisztián Szűcs <[email protected]>
AuthorDate: Wed Jul 8 21:49:16 2026 +0200

    Reduce lock hold time in DefaultObjectStoreRegistry::deregister (#792)
    
    Compute the URL key and path segments before acquiring the write
    lock, so the lock is only held for the actual map mutation.
---
 src/registry.rs | 2 +-
 1 file changed, 1 insertion(+), 1 deletion(-)

diff --git a/src/registry.rs b/src/registry.rs
index 29282c1..d6cee5a 100644
--- a/src/registry.rs
+++ b/src/registry.rs
@@ -263,9 +263,9 @@ impl ObjectStoreRegistry for DefaultObjectStoreRegistry {
     }
 
     fn deregister(&self, url: &Url) -> Option<Arc<dyn ObjectStore>> {
-        let mut map = self.map.write();
         let key = url_key(url);
         let segments: Vec<&str> = path_segments(url.path()).collect();
+        let mut map = self.map.write();
         let entry = map.get_mut(key)?;
         let removed = entry.remove(&segments);
         // Drop the authority entry entirely once it holds no stores.

Reply via email to