Skip to content

Commit

Permalink
Move deprecation flags to path section. Add deprecation warning tests…
Browse files Browse the repository at this point in the history
… for _upgrade API.

Ref #47678
  • Loading branch information
timoninmaxim committed Jan 13, 2020
1 parent 635c7c8 commit 76bd135
Show file tree
Hide file tree
Showing 4 changed files with 163 additions and 13 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -2,7 +2,7 @@
"indices.get_upgrade":{
"documentation":{
"url":"https://www.elastic.co/guide/en/elasticsearch/reference/master/indices-upgrade.html",
"description":"Returns a progress status of current upgrade."
"description":"DEPRECATED Returns a progress status of current upgrade."
},
"stability":"stable",
"url":{
Expand All @@ -11,7 +11,11 @@
"path":"/_upgrade",
"methods":[
"GET"
]
],
"deprecated":{
"version":"8.0.0",
"description":"The _upgrade API is no longer useful and will be removed. Instead, see _reindex API."
}
},
{
"path":"/{index}/_upgrade",
Expand All @@ -23,6 +27,10 @@
"type":"list",
"description":"A comma-separated list of index names; use `_all` or empty string to perform the operation on all indices"
}
},
"deprecated":{
"version":"8.0.0",
"description":"The _upgrade API is no longer useful and will be removed. Instead, see _reindex API."
}
}
]
Expand All @@ -47,10 +55,6 @@
"default":"open",
"description":"Whether to expand wildcard expression to concrete indices that are open, closed or both."
}
},
"deprecated":{
"version":"8.0.0",
"description":"The _upgrade API is no longer useful and will be removed. Instead, see _reindex API."
}
}
}
Original file line number Diff line number Diff line change
Expand Up @@ -2,7 +2,7 @@
"indices.upgrade":{
"documentation":{
"url":"https://www.elastic.co/guide/en/elasticsearch/reference/master/indices-upgrade.html",
"description":"Upgrades to the current version of Lucene."
"description":"DEPRECATED Upgrades to the current version of Lucene."
},
"stability":"stable",
"url":{
Expand All @@ -11,7 +11,11 @@
"path":"/_upgrade",
"methods":[
"POST"
]
],
"deprecated":{
"version":"8.0.0",
"description":"The _upgrade API is no longer useful and will be removed. Instead, see _reindex API."
}
},
{
"path":"/{index}/_upgrade",
Expand All @@ -23,6 +27,10 @@
"type":"list",
"description":"A comma-separated list of index names; use `_all` or empty string to perform the operation on all indices"
}
},
"deprecated":{
"version":"8.0.0",
"description":"The _upgrade API is no longer useful and will be removed. Instead, see _reindex API."
}
}
]
Expand Down Expand Up @@ -55,10 +63,6 @@
"type":"boolean",
"description":"If true, only ancient (an older Lucene major release) segments will be upgraded"
}
},
"deprecated":{
"version":"8.0.0",
"description":"The _upgrade API is no longer useful and will be removed. Instead, see _reindex API."
}
}
}
Original file line number Diff line number Diff line change
@@ -1,5 +1,9 @@
---
"Basic test for upgrade indices":
- skip:
version: " - 7.99.99"
reason: "_upgrade api is deprecated since 8.0.0"
features: ["warnings", "node_selector"]

- do:
indices.create:
Expand All @@ -12,12 +16,21 @@
- do:
indices.upgrade:
index: test_index
warnings:
- "The _upgrade API is no longer useful and will be removed. Instead, see _reindex API."
node_selector:
version: "8.0.0 - "

- match: {upgraded_indices.test_index.oldest_lucene_segment_version: '/(\d\.)+\d/'}
- is_true: upgraded_indices.test_index.upgrade_version

---
"Upgrade indices ignore unavailable":
- skip:
version: " - 7.99.99"
reason: "_upgrade api is deprecated since 8.0.0"
features: ["warnings", "node_selector"]

- do:
indices.create:
index: test_index
Expand All @@ -31,34 +44,58 @@
indices.upgrade:
index: ["does_not_exist", "test_index"]
ignore_unavailable: true
warnings:
- "The _upgrade API is no longer useful and will be removed. Instead, see _reindex API."
node_selector:
version: "8.0.0 - "

- match: {_shards.total: 1}
- is_true: upgraded_indices.test_index.upgrade_version
- is_false: upgraded_indices.does_not_exist

---
"Upgrade indices allow no indices":
- skip:
version: " - 7.99.99"
reason: "_upgrade api is deprecated since 8.0.0"
features: ["warnings", "node_selector"]

- do:
indices.upgrade:
index: test_index
ignore_unavailable: true
allow_no_indices: true
warnings:
- "The _upgrade API is no longer useful and will be removed. Instead, see _reindex API."
node_selector:
version: "8.0.0 - "

- match: {_shards.total: 0}

---
"Upgrade indices disallow no indices":
- skip:
version: " - 7.99.99"
reason: "_upgrade api is deprecated since 8.0.0"
features: ["warnings", "node_selector"]

- do:
catch: missing
indices.upgrade:
index: test_index
ignore_unavailable: true
allow_no_indices: false
warnings:
- "The _upgrade API is no longer useful and will be removed. Instead, see _reindex API."
node_selector:
version: "8.0.0 - "

---
"Upgrade indices disallow unavailable":
- skip:
version: " - 7.99.99"
reason: "_upgrade api is deprecated since 8.0.0"
features: ["warnings", "node_selector"]

- do:
indices.create:
Expand All @@ -69,4 +106,7 @@
indices.upgrade:
index: ["test_index", "does_not_exist"]
ignore_unavailable: false

warnings:
- "The _upgrade API is no longer useful and will be removed. Instead, see _reindex API."
node_selector:
version: "8.0.0 - "
Original file line number Diff line number Diff line change
@@ -0,0 +1,102 @@
---
"Basic test for upgrade indices < 8.0.0":
- skip:
version: "8.0.0 - "
reason: "_upgrade api has deprecation header since 8.0.0"
features: "node_selector"

- do:
indices.create:
index: test_index
body:
settings:
index:
number_of_replicas: 0

- do:
indices.upgrade:
index: test_index
node_selector:
version: " - 7.99.99"

- match: {upgraded_indices.test_index.oldest_lucene_segment_version: '/(\d\.)+\d/'}
- is_true: upgraded_indices.test_index.upgrade_version

---
"Upgrade indices ignore unavailable < 8.0.0":
- skip:
version: "8.0.0 - "
reason: "_upgrade api has deprecation header since 8.0.0"
features: "node_selector"

- do:
indices.create:
index: test_index
body:
settings:
index:
number_of_shards: 1
number_of_replicas: 0

- do:
indices.upgrade:
index: ["does_not_exist", "test_index"]
ignore_unavailable: true
node_selector:
version: " - 7.99.99"

- match: {_shards.total: 1}
- is_true: upgraded_indices.test_index.upgrade_version
- is_false: upgraded_indices.does_not_exist

---
"Upgrade indices allow no indices < 8.0.0":
- skip:
version: "8.0.0 - "
reason: "_upgrade api has deprecation header since 8.0.0"
features: "node_selector"

- do:
indices.upgrade:
index: test_index
ignore_unavailable: true
allow_no_indices: true
node_selector:
version: " - 7.99.99"

- match: {_shards.total: 0}

---
"Upgrade indices disallow no indices < 8.0.0":
- skip:
version: "8.0.0 - "
reason: "_upgrade api has deprecation header since 8.0.0"
features: "node_selector"

- do:
catch: missing
indices.upgrade:
index: test_index
ignore_unavailable: true
allow_no_indices: false
node_selector:
version: " - 7.99.99"

---
"Upgrade indices disallow unavailable < 8.0.0":
- skip:
version: "8.0.0 - "
reason: "_upgrade api has deprecation header since 8.0.0"
features: "node_selector"

- do:
indices.create:
index: test_index

- do:
catch: missing
indices.upgrade:
index: ["test_index", "does_not_exist"]
ignore_unavailable: false
node_selector:
version: " - 7.99.99"

0 comments on commit 76bd135

Please sign in to comment.