hello-stephen commented on code in PR #69670:
URL: https://github.com/apache/doris/pull/69670#discussion_r4783980855


##########
be/src/format_v2/table_reader.cpp:
##########
@@ -715,6 +716,11 @@ std::shared_ptr<io::FileSystemProperties> 
create_system_properties(
         return system_properties;
     }
     system_properties->system_type = scan_params->file_type;
+    // This property holder spans all files of the TableReader, so sequential
+    // opens reuse their client even after the preceding file reader is closed.
+    if (system_properties->system_type == TFileType::FILE_S3) {
+        system_properties->s3_client_scope = std::make_shared<S3ClientScope>();

Review Comment:
   [P2] Reuse the scan client for S3 delete sidecar reads
   
   On a cold Iceberg V2 split, `prepare_split()` reads position and equality 
delete files before opening the data reader. 
`IcebergTableReader::_delete_file_system_properties()` creates independent 
properties for those readers, and `DeletionVectorReader` also builds properties 
without the scope. With `s3_client_cache_capacity=0`, two same-bucket delete 
files followed by the data file can construct three SDK clients because each 
short-lived delete reader releases its only owner. Pass the existing scan scope 
through the sidecar paths and cover a cold split with retention disabled.



##########
be/src/runtime/exec_env_init.cpp:
##########
@@ -1045,6 +1087,11 @@ void ExecEnv::destroy() {
 
     // cache_manager must be destoried after all cache.
     // https://github.com/apache/doris/issues/24082#issuecomment-1712544039
+    // Partial/offline ExecEnvs do not own the process-wide client's cache. The
+    // initialized environment releases it before its CacheManager disappears.
+    if (_cache_manager) {
+        S3ClientRegistry::instance()->release_cache();

Review Comment:
   [P2] Keep the registry alive through implicit ExecEnv teardown
   
   `file_cache_microbench` calls `ExecEnv::GetInstance()` and full 
`ExecEnv::init()`, then returns from `main()` without explicitly destroying the 
environment. In that path the registry static and its owning factory callback 
are initialized after the environment. Reverse static destruction tears down 
both owners before `ExecEnv::~ExecEnv()` reaches this call, which then copies 
an already-destroyed static `shared_ptr`. Arrange explicit teardown while those 
dependencies are alive, or have the environment own the registry reference used 
for cleanup.



##########
be/src/util/s3_client_registry.cpp:
##########
@@ -0,0 +1,502 @@
+// Licensed to the Apache Software Foundation (ASF) under one
+// or more contributor license agreements.  See the NOTICE file
+// distributed with this work for additional information
+// regarding copyright ownership.  The ASF licenses this file
+// to you under the Apache License, Version 2.0 (the
+// "License"); you may not use this file except in compliance
+// with the License.  You may obtain a copy of the License at
+//
+//   http://www.apache.org/licenses/LICENSE-2.0
+//
+// Unless required by applicable law or agreed to in writing,
+// software distributed under the License is distributed on an
+// "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
+// KIND, either express or implied.  See the License for the
+// specific language governing permissions and limitations
+// under the License.
+
+#include "util/s3_client_registry.h"
+
+#include <bvar/bvar.h>
+
+#include <algorithm>
+#include <atomic>
+#include <condition_variable>
+#include <exception>
+#include <future>
+#include <mutex>
+#include <unordered_map>
+#include <utility>
+
+#include "core/custom_allocator.h"
+#include "cpp/obj-storage/client/obj_storage_client_factory.h"
+#include "cpp/sync_point.h"
+#include "runtime/memory/lru_cache_policy.h"
+#include "runtime/memory/mem_tracker_limiter.h"
+#include "runtime/thread_context.h"
+#include "util/defer_op.h"
+
+namespace doris {
+
+class S3ClientRegistry::ClientCache final : public LRUCachePolicy {
+public:
+    ClientCache(size_t capacity, uint32_t idle_timeout_seconds)
+            : LRUCachePolicy(CacheType::S3_CLIENT_CACHE, capacity, 
LRUCacheType::NUMBER,
+                             idle_timeout_seconds, /*num_shards=*/1,
+                             /*element_count_capacity=*/0, 
/*enable_prune=*/true,
+                             /*is_lru_k=*/false),
+              _cached_metric(
+                      [](void* p) { return 
static_cast<ClientCache*>(p)->get_element_count(); },
+                      this) {
+        DORIS_CHECK(idle_timeout_seconds > 0);
+    }
+
+    void expose_metrics() { DORIS_CHECK(_cached_metric.expose_as("s3_client", 
"cached") == 0); }
+
+    ~ClientCache() override {
+        // Unregister while the derived object is still intact: a concurrent
+        // memory-GC sweep must finish before its cache and sampler disappear.
+        CacheManager::instance()->unregister_cache(type());
+        close();
+    }
+
+    void retain(const Client& client) {
+        SCOPED_SWITCH_THREAD_MEM_TRACKER_LIMITER(mem_tracker());
+        {
+            std::lock_guard lock(_lifecycle_mutex);
+            // A completed acquisition can reach here after close() stopped the
+            // registry. Return its real owner without refilling the cache.
+            if (_closed) {
+                return;
+            }
+            ++_retainers;
+        }
+        Defer finished([this] {
+            std::lock_guard lock(_lifecycle_mutex);
+            --_retainers;
+            _retainers_done.notify_all();
+        });
+        // LRU callbacks can destroy an SDK client and re-enter acquisition.
+        // Neither the registry nor the lifecycle mutex covers these 
operations.
+        // The full-configuration weak index already selected this client. Its
+        // address is unique while any real/cache owner exists; unlike a config
+        // hash, it cannot merge distinct identities on a collision.
+        const auto* identity = client.get();
+        CacheKey key(reinterpret_cast<const char*>(&identity), 
sizeof(identity));
+        auto* handle = lookup(key);
+        const auto now = now_millis();
+        if (handle) {
+            static_cast<Value*>(value(handle))
+                    ->last_access_ms.store(now, std::memory_order_relaxed);
+        } else {
+            TEST_SYNC_POINT("S3ClientRegistry::cache_miss");
+            handle = insert(key, new Value(client, now), 1, sizeof(Value));
+        }
+        release(handle);
+    }
+
+    void prune_stale() override {
+        SCOPED_SWITCH_THREAD_MEM_TRACKER_LIMITER(mem_tracker());
+        std::lock_guard lock(_lock);
+        COUNTER_SET(_freed_memory_counter, int64_t {0});
+        COUNTER_SET(_freed_entrys_counter, int64_t {0});
+        COUNTER_SET(_cost_timer, int64_t {0});
+        const auto now = now_millis();
+        const auto timeout_ms = int64_t(_stale_sweep_time_s) * 1000;
+        SCOPED_TIMER(_cost_timer);
+        auto info = _cache->prune_if(
+                [&](const LRUHandle* handle) {
+                    return now - static_cast<const Value*>(handle->value)
+                                           
->last_access_ms.load(std::memory_order_relaxed) >=
+                           timeout_ms;
+                },
+                false);
+        COUNTER_SET(_freed_entrys_counter, info.pruned_count);
+        COUNTER_SET(_freed_memory_counter, freed_memory(info));
+        COUNTER_UPDATE(_prune_stale_number_counter, 1);
+    }
+
+    bool exceed_prune_limit() override {
+        // Even one idle SDK client must expire; the generic 1024-object GC
+        // threshold would otherwise retain a small cache indefinitely.
+        return true;
+    }
+
+    int64_t adjust_capacity_weighted(double weight) override {
+        return LRUCachePolicy::adjust_capacity_weighted(std::min(weight, 1.0));
+    }
+
+    int64_t reset_initial_capacity(double weight) override {
+        // Raising mem_limit scales byte-cache budgets, but must not increase
+        // the configured SDK object-count ceiling (e.g. 64 must not become 
128).
+        return adjust_capacity_weighted(weight);

Review Comment:
   [P2] Apply cgroup resize ratios to the current sizing baseline
   
   `MemInfo::refresh_proc_meminfo()` passes the new physical limit divided by 
the previous limit. This override applies each ratio to the original configured 
count. With capacity 64 and limits dropping from 100 GiB to 50 GiB to 40 GiB, 
it first sets capacity to 32, then raises it to 51 on the second reduction. 
Keep a rolling or absolute cgroup-derived baseline with a separate configured 
ceiling, and cover consecutive decreases and recovery.



##########
be/src/util/s3_client_registry.cpp:
##########
@@ -0,0 +1,502 @@
+// Licensed to the Apache Software Foundation (ASF) under one
+// or more contributor license agreements.  See the NOTICE file
+// distributed with this work for additional information
+// regarding copyright ownership.  The ASF licenses this file
+// to you under the Apache License, Version 2.0 (the
+// "License"); you may not use this file except in compliance
+// with the License.  You may obtain a copy of the License at
+//
+//   http://www.apache.org/licenses/LICENSE-2.0
+//
+// Unless required by applicable law or agreed to in writing,
+// software distributed under the License is distributed on an
+// "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
+// KIND, either express or implied.  See the License for the
+// specific language governing permissions and limitations
+// under the License.
+
+#include "util/s3_client_registry.h"
+
+#include <bvar/bvar.h>
+
+#include <algorithm>
+#include <atomic>
+#include <condition_variable>
+#include <exception>
+#include <future>
+#include <mutex>
+#include <unordered_map>
+#include <utility>
+
+#include "core/custom_allocator.h"
+#include "cpp/obj-storage/client/obj_storage_client_factory.h"
+#include "cpp/sync_point.h"
+#include "runtime/memory/lru_cache_policy.h"
+#include "runtime/memory/mem_tracker_limiter.h"
+#include "runtime/thread_context.h"
+#include "util/defer_op.h"
+
+namespace doris {
+
+class S3ClientRegistry::ClientCache final : public LRUCachePolicy {
+public:
+    ClientCache(size_t capacity, uint32_t idle_timeout_seconds)
+            : LRUCachePolicy(CacheType::S3_CLIENT_CACHE, capacity, 
LRUCacheType::NUMBER,
+                             idle_timeout_seconds, /*num_shards=*/1,
+                             /*element_count_capacity=*/0, 
/*enable_prune=*/true,
+                             /*is_lru_k=*/false),
+              _cached_metric(
+                      [](void* p) { return 
static_cast<ClientCache*>(p)->get_element_count(); },
+                      this) {
+        DORIS_CHECK(idle_timeout_seconds > 0);
+    }
+
+    void expose_metrics() { DORIS_CHECK(_cached_metric.expose_as("s3_client", 
"cached") == 0); }
+
+    ~ClientCache() override {
+        // Unregister while the derived object is still intact: a concurrent
+        // memory-GC sweep must finish before its cache and sampler disappear.
+        CacheManager::instance()->unregister_cache(type());
+        close();
+    }
+
+    void retain(const Client& client) {
+        SCOPED_SWITCH_THREAD_MEM_TRACKER_LIMITER(mem_tracker());
+        {
+            std::lock_guard lock(_lifecycle_mutex);
+            // A completed acquisition can reach here after close() stopped the
+            // registry. Return its real owner without refilling the cache.
+            if (_closed) {
+                return;
+            }
+            ++_retainers;
+        }
+        Defer finished([this] {
+            std::lock_guard lock(_lifecycle_mutex);
+            --_retainers;
+            _retainers_done.notify_all();
+        });
+        // LRU callbacks can destroy an SDK client and re-enter acquisition.
+        // Neither the registry nor the lifecycle mutex covers these 
operations.
+        // The full-configuration weak index already selected this client. Its
+        // address is unique while any real/cache owner exists; unlike a config
+        // hash, it cannot merge distinct identities on a collision.
+        const auto* identity = client.get();
+        CacheKey key(reinterpret_cast<const char*>(&identity), 
sizeof(identity));
+        auto* handle = lookup(key);
+        const auto now = now_millis();
+        if (handle) {
+            static_cast<Value*>(value(handle))
+                    ->last_access_ms.store(now, std::memory_order_relaxed);
+        } else {
+            TEST_SYNC_POINT("S3ClientRegistry::cache_miss");
+            handle = insert(key, new Value(client, now), 1, sizeof(Value));

Review Comment:
   [P3] Keep the newest access time on concurrent retention
   
   Two callers can miss the LRU lookup for the same client. With a one-second 
idle timeout, A can sample 0 ms and pause, B can install the entry at 900 ms, 
and A can then replace it with its older timestamp. A sweep at 1000 ms evicts 
the client only 100 ms after B's access. The hit path's plain store can also 
overwrite a newer timestamp. Preserve the maximum access time when refreshing 
or replacing the entry.



##########
be/src/util/s3_client_registry.cpp:
##########
@@ -0,0 +1,502 @@
+// Licensed to the Apache Software Foundation (ASF) under one
+// or more contributor license agreements.  See the NOTICE file
+// distributed with this work for additional information
+// regarding copyright ownership.  The ASF licenses this file
+// to you under the Apache License, Version 2.0 (the
+// "License"); you may not use this file except in compliance
+// with the License.  You may obtain a copy of the License at
+//
+//   http://www.apache.org/licenses/LICENSE-2.0
+//
+// Unless required by applicable law or agreed to in writing,
+// software distributed under the License is distributed on an
+// "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
+// KIND, either express or implied.  See the License for the
+// specific language governing permissions and limitations
+// under the License.
+
+#include "util/s3_client_registry.h"
+
+#include <bvar/bvar.h>
+
+#include <algorithm>
+#include <atomic>
+#include <condition_variable>
+#include <exception>
+#include <future>
+#include <mutex>
+#include <unordered_map>
+#include <utility>
+
+#include "core/custom_allocator.h"
+#include "cpp/obj-storage/client/obj_storage_client_factory.h"
+#include "cpp/sync_point.h"
+#include "runtime/memory/lru_cache_policy.h"
+#include "runtime/memory/mem_tracker_limiter.h"
+#include "runtime/thread_context.h"
+#include "util/defer_op.h"
+
+namespace doris {
+
+class S3ClientRegistry::ClientCache final : public LRUCachePolicy {
+public:
+    ClientCache(size_t capacity, uint32_t idle_timeout_seconds)
+            : LRUCachePolicy(CacheType::S3_CLIENT_CACHE, capacity, 
LRUCacheType::NUMBER,
+                             idle_timeout_seconds, /*num_shards=*/1,
+                             /*element_count_capacity=*/0, 
/*enable_prune=*/true,
+                             /*is_lru_k=*/false),
+              _cached_metric(
+                      [](void* p) { return 
static_cast<ClientCache*>(p)->get_element_count(); },
+                      this) {
+        DORIS_CHECK(idle_timeout_seconds > 0);
+    }
+
+    void expose_metrics() { DORIS_CHECK(_cached_metric.expose_as("s3_client", 
"cached") == 0); }
+
+    ~ClientCache() override {
+        // Unregister while the derived object is still intact: a concurrent
+        // memory-GC sweep must finish before its cache and sampler disappear.
+        CacheManager::instance()->unregister_cache(type());
+        close();
+    }
+
+    void retain(const Client& client) {
+        SCOPED_SWITCH_THREAD_MEM_TRACKER_LIMITER(mem_tracker());
+        {
+            std::lock_guard lock(_lifecycle_mutex);
+            // A completed acquisition can reach here after close() stopped the
+            // registry. Return its real owner without refilling the cache.
+            if (_closed) {
+                return;
+            }
+            ++_retainers;
+        }
+        Defer finished([this] {
+            std::lock_guard lock(_lifecycle_mutex);
+            --_retainers;
+            _retainers_done.notify_all();
+        });
+        // LRU callbacks can destroy an SDK client and re-enter acquisition.
+        // Neither the registry nor the lifecycle mutex covers these 
operations.
+        // The full-configuration weak index already selected this client. Its
+        // address is unique while any real/cache owner exists; unlike a config
+        // hash, it cannot merge distinct identities on a collision.
+        const auto* identity = client.get();
+        CacheKey key(reinterpret_cast<const char*>(&identity), 
sizeof(identity));
+        auto* handle = lookup(key);
+        const auto now = now_millis();
+        if (handle) {
+            static_cast<Value*>(value(handle))
+                    ->last_access_ms.store(now, std::memory_order_relaxed);
+        } else {
+            TEST_SYNC_POINT("S3ClientRegistry::cache_miss");
+            handle = insert(key, new Value(client, now), 1, sizeof(Value));
+        }
+        release(handle);
+    }
+
+    void prune_stale() override {
+        SCOPED_SWITCH_THREAD_MEM_TRACKER_LIMITER(mem_tracker());
+        std::lock_guard lock(_lock);
+        COUNTER_SET(_freed_memory_counter, int64_t {0});
+        COUNTER_SET(_freed_entrys_counter, int64_t {0});
+        COUNTER_SET(_cost_timer, int64_t {0});
+        const auto now = now_millis();
+        const auto timeout_ms = int64_t(_stale_sweep_time_s) * 1000;
+        SCOPED_TIMER(_cost_timer);
+        auto info = _cache->prune_if(
+                [&](const LRUHandle* handle) {
+                    return now - static_cast<const Value*>(handle->value)
+                                           
->last_access_ms.load(std::memory_order_relaxed) >=
+                           timeout_ms;
+                },
+                false);
+        COUNTER_SET(_freed_entrys_counter, info.pruned_count);
+        COUNTER_SET(_freed_memory_counter, freed_memory(info));
+        COUNTER_UPDATE(_prune_stale_number_counter, 1);
+    }
+
+    bool exceed_prune_limit() override {
+        // Even one idle SDK client must expire; the generic 1024-object GC
+        // threshold would otherwise retain a small cache indefinitely.
+        return true;
+    }
+
+    int64_t adjust_capacity_weighted(double weight) override {
+        return LRUCachePolicy::adjust_capacity_weighted(std::min(weight, 1.0));
+    }
+
+    int64_t reset_initial_capacity(double weight) override {
+        // Raising mem_limit scales byte-cache budgets, but must not increase
+        // the configured SDK object-count ceiling (e.g. 64 must not become 
128).
+        return adjust_capacity_weighted(weight);
+    }
+
+    void close() {
+        SCOPED_SWITCH_THREAD_MEM_TRACKER_LIMITER(mem_tracker());
+        {
+            std::unique_lock lock(_lifecycle_mutex);
+            _closed = true;
+            _retainers_done.wait(lock, [this] { return _retainers == 0; });
+        }
+        prune_all(true);
+    }
+
+private:
+    struct Value final : LRUCacheValueBase {
+        Value(Client owner, int64_t now) : client(std::move(owner)), 
last_access_ms(now) {}
+        Client client;
+        std::atomic<int64_t> last_access_ms;
+    };
+
+    int64_t freed_memory(const PrunedInfo& info) const override {
+        // Match insert()'s tracked handle, pointer key and Value bytes in 
every
+        // pruning path. SDK-owned allocations are not measured here.
+        return info.pruned_count * (sizeof(LRUHandle) - 1 + sizeof(void*) + 
sizeof(Value));
+    }
+
+    static int64_t now_millis() {
+        int64_t now = MonotonicMillis();
+        TEST_SYNC_POINT_CALLBACK("S3ClientRegistry::cache_clock", &now);
+        return now;
+    }
+
+    bool _closed = false;
+    size_t _retainers = 0;
+    std::mutex _lifecycle_mutex;
+    std::condition_variable _retainers_done;
+    bvar::PassiveStatus<size_t> _cached_metric;
+};
+
+struct S3ClientRegistry::Impl : std::enable_shared_from_this<Impl> {
+    struct Counter {
+        std::atomic<int64_t> value {0};
+        bvar::PassiveStatus<int64_t> metric {
+                [](void* p) {
+                    return 
static_cast<Counter*>(p)->value.load(std::memory_order_relaxed);
+                },
+                this};
+        void add(int64_t delta) { value.fetch_add(delta, 
std::memory_order_relaxed); }
+        int64_t get_value() const { return 
value.load(std::memory_order_relaxed); }
+    };
+
+    struct ClientLifetime {
+        ClientLifetime(std::shared_ptr<Impl> registry, S3ClientKey key, const 
Client& client)
+                : state(std::move(registry)), conf(std::move(key)), 
identity(client) {
+            state->created.add(1);
+            state->live.add(1);
+        }
+        ~ClientLifetime() {
+            SCOPED_SWITCH_THREAD_MEM_TRACKER_LIMITER(state->tracker);
+            // SDK members have already been destroyed. Remove just this 
client's
+            // registration: a new acquisition may have replaced the expired 
weak
+            // pointer while the old SDK destructor was still running.
+            std::lock_guard lock(state->mutex);
+            auto it = state->entries.find(conf);
+            if (it != state->entries.end() && 
!it->second.owner_before(identity) &&
+                !identity.owner_before(it->second)) {
+                state->entries.erase(it);
+            }
+            state->destroyed.add(1);
+            state->live.add(-1);
+        }
+        // State has only weak references back to clients, so this is not a 
cycle.
+        // Keep tracking and index cleanup valid even if a user outlives the 
registry.
+        std::shared_ptr<Impl> state;
+        S3ClientKey conf;
+        std::weak_ptr<ObjStorageClient> identity;
+    };
+
+    struct Pending {
+        std::promise<Result<Client>> promise;
+        std::shared_future<Result<Client>> future = 
promise.get_future().share();
+    };
+    template <typename Value>
+    using Map = std::unordered_map<S3ClientKey, Value, S3ClientKeyHash, 
std::equal_to<S3ClientKey>,
+                                   CustomStdAllocator<std::pair<const 
S3ClientKey, Value>>>;
+
+    Impl()
+            : 
tracker(MemTrackerLimiter::create_shared(MemTrackerLimiter::Type::OTHER,
+                                                       "S3ClientRegistry")),
+              indexed_metric(std::make_unique<bvar::PassiveStatus<size_t>>(
+                      [](void* p) { return 
static_cast<Impl*>(p)->snapshot().indexed; }, this)),
+              inflight_metric(std::make_unique<bvar::PassiveStatus<size_t>>(
+                      [](void* p) { return 
static_cast<Impl*>(p)->snapshot().inflight; }, this)) {}
+
+    ~Impl() {
+        // Stop bvar samplers before destroying the maps they inspect.
+        indexed_metric.reset();
+        inflight_metric.reset();
+        SCOPED_SWITCH_THREAD_MEM_TRACKER_LIMITER(tracker);
+        Map<std::weak_ptr<ObjStorageClient>>().swap(entries);
+        Map<std::shared_ptr<Pending>>().swap(pending);
+    }
+
+    Result<Client> acquire(const S3ClientKey& conf, const Creator& creator) {
+        SCOPED_SWITCH_THREAD_MEM_TRACKER_LIMITER(tracker);
+        // A weak lock may become the last owner while other users finish IO.
+        // Release both clients and completed futures outside the registry 
mutex.
+        Client client;
+        std::shared_ptr<Pending> task;
+        bool leader = false;
+        {
+            std::lock_guard lock(mutex);
+            if (closed) {
+                return ResultError(Status::InternalError("S3 client registry 
is closed"));
+            }
+            auto it = entries.find(conf);
+            if (it != entries.end()) {
+                client = it->second.lock();
+                if (client) {
+                    hits.add(1);
+                    return client;
+                }
+                // The old SDK destructor can still be running. Its lifetime 
guard
+                // will not erase a newer client published for this 
configuration.
+                entries.erase(it);
+            }
+            misses.add(1);
+            auto creating = pending.find(conf);
+            if (creating != pending.end()) {
+                waits.add(1);
+                task = creating->second;
+            } else {
+                task = std::make_shared<Pending>();
+                pending.emplace(conf, task);

Review Comment:
   [P2] Keep allocator GC waits outside the registry mutex
   
   This insertion and the weak-entry insertion in `create_and_publish()` use 
the default tracked allocator while holding `Impl::mutex`. A scanner attached 
to a task can cross the hard memory limit here and wait for GC for about one 
second at the default setting. Acquisitions for unrelated buckets, including 
hits, need the same mutex. Cache pruning can also need it when eviction 
releases the last client owner and destroys its lifetime guard. Move the memory 
check and wait outside the critical section while preserving accounting so 
unrelated acquisitions and reclamation can proceed.



##########
be/src/io/object_storage/obj_storage_client_holder.cpp:
##########
@@ -36,8 +37,18 @@ ObjStorageClientHolder::ObjStorageClientHolder(
 ObjStorageClientHolder::~ObjStorageClientHolder() = default;
 
 Result<std::shared_ptr<ObjStorageClient>> 
ObjStorageClientHolder::create_client(
-        const ObjStorageClientConfig& conf) const {
-    auto result = ObjStorageClientFactory::instance().create(conf, 
/*use_cache=*/true, _bucket);
+        const ObjStorageClientConfig& conf, S3ClientScope* scope) const {
+    S3ClientRegistry::instance();

Review Comment:
   [P2] Preserve S3 access in tools without BE memory tracking
   
   A standalone `fs_benchmark_tool` S3 `exists` run reaches this holder through 
`S3Benchmark::get_fs()` and `ObjStorageFileSystem::create()`. The tool 
initializes config, CPU information, and optional JNI, then opens the 
filesystem without initializing BE memory tracking. This call constructs the 
registry's `MemTrackerLimiter`, whose production path indexes 
`ExecEnv::mem_tracker_limiter_pool`. That pool is still empty, so the tool 
fails before it can create the client. Keep the shared factory available for 
callers without a tracking environment, or initialize tracking before this 
entry point acquires a client.



-- 
This is an automated message from the Apache Git Service.
To respond to the message, please log on to GitHub and use the
URL above to go to the specific comment.

To unsubscribe, e-mail: [email protected]

For queries about this service, please contact Infrastructure at:
[email protected]


---------------------------------------------------------------------
To unsubscribe, e-mail: [email protected]
For additional commands, e-mail: [email protected]

Reply via email to