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

Add support to upload snapshot shard blobs with hashed prefix #15426

Merged
merged 14 commits into from
Sep 1, 2024

Conversation

ashking94
Copy link
Member

@ashking94 ashking94 commented Aug 26, 2024

Description

Following up from the RFC #15146, in this PR, we implement the same. More details can be seen in the RFC itself. Below is the summarised change -

  1. Snapshot models each index as an IndexId. Multiple indexes can share the same IndexId even though they are fundamentally different. In this PR, we are updating the IndexId class to also hold information about the pathType.
  2. The data corresponding to each of the IndexId is then stored in the index-N file (i.e. RepositoryData). Due to this, the metadata about the pathType is available at no additional cost during Snapshot operations like Creation, Deletion, Clone, cleanup.
  3. To handle no zombie data due to the hashed prefix nature of the path, we also have introduced a snapshot_shard_paths file which keeps the data about the paths for all the shards for an IndexId. The same information is also used later during stale blob deletion. This file is cleaned up only when all the paths present in the file are deleted. Also, that the stale blob cleanup is done after the index-N file upload, which can lead to cases where the pathType information is no more available.

Related Issues

Resolves #15146

Check List

  • Functionality includes testing.
  • [ ] API changes companion pull request created, if applicable.
  • Public documentation issue/PR created, if applicable.

By submitting this pull request, I confirm that my contribution is made under the terms of the Apache 2.0 license.
For more information on following Developer Certificate of Origin and signing off your commits, please check here.

@ashking94 ashking94 force-pushed the snapshot-hashed-prefix branch from fb19151 to 68d100b Compare August 27, 2024 11:27
@opensearch-project opensearch-project deleted a comment from github-actions bot Aug 27, 2024
@ashking94 ashking94 changed the title Add snapshot shard blobs with hashed prefix Add support to upload snapshot shard blobs with hashed prefix Aug 27, 2024
@ashking94 ashking94 force-pushed the snapshot-hashed-prefix branch from 68d100b to 52797c9 Compare August 27, 2024 11:31
@github-actions github-actions bot added discuss Issues intended to help drive brainstorming and decision making enhancement Enhancement or improvement to existing feature or request RFC Issues requesting major changes Storage:Snapshots labels Aug 27, 2024
@opensearch-project opensearch-project deleted a comment from github-actions bot Aug 27, 2024
@ashking94 ashking94 force-pushed the snapshot-hashed-prefix branch from 52797c9 to 158418b Compare August 27, 2024 16:05
@ashking94 ashking94 added the backport 2.x Backport to 2.x branch label Aug 27, 2024
@ashking94 ashking94 force-pushed the snapshot-hashed-prefix branch from 158418b to f1a145f Compare August 27, 2024 16:13
@opensearch-project opensearch-project deleted a comment from github-actions bot Aug 27, 2024
@opensearch-project opensearch-project deleted a comment from github-actions bot Aug 27, 2024
@opensearch-project opensearch-project deleted a comment from github-actions bot Aug 27, 2024
@ashking94 ashking94 force-pushed the snapshot-hashed-prefix branch from f1a145f to e21d937 Compare August 27, 2024 17:06
Copy link
Contributor

❕ Gradle check result for e21d937: UNSTABLE

Please review all flaky tests that succeeded after retry and create an issue if one does not already exist to track the flaky failure.

Copy link

codecov bot commented Aug 27, 2024

Codecov Report

Attention: Patch coverage is 72.97297% with 90 lines in your changes missing coverage. Please review.

Project coverage is 72.00%. Comparing base (71d122b) to head (7c5b751).
Report is 1 commits behind head on main.

Files with missing lines Patch % Lines
...ch/repositories/blobstore/BlobStoreRepository.java 69.65% 62 Missing and 9 partials ⚠️
...a/org/opensearch/snapshots/SnapshotShardPaths.java 85.36% 3 Missing and 3 partials ⚠️
...mote/directory/RemoteSnapshotDirectoryFactory.java 0.00% 5 Missing ⚠️
...main/java/org/opensearch/repositories/IndexId.java 80.00% 1 Missing and 2 partials ⚠️
...va/org/opensearch/repositories/RepositoryData.java 83.33% 0 Missing and 2 partials ⚠️
...ava/org/opensearch/snapshots/SnapshotsService.java 60.00% 1 Missing and 1 partial ⚠️
...arch/index/recovery/RemoteStoreRestoreService.java 0.00% 1 Missing ⚠️
Additional details and impacted files
@@             Coverage Diff              @@
##               main   #15426      +/-   ##
============================================
+ Coverage     71.99%   72.00%   +0.01%     
- Complexity    63700    63753      +53     
============================================
  Files          5248     5249       +1     
  Lines        297416   297643     +227     
  Branches      42984    43011      +27     
============================================
+ Hits         214113   214309     +196     
+ Misses        65776    65698      -78     
- Partials      17527    17636     +109     

☔ View full report in Codecov by Sentry.
📢 Have feedback on the report? Share it here.

Copy link
Collaborator

@Bukhtawar Bukhtawar left a comment

Choose a reason for hiding this comment

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

Are existing ITs exercising these code paths or do we need to explicitly add them

Copy link
Contributor

❌ Gradle check result for 1975071: null

Please examine the workflow log, locate, and copy-paste the failure(s) below, then iterate to green. Is the failure a flaky test unrelated to your change?

@ashking94
Copy link
Member Author

❌ Gradle check result for 1975071: null

Please examine the workflow log, locate, and copy-paste the failure(s) below, then iterate to green. Is the failure a flaky test unrelated to your change?

#14314

@ashking94 ashking94 force-pushed the snapshot-hashed-prefix branch from 1975071 to c04eb67 Compare August 28, 2024 05:00
Copy link
Contributor

✅ Gradle check result for 1975071: SUCCESS

Copy link
Contributor

❌ Gradle check result for c04eb67: FAILURE

Please examine the workflow log, locate, and copy-paste the failure(s) below, then iterate to green. Is the failure a flaky test unrelated to your change?

@ashking94
Copy link
Member Author

❌ Gradle check result for c04eb67: FAILURE

Please examine the workflow log, locate, and copy-paste the failure(s) below, then iterate to green. Is the failure a flaky test unrelated to your change?

Flaky test - #14599

@ashking94 ashking94 force-pushed the snapshot-hashed-prefix branch from c04eb67 to fc82193 Compare August 28, 2024 06:00
Copy link
Contributor

✅ Gradle check result for c04eb67: SUCCESS

Copy link
Contributor

✅ Gradle check result for fc82193: SUCCESS

akolarkunnu pushed a commit to akolarkunnu/OpenSearch that referenced this pull request Sep 10, 2024
…arch-project#15426)

* Add snapshot shard blobs with hashed prefix

Signed-off-by: Ashish Singh <[email protected]>

* Add UTs

Signed-off-by: Ashish Singh <[email protected]>

* Address comments and add UTs

Signed-off-by: Ashish Singh <[email protected]>

* Change default snapshot shard path type to hashed_prefix for testing

Signed-off-by: Ashish Singh <[email protected]>

* Fix failing tests

Signed-off-by: Ashish Singh <[email protected]>

* Introduce single method for all create/put repository calls

Signed-off-by: Ashish Singh <[email protected]>

* Move the index shard path upload to sync upload

Signed-off-by: Ashish Singh <[email protected]>

* Fix spotless errors

Signed-off-by: Ashish Singh <[email protected]>

* Do minor code refactor

Signed-off-by: Ashish Singh <[email protected]>

* Fix tests

Signed-off-by: Ashish Singh <[email protected]>

* More tests to use common methods for repo creation

Signed-off-by: Ashish Singh <[email protected]>

* Address comments and fix multiple failing tests

Signed-off-by: Ashish Singh <[email protected]>

---------

Signed-off-by: Ashish Singh <[email protected]>
akolarkunnu pushed a commit to akolarkunnu/OpenSearch that referenced this pull request Sep 10, 2024
dk2k pushed a commit to dk2k/OpenSearch that referenced this pull request Oct 16, 2024
…arch-project#15426)

* Add snapshot shard blobs with hashed prefix

Signed-off-by: Ashish Singh <[email protected]>

* Add UTs

Signed-off-by: Ashish Singh <[email protected]>

* Address comments and add UTs

Signed-off-by: Ashish Singh <[email protected]>

* Change default snapshot shard path type to hashed_prefix for testing

Signed-off-by: Ashish Singh <[email protected]>

* Fix failing tests

Signed-off-by: Ashish Singh <[email protected]>

* Introduce single method for all create/put repository calls

Signed-off-by: Ashish Singh <[email protected]>

* Move the index shard path upload to sync upload

Signed-off-by: Ashish Singh <[email protected]>

* Fix spotless errors

Signed-off-by: Ashish Singh <[email protected]>

* Do minor code refactor

Signed-off-by: Ashish Singh <[email protected]>

* Fix tests

Signed-off-by: Ashish Singh <[email protected]>

* More tests to use common methods for repo creation

Signed-off-by: Ashish Singh <[email protected]>

* Address comments and fix multiple failing tests

Signed-off-by: Ashish Singh <[email protected]>

---------

Signed-off-by: Ashish Singh <[email protected]>
dk2k pushed a commit to dk2k/OpenSearch that referenced this pull request Oct 16, 2024
dk2k pushed a commit to dk2k/OpenSearch that referenced this pull request Oct 17, 2024
…arch-project#15426)

* Add snapshot shard blobs with hashed prefix

Signed-off-by: Ashish Singh <[email protected]>

* Add UTs

Signed-off-by: Ashish Singh <[email protected]>

* Address comments and add UTs

Signed-off-by: Ashish Singh <[email protected]>

* Change default snapshot shard path type to hashed_prefix for testing

Signed-off-by: Ashish Singh <[email protected]>

* Fix failing tests

Signed-off-by: Ashish Singh <[email protected]>

* Introduce single method for all create/put repository calls

Signed-off-by: Ashish Singh <[email protected]>

* Move the index shard path upload to sync upload

Signed-off-by: Ashish Singh <[email protected]>

* Fix spotless errors

Signed-off-by: Ashish Singh <[email protected]>

* Do minor code refactor

Signed-off-by: Ashish Singh <[email protected]>

* Fix tests

Signed-off-by: Ashish Singh <[email protected]>

* More tests to use common methods for repo creation

Signed-off-by: Ashish Singh <[email protected]>

* Address comments and fix multiple failing tests

Signed-off-by: Ashish Singh <[email protected]>

---------

Signed-off-by: Ashish Singh <[email protected]>
dk2k pushed a commit to dk2k/OpenSearch that referenced this pull request Oct 17, 2024
dk2k pushed a commit to dk2k/OpenSearch that referenced this pull request Oct 21, 2024
…arch-project#15426)

* Add snapshot shard blobs with hashed prefix

Signed-off-by: Ashish Singh <[email protected]>

* Add UTs

Signed-off-by: Ashish Singh <[email protected]>

* Address comments and add UTs

Signed-off-by: Ashish Singh <[email protected]>

* Change default snapshot shard path type to hashed_prefix for testing

Signed-off-by: Ashish Singh <[email protected]>

* Fix failing tests

Signed-off-by: Ashish Singh <[email protected]>

* Introduce single method for all create/put repository calls

Signed-off-by: Ashish Singh <[email protected]>

* Move the index shard path upload to sync upload

Signed-off-by: Ashish Singh <[email protected]>

* Fix spotless errors

Signed-off-by: Ashish Singh <[email protected]>

* Do minor code refactor

Signed-off-by: Ashish Singh <[email protected]>

* Fix tests

Signed-off-by: Ashish Singh <[email protected]>

* More tests to use common methods for repo creation

Signed-off-by: Ashish Singh <[email protected]>

* Address comments and fix multiple failing tests

Signed-off-by: Ashish Singh <[email protected]>

---------

Signed-off-by: Ashish Singh <[email protected]>
dk2k pushed a commit to dk2k/OpenSearch that referenced this pull request Oct 21, 2024
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
backport 2.x Backport to 2.x branch backport-failed discuss Issues intended to help drive brainstorming and decision making enhancement Enhancement or improvement to existing feature or request RFC Issues requesting major changes Storage:Snapshots
Projects
Status: ✅ Done
Development

Successfully merging this pull request may close these issues.

[RFC] Optimized Prefix Pattern for Shard-Level Files for Efficient Snapshots
4 participants