Compactor optimization - PR FOR FEEDBACK ONLY - #754
Closed
davisp wants to merge 4 commits into
Closed
Conversation
Strictly copy/paste moving of code to make a more logical ordering of start to finish reading top down.
ksnavely
reviewed
Aug 16, 2017
| }; | ||
| _ when DataHdrIsDbHdr -> | ||
| % We tried to swap out the compaction but there were | ||
| % writes to the database during compction. Start |
ksnavely
reviewed
Aug 16, 2017
| % This is a bit worrisome. init_db/4 will monitor the data fd | ||
| % but it doesn't know about the meta fd. For now I'll maintain | ||
| % that the data fd is the old normal fd and meta fd is special | ||
| % and hope everything works out for the best. |
Contributor
There was a problem hiding this comment.
Is the concern over the lack of a monitor on the meta file descriptor still valid? Or is it moot with the couch_file:close(MetaFd) call now?
Contributor
There was a problem hiding this comment.
Or is it this? c4969f3#diff-c0abd721a4433ae0399b0c2cbdea8d18R1126
Member
Author
There was a problem hiding this comment.
Yep, it got moved to clean up start_compact. That comment is way old me. I know how couch_file works better now so the comment can go as its misleading.
ksnavely
reviewed
Aug 16, 2017
| {total_changes, TotalChanges} | ||
| ], | ||
| case (Retry /= nil) and couch_task_status:is_task_added() of | ||
| case (Retry) and couch_task_status:is_task_added() of |
kocolosk
reviewed
Aug 16, 2017
| % first pass. This means we may have docs that already exist | ||
| % in the seq_tree in the .data file. Here we lookup any old | ||
| % update_seqs so that they can be removed. | ||
| OldDocIdTree = |
Member
There was a problem hiding this comment.
I'm a little rusty but this looks like a refactoring mistake ...
Member
Author
There was a problem hiding this comment.
Totes was. Got mixed in when separating commits.
This change adds a new `#comp_st{}` record that is used to pass
compaction state through the various compaction steps. There are zero
changes to the existing compaction logic. This merely sets the stage for
adding our docid copy optimization.
davisp
force-pushed
the
compactor-rewrite
branch
from
August 16, 2017 19:56
0f899b7 to
fb67c8b
Compare
This optimizes the first pass of compaction to avoid writing data to the emsort structure stored in the .compact.meta file. Instead of writing data there we instead just re-read the docid tree from the original database.
davisp
force-pushed
the
compactor-rewrite
branch
from
August 16, 2017 21:15
fb67c8b to
c802565
Compare
Member
Author
|
Closing in favor of #778 |
This file contains hidden or 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
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
It occurred to me the other day that we already have the docid tree stored in the original database so the first pass at compaction is wasting a lot of time and IO writing out the emsort structure. This optimizes the compactor to avoid that first use of emsort and instead reads document IDs from the original db's id_tree.
There are zero tests for correct compactor behavior right now (outside of the PSE branch) so I'm going to start writing a bunch of tests that will do mean things to the compactor to make sure that this doesn't have any issues around breaking things. However, given the change I figured I'd at least open a feedback PR while I write the test suite for the compactor behavior.