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

[Discover] Attempt to fix onDataViewEdited flakiness by resetting dataStateContainer #199982

Closed
wants to merge 9 commits into from

Conversation

kertal
Copy link
Member

@kertal kertal commented Nov 13, 2024

Summary

fixes #184600

Checklist

Delete any items that are not applicable to this PR.

Risk Matrix

Delete this section if it is not applicable to this PR.

Before closing this PR, invite QA, stakeholders, and other developers to identify risks that should be tested prior to the change/feature release.

When forming the risk matrix, consider some of the following examples and how they may potentially impact the change:

Risk Probability Severity Mitigation/Notes
Multiple Spaces—unexpected behavior in non-default Kibana Space. Low High Integration tests will verify that all features are still supported in non-default Kibana Space and when user switches between spaces.
Multiple nodes—Elasticsearch polling might have race conditions when multiple Kibana nodes are polling for the same tasks. High Low Tasks are idempotent, so executing them multiple times will not result in logical error, but will degrade performance. To test for this case we add plenty of unit tests around this logic and document manual testing procedure.
Code should gracefully handle cases when feature X or plugin Y are disabled. Medium High Unit tests will verify that any feature flag or plugin combination still results in our service operational.
See more potential risk examples

For maintainers

@elasticmachine
Copy link
Contributor

elasticmachine commented Nov 13, 2024

🤖 Jobs for this PR can be triggered through checkboxes. 🚧

ℹ️ To trigger the CI, please tick the checkbox below 👇

  • Click to trigger kibana-pull-request for this PR!
  • Click to trigger kibana-deploy-project-from-pr for this PR!

@kertal
Copy link
Member Author

kertal commented Nov 13, 2024

/ci

@kibanamachine
Copy link
Contributor

Flaky Test Runner Stats

🎉 All tests passed! - kibana-flaky-test-suite-runner#7391

[✅] test/functional/apps/discover/group3/config.ts: 25/25 tests passed.

see run history

@kibanamachine
Copy link
Contributor

Flaky Test Runner Stats

🎉 All tests passed! - kibana-flaky-test-suite-runner#7395

[✅] test/functional/apps/discover/group3/config.ts: 100/100 tests passed.

see run history

@kertal
Copy link
Member Author

kertal commented Nov 13, 2024

/ci

@kertal
Copy link
Member Author

kertal commented Nov 15, 2024

/ci

Comment on lines 1555 to 1559
const prevInternalDataViews = this.internalDataViews;

this.internalDataViews = uniqBy(indexPatterns, 'id');
// making sure to not run into the race condition that the data source has the previous data view id
// causing to throw an exception that's not necessary
this.internalDataViews = uniqBy([...indexPatterns, ...prevInternalDataViews], 'id');
Copy link
Member Author

Choose a reason for hiding this comment

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

I don't know if we can commit it this way, but it appears to resolve the race condition in the manual testing, that never happened in CI (in combination with the other small adaptation of this PR, because just this adaptation doesn't resolve it completely ).

Manual testing (copyright @jughosta)

Steps to reproduce the error:

  • Install all sample data.
  • On Discover page, create an ad hoc data view kib* with @timetamp as the time field. Edit data view and set timestamp as the time field. Edit again and remove the time field. Edit again and set timestamp as the time field.

Copy link
Contributor

Choose a reason for hiding this comment

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

Still fails for me. I think it can't find the data view by its new ID, not the previous one.

Screenshot 2024-11-18 at 10 26 23

Copy link
Member Author

Choose a reason for hiding this comment

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

I think both cases apply, previous id can't be found, and new id can't be found 😿

Copy link
Contributor

Choose a reason for hiding this comment

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

I observed that in

const missingIds = currentDatasource.checkIntegrity(currentDatasourceState.state, indexPatterns);
it had previous values instead of the new one.

Copy link
Member Author

Choose a reason for hiding this comment

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

seems the list of data view is not always provided to this checking function, leading to this error

CleanShot 2024-11-18 at 19 44 15

🤯

Copy link
Member Author

Choose a reason for hiding this comment

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

@jughosta I don't dare to say: I think I've found a hack to solve it, until you confirm by testing (when having time).

Here's another take on it:
#200687

Copy link
Contributor

Choose a reason for hiding this comment

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

That's a great finding! I will take a look, thanks!

@kertal kertal self-assigned this Nov 18, 2024
@kertal
Copy link
Member Author

kertal commented Nov 19, 2024

/ci

@elasticmachine
Copy link
Contributor

elasticmachine commented Nov 19, 2024

💔 Build Failed

Failed CI Steps

History

cc @kertal

@kertal
Copy link
Member Author

kertal commented Nov 20, 2024

Closing in favor of #200687

@kertal kertal closed this Nov 20, 2024
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
4 participants