forked from apache/kudu
-
Notifications
You must be signed in to change notification settings - Fork 0
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
log: remove SegmentAllocator functors
When we roll the log, we close the active segment before switching to the next preallocated segment. What happens when we close the active segment? 1. We sync it. 2. We write out the (now complete) footer. 3. We close the segment file. Under the hood, this will truncate any unused preallocated space out of the file and sync it one last time. 4. We open the closed segment file for reading. Note that this is the second time we've opened it; we also opened it once when we last rolled the log. 5. We create a new in-memory segment reader. To avoid needless IO, we initialize it using the in-memory header and footer, but we do end up reloading the segment's file size from disk. 6. We replace the last segment reader in the log with the reader constructed in step apache#5. Side effect: the original segment reader is now closed. My original intent with this patch was to replace steps 4-6 with a simpler "inject the footer into the existing in-memory segment reader". This proved to be impossible without adding a new synchronization primitive to protect the footer in the segment reader, which is something I wanted to avoid. And the win would have been minimal: with proper file cache usage, step 4 is likely to be a cache hit. So now this patch just cleans up SegmentAllocator by removing its functors, which I found difficult to follow. Instead, Log now manipulates LogReader directly, using information passed back from SegmentAllocator functions. Change-Id: Id2f5dd47e3be930288dcfeb1f77409fda45daac4 Reviewed-on: http://gerrit.cloudera.org:8080/14819 Reviewed-by: Andrew Wong <[email protected]> Tested-by: Kudu Jenkins
- Loading branch information
Showing
12 changed files
with
206 additions
and
185 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Oops, something went wrong.