Skip to content
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

flush method for BulkProcessor class. #5575

Closed
wants to merge 1 commit into from
Closed

Conversation

kul
Copy link
Contributor

@kul kul commented Mar 27, 2014

This is for #5570.

There is no explicit method flush/execute in BulkProcessor class. This can be useful in certain scenarios. Currently it requires to close and create a new BulkProcessor if one wants an immediate flush.

@dadoonet
Copy link
Member

I think you should add a test in addition to it in BulkTests?

@kul
Copy link
Contributor Author

kul commented Mar 28, 2014

Added a test case and doc string for method.

@s1monw
Copy link
Contributor

s1monw commented Mar 28, 2014

I looked at it quickly and I think you should check if we really need to flush ie. if bulkRequest.numberOfActions() > 0 ? it also seems that we can move the :

if (closed) {
  throw new XZYException("already closed");
}

into a separate method called ensureOpen() that is called even before we add requests in internalAdd?

@dadoonet
Copy link
Member

Hi @kul
Could you sign the CLA: http://www.elasticsearch.org/contributor-agreement/

Thanks.

@kul
Copy link
Contributor Author

kul commented Mar 28, 2014

@dadoonet i have signed the CLA.

@s1monw makes sense, i will add another commit to the PR.

assertThat("Could not get a bulk response even after an explicit flush.", response, is(notNullValue()));
assertThat(response.getItems().length, is(5));
} finally {
if (processor != null) {
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

you can use IOUtils.close(processor) it deals with null values...

@s1monw
Copy link
Contributor

s1monw commented Apr 2, 2014

I left small comments on the test, just style :) LGTM can you squash the commits and rebase? @dadoonet can you take it form here?

@kul
Copy link
Contributor Author

kul commented Apr 2, 2014

made the changes and squashed commits. Also made BulkProcessor class implement Closeable.

@dadoonet dadoonet self-assigned this Apr 2, 2014
dadoonet pushed a commit that referenced this pull request Apr 2, 2014
There is no explicit method `flush/execute` in `BulkProcessor` class. This can be useful in certain scenarios.
Currently it requires to close and create a new BulkProcessor if one wants an immediate flush.

Closes #5575.
Closes #5570.
(cherry picked from commit dc19e06)
@dadoonet dadoonet closed this in dc19e06 Apr 2, 2014
@dadoonet
Copy link
Member

dadoonet commented Apr 2, 2014

Pushed in 1.x and master. Thanks!

@clintongormley clintongormley added the :Core/Infra/Transport API Transport client API label Jun 7, 2015
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
Development

Successfully merging this pull request may close these issues.

None yet

4 participants