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

Bug fix:Adds a migration for transforming TSVB vis split_filters #49000

Merged

Conversation

TinaHeiligers
Copy link
Contributor

@TinaHeiligers TinaHeiligers commented Oct 22, 2019

Summary

Fixes #48710
When migrating to Kibana 7.3, split_filters from the 'Group by' series option were not migrated to query:language objects. After an upgrade to 7.3, visualizations that had split_filters in previous versions don't interpret the filter as a string.
For example, if we have a TSVB visualization in Kibana 6.8 with the following configuration:
TopN_in_6_8_with_filters

After an upgrade to 7.3, the filters appear to have been lost:
TopN_with_filters_from_6_8_missing_group_by_filter_query

However, the filter strings haven't been deleted, they are not interpretable by the code because they are not query:language objects.
Inspecting the visState data using the utilities in the Management -> Saved Objects list, we see that the filter strings are still there:
Screen Shot 2019-10-22 at 12 26 10 PM

Patches are not being backported to 7.3 anymore, so a fix to the original migration can't be applied.
A new migration has been added and runs for version 7.5. The migration transforms any remaining split_filters filters that are still strings. The migration will effectively restore the original filters if they have not been deleted.
migrated_filters_on_import_to_v8

Unfortunately, the only way to 'fix' the missing filters in a version between 7.3 and 7.5 is to manually convert the filter string to an object in the visState panel shown when inspecting the saved object as follows:

  1. Go to the Management page and select Saved Objects.
  2. Find the visualization with 'missing' filters
  3. Click on the 'inspect' icon. This will show a series of panels with json in them.
  4. Find the panel that shows the visState
  5. Look for the split_filters array and convert each filter:<string> into an object containing the original filter string as the value for the query key and use lucene as the value for the language key.
  6. Save the object.
    You should see that the visualization's filters have been restored.

The other way to restore the filters after an upgrade to 7.3 is to inspect the saved object and manually reapply the filter as seen in the json under visState -> params -> series -> split_filters -> filter in the visualization itself.

Checklist

Use strikethroughs to remove checklist items you don't feel are applicable to this PR.

- [ ] This was checked for cross-browser compatibility, including a check against IE11
- [ ] Any text added follows EUI's writing guidelines, uses sentence case text and includes i18n support
- [ ] Documentation was added for features that require explanation or tutorials

For maintainers

- [ ] This was checked for breaking API changes and was labeled appropriately
No breaking changes in this PR
- [ ] This includes a feature addition or change that requires a release note and was labeled appropriately

…lters from strings to query:language objects to 7.5
@TinaHeiligers TinaHeiligers added Feature:TSVB TSVB (Time Series Visual Builder) v8.0.0 v7.5.0 labels Oct 22, 2019
@TinaHeiligers TinaHeiligers added the release_note:skip Skip the PR/issue when compiling release notes label Oct 22, 2019
…he saved object's migrationVersion in failing functional test
@elasticmachine
Copy link
Contributor

💔 Build Failed

@elasticmachine
Copy link
Contributor

💚 Build Succeeded

@TinaHeiligers TinaHeiligers added the Team:Visualizations Visualization editors, elastic-charts and infrastructure label Oct 23, 2019
@elasticmachine
Copy link
Contributor

Pinging @elastic/kibana-app (Team:KibanaApp)

@TinaHeiligers
Copy link
Contributor Author

@timroes
@rayafratkina said I should backport this to 7.4 proactively, even though there isn't a patch planned for 7.4.
I need advice on PR labelling for 7.4 (should I create a label for 7.4.2?). I'll also have to change the migration number here to 7.4.2(?) but the migration won't run if we only get the patch into 7.5 and the migration number is 7.4. How should I handle this?

@timroes
Copy link
Contributor

timroes commented Oct 24, 2019

@TinaHeiligers I think I would wait with the 7.4.x labeling here until we know if there will be another version (nevertheless ideally already backport it to that branch). Given the migration version numbers: They don't really need to correlate to Kibana versions (it's nice if they do, but it's not a technical must). So since there are no other migrations in 7.5.0 for visualizations it basically doesn't matter if you use 7.5.0 or 7.4.2 as a version for the migration. The migration system will just check if there are any migrations with a higher version number available than the current one and execute them all. So even if you update to 7.5.0 and the migration version would be 7.4.2 it would immediately run on any saved object that has a lower migration version (e.g. 7.3.1) saved in it's saved object. The only time the versioning might cause problems (or is tricky) is when we're trying to backport a migration "before" another migration, which is not the case here.

@timroes
Copy link
Contributor

timroes commented Oct 24, 2019

@elastic/kibana-qa Since that is a critical backport, could you please have a look and test this?

Copy link
Contributor

@timroes timroes left a comment

Choose a reason for hiding this comment

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

A couple of minor suggestions left (the only mandatory one would be the missing toHaveProperty not being called. Otherwise looks good to me. Please wait for @elastic/kibana-qa approval before merging.

@elasticmachine
Copy link
Contributor

💔 Build Failed

@TinaHeiligers
Copy link
Contributor Author

TinaHeiligers commented Oct 24, 2019

@TinaHeiligers I think I would wait with the 7.4.x labeling here until we know if there will be another version (nevertheless ideally already backport it to that branch). Given the migration version numbers: They don't really need to correlate to Kibana versions (it's nice if they do, but it's not a technical must). So since there are no other migrations in 7.5.0 for visualizations it basically doesn't matter if you use 7.5.0 or 7.4.2 as a version for the migration. The migration system will just check if there are any migrations with a higher version number available than the current one and execute them all. So even if you update to 7.5.0 and the migration version would be 7.4.2 it would immediately run on any saved object that has a lower migration version (e.g. 7.3.1) saved in it's saved object. The only time the versioning might cause problems (or is tricky) is when we're trying to backport a migration "before" another migration, which is not the case here.

Backporting: there isn't a 7.4.x branch, so I'll backport to 7.4.

Migration numbers, I've changed it to 7.4.2 here so that we don't end up with another migration that might need to happen before this one.

@TinaHeiligers TinaHeiligers requested review from bhavyarm and removed request for bhavyarm October 24, 2019 16:40
@elasticmachine
Copy link
Contributor

💔 Build Failed

@TinaHeiligers
Copy link
Contributor Author

@elasticmachine merge upstream

@TinaHeiligers TinaHeiligers requested a review from a team October 24, 2019 23:21
@elasticmachine
Copy link
Contributor

💚 Build Succeeded

@TinaHeiligers
Copy link
Contributor Author

@bhavyarm Could you please test this PR so that I can merge it and do the backport?

Steps to reproduce the missing filters situation:

  1. Load up a sample data set in Kibana 6.8.
  2. Edit a TSVB visualization, changing the aggregation to a Filters aggregation (in the 'Group by' option).
  3. Add a few filters and give each a label.
  4. Observe that the visualization changes and the filters are applied.
  5. Save the visualization and export it.
  6. Change to Kibana 7.3 and load the same sample data you used in steps 1 to 5.
  7. Import the visualization from the Management App, Saved Objects page.
  8. Open the imported visualization.
  9. Observe that the filters aggregation filters appear to be missing but the labels are there.

With this PR, the filters will be present. To test that the fix works:

  1. Change to an instance of Kibana running this bug fix.
  2. Load the data and import the visualization with missing filters from above.
  3. Observe that the filters are restored.

Please let me know if you have any questions.

@LeeDr
Copy link

LeeDr commented Oct 25, 2019

@TinaHeiligers we need to find a Kibana App dev to do the test you requested Bhavya to do. The test you've outlined (which is great, thanks for describing the steps so well) is going to take a fair amount of time and Bhavya and other QA are busy testing PRs that are already in 7.5.0.

The QA team will still have to test it after it's merged and in the next BC.

@elasticmachine
Copy link
Contributor

💚 Build Succeeded

@TinaHeiligers
Copy link
Contributor Author

@TinaHeiligers we need to find a Kibana App dev to do the test you requested Bhavya to do. The test you've outlined (which is great, thanks for describing the steps so well) is going to take a fair amount of time and Bhavya and other QA are busy testing PRs that are already in 7.5.0.

The QA team will still have to test it after it's merged and in the next BC.

@timroes Should I merge?

@elasticmachine
Copy link
Contributor

💚 Build Succeeded

@elasticmachine
Copy link
Contributor

💚 Build Succeeded

@TinaHeiligers
Copy link
Contributor Author

If possible, also backport to 7.3.x, in which case we may need to change the migration number.

@TinaHeiligers
Copy link
Contributor Author

@elasticmachine merge upstream

@elasticmachine
Copy link
Contributor

💚 Build Succeeded

@TinaHeiligers TinaHeiligers merged commit c2672ae into elastic:master Oct 28, 2019
@timroes timroes added the v7.6.0 label Oct 28, 2019
timroes pushed a commit to timroes/kibana that referenced this pull request Oct 28, 2019
…stic#49000)

* Bug fix:Adds a migration for transforming TSVB visualization split_filters from strings to query:language objects to 7.5

* Changes hard coded migration version to get the version number from the saved object's migrationVersion in failing functional test

* Changes migration number from '7.5.0' to '7.4.2', fixes typo, changes test expectations to more explicit ones
timroes pushed a commit to timroes/kibana that referenced this pull request Oct 28, 2019
…stic#49000)

* Bug fix:Adds a migration for transforming TSVB visualization split_filters from strings to query:language objects to 7.5

* Changes hard coded migration version to get the version number from the saved object's migrationVersion in failing functional test

* Changes migration number from '7.5.0' to '7.4.2', fixes typo, changes test expectations to more explicit ones
timroes pushed a commit to timroes/kibana that referenced this pull request Oct 28, 2019
…stic#49000)

* Bug fix:Adds a migration for transforming TSVB visualization split_filters from strings to query:language objects to 7.5

* Changes hard coded migration version to get the version number from the saved object's migrationVersion in failing functional test

* Changes migration number from '7.5.0' to '7.4.2', fixes typo, changes test expectations to more explicit ones
TinaHeiligers pushed a commit that referenced this pull request Oct 28, 2019
) (#49496)

* Bug fix:Adds a migration for transforming TSVB visualization split_filters from strings to query:language objects to 7.5

* Changes hard coded migration version to get the version number from the saved object's migrationVersion in failing functional test

* Changes migration number from '7.5.0' to '7.4.2', fixes typo, changes test expectations to more explicit ones
TinaHeiligers pushed a commit that referenced this pull request Oct 28, 2019
) (#49492)

* Bug fix:Adds a migration for transforming TSVB visualization split_filters from strings to query:language objects to 7.5

* Changes hard coded migration version to get the version number from the saved object's migrationVersion in failing functional test

* Changes migration number from '7.5.0' to '7.4.2', fixes typo, changes test expectations to more explicit ones
TinaHeiligers pushed a commit that referenced this pull request Oct 28, 2019
) (#49493)

* Bug fix:Adds a migration for transforming TSVB visualization split_filters from strings to query:language objects to 7.5

* Changes hard coded migration version to get the version number from the saved object's migrationVersion in failing functional test

* Changes migration number from '7.5.0' to '7.4.2', fixes typo, changes test expectations to more explicit ones
@TinaHeiligers TinaHeiligers deleted the TSVB_migrate_split_filters_from_7_3 branch October 28, 2019 18:25
@LeeDr
Copy link

LeeDr commented Oct 29, 2019

I verified this fix on Cloud.

  1. Starting with 7.2.1, Installed eCommerce sample data, modified a TSVB visualization to have a Group by filters and saved it.
  2. Upgraded the Cloud instance to 7.3.2, re-opened the saved TSVB visualization and saw the problem (the filter was gone)
  3. Upgraded the Cloud instance to 7.4.2 BC1, re-opened the saved TSVB visualization and saw the problem was corrected. The filter was back and functioning.

@TinaHeiligers
Copy link
Contributor Author

@LeeDr Thank you for following up! I'm glad it works.

@rayafratkina rayafratkina added release_note:fix and removed release_note:skip Skip the PR/issue when compiling release notes labels Oct 30, 2019
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
Feature:TSVB TSVB (Time Series Visual Builder) release_note:fix Team:Visualizations Visualization editors, elastic-charts and infrastructure v7.4.2 v7.5.0 v7.6.0 v8.0.0
Projects
None yet
Development

Successfully merging this pull request may close these issues.

Kibana loses filters in TSVB after upgrade from to 7.3
5 participants