Skip to content

Unmap files to add eagerly in FileSmoother#50

Closed
leventov wants to merge 1 commit intometamx:masterfrom
leventov:master
Closed

Unmap files to add eagerly in FileSmoother#50
leventov wants to merge 1 commit intometamx:masterfrom
leventov:master

Conversation

@leventov
Copy link
Copy Markdown
Contributor

@leventov leventov commented Sep 2, 2016

The exact purpose of this is to enable running Druid's IndexMergeBenchmark in Windows, but this is also universally healthy becauseit releases memory determenistically, otherwise files are unmapped when MappedByteBuffers are garbage-collected

…urpose of this is to enable running Druid's IndexMergeBenchmark in Windows, but this is also universally healthy becauseit releases memory determenistically, otherwise files are unmapped when MappedByteBuffers are garbage-collected
@drcrallen
Copy link
Copy Markdown
Contributor

Wait a sec, I need to double-check this.

@drcrallen
Copy link
Copy Markdown
Contributor

There are explicit tests in druid about properly unmapping files. It would be good to make sure this still functions in those tests.

@leventov
Copy link
Copy Markdown
Contributor Author

leventov commented Sep 2, 2016

@drcrallen could you please point to them? This commit in java-util is only a part of the change. I'm also going to propose some fixes to druid itself, regarding specifically leaking file mappings. So those tests apparently don't catch the problems and should be updated too.

@drcrallen
Copy link
Copy Markdown
Contributor

@leventov can you peek at #46 by @navis and see how much it collides with this one? I completely forgot #46 existed.

try {
add(name, mappedFileBuffer);
} finally {
ByteBufferUtils.unmap(mappedFileBuffer);
Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

try-with-resources preferable here to avoid exception chomping.

Copy link
Copy Markdown
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Yes... also there is #46, and also there is an idea to approach this more fundamentially with ResourceHandlers, discussed in apache/druid#3422. Another option is to move away from ByteBuffers, to e. g. Netty's, Aeron's or Chronicle's alternatives, which are better in many ways. So I close this PR for now anyway.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

3 participants