-
Notifications
You must be signed in to change notification settings - Fork 25.6k
INGEST: Simplify IngestService #33008
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
INGEST: Simplify IngestService #33008
Conversation
* Follow up to elastic#32617 * Flatten redundant inner classes of `IngestService`
|
Pinging @elastic/es-core-infra |
martijnvg
left a comment
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 a couple of comments, LGTM otherwise assuming pr builds pass.
| private final ThreadPool threadPool; | ||
|
|
||
| private final StatsHolder totalStats = new StatsHolder(); | ||
|
|
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: remove these white lines?
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.
yea, that would be nicer => cleaning it up :)
|
|
||
| private final PipelineStore store; | ||
| private final ThreadPool threadPool; | ||
| public void executeBulkRequest(Iterable<DocWriteRequest<?>> actionRequests, |
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 this method need to remain public?
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.
@martijnvg it does, it's called from org.elasticsearch.action.bulk.TransportBulkAction#processBulkIndexIngestRequest.
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.
ah, nevermind :)
| Pipeline pipeline = store.get(pipelineId); | ||
| if (pipeline == null) { | ||
| throw new IllegalArgumentException("pipeline with id [" + pipelineId + "] does not exist"); | ||
| private void innerExecute(IndexRequest indexRequest, Pipeline pipeline) throws Exception { |
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.
maybe a more descriptive method name?
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.
@martijnvg any suggestions? :)
I agree that these names are kind of meh, but note: We have a bunch of other inner* methods in this class. In the end they're all kind of redundant since they're only used in one place (at least in production code that is) each => somewhat hard to find a better name for a method that effectively only exists to shorten the code of whatever method name that comes after the inner prefix.
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.
The inner method prefix was introduced to make the actual logic easier to unit test.
I was more referring to the execute part of this method, which is very generic :)
maybe innerIngest()?
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.
@martijnvg I like that (innerIngest), renaming :)
|
@martijnvg thanks for the review! |
* INGEST: Simplify IngestService * Follow up to elastic#32617 * Flatten redundant inner classes of `IngestService`
IngestService