diff --git a/internal/core/src/storage/ChunkCache.cpp b/internal/core/src/storage/ChunkCache.cpp index abc1de24e92dc..7576f9002f74b 100644 --- a/internal/core/src/storage/ChunkCache.cpp +++ b/internal/core/src/storage/ChunkCache.cpp @@ -40,7 +40,6 @@ ChunkCache::Read(const std::string& filepath) { strerror(errno))); columns_.emplace(path, column); - mmap_file_locks_.erase(path); return column; } @@ -71,13 +70,7 @@ ChunkCache::Prefetch(const std::string& filepath) { std::shared_ptr ChunkCache::Mmap(const std::filesystem::path& path, const FieldDataPtr& field_data) { - MmapFileLocks::accessor acc; - if (!mmap_file_locks_.find(acc, path)) { - mmap_file_locks_.insert( - acc, std::make_pair(path, std::make_unique())); - } - std::unique_lock lck(*acc->second.get()); - acc.release(); + std::unique_lock lck(mutex_); auto dir = path.parent_path(); std::filesystem::create_directories(dir); diff --git a/internal/core/src/storage/ChunkCache.h b/internal/core/src/storage/ChunkCache.h index da790f217b0bb..9d842b8e556ec 100644 --- a/internal/core/src/storage/ChunkCache.h +++ b/internal/core/src/storage/ChunkCache.h @@ -61,12 +61,8 @@ class ChunkCache { oneapi::tbb::concurrent_hash_map>; - using MmapFileLocks = - oneapi::tbb::concurrent_hash_map>; - private: - MmapFileLocks mmap_file_locks_; + mutable std::mutex mutex_; int read_ahead_policy_; std::string path_prefix_; ChunkManagerPtr cm_;