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

ZBUG-4409: Missing Blobs on a restored account from backup with S3 storage #1698

Open
wants to merge 5 commits into
base: develop
Choose a base branch
from

Conversation

Gopal-Moolchandani
Copy link
Contributor

@Gopal-Moolchandani Gopal-Moolchandani commented Jan 30, 2025

Issue: With-Blob Backup was not supported for external storage.

Fix: Modified the Backup and Restore code to support with-blob backup. For external storage, blobs will be restored in the same bucket.


try {
String locator = writeStreamToStore(pin, actualSize, mbox, volume.getId());
if (locator != null) {
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
if (locator != null) {
if (null != locator) {

@@ -306,6 +321,21 @@ public StagedBlob stage(InputStream data, Mailbox mbox)
return stage(data, -1, mbox);
Copy link
Contributor

Choose a reason for hiding this comment

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

instead of hard code value can we declare variable for -1 , because its confusing

if (supports(StoreFeature.RESUMABLE_UPLOAD) && blob instanceof ExternalUploadedBlob) {
ZimbraLog.store.debug("blob already uploaded, just need to commit");
String locator = ((ExternalResumableUpload) this).finishUpload((ExternalUploadedBlob) blob);
if (locator != null) {
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
if (locator != null) {
if (null != locator) {

InputStream is = getContent(blob);
try {
StagedBlob staged = stage(is, blob.getRawSize(), mbox, volume);
if (staged != null && staged.getLocator() != null) {
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
if (staged != null && staged.getLocator() != null) {
if (null != staged && null != staged.getLocator()) {

@@ -59,6 +60,11 @@ public StagedBlob stage(InputStream data, long actualSize, Mailbox mbox) throws
return null;
}

@Override
public StagedBlob stage(InputStream data, long actualSize, Mailbox mbox, Volume volume) throws IOException, ServiceException {
return null;
Copy link
Contributor

Choose a reason for hiding this comment

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

What about NotImplementedException or UnsupportedOperation

@Override
public StagedBlob stage(InputStream data, long actualSize, Mailbox mbox, Volume volume) throws IOException, ServiceException {
// mailbox store is on the same volume as incoming directory, so no need to stage the blob
throw ServiceException.FAILURE("Operation can not be completed because ExternalStoreManager is not available", null);
Copy link
Contributor

Choose a reason for hiding this comment

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

It is not necessary this method will be always executed for external storage, this message should be generic

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.

7 participants