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 @@ -184,9 +184,15 @@ absl::StatusOr<std::shared_ptr<fslib::FileSystem>> StarOSWorker::get_shard_files
184184 return build_filesystem_on_demand (id, conf);
185185 }
186186
187- auto fs = lookup_fs_cache (it->second .fs_cache_key );
188- if (fs != nullptr ) {
189- return fs;
187+ // Cache miss: reset the fs_cache_key to ensure a new shared_ptr will be created
188+ {
189+ std::lock_guard<std::mutex> reset_lock (_fs_cache_key_reset_mtx);
190+ auto fs = lookup_fs_cache (it->second .fs_cache_key );
191+ if (fs != nullptr ) {
192+ return fs;
193+ }
194+
195+ it->second .fs_cache_key .reset ();
190196 }
191197 shard_info = it->second .shard_info ;
192198 }
Original file line number Diff line number Diff line change @@ -121,6 +121,7 @@ class StarOSWorker : public staros::starlet::Worker {
121121private:
122122 mutable std::shared_mutex _mtx;
123123 std::shared_mutex _cache_mtx;
124+ std::mutex _fs_cache_key_reset_mtx; // Protects fs_cache_key reset operations
124125 std::unordered_map<ShardId, ShardInfoDetails> _shards;
125126 std::unique_ptr<Cache> _fs_cache;
126127};
You can’t perform that action at this time.
0 commit comments