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

[Dynamic Config] Fix bug when attempting dynamic config index creation #8184

Merged
merged 2 commits into from
Sep 13, 2024

Conversation

huyaboo
Copy link
Member

@huyaboo huyaboo commented Sep 13, 2024

Description

This PR fixes a bug that can occur if the alias .opensearch_dashboards_dynamic_config exists but not the index opensearch_dashboards_dynamic_config_N. In particular the following test cases are as follows:

Alias present? Alias points to what index(es)? Expected behavior
No No index Create new index with alias
No .opensearch_dashboards_dynamic_config_N Update index with alias
No .opensearch_dashboards_dynamic_config_1 Update index with alias
Yes Multiple indexes Throw error
Yes A non .opensearch_dashboards_dynamic_config_* index Throw error
Yes A valid .opensearch_dashboards_dynamic_config_* index Do nothing

Issues Resolved

Testing the changes

Attached are the following cases when calling dev tools or by looking in application logs:

  • No alias, no .opensearch_dashboards_dynamic_config_1 index
GET _cat/indices

yellow open .opensearch_dashboards_dynamic_config_1 sXe3MP8hS7ibdy0KMQwIIQ 1 1 0 0  208b  208b
green  open .kibana_1                               SAzyiuKvSCKNn4zrIVUY9Q 1 0 1 0 5.1kb 5.1kb

GET _cat/aliases
.opensearch_dashboards_dynamic_config .opensearch_dashboards_dynamic_config_1 - - - -
.kibana                               .kibana_1                               - - - -
  • No alias, .opensearch_dashboards_dynamic_config_N present (used below curl command)
curl -X PUT "http://localhost:9200/.opensearch_dashboards_dynamic_config_4"
GET _cat/indices

yellow open .opensearch_dashboards_dynamic_config_4 OcHhtiswT7Op03sr260hxg 1 1 0 0  208b  208b
green  open .kibana_1                               VZGJVZFURPiE3Xx3AyTgsg 1 0 1 0 5.1kb 5.1kb

GET _cat/aliases
.opensearch_dashboards_dynamic_config .opensearch_dashboards_dynamic_config_4 - - - -
.kibana                               .kibana_1                               - - - -
  • No alias, .opensearch_dashboards_dynamic_config_1 present (used below curl command)
curl -X PUT "http://localhost:9200/.opensearch_dashboards_dynamic_config_1"
GET _cat/indices

yellow open ..opensearch_dashboards_dynamic_config i5GcQi6OTEGwvGxI4kKnow 1 1 0 0  208b  208b
green  open .kibana_1                               ytbTll4tQ6mWGGMtiiuEXQ 1 0 1 0 5.1kb 5.1kb

GET _cat/aliases
.opensearch_dashboards_dynamic_config .opensearch_dashboards_dynamic_config_1 - - - -
.kibana                               .kibana_1                               - - - -
  • Alias, multiple indices pointed to alias
 FATAL  Error: Alias .opensearch_dashboards_dynamic_config is pointing to 0 or multiple indices. Please remove the alias(es) and restart the server
  • Alias, .random_index_3 pointed to alias (used below curl command)
curl -X PUT "http://localhost:9200/.random_index_3" -H 'Content-Type: application/json' -d '
{
  "aliases": {
    ".opensearch_dashboards_dynamic_config": {}
  }
}
'
 FATAL  Error: Alias .opensearch_dashboards_dynamic_config is pointing to a non dynamic config index. Please remove the alias and restart the server
  • Alias, valid .opensearch_dashboards_dynamic_config_1 pointed to alias
GET _cat/indices

yellow open .opensearch_dashboards_dynamic_config_1 i5GcQi6OTEGwvGxI4kKnow 1 1 0 0  208b  208b
green  open .kibana_1                               ytbTll4tQ6mWGGMtiiuEXQ 1 0 1 0 5.1kb 5.1kb

GET _cat/aliases
.opensearch_dashboards_dynamic_config .opensearch_dashboards_dynamic_config_1 - - - -
.kibana                               .kibana_1                               - - - -

Changelog

  • fix: Fix bug when dynamic config index and alias are checked

Check List

  • All tests pass
    • yarn test:jest
    • yarn test:jest_integration
  • New functionality includes testing.
  • New functionality has been documented.
  • Update CHANGELOG.md
  • Commits are signed per the DCO using --signoff

Copy link
Contributor

❌ Empty Changelog Section

The Changelog section in your PR description is empty. Please add a valid changelog entry or entries. If you did add a changelog entry, check to make sure that it was not accidentally included inside the comment block in the Changelog section.

opensearch-changeset-bot bot added a commit to huyaboo/OpenSearch-Dashboards that referenced this pull request Sep 13, 2024
huyaboo and others added 2 commits September 12, 2024 19:28
Copy link

codecov bot commented Sep 13, 2024

Codecov Report

Attention: Patch coverage is 96.66667% with 1 line in your changes missing coverage. Please review.

Project coverage is 64.04%. Comparing base (18875f7) to head (f8964ad).
Report is 1 commits behind head on main.

Files with missing lines Patch % Lines
...fig_store_client/opensearch_config_store_client.ts 95.45% 1 Missing ⚠️
Additional details and impacted files
@@            Coverage Diff             @@
##             main    #8184      +/-   ##
==========================================
- Coverage   64.04%   64.04%   -0.01%     
==========================================
  Files        3740     3740              
  Lines       88582    88608      +26     
  Branches    13791    13799       +8     
==========================================
+ Hits        56731    56745      +14     
- Misses      31253    31265      +12     
  Partials      598      598              
Flag Coverage Δ
Linux_1 30.03% <6.66%> (-0.01%) ⬇️
Linux_2 58.83% <96.66%> (+0.03%) ⬆️
Linux_3 40.37% <6.66%> (-0.02%) ⬇️
Linux_4 31.46% <6.66%> (-0.02%) ⬇️
Windows_1 30.05% <6.66%> (-0.03%) ⬇️
Windows_2 58.78% <96.66%> (+0.03%) ⬆️
Windows_3 40.37% <6.66%> (-0.02%) ⬇️
Windows_4 31.46% <6.66%> (-0.02%) ⬇️

Flags with carried forward coverage won't be shown. Click here to find out more.

☔ View full report in Codecov by Sentry.
📢 Have feedback on the report? Share it here.

@huyaboo huyaboo merged commit 678c644 into opensearch-project:main Sep 13, 2024
75 checks passed
@huyaboo huyaboo deleted the fix-dynamic-migration branch September 13, 2024 17:36
opensearch-trigger-bot bot pushed a commit that referenced this pull request Sep 13, 2024
#8184)

* Fix bug when attempting dynamic config index creation

Signed-off-by: Huy Nguyen <73027756+huyaboo@users.noreply.github.com>

* Changeset file for PR #8184 created/updated

---------

Signed-off-by: Huy Nguyen <73027756+huyaboo@users.noreply.github.com>
Co-authored-by: opensearch-changeset-bot[bot] <154024398+opensearch-changeset-bot[bot]@users.noreply.github.com>
(cherry picked from commit 678c644)
Signed-off-by: github-actions[bot] <github-actions[bot]@users.noreply.github.com>
opensearch-trigger-bot bot pushed a commit that referenced this pull request Sep 13, 2024
#8184)

* Fix bug when attempting dynamic config index creation

Signed-off-by: Huy Nguyen <73027756+huyaboo@users.noreply.github.com>

* Changeset file for PR #8184 created/updated

---------

Signed-off-by: Huy Nguyen <73027756+huyaboo@users.noreply.github.com>
Co-authored-by: opensearch-changeset-bot[bot] <154024398+opensearch-changeset-bot[bot]@users.noreply.github.com>
(cherry picked from commit 678c644)
Signed-off-by: github-actions[bot] <github-actions[bot]@users.noreply.github.com>
BionIT pushed a commit that referenced this pull request Sep 13, 2024
#8184) (#8192)

* Fix bug when attempting dynamic config index creation



* Changeset file for PR #8184 created/updated

---------



(cherry picked from commit 678c644)

Signed-off-by: Huy Nguyen <73027756+huyaboo@users.noreply.github.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>
BionIT pushed a commit that referenced this pull request Sep 13, 2024
#8184) (#8193)

* Fix bug when attempting dynamic config index creation



* Changeset file for PR #8184 created/updated

---------



(cherry picked from commit 678c644)

Signed-off-by: Huy Nguyen <73027756+huyaboo@users.noreply.github.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
Projects
None yet
Development

Successfully merging this pull request may close these issues.

3 participants