翟玉勇 created KAFKA-7442: -------------------------- Summary: forceUnmap mmap on linux Key: KAFKA-7442 URL: https://issues.apache.org/jira/browse/KAFKA-7442 Project: Kafka Issue Type: Improvement Components: log Affects Versions: 0.10.1.1 Reporter: 翟玉勇
when resize OffsetIndex or TimeIndex,We should force unmap mmap for linux platform {code} def resize(newSize: Int) { inLock(lock) { val raf = new RandomAccessFile(_file, "rw") val roundedNewSize = roundDownToExactMultiple(newSize, entrySize) val position = mmap.position /* Windows won't let us modify the file length while the file is mmapped :-( */ if(Os.isWindows) forceUnmap(mmap) try { raf.setLength(roundedNewSize) mmap = raf.getChannel().map(FileChannel.MapMode.READ_WRITE, 0, roundedNewSize) _maxEntries = mmap.limit / entrySize mmap.position(position) } finally { CoreUtils.swallow(raf.close()) } } } {code} -- This message was sent by Atlassian JIRA (v7.6.3#76005)