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

Shrinking doesn't play well with index.mapping.single_type #31787

Closed
jpountz opened this issue Jul 4, 2018 · 4 comments
Closed

Shrinking doesn't play well with index.mapping.single_type #31787

jpountz opened this issue Jul 4, 2018 · 4 comments
Labels
>bug :Data Management/Indices APIs APIs to create and manage indices and templates

Comments

@jpountz
Copy link
Contributor

jpountz commented Jul 4, 2018

Here is a recreation for 5.6 (only 5.x is affected, not 6.x where this setting doesn't make sense):

DELETE test

PUT test 
{
  "settings": {
    "number_of_shards": 2,
    "mapping.single_type": true
  },
  "mappings": {
    "doc": {
      "properties": {
        "foo": {
          "type": "keyword"
        }
      }
    }
  }
}

PUT test/doc/1
{
  "foo": "bar"
}

PUT /test/_settings
{
  "settings": {
    "index.blocks.write": true 
  }
}

POST test/_shrink/test2

GET test2/_search


{
  "error": {
    "root_cause": [
      {
        "type": "illegal_state_exception",
        "reason": "Call postProcess before getting the uid"
      }
    ],
    "type": "search_phase_execution_exception",
    "reason": "all shards failed",
    "phase": "query",
    "grouped": true,
    "failed_shards": [
      {
        "shard": 0,
        "index": "test2",
        "node": "hKTfMOBARL-EapXTxdKcUA",
        "reason": {
          "type": "illegal_state_exception",
          "reason": "Call postProcess before getting the uid"
        }
      }
    ]
  },
  "status": 500
}

This is due to the fact that the single type setting is not preserved by the shrink:

GET test2/_settings 

{
  "test2" : {
    "settings" : {
      "index" : {
        "routing" : {
          "allocation" : {
            "initial_recovery" : {
              "_id" : "hKTfMOBARL-EapXTxdKcUA"
            }
          }
        },
        "allocation" : {
          "max_retries" : "1"
        },
        "number_of_shards" : "1",
        "routing_partition_size" : "1",
        "shrink" : {
          "source" : {
            "name" : "test",
            "uuid" : "RPfBwJwFTteDPXgcmZlzbw"
          }
        },
        "provided_name" : "test2",
        "creation_date" : "1530698402187",
        "number_of_replicas" : "1",
        "uuid" : "ql1DbgPsTs6oKuIIl-BsCQ",
        "version" : {
          "created" : "5061199",
          "upgraded" : "5061199"
        }
      }
    }
  }
}
@jpountz jpountz added >bug :Data Management/Indices APIs APIs to create and manage indices and templates labels Jul 4, 2018
@elasticmachine
Copy link
Collaborator

Pinging @elastic/es-core-infra

@jpountz
Copy link
Contributor Author

jpountz commented Jul 4, 2018

@gmoskovicz just let me know that we actually already fixed it in 6.3 via #29202 cc @jimczi

@jimczi
Copy link
Contributor

jimczi commented Jul 5, 2018

Yep this is fixed in 6.3 but I don't remember why I did not backport in 5.6 😕 . I'll open a new pr for 5.6, sorry for the confusion.

jimczi added a commit to jimczi/elasticsearch that referenced this issue Jul 5, 2018
The index.mapping.single_type setting is not propagated when shrinking an index created in 5.x.
This breaks search/get on the shrinked index because this setting is used to choose
whether _uid or _id field should be used as the primary key.
This commit fixes this bug by copying the setting in the shrinked index.

Closes elastic#31787
jimczi added a commit that referenced this issue Jul 5, 2018
The index.mapping.single_type setting is not propagated when shrinking an index created in 5.x.
This breaks search/get on the shrinked index because this setting is used to choose
whether _uid or _id field should be used as the primary key.
This commit fixes this bug by copying the setting in the shrinked index.

Closes #31787
@jimczi
Copy link
Contributor

jimczi commented Jul 5, 2018

Closed by #31811, thanks @jpountz and @gmoskovicz !

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
>bug :Data Management/Indices APIs APIs to create and manage indices and templates
Projects
None yet
Development

No branches or pull requests

3 participants