File tree Expand file tree Collapse file tree 2 files changed +10
-3
lines changed Expand file tree Collapse file tree 2 files changed +10
-3
lines changed Original file line number Diff line number Diff line change @@ -221,9 +221,15 @@ absl::StatusOr<std::shared_ptr<fslib::FileSystem>> StarOSWorker::get_shard_files
221221 return build_filesystem_on_demand (id, conf);
222222 }
223223
224- auto fs = lookup_fs_cache (it->second .fs_cache_key );
225- if (fs != nullptr ) {
226- return fs;
224+ // Cache miss: reset the fs_cache_key to ensure a new shared_ptr will be created
225+ {
226+ std::lock_guard<std::mutex> reset_lock (_fs_cache_key_reset_mtx);
227+ auto fs = lookup_fs_cache (it->second .fs_cache_key );
228+ if (fs != nullptr ) {
229+ return fs;
230+ }
231+
232+ it->second .fs_cache_key .reset ();
227233 }
228234 shard_info = it->second .shard_info ;
229235 }
Original file line number Diff line number Diff line change @@ -138,6 +138,7 @@ class StarOSWorker : public staros::starlet::Worker {
138138private:
139139 mutable std::shared_mutex _mtx;
140140 std::shared_mutex _cache_mtx;
141+ std::mutex _fs_cache_key_reset_mtx; // Protects fs_cache_key reset operations
141142 std::unordered_map<ShardId, ShardInfoDetails> _shards;
142143 std::unique_ptr<Cache> _fs_cache;
143144 add_shard_listener _add_shard_listener;
You can’t perform that action at this time.
0 commit comments