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

[WIP] StaticHeader::setup Improve error reporting #1562

Draft
wants to merge 1 commit into
base: master
Choose a base branch
from

Conversation

GuillaumeGomez
Copy link
Contributor

Fixes #1443.

Before finalizing this: do we want to provide two different kind of errors in here or consider the second case of error as non-fatal and providing it alongside the returned data (like I did currently)?

@stratis-bot
Copy link

Test with Jenkins?

1 similar comment
@stratis-bot
Copy link

Test with Jenkins?

@mulkieran
Copy link
Member

ok to test

@mulkieran mulkieran added this to In progress (long term) in 2019June via automation Jun 17, 2019
@mulkieran
Copy link
Member

Before finalizing this: do we want to provide two different kind of errors in here or consider the second case of error as non-fatal and providing it alongside the returned data (like I did currently)?

Yes, this is exactly right. We should consider the error on repair attempt as non-fatal, because if we tried to repair that means we think we have good data on hand.

@GuillaumeGomez
Copy link
Contributor Author

@mulkieran suggested to use an enum instead and also to add #[must_use] usage. I'll check with those solutions.

@mulkieran mulkieran moved this from In progress (long term) to In progress in 2019June Jun 17, 2019
@GuillaumeGomez
Copy link
Contributor Author

Should I do something with the errors or...?

src/engine/strat_engine/backstore/metadata/bda.rs Outdated Show resolved Hide resolved
src/engine/strat_engine/backstore/metadata/bda.rs Outdated Show resolved Hide resolved
src/engine/strat_engine/backstore/metadata/bda.rs Outdated Show resolved Hide resolved
src/engine/strat_engine/backstore/metadata/bda.rs Outdated Show resolved Hide resolved
@GuillaumeGomez GuillaumeGomez force-pushed the improve-error-handling branch 2 times, most recently from 7307162 to d1ef8a3 Compare June 19, 2019 12:17
@GuillaumeGomez
Copy link
Contributor Author

Updated. Is there anything else to do in here?

src/engine/strat_engine/backstore/metadata/bda.rs Outdated Show resolved Hide resolved
src/engine/strat_engine/backstore/metadata/bda.rs Outdated Show resolved Hide resolved
src/engine/strat_engine/backstore/metadata/bda.rs Outdated Show resolved Hide resolved
Ok(Some(sh)) => Ok(Some((sh.pool_uuid, sh.dev_uuid))),
Ok(Some(SetupResult::Ok(sh))) => Ok(Some((sh.pool_uuid, sh.dev_uuid))),
Ok(Some(SetupResult::OkWithError(sh, err))) => {
warn!("StaticHeader::setup didn't completely succeed: {:?}", err);
Copy link
Member

Choose a reason for hiding this comment

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

The I/O error that you picked up doesn't really explain what happened. So, a clearer explanation would be something like:

warn!("Experienced an I/O error while attempting to repair an ill-formed, unreadable, or stale signature block: {:?}", err);

This has the flaw that it does not identify which signature block, on which device, etc., so it is more alarming than helpful in that simple state.

But you can improve it quite a bit, by including the good StaticHeader, the one that was succesfully read, in the error message (or possibly just selected identifying information from that StaticHeader). This would probably be worth a separate function, since you do it in two places.

Copy link
Contributor Author

Choose a reason for hiding this comment

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

I extended your text a bit. Tell me if it's what you had in mind otherwise I'll just update. :)

@GuillaumeGomez GuillaumeGomez force-pushed the improve-error-handling branch 3 times, most recently from db984b7 to c39cb15 Compare June 24, 2019 15:47
@mulkieran
Copy link
Member

@GuillaumeGomez Could you rebase this one? device_identifiers has moved and changed its structure, so there is a conflict. I believe it shouldn't be hard for you to adapt your changes to the new structure, and location.

@GuillaumeGomez
Copy link
Contributor Author

Sure!

@GuillaumeGomez
Copy link
Contributor Author

Rebased.

@mulkieran
Copy link
Member

Makes sense to call this blocked b #1575.

@mulkieran mulkieran removed this from In progress in 2019June Jun 25, 2019
@mulkieran mulkieran added this to In progress (long term) in 2019July via automation Jun 25, 2019
@mulkieran mulkieran removed the blocked label Jul 2, 2019
@mulkieran
Copy link
Member

unblocked.

@mulkieran
Copy link
Member

yup. conflicts galore, unfortunately, but ultimately a better situation.

@stratis-bot
Copy link

Test with Jenkins?

@GuillaumeGomez GuillaumeGomez force-pushed the improve-error-handling branch 2 times, most recently from d63a18e to 6457012 Compare July 2, 2019 21:41
@GuillaumeGomez GuillaumeGomez force-pushed the improve-error-handling branch 2 times, most recently from fe145a7 to 32d98e5 Compare July 3, 2019 18:40
@GuillaumeGomez
Copy link
Contributor Author

cargo fmt once again. T_T

Copy link
Member

@mulkieran mulkieran left a comment

Choose a reason for hiding this comment

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

I'm not done just yet, I think that if the extra curly brace is removed then it'll look like fewer changes, which will make it easier to review. So, please go ahead and do that and I'll take another look.

}
}

fn setup_warn(header: &StaticHeader, err: StratisError) {
Copy link
Member

Choose a reason for hiding this comment

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

Please add some explanatory header comments.

Copy link
Contributor Author

Choose a reason for hiding this comment

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

I added a comment. Considering the function was just emitting a warning, I didn't think it was necessary to kinda repeat what it was doing but I guess a comment cannot hurt. Also, don't hesitate if the comment isn't well written.

src/engine/strat_engine/backstore/metadata/bda.rs Outdated Show resolved Hide resolved
warn!(
"Experienced an I/O error while attempting to repair an ill-formed, \
unreadable, or stale signature block: {:?}.\n\
Returning device \"{:?}\" from pool \"{:?}\".",
Copy link
Member

Choose a reason for hiding this comment

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

How about Read and returned static header {:?}, sh for the second sentence. We implemented Debug for StaticHeader so that is doable; we had to implement it explicitly since the Debug info for UUIDs is far too long.

Copy link
Contributor Author

Choose a reason for hiding this comment

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

I updated the text but not sure if it was how you had it in mind?

src/engine/strat_engine/backstore/metadata/bda.rs Outdated Show resolved Hide resolved
src/engine/strat_engine/backstore/metadata/bda.rs Outdated Show resolved Hide resolved
src/engine/strat_engine/backstore/metadata/bda.rs Outdated Show resolved Hide resolved
@GuillaumeGomez
Copy link
Contributor Author

Updated.

@mulkieran
Copy link
Member

Travis failed due to infrastructure errors, not test failiures, I tried restarting it.

Copy link
Member

@mulkieran mulkieran left a comment

Choose a reason for hiding this comment

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

Thanks, I think we're getting close to finish. Please look into the further abstractions suggested...it doesn't make sense to waste the opportunity, once we've made it this far.

Right now this PR needs only 50 additional lines of code to introduce a significant improvement in behavior, because it improves the method structure at the same time; I hope we can do better still.

src/engine/strat_engine/backstore/metadata/bda.rs Outdated Show resolved Hide resolved
src/engine/strat_engine/backstore/metadata/bda.rs Outdated Show resolved Hide resolved
fn setup_warn(header: &StaticHeader, err: StratisError) {
warn!(
"Experienced an I/O error while attempting to repair an ill-formed, \
unreadable, or stale signature block: {:?}.\n\
Copy link
Member

Choose a reason for hiding this comment

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

Please drop the newline. We should allow something else to do the formatting at some later, post-processing step.

where
F: Read + Seek + SyncAll,
{
fn bda_write_check<F>(
Copy link
Member

Choose a reason for hiding this comment

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

Please change name to just write_check. The use of bda is wrong, because some bad nomenclature crept in in a previous PR, and since the method is defined in setup, it doesn't really need a long identifying name anyway.

src/engine/strat_engine/backstore/metadata/bda.rs Outdated Show resolved Hide resolved
src/engine/strat_engine/backstore/metadata/bda.rs Outdated Show resolved Hide resolved
@GuillaumeGomez
Copy link
Contributor Author

Updated.

@mulkieran
Copy link
Member

@GuillaumeGomez I've realized that there is yet another preliminary step that should happen before you try to move forward w/ this. I'ld already worked it out, but now I realize that it will conflict w/ this very badly. So, please put this on hold, and I'll assign to you this additional pre-project.

@mulkieran
Copy link
Member

Blocked by #1579.

@mulkieran mulkieran moved this from In progress to In progress (long term) in 2019July Jul 8, 2019
@mulkieran
Copy link
Member

Blocked by #1586.

@mulkieran mulkieran added this to In progress (long term) in 2019August via automation Jul 24, 2019
@mulkieran mulkieran removed this from In progress (long term) in 2019July Jul 24, 2019
@mulkieran mulkieran added this to In progress (long term) in metadata refactoring via automation Aug 2, 2019
@mulkieran mulkieran removed this from In progress (long term) in 2019August Aug 2, 2019
@stratis-bot
Copy link

Test with Jenkins?

@stratis-bot
Copy link

Can one of the admins verify this patch?

@mulkieran mulkieran marked this pull request as draft March 15, 2021 20:52
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
Projects
metadata refactoring
  
In progress (long term)
Development

Successfully merging this pull request may close these issues.

StaticHeader::setup Improve error reporting
4 participants