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

HDDS-7076. Log container file path when container cannot be written. #3684

Conversation

Galsza
Copy link
Contributor

@Galsza Galsza commented Aug 15, 2022

What changes were proposed in this pull request?

Add container file path to error message when writing to container encounters an error

What is the link to the Apache JIRA

HDDS-7076

How was this patch tested?

Reproduce the error on a local cluster via taking away the write permission on container data by making its folder read only.

@@ -260,7 +260,8 @@ private void writeToContainerFile(File containerFile, boolean isCreate)
} catch (IOException ex) {
onFailure(containerData.getVolume());
throw new StorageContainerException("Error while creating/ updating " +
".container file. ContainerID: " + containerId, ex,
".container file. ContainerID: " + containerId + " Container path: " +
Copy link
Contributor

Choose a reason for hiding this comment

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

Suggested change
".container file. ContainerID: " + containerId + " Container path: " +
" container file. ContainerID: " + containerId + ", container path: " +

Copy link
Contributor

Choose a reason for hiding this comment

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

I think the . was originally there to signify the file extension of the file is .container. I don't think it matters either way, just a note.

Copy link
Contributor Author

Choose a reason for hiding this comment

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

Thanks for spotting this, I've fixed it.

@duongkame
Copy link
Contributor

Thanks for the patch @Galsza. LGTM, just one nitpicking comment inline.

@Galsza Galsza force-pushed the HDDS-7076_log_container_file_path_when_container_can_not_be_written branch from d8fe471 to d22f9a4 Compare August 16, 2022 08:38
Comment on lines 262 to 264
throw new StorageContainerException("Error while creating/ updating " +
".container file. ContainerID: " + containerId, ex,
" container file. ContainerID: " + containerId +
" ,container path: " + containerFile.getAbsolutePath(), ex,
Copy link
Contributor

Choose a reason for hiding this comment

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

Note that error may happen for temp file (lines 246-248) or final file (lines 254, 256-257). Can we distinguish between those two cases?

Also, spacing is a bit odd here (some double, some missing). How about:

      throw new StorageContainerException("Error while creating/updating" +
          " container file. ContainerID: " + containerId +
          ", container path: " + containerFile.getAbsolutePath(), ex,

Copy link
Contributor Author

Choose a reason for hiding this comment

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

Added additional text when the temp file could not be created. I'm not sure what else we can do with this situation.

@Galsza Galsza force-pushed the HDDS-7076_log_container_file_path_when_container_can_not_be_written branch from f42c2e4 to 960ca1b Compare August 17, 2022 15:04
@adoroszlai
Copy link
Contributor

@Galsza Please try to avoid force-push when updating the PR. Here are some great articles that explain why:

https://developers.mattermost.com/blog/submitting-great-prs/#4-avoid-force-pushing
https://www.freecodecamp.org/news/optimize-pull-requests-for-reviewer-happiness#request-a-review

@adoroszlai adoroszlai merged commit 82b6441 into apache:master Aug 18, 2022
@adoroszlai
Copy link
Contributor

Thanks @Galsza for updating the patch. Thanks @DuongNguyen0 for the review.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
4 participants