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

Use removeBlobs() for bulk-delete. #39

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

Conversation

timuralp
Copy link
Member

We should use removeBlobs() for bulk-delete. The change deletes blobs
en-masse. Further, we no longer will perform a HEAD on every blob, as
that's fairly expensive.

Fixes #38

} catch (ContainerNotFoundException e) {
result.numberNotFound += 1;
} catch (Exception e) {
e.printStackTrace();
Copy link
Member

Choose a reason for hiding this comment

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

We really shouldn't have printStackTrace anywhere in our code.

Copy link
Member Author

Choose a reason for hiding this comment

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

Done -- was following the other code in the project (e.g. AuthResource, ExceptionLogger, and IdentityResource).

@gaul
Copy link
Member

gaul commented Jun 15, 2015

Exception.printStackTrace does not go anywhere useful. If you want to log it, use logger.debug("some message", Exception) instead.

@gaul
Copy link
Member

gaul commented Jun 15, 2015

👍

1 similar comment
@kahing
Copy link
Member

kahing commented Jun 17, 2015

👍

@@ -151,33 +153,48 @@ public BulkDeleteResult bulkDelete(@NotNull @PathParam("account") String account
}

BulkDeleteResult result = new BulkDeleteResult();
Map<String, List<String>> removeBlobsMap = new HashMap<>();
Copy link
Member

Choose a reason for hiding this comment

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

Do you want to use a Multimap instead?

Copy link
Member Author

Choose a reason for hiding this comment

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

That would work too. I'll change the commit.

We should use removeBlobs() for bulk-delete. The change deletes blobs
en-masse. Further, we no longer will perform a HEAD on every blob, as
that's fairly expensive.

Fixes #38
}
int separatorIndex = objectContainer.indexOf('/');
if (separatorIndex < 0) {
deleteContainers.add(objectContainer.substring(1));
Copy link
Member

Choose a reason for hiding this comment

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

Do you need substring here?

Copy link
Member Author

Choose a reason for hiding this comment

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

I think you're right, because we already do substring(1) on line 161. I'm not sure how this works right now for containers that start with "/"!

Copy link
Member

Choose a reason for hiding this comment

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

We are probably deleting a non-existent container which does not generate an error. We should enable/add some swift-tests to check for these behaviors.

@gaul
Copy link
Member

gaul commented Dec 13, 2019

@timuralp Do we we a path forward on this PR?

@timuralp
Copy link
Member Author

@gaul I'll need to reload this into my brain. Will try to check it out over the weekend.

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.

Native multi-delete objects
3 participants