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

Fix mapping creation on bulk request #5623

Closed
wants to merge 3 commits into from

Conversation

brwe
Copy link
Contributor

@brwe brwe commented Mar 31, 2014

When a bulk request triggers an index creation a mapping might not be
created. The reason is that when indexing documents in a bulk,
an indexing operation might fail due to a shard not yet being
started. The mapping service, however, might already
have the mapping but the mapping update is never issued to the master,
even on subsequent indexing of documents.

Instead, the mapping must be propagated to master even if the
indexing fails due to a shard not being started.

@brwe brwe added bug labels Mar 31, 2014
@kimchy
Copy link
Member

kimchy commented Mar 31, 2014

LGTM, wonderful catch!


@Test
public void testBulkIndexCreatesMapping() throws Exception {
cluster().wipe();
Copy link
Contributor

Choose a reason for hiding this comment

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

this cluster().wipe() is unnecessary it happens during before / after already

brwe added 2 commits April 2, 2014 11:22
When a bulk request triggers an index creation a mapping might not be
created. The reason is that when indexing documents in a bulk,
an indexing operation might fail due to a shard not yet being
started. The mapping service, however, might already
have the mapping but the mapping update is never issued to the master,
even on subsequent indexing of documents.

Instead, the mapping must be propagated to master even if the
indexing fails due to a shard not being started.
@brwe
Copy link
Contributor Author

brwe commented Apr 2, 2014

Thanks for the comments! I updated the commits accordingly. I will push to master 1.x an 1.1. Should I also try and push to 1.0 and 0.90?

@@ -171,12 +173,27 @@ protected ShardIterator shards(ClusterState clusterState, BulkShardRequest reque
ops[requestIndex] = result.op;
}
} catch (Throwable e) {
if (e instanceof WriteFailure) {
Copy link
Contributor

Choose a reason for hiding this comment

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

Instead of doing the instanceof check here can we maybe wrap the body of the try / catch in another try catch and then rethrow? like this:

try {
  try {


  } catch (WriteFailure e) {
    // do all the things
    throw e.getCause(); // maybe check if e.getCause() can be null?
  }
} catch (Throwable e) {
  // do all the other things
}

Copy link
Contributor Author

Choose a reason for hiding this comment

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

changed in last commit

@s1monw
Copy link
Contributor

s1monw commented Apr 2, 2014

change LGTM +1 to squash and push

@brwe brwe closed this in ac57019 Apr 2, 2014
brwe added a commit that referenced this pull request Apr 2, 2014
When a bulk request triggers an index creation a mapping might not be
created. The reason is that when indexing documents in a bulk,
an indexing operation might fail due to a shard not yet being
started. The mapping service, however, might already
have the mapping but the mapping update is never issued to the master,
even on subsequent indexing of documents.

Instead, the mapping must be propagated to master even if the
indexing fails due to a shard not being started.

closes #5623
brwe added a commit that referenced this pull request Apr 2, 2014
When a bulk request triggers an index creation a mapping might not be
created. The reason is that when indexing documents in a bulk,
an indexing operation might fail due to a shard not yet being
started. The mapping service, however, might already
have the mapping but the mapping update is never issued to the master,
even on subsequent indexing of documents.

Instead, the mapping must be propagated to master even if the
indexing fails due to a shard not being started.

closes #5623
brwe added a commit that referenced this pull request Apr 2, 2014
When a bulk request triggers an index creation a mapping might not be
created. The reason is that when indexing documents in a bulk,
an indexing operation might fail due to a shard not yet being
started. The mapping service, however, might already
have the mapping but the mapping update is never issued to the master,
even on subsequent indexing of documents.

Instead, the mapping must be propagated to master even if the
indexing fails due to a shard not being started.

closes #5623
@brwe brwe added v1.1.0 and removed v1.0.1 labels Apr 2, 2014
brwe added a commit to brwe/elasticsearch that referenced this pull request Apr 10, 2014
If a document is percolated, the mapping service is updated while the
document is parsed. The cluster state is not updated with the new mapping.
If the same document is then indexed, the mapping is therfore not created.
More explanaition in the test.
This is similar to issue elastic#5623
mute pushed a commit to mute/elasticsearch that referenced this pull request Jul 29, 2015
When a bulk request triggers an index creation a mapping might not be
created. The reason is that when indexing documents in a bulk,
an indexing operation might fail due to a shard not yet being
started. The mapping service, however, might already
have the mapping but the mapping update is never issued to the master,
even on subsequent indexing of documents.

Instead, the mapping must be propagated to master even if the
indexing fails due to a shard not being started.

closes elastic#5623
mute pushed a commit to mute/elasticsearch that referenced this pull request Jul 29, 2015
When a bulk request triggers an index creation a mapping might not be
created. The reason is that when indexing documents in a bulk,
an indexing operation might fail due to a shard not yet being
started. The mapping service, however, might already
have the mapping but the mapping update is never issued to the master,
even on subsequent indexing of documents.

Instead, the mapping must be propagated to master even if the
indexing fails due to a shard not being started.

closes elastic#5623
@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.0.3 v1.1.1 v1.2.0 v2.0.0-beta1
Projects
None yet
Development

Successfully merging this pull request may close these issues.

None yet

6 participants