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

Reindex wait_for_completion=false task failure #50248

Closed
jbudz opened this issue Dec 16, 2019 · 6 comments · Fixed by #50359
Closed

Reindex wait_for_completion=false task failure #50248

jbudz opened this issue Dec 16, 2019 · 6 comments · Fixed by #50359
Labels
>bug :Distributed Indexing/Reindex Issues relating to reindex that are not caused by issues further down

Comments

@jbudz
Copy link
Member

jbudz commented Dec 16, 2019

curl -XPUT "http://localhost:9220/foo"
curl -XPOST "http://localhost:9220/_reindex?wait_for_completion=false" -H 'Content-Type: application/json' -d'{  "source": {    "index": "foo"  },  "dest": {    "index": "bar"  }}'

// run twice
curl -XPOST "http://localhost:9220/_reindex?wait_for_completion=false" -H 'Content-Type: application/json' -d'{  "source": {    "index": "foo"  },  "dest": {    "index": "bar"  }}'

Error log

   │ info [o.e.t.LoggingTaskListener] [windesk] 6563 failed with exception
   │      org.elasticsearch.index.mapper.MapperParsingException: Root mapping definition has unsupported parameters:  [task : {_meta={version=2}, dynamic=strict, properties={completed={type=boolean}, task={properties={action={type=keyword}, cancellable={type=boolean}, id={type=long}, parent_task_id={type=keyword}, node={type=keyword}, running_time_in_nanos={type=long}, start_time_in_millis={type=long}, type={type=keyword}, status={type=object, enabled=false}, description={type=text}, headers={type=object, enabled=false}}}, response={type=object, enabled=false}, error={type=object, enabled=false}}}]
   │            at org.elasticsearch.index.mapper.DocumentMapperParser.checkNoRemainingFields(DocumentMapperParser.java:147) ~[elasticsearch-8.0.0-SNAPSHOT.jar:8.0.0-SNAPSHOT]
   │            at org.elasticsearch.index.mapper.DocumentMapperParser.parse(DocumentMapperParser.java:135) ~[elasticsearch-8.0.0-SNAPSHOT.jar:8.0.0-SNAPSHOT]
   │            at org.elasticsearch.index.mapper.DocumentMapperParser.parse(DocumentMapperParser.java:83) ~[elasticsearch-8.0.0-SNAPSHOT.jar:8.0.0-SNAPSHOT]
   │            at org.elasticsearch.index.mapper.MapperService.parse(MapperService.java:553) ~[elasticsearch-8.0.0-SNAPSHOT.jar:8.0.0-SNAPSHOT]

The response code is 200 with a task id. When attempting to retrieve the returned task id:

curl -XGET "http://localhost:9220/_tasks/UWqGoA9jRM25A2GQIUZp3g:6563"
{
  "error" : {
    "root_cause" : [
      {
        "type" : "resource_not_found_exception",
        "reason" : "task [UWqGoA9jRM25A2GQIUZp3g:6563] isn't running and hasn't stored its results"
      }
    ],
    "type" : "resource_not_found_exception",
    "reason" : "task [UWqGoA9jRM25A2GQIUZp3g:6563] isn't running and hasn't stored its results"
  },
  "status" : 404
}

Re-indexing fails until the .tasks index is deleted, and then I can run it once before it starts failing again.

@jbudz jbudz changed the title Reindex wait_for_completion=false task fails on an empty index Reindex wait_for_completion=false task failure Dec 16, 2019
@jbudz
Copy link
Member Author

jbudz commented Dec 16, 2019

Edited the title to clarify, minimal reproduction with empty index but happens with docs too.

@jimczi
Copy link
Contributor

jimczi commented Dec 16, 2019

It looks like the creation of the .tasks index fails due to an issue with the mapping. It might be a leftover of the type removal but I am surprised that it's not caught by tests. @romseygeek can you take a look ?

@jimczi jimczi added :Distributed Indexing/Reindex Issues relating to reindex that are not caused by issues further down >bug labels Dec 16, 2019
@elasticmachine
Copy link
Collaborator

Pinging @elastic/es-distributed (:Distributed/Reindex)

@romseygeek
Copy link
Contributor

The inbuilt tasks mapping still has a top-level type of tasks, instead of _doc, which is what's causing the failure. The fix is simple, but I'm trying to work out why tests haven't picked this up so far.

@tylersmalley
Copy link
Contributor

Thanks @romseygeek - we're happy to help test the fix to help unblock some downstream teams since we're currently pinning Kibana to a previous snapshot.

@romseygeek
Copy link
Contributor

This is a combination of two problems, the tasks default mapping and the fact that we haven't incremented the version metadata in the mapping either, so it gets re-applied with every new task. I'll open a PR to fix master, and also a 7x backport to fix the version.

romseygeek added a commit that referenced this issue Dec 19, 2019
The built-in mapping for the tasks result index still has a mapping type defined; while
this does not matter for index creation, as we still have a create method that takes a
top-level type, it does matter for updates. In combination with a separate bug, that the
built-in mapping has not incremented its meta version, this meant that tasks submitted
to a cluster with an already existing task index would attempt to update the mappings
on that index, and fail due to the top-level type.

This commit fixes the mapping to have a top-level mapping of _doc, and also updates
the meta version so that we do not update mappings on every new task. It also adds a
test that explicitly runs two asynchronous tasks to ensure that the mappings do not
cause a failure.

Fixes #50248
jbudz added a commit to jbudz/kibana that referenced this issue Dec 19, 2019
Elasticsearch was pinned to an older version due to a migrations
failure.  Root cause was determined to be upstream and tracked at
elastic/elasticsearch#50248.  Now that a fix is merged we can see where
the most recent snapshot leaves us.
SivagurunathanV pushed a commit to SivagurunathanV/elasticsearch that referenced this issue Jan 23, 2020
The built-in mapping for the tasks result index still has a mapping type defined; while
this does not matter for index creation, as we still have a create method that takes a
top-level type, it does matter for updates. In combination with a separate bug, that the
built-in mapping has not incremented its meta version, this meant that tasks submitted
to a cluster with an already existing task index would attempt to update the mappings
on that index, and fail due to the top-level type.

This commit fixes the mapping to have a top-level mapping of _doc, and also updates
the meta version so that we do not update mappings on every new task. It also adds a
test that explicitly runs two asynchronous tasks to ensure that the mappings do not
cause a failure.

Fixes elastic#50248
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
>bug :Distributed Indexing/Reindex Issues relating to reindex that are not caused by issues further down
Projects
None yet
Development

Successfully merging a pull request may close this issue.

5 participants