Skip to content

Commit f545f22

Browse files
committed
Make MMapMemoryAllocator map files in read-only (O_RDONLY) mode. Mapping with O_RDWR will cause copy_up across Docker layers.
1 parent 78160c0 commit f545f22

File tree

2 files changed

+4
-4
lines changed

2 files changed

+4
-4
lines changed

include/engine/datafacade/mmap_memory_allocator.hpp

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -33,7 +33,7 @@ class MMapMemoryAllocator : public ContiguousBlockAllocator
3333

3434
private:
3535
storage::SharedDataIndex index;
36-
std::vector<boost::iostreams::mapped_file> mapped_memory_files;
36+
std::vector<boost::iostreams::mapped_file_source> mapped_memory_files;
3737
std::string rtree_filename;
3838
};
3939

src/engine/datafacade/mmap_memory_allocator.cpp

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -52,11 +52,11 @@ MMapMemoryAllocator::MMapMemoryAllocator(const storage::StorageConfig &config)
5252
{
5353
std::unique_ptr<storage::BaseDataLayout> layout =
5454
std::make_unique<storage::TarDataLayout>();
55-
boost::iostreams::mapped_file mapped_memory_file;
56-
util::mmapFile<char>(file.second, mapped_memory_file);
55+
boost::iostreams::mapped_file_source mapped_memory_file;
56+
auto data = util::mmapFile<char>(file.second, mapped_memory_file).data();
5757
mapped_memory_files.push_back(std::move(mapped_memory_file));
5858
storage::populateLayoutFromFile(file.second, *layout);
59-
allocated_regions.push_back({mapped_memory_file.data(), std::move(layout)});
59+
allocated_regions.push_back({const_cast<char *>(data), std::move(layout)});
6060
}
6161
}
6262

0 commit comments

Comments
 (0)