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

[Lens] Datasource dimensions are not cleared properly #160116

Closed
mbondyra opened this issue Jun 21, 2023 · 2 comments · Fixed by #160260
Closed

[Lens] Datasource dimensions are not cleared properly #160116

mbondyra opened this issue Jun 21, 2023 · 2 comments · Fixed by #160260
Assignees
Labels
bug Fixes for quality problems that affect the customer experience Feature:Lens impact:medium Addressing this issue will have a medium level of impact on the quality/strength of our product. Team:Visualizations Visualization editors, elastic-charts and infrastructure

Comments

@mbondyra
Copy link
Contributor

mbondyra commented Jun 21, 2023

Kibana version:
main, only 8.9 caused by [2c491b5] [CM] - lens (#155700)

When updated, the Lens object is being deep-merged so all the properties ever set stay in the saved object even if they were removed. What is odd is that the save call gets the proper response from the backend and Lens app works on correct saved object (removed properties are cleared) but after refreshing we can see that saved object from the DB keeps everything unless it was overwritten.

Here's the flow to reproduce for datasource columns:

  1. Create a visualization with some dimensions and save
Screenshot 2023-06-21 at 13 16 03
  1. Remove two bucket dimensions and save

  2. Go to /app/management/kibana/objects and inspect your saved object.
    The dimensions are still there:

Screenshot 2023-06-21 at 13 18 18

I've put impact medium, but it's imo potentially high as it can create incorrect saved objects that will be difficult to clean up and cause errors we cannot predict. @stratoula feel free to change.

The side effects include for example:

  1. if remove the runtime field and then fix the visualization by removing the dimension using the field, we will get error message impossible to get rid of.
  2. If we remove the dimension that shows an error coming from datasource, we will never be able to fix visualization.
@mbondyra mbondyra added bug Fixes for quality problems that affect the customer experience Team:Visualizations Visualization editors, elastic-charts and infrastructure Feature:Lens labels Jun 21, 2023
@elasticmachine
Copy link
Contributor

Pinging @elastic/kibana-visualizations @elastic/kibana-visualizations-external (Team:Visualizations)

@mbondyra mbondyra self-assigned this Jun 21, 2023
@mbondyra mbondyra added the impact:medium Addressing this issue will have a medium level of impact on the quality/strength of our product. label Jun 21, 2023
@Dosant
Copy link
Contributor

Dosant commented Jun 22, 2023

I think the problem is in this update:

const partialSavedObject = await soClient.update<LensSavedObjectAttributes>(

It adds new properties and doesn't remove the old ones. I think the properties must be explicitly set to null to remove them.

The old code worked because it used create with overwrite:true:

const result = await this.client.create(
DOC_TYPE,
attributes,
savedObjectId
? {
references,
overwrite: true,
id: savedObjectId,
}

Interesting that, for example, dashboard so won't have the same problem because panels are stored as a json string.

jrodewig pushed a commit that referenced this issue Sep 14, 2023
kibanamachine pushed a commit to kibanamachine/kibana that referenced this issue Sep 14, 2023
…166371)

Adds elastic#160116 known issue to 8.9 release notes.

(cherry picked from commit 7010742)
kibanamachine pushed a commit to kibanamachine/kibana that referenced this issue Sep 14, 2023
…166371)

Adds elastic#160116 known issue to 8.9 release notes.

(cherry picked from commit 7010742)
kibanamachine added a commit that referenced this issue Sep 14, 2023
…#166452)

# Backport

This will backport the following commits from `main` to `8.10`:
- [[DOCS] Adds #160116 known issue to 8.9 release notes
(#166371)](#166371)

<!--- Backport version: 8.9.7 -->

### Questions ?
Please refer to the [Backport tool
documentation](https://github.com/sqren/backport)

<!--BACKPORT [{"author":{"name":"Kaarina
Tungseth","email":"[email protected]"},"sourceCommit":{"committedDate":"2023-09-14T12:42:05Z","message":"[DOCS]
Adds #160116 known issue to 8.9 release notes (#166371)\n\nAdds #160116
known issue to 8.9 release
notes.","sha":"7010742461a3e974f918d10bc181c4737aa08edd","branchLabelMapping":{"^v8.11.0$":"main","^v(\\d+).(\\d+).\\d+$":"$1.$2"}},"sourcePullRequest":{"labels":["Team:Docs","release_note:skip","v8.9.0","v8.11.0","v8.10.1"],"number":166371,"url":"https://github.com/elastic/kibana/pull/166371","mergeCommit":{"message":"[DOCS]
Adds #160116 known issue to 8.9 release notes (#166371)\n\nAdds #160116
known issue to 8.9 release
notes.","sha":"7010742461a3e974f918d10bc181c4737aa08edd"}},"sourceBranch":"main","suggestedTargetBranches":["8.9","8.10"],"targetPullRequestStates":[{"branch":"8.9","label":"v8.9.0","labelRegex":"^v(\\d+).(\\d+).\\d+$","isSourceBranch":false,"state":"NOT_CREATED"},{"branch":"main","label":"v8.11.0","labelRegex":"^v8.11.0$","isSourceBranch":true,"state":"MERGED","url":"https://github.com/elastic/kibana/pull/166371","number":166371,"mergeCommit":{"message":"[DOCS]
Adds #160116 known issue to 8.9 release notes (#166371)\n\nAdds #160116
known issue to 8.9 release
notes.","sha":"7010742461a3e974f918d10bc181c4737aa08edd"}},{"branch":"8.10","label":"v8.10.1","labelRegex":"^v(\\d+).(\\d+).\\d+$","isSourceBranch":false,"state":"NOT_CREATED"}]}]
BACKPORT-->

Co-authored-by: Kaarina Tungseth <[email protected]>
kibanamachine added a commit that referenced this issue Sep 14, 2023
…166453)

# Backport

This will backport the following commits from `main` to `8.9`:
- [[DOCS] Adds #160116 known issue to 8.9 release notes
(#166371)](#166371)

<!--- Backport version: 8.9.7 -->

### Questions ?
Please refer to the [Backport tool
documentation](https://github.com/sqren/backport)

<!--BACKPORT [{"author":{"name":"Kaarina
Tungseth","email":"[email protected]"},"sourceCommit":{"committedDate":"2023-09-14T12:42:05Z","message":"[DOCS]
Adds #160116 known issue to 8.9 release notes (#166371)\n\nAdds #160116
known issue to 8.9 release
notes.","sha":"7010742461a3e974f918d10bc181c4737aa08edd","branchLabelMapping":{"^v8.11.0$":"main","^v(\\d+).(\\d+).\\d+$":"$1.$2"}},"sourcePullRequest":{"labels":["Team:Docs","release_note:skip","v8.9.0","v8.11.0","v8.10.1"],"number":166371,"url":"https://github.com/elastic/kibana/pull/166371","mergeCommit":{"message":"[DOCS]
Adds #160116 known issue to 8.9 release notes (#166371)\n\nAdds #160116
known issue to 8.9 release
notes.","sha":"7010742461a3e974f918d10bc181c4737aa08edd"}},"sourceBranch":"main","suggestedTargetBranches":["8.9","8.10"],"targetPullRequestStates":[{"branch":"8.9","label":"v8.9.0","labelRegex":"^v(\\d+).(\\d+).\\d+$","isSourceBranch":false,"state":"NOT_CREATED"},{"branch":"main","label":"v8.11.0","labelRegex":"^v8.11.0$","isSourceBranch":true,"state":"MERGED","url":"https://github.com/elastic/kibana/pull/166371","number":166371,"mergeCommit":{"message":"[DOCS]
Adds #160116 known issue to 8.9 release notes (#166371)\n\nAdds #160116
known issue to 8.9 release
notes.","sha":"7010742461a3e974f918d10bc181c4737aa08edd"}},{"branch":"8.10","label":"v8.10.1","labelRegex":"^v(\\d+).(\\d+).\\d+$","isSourceBranch":false,"state":"NOT_CREATED"}]}]
BACKPORT-->

Co-authored-by: Kaarina Tungseth <[email protected]>
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
bug Fixes for quality problems that affect the customer experience Feature:Lens impact:medium Addressing this issue will have a medium level of impact on the quality/strength of our product. Team:Visualizations Visualization editors, elastic-charts and infrastructure
Projects
None yet
Development

Successfully merging a pull request may close this issue.

3 participants