Skip to content

Eager file unmapping in IndexIO, IndexMerger and IndexMergerV9#3422

Merged
drcrallen merged 4 commits intoapache:masterfrom
leventov:master
Sep 7, 2016
Merged

Eager file unmapping in IndexIO, IndexMerger and IndexMergerV9#3422
drcrallen merged 4 commits intoapache:masterfrom
leventov:master

Conversation

@leventov
Copy link
Copy Markdown
Member

@leventov leventov commented Sep 2, 2016

The exact purpose for this change is to allow running IndexMergeBenchmark in Windows, however should also be universally 'better' than non-deterministic unmapping, done when MappedByteBuffers are garbage-collected

…xact purpose for this change is to allow running IndexMergeBenchmark in Windows, however should also be universally 'better' than non-deterministic unmapping, done when MappedByteBuffers are garbage-collected (BACKEND-312)
@leventov
Copy link
Copy Markdown
Member Author

leventov commented Sep 2, 2016

To be complete this should also include metamx/java-util#50, i. e. changing java-util dependency to the next snapshot in druid.

log.info("Skipped files[%s]", skippedFiles);

v9Smoosher.close();
} finally {
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.

Closer docs suggest a different pattern here, see https://google.github.io/guava/releases/19.0/api/docs/com/google/common/io/Closer.html for the throwables catching.

@leventov leventov changed the title [WIP, don't merge] Eager file unmapping in IndexIO, IndexMerger and IndexMergerV9 Eager file unmapping in IndexIO, IndexMerger and IndexMergerV9 Sep 7, 2016
@leventov
Copy link
Copy Markdown
Member Author

leventov commented Sep 7, 2016

@drcrallen could you please merge this PR without change in java-util? It passes tests in CI and locally in Linux.

@drcrallen
Copy link
Copy Markdown
Contributor

@leventov for some reason there are odd formatting changes with newlines before { getting eliminated. Can you please try re-running https://github.com/druid-io/druid/blob/master/druid_intellij_formatting.xml on IndexIO?

@leventov
Copy link
Copy Markdown
Member Author

leventov commented Sep 7, 2016

@drcrallen done

@drcrallen
Copy link
Copy Markdown
Contributor

Cool 👍 after TravisCI

Still needs another +1 from another committer.

@gianm
Copy link
Copy Markdown
Contributor

gianm commented Sep 7, 2016

Hmm, the general idea looks good to me, although if we're going down the road of being more unmappy-happy with ByteBuffers, I think it'd be nice to use a function that does a Files.map and then wraps the result in a ResourceHolder. That way they can be used with try-with-resources, which is cleaner than using Closers imo. Also they could be composed into already existing things we have like ReferenceCountingResourceHolder, if we have some need for refcounted mmapped files.

@gianm
Copy link
Copy Markdown
Contributor

gianm commented Sep 7, 2016

👍 with or without the ResourceHolder-returning mmap function. But I do think that would be nice if we are going down this road.

@drcrallen
Copy link
Copy Markdown
Contributor

I propose accepting the Closer approach for now and @leventov sending a notice out to the dev mailing list about the potential future need for a more advanced and prettier try-with-resources friendly class with a callout to this PR. So that in the future if the use gets expanded, it will be time to consider the use cases and add a proper class (with proper test framework support)

@gianm
Copy link
Copy Markdown
Contributor

gianm commented Sep 7, 2016

I'm 👍 on accepting the Closer stuff for this PR. IMO a dev notice isn't super necessary but wouldn't hurt.

@fjy
Copy link
Copy Markdown
Contributor

fjy commented Sep 7, 2016

@drcrallen @gianm I'm on board with that as well

@drcrallen drcrallen merged commit 4f0bcdc into apache:master Sep 7, 2016
@gianm gianm added this to the 0.9.2 milestone Sep 7, 2016
@fjy
Copy link
Copy Markdown
Contributor

fjy commented Sep 7, 2016

@drcrallen @gianm was there a CLA signed?

@drcrallen
Copy link
Copy Markdown
Contributor

@fjy he's covered under MMX corporate

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

Projects

None yet

Development

Successfully merging this pull request may close these issues.

4 participants