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] Default data source that isn't local breaks Discover and dashboards #7129

Closed
kavilla opened this issue Jun 29, 2024 · 2 comments
Closed
Labels
bug Something isn't working multiple datasource multiple datasource project needs more info Requires more information from poster

Comments

@kavilla
Copy link
Member

kavilla commented Jun 29, 2024

Describe the bug

Discover plugin and Dashboards plugin is based on the current context. The current context has the data source being the local cluster (or the one it started up with). When Discover loads it will retrieve the index patterns from the local cluster.

These index patterns can have references to other data sources but the index patterns that were created and have no external data source ref will still be based on the local cluster.

Then switching the default data source so now the local cluster is not the default cluster. Then any index patterns, that were created with no reference, that are selected will eventually make to the deciding the client with no data source id so it will go with the default client which is NOT the local cluster that has the saved index pattern.

Any search calls that are sourced from the local cluster and did not expect that the default client can be swapped out should break and crash.

Any thing added to a dashboard that doesn't include the data source will break if the default client is not the local client.

Users are stuck because there doesn't seem to be a clear way to set the default data source to the local cluster:
Screenshot 2024-06-29 at 4 12 54 AM

So I would have to delete all my external data sources added.

The Discover plugin data source selector bases off a default Index in Advanced Settings:
Screenshot 2024-06-29 at 4 14 04 AM

This again is based on the default cluster, if the user swaps the default cluster, Discover will do it's initial call to get that value so if the default data source does not have any clue about that ID because it was autopopulated based on a different data source then Discover will crash.

We can add data source selectors every where, but the problem is shared URLs have no context about the data source ref.

If you go into Discover and click "Share", we will save it with the index pattern which will have the data source ref. But if the default cluster is not the local cluster then there is no reference to that for any EXISTING shared URLs for example:

https://playground.opensearch.org/app/data-explorer/discover#?_a=(discover:(columns:!(_source),isDirty:!f,sort:!()),metadata:(indexPattern:ff959d40-b880-11e8-a6d9-e546fe2bba5f,view:discover))&_g=(filters:!(),refreshInterval:(pause:!t,value:0),time:(from:now-15m,to:now))&_q=(filters:!(),query:(language:kuery,query:''))

Could be bookmarked by users but if some admin updated the default data source to not be the data source that index pattern was originally created then ALL the previous shared urls are broken.

Other information

I would be wary about now pushing down the data source into the search source, instead of referencing it based on the index pattern. Because that could be a lot of work and could break a lot of things.

There appears to be some race condition where I can try to create an index pattern or datasource before the default client is established which kicks me in a state where it thinks I have data but not an index pattern

@kavilla kavilla added bug Something isn't working untriaged multiple datasource multiple datasource project labels Jun 29, 2024
@seraphjiang
Copy link
Member

Local cluster is very confused concept in MDS. we suggest to hide it when enable MDS.

# hide local cluster in the data source dropdown and index pattern creation page.
data_source.hideLocalCluster: true

@joshuali925
Copy link
Member

triaging issue..

Users are stuck because there doesn't seem to be a clear way to set the default data source to the local cluster

i do see this problem

Then any index patterns, that were created with no reference, that are selected will eventually make to the deciding the client with no data source id so it will go with the default client which is NOT the local cluster that has the saved index pattern.

I don't see this problem, here is what i did

  1. add data_source.enabled: true to dashboards yml
  2. run in devtools
POST /a/_doc
{
  "cluster": "local"
}
  1. add datasource
  2. run in devtools with the datasource selected
POST /a/_doc
{
  "cluster": "remote"
}
  1. create index patterns for each
  2. search them in discover, the results are correct

i'm on commit f04708e6efb

@joshuali925 joshuali925 added needs more info Requires more information from poster and removed untriaged labels Jul 2, 2024
kavilla added a commit to kavilla/OpenSearch-Dashboards-1 that referenced this issue Jul 2, 2024
Enables the editor to let plugins to mount their own data source component
to the data source container.

Issue partially resolved:
opensearch-project#7129

Signed-off-by: Kawika Avilla <kavilla414@gmail.com>
@kavilla kavilla closed this as completed in e1c5cfd Jul 2, 2024
opensearch-trigger-bot bot pushed a commit that referenced this issue Jul 3, 2024
* [Discover-next] add datasource container

Enables the editor to let plugins to mount their own data source component
to the data source container.

Issue partially resolved:
#7129

Signed-off-by: Kawika Avilla <kavilla414@gmail.com>

* Changeset file for PR #7157 created/updated

---------

Signed-off-by: Kawika Avilla <kavilla414@gmail.com>
Co-authored-by: opensearch-changeset-bot[bot] <154024398+opensearch-changeset-bot[bot]@users.noreply.github.com>
(cherry picked from commit e1c5cfd)
Signed-off-by: github-actions[bot] <github-actions[bot]@users.noreply.github.com>
abbyhu2000 pushed a commit that referenced this issue Jul 22, 2024
* [Discover-next] add datasource container

Enables the editor to let plugins to mount their own data source component
to the data source container.

Issue partially resolved:
#7129



* Changeset file for PR #7157 created/updated

---------



(cherry picked from commit e1c5cfd)

Signed-off-by: Kawika Avilla <kavilla414@gmail.com>
Signed-off-by: github-actions[bot] <github-actions[bot]@users.noreply.github.com>
Co-authored-by: github-actions[bot] <github-actions[bot]@users.noreply.github.com>
Co-authored-by: opensearch-changeset-bot[bot] <154024398+opensearch-changeset-bot[bot]@users.noreply.github.com>
ananzh pushed a commit to ananzh/OpenSearch-Dashboards that referenced this issue Jul 24, 2024
…pensearch-project#7164)

* [Discover-next] add datasource container

Enables the editor to let plugins to mount their own data source component
to the data source container.

Issue partially resolved:
opensearch-project#7129

* Changeset file for PR opensearch-project#7157 created/updated

---------

(cherry picked from commit e1c5cfd)

Signed-off-by: Kawika Avilla <kavilla414@gmail.com>
Signed-off-by: github-actions[bot] <github-actions[bot]@users.noreply.github.com>
Co-authored-by: github-actions[bot] <github-actions[bot]@users.noreply.github.com>
Co-authored-by: opensearch-changeset-bot[bot] <154024398+opensearch-changeset-bot[bot]@users.noreply.github.com>
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
bug Something isn't working multiple datasource multiple datasource project needs more info Requires more information from poster
Projects
None yet
Development

No branches or pull requests

3 participants