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

objstore: add ObjectSize() implementation #1792

Merged
merged 4 commits into from
Nov 30, 2019

Conversation

GiedriusS
Copy link
Member

@GiedriusS GiedriusS commented Nov 26, 2019

Adds a new method ObjectSize(context.Context, string) method to our
object storage interface which returns the size of the specified object
in uint64 without actually downloading all of it.

This is a pre-requisite to one check that we want to add (#1550).

Add a check to our E2E tests to see if it works.

Signed-off-by: Giedrius Statkevičius [email protected]

Adds a new method ObjectSize(context.Context, string) method to our
object storage interface which returns the size of the specified object
in uint64 without actually downloading all of it.

This is a pre-requisite to one check that we want to add.

Add a check to our E2E tests to see if it works.

Signed-off-by: Giedrius Statkevičius <[email protected]>
Signed-off-by: Giedrius Statkevičius <[email protected]>
Copy link
Member

@bwplotka bwplotka left a comment

Choose a reason for hiding this comment

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

Happy with this 👍

LGTM!

@@ -42,6 +42,11 @@ func TestObjStore_AcceptanceTest_e2e(t *testing.T) {
testutil.Ok(t, err)
testutil.Equals(t, "@test-data@", string(content))

// Check if we can get the correct size.
Copy link
Member

Choose a reason for hiding this comment

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

Can we check if ObjectSize for non existing block properly errors? Also if we can find assert NotFound on such operation if block is missing? The latter is not critical, but if we cannot assume so, we should document that as a method comment (:

Copy link
Member Author

Choose a reason for hiding this comment

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

Added a test for this before the initial upload and cleaned up the functions so that IsObjNotFoundErr(error) would be properly triggered in such cases.

Copy link
Member

@povilasv povilasv left a comment

Choose a reason for hiding this comment

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

👍

The exact error is needed by the callers so that they could check
`IsObjNotFoundErr` correctly.

Add a test for this to the E2E tests.

Signed-off-by: Giedrius Statkevičius <[email protected]>
@GiedriusS GiedriusS marked this pull request as ready for review November 30, 2019 08:15
Signed-off-by: Giedrius Statkevičius <[email protected]>
@GiedriusS GiedriusS merged commit 229f978 into thanos-io:master Nov 30, 2019
@GiedriusS
Copy link
Member Author

Merging this as I have addressed the comments and since it doesn't change the behaviour in any way ATM. Will rebase #1550 on these methods now.

@bwplotka
Copy link
Member

bwplotka commented Dec 2, 2019

Thanks!

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.

3 participants