Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
12 changes: 9 additions & 3 deletions be/src/service/staros_worker.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -221,9 +221,15 @@ absl::StatusOr<std::shared_ptr<fslib::FileSystem>> StarOSWorker::get_shard_files
return build_filesystem_on_demand(id, conf);
}

auto fs = lookup_fs_cache(it->second.fs_cache_key);
if (fs != nullptr) {
return fs;
// Cache miss: reset the fs_cache_key to ensure a new shared_ptr will be created
{
std::lock_guard<std::mutex> reset_lock(_fs_cache_key_reset_mtx);
auto fs = lookup_fs_cache(it->second.fs_cache_key);
if (fs != nullptr) {
return fs;
}

it->second.fs_cache_key.reset();
}
shard_info = it->second.shard_info;
}
Expand Down
1 change: 1 addition & 0 deletions be/src/service/staros_worker.h
Original file line number Diff line number Diff line change
Expand Up @@ -138,6 +138,7 @@ class StarOSWorker : public staros::starlet::Worker {
private:
mutable std::shared_mutex _mtx;
std::shared_mutex _cache_mtx;
std::mutex _fs_cache_key_reset_mtx; // Protects fs_cache_key reset operations
std::unordered_map<ShardId, ShardInfoDetails> _shards;
std::unique_ptr<Cache> _fs_cache;
add_shard_listener _add_shard_listener;
Expand Down
Loading