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

Bulk request which try and fail to create multiple indices may never return #6436

Closed
wants to merge 4 commits into from

Conversation

bleskes
Copy link
Contributor

@bleskes bleskes commented Jun 6, 2014

This is caused by an NPE in the error handling code. All is well if only 1 index fails (or none).

…return

This is caused by an NPE in the error handling code. All is well if only 1 index fails (or none).
builder.add(client().prepareIndex().setIndex(expectedFailures[i] ? "INVALID.NAME" : "test").setType("type1").setId("1").setSource("field", 1));
String name;
if (expectedFailures[i]) {
name = twoBadNames[randomIntBetween(0, 1)];
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 call randomFrom(twoBadNames)

@@ -624,10 +624,17 @@ public void testThatInvalidIndexNamesShouldNotBreakCompleteBulkRequest() {
int bulkEntryCount = randomIntBetween(10, 50);
BulkRequestBuilder builder = client().prepareBulk();
boolean[] expectedFailures = new boolean[bulkEntryCount];
String[] twoBadNames = new String[]{"INVALID.NAME1", "INVALID.NAME2"};
Copy link
Contributor

Choose a reason for hiding this comment

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

since the test didn't catch the bug because there was exactly one bad name, maybe we should also try having more bad names (ie. randomizing the size of this array)?

@@ -624,10 +625,20 @@ public void testThatInvalidIndexNamesShouldNotBreakCompleteBulkRequest() {
int bulkEntryCount = randomIntBetween(10, 50);
BulkRequestBuilder builder = client().prepareBulk();
boolean[] expectedFailures = new boolean[bulkEntryCount];
ArrayList<String> badIndexNames = new ArrayList<>();
for (int i = 1; i < randomIntBetween(1, 5); i++) {
Copy link
Contributor

Choose a reason for hiding this comment

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

the upper bound would be recomputed on each iteration, probably not what you want?

Copy link
Contributor

Choose a reason for hiding this comment

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

(and starting from i=1 allows for an empty list, is it ok?)

Copy link
Contributor Author

Choose a reason for hiding this comment

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

shame on me. fixing.

@bleskes
Copy link
Contributor Author

bleskes commented Jun 6, 2014

@jpountz pushed another commit.

@jpountz
Copy link
Contributor

jpountz commented Jun 6, 2014

LGTM

@bleskes bleskes closed this in b454f64 Jun 6, 2014
bleskes added a commit that referenced this pull request Jun 6, 2014
…return

This is caused by an NPE in the error handling code. All is well if only 1 index creation fails (or none).

Closes #6436
@bleskes
Copy link
Contributor Author

bleskes commented Jun 6, 2014

merged. Thx @jpountz

@bleskes bleskes deleted the bug/bulk_multi_create_index branch June 6, 2014 21:18
@s1monw s1monw removed the review label Jun 18, 2014
@clintongormley clintongormley changed the title Bulk request which try and fail to create multiple indices may never return Bulk API: Bulk request which try and fail to create multiple indices may never return Jul 16, 2014
@clintongormley clintongormley changed the title Bulk API: Bulk request which try and fail to create multiple indices may never return Bulk request which try and fail to create multiple indices may never return Jun 7, 2015
@lcawl lcawl added :Distributed/CRUD A catch all label for issues around indexing, updating and getting a doc by id. Not search. and removed :Bulk labels Feb 13, 2018
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
>bug :Distributed/CRUD A catch all label for issues around indexing, updating and getting a doc by id. Not search. v1.3.0 v2.0.0-beta1
Projects
None yet
Development

Successfully merging this pull request may close these issues.

None yet

5 participants