opensearch-project / OpenSearch

🔎 Open source distributed and RESTful search engine.
https://opensearch.org/docs/latest/opensearch/index/
Apache License 2.0
9.84k stars 1.83k forks source link

Fix stale index deletion in snapshots for hashed prefix path type #16617

Closed ashking94 closed 1 week ago

ashking94 commented 1 week ago

Description

If the index name has . period in it, then the stale index deletion fails as the period character interferes with the delimiter (which is also period character) by giving more parts than expected during the String.split(".") operation while interpreting the snapshot shards path file. The fix is to handle the variables after the index name as relative from last than from 0. This fixes the problem.

Check List

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.

github-actions[bot] commented 1 week ago

:x: Gradle check result for 8d819de1f126015739367c6fb5161e9b33dd7163: FAILURE

Please examine the workflow log, locate, and copy-paste the failure(s) below, then iterate to green. Is the failure a flaky test unrelated to your change?

github-actions[bot] commented 1 week ago

:x: Gradle check result for c17268348702f23d6a60ab077246c84b86c3e262: FAILURE

Please examine the workflow log, locate, and copy-paste the failure(s) below, then iterate to green. Is the failure a flaky test unrelated to your change?

github-actions[bot] commented 1 week ago

:white_check_mark: Gradle check result for fb503986f37119a12437cff841a47d98ab504c71: SUCCESS

codecov[bot] commented 1 week ago

Codecov Report

Attention: Patch coverage is 88.23529% with 4 lines in your changes missing coverage. Please review.

Project coverage is 72.07%. Comparing base (10873f1) to head (fb50398). Report is 12 commits behind head on main.

Files with missing lines Patch % Lines
...ch/repositories/blobstore/BlobStoreRepository.java 88.88% 1 Missing and 2 partials :warning:
...a/org/opensearch/snapshots/SnapshotShardPaths.java 85.71% 0 Missing and 1 partial :warning:
Additional details and impacted files ```diff @@ Coverage Diff @@ ## main #16617 +/- ## ============================================ - Coverage 72.15% 72.07% -0.09% + Complexity 65145 65043 -102 ============================================ Files 5315 5315 Lines 303573 303590 +17 Branches 43925 43928 +3 ============================================ - Hits 219039 218802 -237 - Misses 66587 66863 +276 + Partials 17947 17925 -22 ```

:umbrella: View full report in Codecov by Sentry.
:loudspeaker: Have feedback on the report? Share it here.