Skip to content

Commit

Permalink
[Upgrade Assistant] Removes unnecessary mappings for reindexing (#150878
Browse files Browse the repository at this point in the history
)

## Summary
Partially addresses #64547

This PR removes unnecessary mappings from the saved objects type
`upgrade-assistant-reindex-operation` that holds information about
reindex processes.
Currently, the reindexing is disabled via a config for Upgrade Assistant
plugin `xpack.upgrade_assistant.featureSet.reindexCorrectiveActions`. ES
also doesn't log any deprecations for indices created since 7.0 and
indices created before 7.0 are incompatible with versions 8.0+. That
means that when reindexing will be enabled in UA, it needs to be
configured for the specific upgrade scenario, for example for 9.0.

### How to test
Even though reindexing is currently disabled, I was able to do some
testing for the changes. Here is how to test reindexing locally:
1. Add `xpack.upgrade_assistant.featureSet.reindexCorrectiveActions:
true` to your `kibana.dev.yml` file
2. Start ES and Kibana with `yarn es snapshot --license=trial` and `yarn
start`
3. Create a test user with the role `system_indices_superuser` (in Stack
Management -> Security -> Users). Log in with that user for further
steps.
4. Create an index via Dev Tools 
```
POST /old_index/_doc
{
  "test": "test"
}
```
5. replace `deprecations` on line 22 in the file
[`/server/lib/es_deprecations_status.ts`](https://github.com/elastic/kibana/blob/main/x-pack/plugins/upgrade_assistant/server/lib/es_deprecations_status.ts#L22)
with
```
  const deprecations = {
    cluster_settings: [],
    node_settings: [],
    ml_settings: [],
    index_settings: {
      old_index: [
        {
          level: 'critical',
          message: 'Index created before 7.0',
          url: 'https: //www.elastic.co/guide/en/elasticsearch/reference/master/breaking-changes-8.0.html',
          details: 'This index was created using version: 6.8.13',
          resolve_during_rolling_upgrade: false,
        },
      ],
    },
  };
```
6. open UA and test the reindexing of `old_index`

### Follow up work
A follow up PR if needed will be opened for saved objects types
`upgrade-assistant-ml-upgrade-operation` and
`upgrade-assistant-telemetry`
  • Loading branch information
yuliacech authored Feb 21, 2023
1 parent 5ee2b21 commit eaa0884
Show file tree
Hide file tree
Showing 2 changed files with 2 additions and 60 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -144,7 +144,7 @@ describe('checking migration metadata changes on all registered SO types', () =>
"telemetry": "561b329aaed3c15b91aaf2075645be3097247612",
"ui-metric": "410a8ad28e0f44b161c960ff0ce950c712b17c52",
"upgrade-assistant-ml-upgrade-operation": "e20ff1efa3c4757f5e7ff5fb897c557b08524c3a",
"upgrade-assistant-reindex-operation": "c7442ffe34954c117a74bf138e48e4c25095a6cf",
"upgrade-assistant-reindex-operation": "09ac8ed9c9acf7e8ece8eafe47d7019ea1472144",
"upgrade-assistant-telemetry": "12bcbfc4e4ce64d2ca7c24f9acccd331a2bd2ab6",
"uptime-dynamic-settings": "9a63ce80904a04be114749e426882dc3ff011137",
"uptime-synthetics-api-key": "599319bedbfa287e8761e1ba49d536417a33fa13",
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -14,72 +14,14 @@ export const reindexOperationSavedObjectType: SavedObjectsType = {
hidden: false,
namespaceType: 'agnostic',
mappings: {
dynamic: false,
properties: {
reindexTaskId: {
type: 'text',
fields: {
keyword: {
type: 'keyword',
ignore_above: 256,
},
},
},
indexName: {
type: 'keyword',
},
newIndexName: {
type: 'text',
fields: {
keyword: {
type: 'keyword',
ignore_above: 256,
},
},
},
status: {
type: 'integer',
},
locked: {
type: 'date',
},
lastCompletedStep: {
type: 'long',
},
// Note that reindex failures can result in extremely long error messages coming from ES.
// We need to map these errors as text and use ignore_above to prevent indexing really large
// messages as keyword. See https://github.com/elastic/kibana/issues/71642 for more info.
errorMessage: {
type: 'text',
fields: {
keyword: {
type: 'keyword',
ignore_above: 256,
},
},
},
reindexTaskPercComplete: {
type: 'float',
},
runningReindexCount: {
type: 'integer',
},
reindexOptions: {
properties: {
openAndClose: {
type: 'boolean',
},
queueSettings: {
properties: {
queuedAt: {
type: 'long',
},
startedAt: {
type: 'long',
},
},
},
},
},
},
},
};

0 comments on commit eaa0884

Please sign in to comment.