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

create findingIndex bugfix #653

Merged
merged 3 commits into from
Nov 7, 2022

Conversation

petardz
Copy link
Contributor

@petardz petardz commented Nov 7, 2022

Signed-off-by: Petar Dzepina [email protected]

Issue #, if available:

Description of changes:
Fixed bug where findingIndex would be recreated in some situations because of faulty "exists" check

CheckList:
[ ] Commits are signed per the DCO using --signoff

By submitting this pull request, I confirm that my contribution is made under the terms of the Apache 2.0 license.
For more information on following Developer Certificate of Origin and signing off your commits, please check here.

Signed-off-by: Petar Dzepina <[email protected]>
@petardz petardz requested a review from a team November 7, 2022 00:13
Signed-off-by: Petar Dzepina <[email protected]>
Signed-off-by: Petar Dzepina <[email protected]>
@codecov-commenter
Copy link

codecov-commenter commented Nov 7, 2022

Codecov Report

Merging #653 (3712b72) into main (c6c12db) will decrease coverage by 0.24%.
The diff coverage is 100.00%.

@@             Coverage Diff              @@
##               main     #653      +/-   ##
============================================
- Coverage     76.37%   76.13%   -0.25%     
  Complexity      116      116              
============================================
  Files           124      124              
  Lines          6443     6569     +126     
  Branches        942      972      +30     
============================================
+ Hits           4921     5001      +80     
- Misses         1040     1072      +32     
- Partials        482      496      +14     
Impacted Files Coverage Δ
...lin/org/opensearch/alerting/alerts/AlertIndices.kt 74.16% <100.00%> (+3.75%) ⬆️
.../alerting/transport/TransportIndexMonitorAction.kt 61.93% <0.00%> (-8.42%) ⬇️
...destinationmigration/DestinationConversionUtils.kt 71.11% <0.00%> (-1.12%) ⬇️
...nationmigration/DestinationMigrationUtilService.kt 81.45% <0.00%> (-0.81%) ⬇️
...ain/kotlin/org/opensearch/alerting/AlertService.kt 79.06% <0.00%> (+0.09%) ⬆️
...rch/alerting/resthandler/RestIndexMonitorAction.kt 81.03% <0.00%> (+0.33%) ⬆️
...rg/opensearch/alerting/BucketLevelMonitorRunner.kt 79.62% <0.00%> (+2.18%) ⬆️
...alerting/transport/TransportSearchMonitorAction.kt 75.00% <0.00%> (+2.50%) ⬆️

Help us with your feedback. Take ten seconds to tell us how you rate us. Have a feature suggestion? Share it here.

Comment on lines 328 to +329
val findingsIndexPattern = dataSources.findingsIndexPattern ?: FINDING_HISTORY_INDEX_PATTERN
if (!clusterService.state().metadata().hasAlias(findingsIndexPattern)) {
if (!clusterService.state().metadata().hasAlias(findingsIndex)) {
Copy link
Member

Choose a reason for hiding this comment

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

Why do we need to set the findingsIndexPattern here?

Copy link
Contributor Author

@petardz petardz Nov 7, 2022

Choose a reason for hiding this comment

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

We're using findingsIndexPattern as index name in createIndex method right below. Index is created with pattern as name and is attached to alias during creation(findingIndex)

@eirsep eirsep merged commit 1018fa2 into opensearch-project:main Nov 7, 2022
@opensearch-trigger-bot
Copy link
Contributor

The backport to 2.x failed:

The process '/usr/bin/git' failed with exit code 1

To backport manually, run these commands in your terminal:

# Fetch latest updates from GitHub
git fetch
# Create a new working tree
git worktree add .worktrees/backport-2.x 2.x
# Navigate to the new working tree
cd .worktrees/backport-2.x
# Create a new branch
git switch --create backport/backport-653-to-2.x
# Cherry-pick the merged commit of this pull request and resolve the conflicts
git cherry-pick -x --mainline 1 1018fa2332ac7ad66266e19b18039bc7fdb17f80
# Push it to GitHub
git push --set-upstream origin backport/backport-653-to-2.x
# Go back to the original working tree
cd ../..
# Delete the working tree
git worktree remove .worktrees/backport-2.x

Then, create a pull request where the base branch is 2.x and the compare/head branch is backport/backport-653-to-2.x.

@opensearch-trigger-bot
Copy link
Contributor

The backport to 2.4 failed:

The process '/usr/bin/git' failed with exit code 1

To backport manually, run these commands in your terminal:

# Fetch latest updates from GitHub
git fetch
# Create a new working tree
git worktree add .worktrees/backport-2.4 2.4
# Navigate to the new working tree
cd .worktrees/backport-2.4
# Create a new branch
git switch --create backport/backport-653-to-2.4
# Cherry-pick the merged commit of this pull request and resolve the conflicts
git cherry-pick -x --mainline 1 1018fa2332ac7ad66266e19b18039bc7fdb17f80
# Push it to GitHub
git push --set-upstream origin backport/backport-653-to-2.4
# Go back to the original working tree
cd ../..
# Delete the working tree
git worktree remove .worktrees/backport-2.4

Then, create a pull request where the base branch is 2.4 and the compare/head branch is backport/backport-653-to-2.4.

petardz added a commit to petardz/alerting that referenced this pull request Nov 8, 2022
* findingIndex create bugfix

Signed-off-by: Petar Dzepina <[email protected]>

* empty commit

Signed-off-by: Petar Dzepina <[email protected]>

* IT fix

Signed-off-by: Petar Dzepina <[email protected]>

Signed-off-by: Petar Dzepina <[email protected]>
(cherry picked from commit 1018fa2)
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.

4 participants