-
Notifications
You must be signed in to change notification settings - Fork 15.2k
MINOR: Unmap index on close follow-up #5778
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Changes from all commits
File filter
Filter by extension
Conversations
Jump to
Diff view
Diff view
There are no files selected for viewing
| Original file line number | Diff line number | Diff line change |
|---|---|---|
|
|
@@ -700,7 +700,6 @@ class Log(@volatile var dir: File, | |
|
|
||
| /** | ||
| * Close this log. | ||
| * The memory mapped buffer for index files of this log will be left open until the log is deleted. | ||
| */ | ||
| def close() { | ||
| debug("Closing log") | ||
|
|
@@ -712,6 +711,7 @@ class Log(@volatile var dir: File, | |
| // (the clean shutdown file is written after the logs are all closed). | ||
| producerStateManager.takeSnapshot() | ||
| logSegments.foreach(_.close()) | ||
| isMemoryMappedBufferClosed = true | ||
| } | ||
| } | ||
| } | ||
|
|
@@ -1671,7 +1671,6 @@ class Log(@volatile var dir: File, | |
| private[log] def delete() { | ||
| maybeHandleIOException(s"Error while deleting log for $topicPartition in dir ${dir.getParent}") { | ||
| lock synchronized { | ||
| checkIfMemoryMappedBufferClosed() | ||
| removeLogMetrics() | ||
|
Member
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. I am wondering if it would be more intuitive not to set The reason is that, if we don't call Another intuition is that, it seems weird if delete() sets
Member
Author
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. It's a good question. It's a little unclear what's the best path as we don't generally require As it happens, the fact that we don't close the file handles before we rename the directory in
Member
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. Regarding the design for the And it seems reasonable to enforce the rule that we always close a log before deleting it in e.g.
Member
Author
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. Seems like this needs a bit more discussion. I propose we revert the change in 2.1 to close the index during Log.close so that the behaviour remains the same as in 2.0. In trunk, we can make the changes after we agree to them. How does that sound?
Member
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. Sure. Sounds good. Thanks for the patch! The previous PR has been reverted in 2.1 branch. |
||
| logSegments.foreach(_.deleteIfExists()) | ||
| segments.clear() | ||
|
|
||
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Now that we also set
isMemoryMappedBufferClosedto true in close(), the first sentence in its comment,The memory mapped buffer for index files of this log will be closed with either delete() or closeHandlers(), is no longer accurate.Can we update its comment to e.g.
After memory mapped buffer is closed, all disk IO operation other than delete() on this log should throw KafkaStorageException.