OpenHFT / Chronicle-Map

Replicate your Key Value Store across your network, with consistency, persistance and performance.

Home Page:http://chronicle.software/products/chronicle-map/

Geek Repo:Geek Repo

Github PK Tool:Github PK Tool

The way getFileStores() is used poses problems in a containerized application

Sax388 opened this issue · comments

I don't understand why the following doesn't use Files.getFileStore(this.file.toPath()). This retrieves the overlay correctly but the current implementation doesn't, which prevents the creation of a persisted chronicle map.

private void fallocate(long mappingOffsetInFile, long length) throws IOException {
FileSystem fileSystem = file.toPath().getFileSystem();
long maxSize = 0;
for (FileStore fileStore : fileSystem.getFileStores()) {
long unallocatedSpace = fileStore.getUnallocatedSpace();
if (unallocatedSpace > length * 11 / 10) {
PosixFallocate.fallocate(raf.getFD(), mappingOffsetInFile, length);
return;
}
maxSize = Math.max(maxSize, unallocatedSpace);
}
throw new IOException("Not enough space to fallocate " + (length >> 20) + " MiB to " + fileSystem.getRootDirectories().iterator().next() + " unallocated was " + (maxSize >> 20) + " MiB");
}

Fixed by #519