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

Return possible states a heal operation #4045

Merged
merged 1 commit into from
Apr 14, 2017

Conversation

krisis
Copy link
Member

@krisis krisis commented Apr 4, 2017

Description

Background

Healing algorithm returns failure only if an attempt to heal any of the disks failed. It returns success even if all disks needing heal were offline.
In its current form, heal admin REST APIs returns the above boolean state making it impossible for clients like mc to distinguish between an object being healed completely, partially and not.

Solution

The fix (so far) is to return struct { HealedCount int, OfflineCount int} in addition to error for a heal-object and heal-upload operation. mc can make use of this to guide users better.

Future-proof solution

This brings us to whether it is right by design to provide internal details of the healing process in admin API. We return an enumerated constant in heal-object and heal-upload API that captures the 3 result states of the heal operation, namely, CompletelyHealed, PartiallyHealed and NotHealed. In addition, we would return error to indicate if the healing operation failed to due to other I/O related errors.

Motivation and Context

How Has This Been Tested?

Types of changes

  • Bug fix (non-breaking change which fixes an issue)
  • New feature (non-breaking change which adds functionality)
  • Breaking change (fix or feature that would cause existing functionality to change)

Checklist:

  • My code follows the code style of this project.
  • My change requires a change to the documentation.
  • I have updated the documentation accordingly.
  • I have added tests to cover my changes.
  • All new and existing tests passed.

@mention-bot
Copy link

@krisis, thanks for your PR! By analyzing the history of the files in this pull request, we identified @harshavardhana, @krishnasrinivas and @balamurugana to be potential reviewers.

@codecov-io
Copy link

codecov-io commented Apr 4, 2017

Codecov Report

Merging #4045 into master will increase coverage by 0.01%.
The diff coverage is 88.88%.

Impacted file tree graph

@@            Coverage Diff             @@
##           master    #4045      +/-   ##
==========================================
+ Coverage   68.23%   68.25%   +0.01%     
==========================================
  Files         174      174              
  Lines       24125    24133       +8     
==========================================
+ Hits        16461    16471      +10     
+ Misses       6553     6551       -2     
  Partials     1111     1111
Impacted Files Coverage Δ
pkg/madmin/heal-commands.go 0% <ø> (ø) ⬆️
cmd/xl-v1-healing.go 72.89% <100%> (-0.28%) ⬇️
cmd/admin-handlers.go 57.09% <83.33%> (+1.32%) ⬆️
cmd/fs-v1-background-append.go 78.52% <0%> (-1.35%) ⬇️

Continue to review full report at Codecov.

Legend - Click here to learn more
Δ = absolute <relative> (impact), ø = not affected, ? = missing data
Powered by Codecov. Last update d103d5f...d6abb4c. Read the comment docs.

@deekoder
Copy link
Contributor

deekoder commented Apr 6, 2017

Can you update the API doc https://github.com/minio/minio/tree/master/docs/admin-api with the details?

@deekoder deekoder self-requested a review April 6, 2017 01:18
Copy link
Contributor

@deekoder deekoder left a comment

Choose a reason for hiding this comment

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

Change looks ok. But please update the admin-api docs as mentioned in the comments.

@krisis krisis changed the title [need-review] Return possible states a heal operation Return possible states a heal operation Apr 7, 2017
@krisis
Copy link
Member Author

krisis commented Apr 8, 2017

@deekoder I have added necessary admin-API docs.

)

// newHealResult - returns healResult given number of disks healed and
// number of disks offline
Copy link
Member

Choose a reason for hiding this comment

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

Can you add a test case for this alone?

Copy link
Member Author

Choose a reason for hiding this comment

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

@harshavardhana Added a unit test.

@harshavardhana harshavardhana requested review from donatello and removed request for abperiasamy April 9, 2017 06:50
@harshavardhana
Copy link
Member

@deekoder @krisis has fixed the admin API docs can you review again?

@harshavardhana harshavardhana requested review from vadmeste and removed request for donatello April 9, 2017 06:51
@harshavardhana
Copy link
Member

ping @vadmeste need your review here..

@@ -494,10 +494,21 @@ func (adm *AdminClient) HealUpload(bucket, object, uploadID string, dryrun bool)

// HealResult - represents result of heal-object admin API.
type HealResult struct {
HealedCount int // number of disks that were healed.
OfflineCount int // number of disks that needed healing but were offline.
State HealState
Copy link
Member

Choose a reason for hiding this comment

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

Can you set a json tag here? json:"state"

Copy link
Member

@vadmeste vadmeste left a comment

Choose a reason for hiding this comment

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

One comment, LGTM otherwise

@deekoder
Copy link
Contributor

I will schedule the gist review today with @abperiasamy

@harshavardhana
Copy link
Member

I will schedule the gist review today with @abperiasamy

Is this PR waiting on the gist review? - we can merge this and proceed with gist review with a separate PR as a doc cleanup.


const (
// notHealed - none of the disks healed
notHealed healState = iota
Copy link
Contributor

@deekoder deekoder Apr 12, 2017

Choose a reason for hiding this comment

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

@abperiasamy : By prefixing heal, there is namespace pollution. Use healOK, healFailed, healPartial everywhere. Always group them with common prefix to help IDEs autocomplete.

@@ -494,10 +494,21 @@ func (adm *AdminClient) HealUpload(bucket, object, uploadID string, dryrun bool)

// HealResult - represents result of heal-object admin API.
Copy link
Contributor

Choose a reason for hiding this comment

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

@abperiasamy : healState is duplicated in cmd/admin-handlers.go

Copy link
Member

@harshavardhana harshavardhana Apr 12, 2017

Choose a reason for hiding this comment

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

This is on purpose the struct on cmd/ cannot be used with madmin package.. Just like how minio-go has ListObjects struct which is similar to what server has as ListObjectInfo. All elements are same.

Since madmin is imported into mc it is not required for minio server to be vendorized in mc to get admin API working. So it is written like an independent SDK capable of parsing all the Admin API REST responses and requests.

@harshavardhana
Copy link
Member

@abperiasamy : healState is duplicated in cmd/admin-handlers.go

This is on purpose the struct on cmd/ cannot be used with madmin package.. Just like how minio-go has ListObjects struct which is similar to what server has as ListObjects.

Since madmin is imported into mc it is not required for minio server to be vendorized in mc to get admin API working. So it is written like an independent SDK capable of parsing all the Admin API REST responses and requests.


| Value | Description |
|---|---|
|`NotHealed` | Object/Upload wasn't healed on any of the disks |
Copy link
Member

Choose a reason for hiding this comment

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

This should be fixed as well @krisis ?

Copy link
Member Author

Choose a reason for hiding this comment

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

@harshavardhana yes, thanks for catching that. I have updated the PR fixing this.

@krisis
Copy link
Member Author

krisis commented Apr 13, 2017

@deekoder I have changed the healState values to be HealNone, HealPartial and HealOK respectively.

@harshavardhana harshavardhana merged commit ca64b86 into minio:master Apr 14, 2017
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.

None yet

6 participants