-
Notifications
You must be signed in to change notification settings - Fork 5.3k
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
Conversation
@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 Report
@@ 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
Continue to review full report at Codecov.
|
Can you update the API doc https://github.com/minio/minio/tree/master/docs/admin-api with the details? |
There was a problem hiding this 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.
@deekoder I have added necessary admin-API docs. |
cmd/admin-handlers.go
Outdated
) | ||
|
||
// newHealResult - returns healResult given number of disks healed and | ||
// number of disks offline |
There was a problem hiding this comment.
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?
There was a problem hiding this comment.
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.
ping @vadmeste need your review here.. |
pkg/madmin/heal-commands.go
Outdated
@@ -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 |
There was a problem hiding this comment.
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"
There was a problem hiding this 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
1f2f383
to
e70ce50
Compare
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. |
cmd/admin-handlers.go
Outdated
|
||
const ( | ||
// notHealed - none of the disks healed | ||
notHealed healState = iota |
There was a problem hiding this comment.
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. |
There was a problem hiding this comment.
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
There was a problem hiding this comment.
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.
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. |
e70ce50
to
e051317
Compare
pkg/madmin/API.md
Outdated
|
||
| Value | Description | | ||
|---|---| | ||
|`NotHealed` | Object/Upload wasn't healed on any of the disks | |
There was a problem hiding this comment.
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 ?
There was a problem hiding this comment.
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.
@deekoder I have changed the |
e051317
to
d6abb4c
Compare
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 toerror
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
andNotHealed
. In addition, we would returnerror
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
Checklist: