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

Detect when the snapshot repo bucket cannot be found and return a clear error message #929

Conversation

peternied
Copy link
Member

@peternied peternied commented Sep 5, 2024

Description

Fix for this error because the snapshot repo doesn't exist:

2024-09-05 21:56:33,737 INFO o.o.m.MetadataMigration [main] Starting Metadata Migration
2024-09-05 21:56:33,758 INFO o.o.m.c.Migrate [main] Command line arguments {0}
2024-09-05 21:56:33,758 INFO o.o.m.c.Migrate [main] Running Metadata worker
2024-09-05 21:56:35,523 INFO o.o.m.c.ClusterProviderRegistry [main] Found snapshot resource reader for version: Elasticsearch 7.10.2
2024-09-05 21:56:38,340 INFO o.o.m.c.ClusterProviderRegistry [main] Found remote writer for version: OpenSearch 2.9.0
2024-09-05 21:56:38,677 INFO o.o.m.c.Migrate [main] Using transformation com.rfs.transformers.Transformer_ES_7_10_OS_2_11@3a1f2a1
2024-09-05 21:56:38,730 INFO c.r.w.MetadataRunner [main] Migrating the Templates...
2024-09-05 21:56:39,514 ERROR o.o.m.c.Migrate [main] Unexpected failure
java.lang.StringIndexOutOfBoundsException: String index out of range: -5
        at java.base/java.lang.String.substring(String.java:1841) ~[?:?]
        at com.rfs.common.S3Uri.<init>(S3Uri.java:9) ~[RFS.jar:?]
        at com.rfs.common.S3Repo.findRepoFileUri(S3Repo.java:63) ~[RFS.jar:?]
        at com.rfs.common.S3Repo.getSnapshotRepoDataFilePath(S3Repo.java:119) ~[RFS.jar:?]
        at com.rfs.version_es_7_10.SnapshotRepoData_ES_7_10.fromRepo(SnapshotRepoData_ES_7_10.java:34) ~[RFS.jar:?]
        at com.rfs.version_es_7_10.SnapshotRepoProvider_ES_7_10.getRepoData(SnapshotRepoProvider_ES_7_10.java:20) ~[RFS.jar:?]
        at com.rfs.version_es_7_10.SnapshotRepoProvider_ES_7_10.getSnapshotId(SnapshotRepoProvider_ES_7_10.java:59) ~[RFS.jar:?]
        at com.rfs.models.GlobalMetadata$Factory.getJsonNode(GlobalMetadata.java:37) ~[RFS.jar:?]
        at com.rfs.models.GlobalMetadata$Factory.fromRepo(GlobalMetadata.java:67) ~[RFS.jar:?]
        at com.rfs.worker.MetadataRunner.migrateMetadata(MetadataRunner.java:23) ~[RFS.jar:?]
        at org.opensearch.migrations.commands.Migrate.execute(Migrate.java:59) [MetadataMigration.jar:?]
        at org.opensearch.migrations.MetadataMigration.main(MetadataMigration.java:37) [MetadataMigration.jar:?]

Issues Resolved

Check List

  • New functionality includes testing
    • All tests pass, including unit test, integration test and doctest
  • New functionality has been documented
  • 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.

Copy link

codecov bot commented Sep 5, 2024

Codecov Report

All modified and coverable lines are covered by tests ✅

Project coverage is 71.28%. Comparing base (d3c9d99) to head (e2129d9).
Report is 4 commits behind head on main.

Additional details and impacted files
@@             Coverage Diff              @@
##               main     #929      +/-   ##
============================================
+ Coverage     71.19%   71.28%   +0.08%     
- Complexity     1939     1942       +3     
============================================
  Files           365      365              
  Lines         14058    14060       +2     
  Branches        809      809              
============================================
+ Hits          10008    10022      +14     
+ Misses         3587     3575      -12     
  Partials        463      463              
Flag Coverage Δ
gradle-test 64.73% <100.00%> (+0.12%) ⬆️
python-test 88.55% <ø> (ø)

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.

@peternied peternied force-pushed the error-when-no-snapshot-repo-found branch from d0c660b to e2129d9 Compare September 5, 2024 22:31
Copy link
Member

@chelma chelma left a comment

Choose a reason for hiding this comment

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

LGTM, thanks!

@peternied peternied merged commit c3d2595 into opensearch-project:main Sep 6, 2024
15 checks passed
@peternied peternied deleted the error-when-no-snapshot-repo-found branch September 6, 2024 17:54
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

2 participants