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

DS-3978: BitStore support for Azure Blob Storage Service. #2140

Closed
wants to merge 4 commits into from
Closed

DS-3978: BitStore support for Azure Blob Storage Service. #2140

wants to merge 4 commits into from

Conversation

ernani
Copy link

@ernani ernani commented Jul 31, 2018

I've implemented the Bitstore support for Azure Blob Storage Service.

https://jira.duraspace.org/browse/DS-3978

@ernani
Copy link
Author

ernani commented Jul 31, 2018

A working sample can be found here:
https://dspacecpstest.azurewebsites.net/handle/123456789/42

Both attachments (bitstreams) and solr indexing thumbnails goes to my Storage Account as a blob storage.

Please do let me know if there is anything else I must provide.

@tdonohue tdonohue added new feature backend: bitstore Related to file/bitstream storage labels Aug 21, 2018
Copy link
Member

@tdonohue tdonohue left a comment

Choose a reason for hiding this comment

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

The overall feature here looks fine to me. However, I'd like to see other institutions express an interest in adding an Azure Storage Service before merging. Obviously, any new storage service will need to be maintained over time, and if we don't have many active developers who use the storage service, that may make maintenance very difficult.

All that said, I've added inline comments where this code could be improved.

scratchFile.delete();

} catch (Throwable t) {
log.error("put(" + bitstream.getInternalId() + ", is)", t);
Copy link
Member

Choose a reason for hiding this comment

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

It would be best to catch specific Exception types that may be thrown, instead of generically catching Throwable. Catching specific Exception types would allow you to log a more detailed/useful error message, which is what we tend to encourage. The current log.error line here is uninformative, as it just notes the method name -- and that could be easily found out by the stacktrace itself.

CloudBlob blob = this.blobContainer.getBlockBlobReference(key);
return (blob != null) ? blob.openInputStream() : null;
} catch (Exception e) {
log.error("get(" + key + ")", e);
Copy link
Member

Choose a reason for hiding this comment

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

This log.error is uninformative. Should provide more information about the error occurring here, and not just provide the method name.

t.printStackTrace(printWriter);
if (t instanceof StorageException) {
if (((StorageException) t).getExtendedErrorInformation() != null) {
log.error(String.format("\nError: %s",
Copy link
Member

Choose a reason for hiding this comment

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

Instead of this if, this should be a separate catch statement. Again, the log.error should provide more information about why a StorageException error may occur here.

((StorageException) t).getExtendedErrorInformation().getErrorMessage()), t);
}
}
log.error(String.format("Exception details:\n%s", stringWriter.toString()), t);
Copy link
Member

Choose a reason for hiding this comment

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

Again, need a better error log statement

}
}
log.error(String.format("Exception details:\n%s", stringWriter.toString()), t);
throw new IOException(t);
Copy link
Member

Choose a reason for hiding this comment

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

Similar to all the log.error comments, is there more information we should add to this newly thrown IOException?


} catch (Exception e) {
log.error("about(" + key + ", attrs)", e);
throw new IOException(e);
Copy link
Member

Choose a reason for hiding this comment

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

Similar to all the log.error comments, is there more information we should add to this newly thrown IOException?

}
} catch (Exception e) {
log.error("remove(" + key + ")", e);
throw new IOException(e);
Copy link
Member

Choose a reason for hiding this comment

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

Similar to all the log.error comments, is there more information we should add to this newly thrown IOException?

// Commit the blocks
blockBlob.commitBlockList(blockList);
} catch (Throwable t) {
throw t;
Copy link
Member

Choose a reason for hiding this comment

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

This catch doesn't seem to be needed. It's just re-throwing the same exception.

*
* @throws Throwable
*/
private void uploadFileBlocksAsBlockBlob(CloudBlockBlob blockBlob, String filePath) throws Throwable {
Copy link
Member

Choose a reason for hiding this comment

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

throws Throwable is not recommended. I'd rather see several throws here with the individual exception types listed out (and then the Javadocs can note when specific Exception types may occur)

@tdonohue tdonohue changed the title BitStore support for Azure Blob Storage Service. DS-3978: BitStore support for Azure Blob Storage Service. Aug 24, 2018
@github-actions github-actions bot added the merge conflict PR has a merge conflict that needs resolution label Aug 26, 2020
@ernani
Copy link
Author

ernani commented May 11, 2021

Due to a family health issue at the time apparently these recommendations and e-mails were not of my awareness and given that the storage engine was even suggested in an old release, I will close this PR and will work on something in the newer releases should we feel it is appropriate. Thanks and sorry for any inconvenience.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
backend: bitstore Related to file/bitstream storage merge conflict PR has a merge conflict that needs resolution new feature
Projects
None yet
Development

Successfully merging this pull request may close these issues.

None yet

2 participants