Skip to content

CMR-11136: Update reshard errors to return more helpful messages - #2466

Merged
jmaeng72 merged 8 commits into
masterfrom
CMR-11136
Jul 24, 2026
Merged

CMR-11136: Update reshard errors to return more helpful messages#2466
jmaeng72 merged 8 commits into
masterfrom
CMR-11136

Conversation

@jmaeng72

@jmaeng72 jmaeng72 commented Jul 17, 2026

Copy link
Copy Markdown
Contributor

Overview

What is the objective?

When trying to reshard indexes and a failed or non finalized resharded index from another CMR session exists, the start end point fails with a 500 Error.

What should happen is a more descriptive error is returned so that users know what the actual issue is. A different http status code and message.

What are the changes?

Updated 'already exist' or 'already resharding' or 'already rebalancing' errors to return 400 instead of 500 with better messaging

What areas of the application does this impact?

Indexer

Required Checklist

  • New and existing unit and int tests pass locally and remotely
  • clj-kondo has been run locally and all errors in changed files are corrected
  • I have commented my code, particularly in hard-to-understand areas
  • I have made changes to the documentation (if necessary)
  • My changes generate no new warnings

Additional Checklist

  • I have removed unnecessary/dead code and imports in files I have changed
  • I have cleaned up integration tests by doing one or more of the following:
    • migrated any are2 tests to are3 in files I have changed
    • de-duped, consolidated, removed dead int tests
    • transformed applicable int tests into unit tests
    • reduced number of system state resets by updating fixtures. Ex) (use-fixtures :each (ingest/reset-fixture {})) to be :once instead of :each

@daniel-zamora

Copy link
Copy Markdown
Contributor

update commit message name

Comment thread indexer-app/src/cmr/indexer/services/index_set_service.clj Outdated
Comment thread indexer-app/src/cmr/indexer/services/index_set_service.clj Outdated
Comment thread indexer-app/src/cmr/indexer/services/index_set_service.clj Outdated
Comment thread indexer-app/src/cmr/indexer/services/index_set_service.clj Outdated
validate-index-not-being-resharded (when-not (nil? reshard-status)
(errors/throw-service-error
:bad-request
(format "Index [%s] is in a current resharding state of [%s]. You cannot reshard an index that is currently being resharded." index reshard-status)))

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

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

kind of a weird wording for the error message and could be more helpful, maybe something like
IN_PROGRESS: "currently being resharded, wait for it to finish or rollback"
COMPLETE: "resharding has completed but not been finalized, finalize or rollback first"
FAILED: "a previous reshard failed, rollback before retrying"
for each state

Copy link
Copy Markdown
Contributor Author

Choose a reason for hiding this comment

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

I don't think we need this specific level of logging. If the dev knows the current resharding state, they should know what to do next

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

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

its pretty confusing, especially for COMPLETE, it seems like "currently being resharded" would indicate an in progress action to wait for and not necessarily something that you would take an action to resolve, similar for FAILED.

and "is in a current sharding state" is kinda clunky, "has a resharding state of" or "Index [%s] already has a reshard in state [%s]. Finalize or roll back the existing reshard before starting a new one."

Copy link
Copy Markdown
Contributor Author

Choose a reason for hiding this comment

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

I can change the wording to be something like this: "Index [%s] has a resharding state of [%s]. You cannot start a new reshard on an index that is in a existing reshard state."

Comment thread indexer-app/src/cmr/indexer/services/index_set_service.clj Outdated
@codecov-commenter

codecov-commenter commented Jul 22, 2026

Copy link
Copy Markdown

Codecov Report

❌ Patch coverage is 8.69565% with 21 lines in your changes missing coverage. Please review.
✅ Project coverage is 57.92%. Comparing base (ca9c018) to head (1e3e7f7).
⚠️ Report is 1 commits behind head on master.

Files with missing lines Patch % Lines
...app/src/cmr/indexer/services/index_set_service.clj 9.09% 20 Missing ⚠️
indexer-app/src/cmr/indexer/api/routes.clj 0.00% 1 Missing ⚠️
Additional details and impacted files
@@            Coverage Diff             @@
##           master    #2466      +/-   ##
==========================================
- Coverage   57.93%   57.92%   -0.01%     
==========================================
  Files        1073     1073              
  Lines       74651    74656       +5     
  Branches     2172     2169       -3     
==========================================
+ Hits        43246    43248       +2     
- Misses      29375    29380       +5     
+ Partials     2030     2028       -2     

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

🚀 New features to boost your workflow:
  • ❄️ Test Analytics: Detect flaky tests, report on failures, and find test suite problems.
  • 📦 JS Bundle Analysis: Save yourself from yourself by tracking and limiting bundle sizes in JS merges.

@jmaeng72
jmaeng72 merged commit 1db234b into master Jul 24, 2026
6 checks passed
daniel-zamora pushed a commit that referenced this pull request Aug 11, 2026
* add error logic and sys tests

* change get-reshard-status func and some minor cosmetic changes

* use is-resharding

* update err msg and tests

* make test wait for index before checking results to fix inconsistent test fails
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.

4 participants