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

HttpHandlers should return correct list of objects #49283

Merged
merged 2 commits into from
Nov 19, 2019

Conversation

tlrx
Copy link
Member

@tlrx tlrx commented Nov 19, 2019

This pull request fixes the server side logic of "List Objects" operations of Azure and S3 fixtures. Until today, the fixtures were returning a "flat" view of stored objects and were not correctly handling the delimiter parameter. This causes some objects listing to be wrongly interpreted by the snapshot deletion logic in Elasticsearch which relies on the ability to list child containers of BlobContainer (#42653) to correctly delete stale indices.

As a consequence, the blobs were not correctly deleted from the emulated storage service and stayed in heap until they got garbage collected, causing CI failures like #48978 where OOM errors happen in the test JVM (but it took me a while to figure this out...).

This pull request fixes the server side logic of Azure and S3 fixture when listing objects so that it now return correct common blob prefixes as expected by the snapshot deletion process. It also adds an after-test check to ensure that tests leave the repository empty (besides the root index files).

Closes #48978

@tlrx tlrx added >test Issues or PRs that are addressing/adding tests :Distributed Coordination/Snapshot/Restore Anything directly related to the `_snapshot/*` APIs v8.0.0 v7.6.0 v7.5.1 labels Nov 19, 2019
@elasticmachine
Copy link
Collaborator

Pinging @elastic/es-distributed (:Distributed/Snapshot/Restore)

Copy link
Member

@original-brownbear original-brownbear left a comment

Choose a reason for hiding this comment

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

This looks good I think. Could we add a test for S3 and Azure where we make sure that BlobContainer listing child directories and listing all children never picks up blobs from nested "directories" to make sure this continues to work?

@tlrx
Copy link
Member Author

tlrx commented Nov 19, 2019

Could we add a test for S3 and Azure where we make sure that BlobContainer listing child directories and listing all children never picks up blobs from nested "directories" to make sure this continues to work?

That sounds like the responsibility of ESBlobStoreContainerTestCase suite? Where we could maybe get rid of AzureStorageServiceMock to also rely on HTTP handlers? Or maybe you were thinking of something different?

@original-brownbear
Copy link
Member

That sounds like the responsibility of ESBlobStoreContainerTestCase suite? Where we could maybe get rid of AzureStorageServiceMock to also rely on HTTP handlers?

Jup exactly, that's what we should do. I guess we even have an issue that is asking for that #30424 :)

@tlrx
Copy link
Member Author

tlrx commented Nov 19, 2019

@original-brownbear Would it be acceptable to do this as a follow up pr?

Copy link
Member

@original-brownbear original-brownbear left a comment

Choose a reason for hiding this comment

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

LGTM, yea ofc follow-up is just fine :) Let's just do it at some point IMO.

@tlrx tlrx merged commit b07d110 into elastic:master Nov 19, 2019
@tlrx
Copy link
Member Author

tlrx commented Nov 19, 2019

Thanks @original-brownbear !

@tlrx tlrx deleted the fix-this-hum branch November 19, 2019 14:55
tlrx added a commit that referenced this pull request Nov 20, 2019
This commit fixes the server side logic of "List Objects" operations
of Azure and S3 fixtures. Until today, the fixtures were returning a "
flat" view of stored objects and were not correctly handling the
delimiter parameter. This causes some objects listing to be wrongly
interpreted by the snapshot deletion logic in Elasticsearch which
relies on the ability to list child containers of BlobContainer (#42653)
to correctly delete stale indices.

As a consequence, the blobs were not correctly deleted from the
 emulated storage service and stayed in heap until they got garbage
collected, causing CI failures like #48978.

This commit fixes the server side logic of Azure and S3 fixture when
listing objects so that it now return correct common blob prefixes as
expected by the snapshot deletion process. It also adds an after-test
check to ensure that tests leave the repository empty (besides the
root index files).

Closes #48978
tlrx added a commit that referenced this pull request Nov 20, 2019
This commit fixes the server side logic of "List Objects" operations
of Azure and S3 fixtures. Until today, the fixtures were returning a "
flat" view of stored objects and were not correctly handling the
delimiter parameter. This causes some objects listing to be wrongly
interpreted by the snapshot deletion logic in Elasticsearch which
relies on the ability to list child containers of BlobContainer (#42653)
to correctly delete stale indices.

As a consequence, the blobs were not correctly deleted from the
 emulated storage service and stayed in heap until they got garbage
collected, causing CI failures like #48978.

This commit fixes the server side logic of Azure and S3 fixture when
listing objects so that it now return correct common blob prefixes as
expected by the snapshot deletion process. It also adds an after-test
check to ensure that tests leave the repository empty (besides the
root index files).

Closes #48978
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
:Distributed Coordination/Snapshot/Restore Anything directly related to the `_snapshot/*` APIs >test Issues or PRs that are addressing/adding tests v7.5.1 v7.6.0 v8.0.0-alpha1
Projects
None yet
Development

Successfully merging this pull request may close these issues.

[CI] AzureBlobStoreRepositoryTests.testIndicesDeletedFromRepository
4 participants