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 @@ -202,9 +202,15 @@ absl::StatusOr<std::shared_ptr<fslib::FileSystem>> StarOSWorker::get_shard_files
202202 return build_filesystem_on_demand (id, conf);
203203 }
204204
205- auto fs = lookup_fs_cache (it->second .fs_cache_key );
206- if (fs != nullptr ) {
207- return fs;
205+ // Cache miss: reset the fs_cache_key to ensure a new shared_ptr will be created
206+ {
207+ std::lock_guard<std::mutex> reset_lock (_fs_cache_key_reset_mtx);
208+ auto fs = lookup_fs_cache (it->second .fs_cache_key );
209+ if (fs != nullptr ) {
210+ return fs;
211+ }
212+
213+ it->second .fs_cache_key .reset ();
208214 }
209215 shard_info = it->second .shard_info ;
210216 }
Original file line number Diff line number Diff line change @@ -124,6 +124,7 @@ class StarOSWorker : public staros::starlet::Worker {
124124private:
125125 mutable std::shared_mutex _mtx;
126126 std::shared_mutex _cache_mtx;
127+ std::mutex _fs_cache_key_reset_mtx; // Protects fs_cache_key reset operations
127128 std::unordered_map<ShardId, ShardInfoDetails> _shards;
128129 std::unique_ptr<Cache> _fs_cache;
129130};
You can’t perform that action at this time.
0 commit comments