-
Notifications
You must be signed in to change notification settings - Fork 25k
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
Refactor internal engine #27082
Refactor internal engine #27082
Conversation
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.
I left some comments.
} | ||
|
||
@FunctionalInterface | ||
protected interface SeqNoServiceSupplier { |
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.
why not use java.util.function.BiFunction
?
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.
This is a good catch. This is a product of the fact that I initially started with the supplier being a function of more parameters (the shard ID, the allocation ID, etc.) but collapsed these into the two that are left and did not see until you pointed it out that we can go all the way and remove the interface. Thank you.
@@ -2008,8 +2031,7 @@ public MergeStats getMergeStats() { | |||
return mergeScheduler.stats(); | |||
} | |||
|
|||
@Override | |||
public SequenceNumbersService seqNoService() { | |||
public final SequenceNumbersService seqNoService() { |
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.
Just wondering: Is it possible to move seqNoService
field to Engine
make the seqNoService()
method there final? The SeqNoServiceSupplier
(or BiFunction) should then also be moved as an constructor parameter to Engine
.
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.
I don't think we can do this cleanly right now. It means that the sequence number service has to be available immediately (to pass to the super constructor) but we are also trying to initialize the index writer at the same time that we initialize the sequence number service.
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.
I see, that makes it trickier. Thanks for explaining that.
import static java.util.Collections.emptyMap; | ||
import static org.elasticsearch.index.mapper.SourceToParse.source; | ||
|
||
public class TranslogHandler implements EngineConfig.TranslogRecoveryRunner { |
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.
nit: maybe add class jdoc here about what the purpose of this implementation is?
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.
From my side this LGTM.
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.
I am curious where this goes, the refactoring LGTM. I wonder if we should do this in master rather than in a branch. looks generic enough?
@s1monw I'm happy to pull this into master/6.x rather than a long-running feature branch, it will require maintenance on the feature branch then. 😇 |
This commit is a minor refactoring of internal engine to move hooks for generating sequence numbers into the engine itself. As such, we refactor tests that relied on this hook to use the new hook, and remove the hook from the sequence number service itself.
5fb2f0f
to
c55542c
Compare
This commit is a minor refactoring of internal engine to move hooks for generating sequence numbers into the engine itself. As such, we refactor tests that relied on this hook to use the new hook, and remove the hook from the sequence number service itself. Relates #27082
This commit is a minor refactoring of internal engine to move hooks for generating sequence numbers into the engine itself. As such, we refactor tests that relied on this hook to use the new hook, and remove the hook from the sequence number service itself.