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

Correct error message when field are not passed when starting replication #1292

Merged
merged 2 commits into from
Dec 7, 2023

Conversation

monusingh-1
Copy link
Collaborator

Description

When replication is started an an important param is missed the Exception is directly returned to the user like

{"_index":"fruit-1","_id":"1","_version":5,"result":"updated","_shards":{"total":2,"successful":1,"failed":0},"_seq_no":4,"_primary_term":1}{
  "error" : {
    "root_cause" : [
      {
        "type" : "uninitialized_property_access_exception",
        "reason" : "lateinit property leaderIndex has not been initialized"
      }
    ],
    "type" : "uninitialized_property_access_exception",
    "reason" : "lateinit property leaderIndex has not been initialized"
  },
  "status" : 500
}

The fix will list down the params that are missing and return useful message to the user.

{"_index":"fruit-1","_id":"1","_version":1,"result":"created","_shards":{"total":2,"successful":1,"failed":0},"_seq_no":0,"_primary_term":1}{
  "error" : {
    "root_cause" : [
      {
        "type" : "action_request_validation_exception",
        "reason" : "Validation Failed: 1: Mandatory params [leader_index, follower_index] are missing for the request;"
      }
    ],
    "type" : "action_request_validation_exception",
    "reason" : "Validation Failed: 1: Mandatory params [leader_index, leader_alias] are missing for the request;"
  },
  "status" : 400
}

Issues Resolved

(#320)

Check List

  • New functionality includes testing.
    • All tests pass
  • New functionality has been documented.
    • New functionality has javadoc added
  • 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 Dec 7, 2023

Codecov Report

Attention: 9 lines in your changes are missing coverage. Please review.

Comparison is base (12ebd7e) 74.81% compared to head (ce10782) 46.05%.
Report is 2 commits behind head on main.

Files Patch % Lines
.../replication/action/index/ReplicateIndexRequest.kt 10.00% 5 Missing and 4 partials ⚠️
Additional details and impacted files
@@              Coverage Diff              @@
##               main    #1292       +/-   ##
=============================================
- Coverage     74.81%   46.05%   -28.76%     
+ Complexity     1030      626      -404     
=============================================
  Files           141      141               
  Lines          4776     4783        +7     
  Branches        525      526        +1     
=============================================
- Hits           3573     2203     -1370     
- Misses          862     2308     +1446     
+ Partials        341      272       -69     

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

@monusingh-1 monusingh-1 merged commit be24bfa into opensearch-project:main Dec 7, 2023
12 of 16 checks passed
opensearch-trigger-bot bot pushed a commit that referenced this pull request Dec 7, 2023
@monusingh-1 monusingh-1 deleted the missing_param branch December 7, 2023 13:57
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