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

[Remote Segment Store] Make metadata file immutable #8363

Merged
merged 12 commits into from
Jul 6, 2023

Conversation

sachinpkale
Copy link
Member

@sachinpkale sachinpkale commented Jun 29, 2023

Description

  • Currently, metadata file in remote segment store is overwritten at each refresh and new file is created only at commit.
  • This was done to keep the number of metadata files limited so that reading latest metadata file will be quick.
  • But this can create concurrency issues as the file that is getting uploaded and the file that is getting read can be different due to same name.
  • To avoid this, in this PR, we make the remote segment store metadata file immutable. We make sure to upload metadata file with different name at each refresh.
  • Following is the format that we are using:
metadata_<Inverted Primary Term>_<Inverted Commit Generation>_<Inverted Translog Generation>
  • Here, each inverted number is represented as Long.MAX_VALUE - original number padded with 0s at the front to make the length consistent with that of Long.MAX_VALUE.
  • The reason behind using inverted values is to make use of Lexicographic sort order that is supported in majority of the blob stores that remote store feature supports.
  • Using translog generation is just to have a strictly increasing counter across nodes in the cluster for a given shard.

Check List

  • New functionality includes testing.
    • All tests pass
  • New functionality has been documented.
    • New functionality has javadoc added
  • Commits are signed per the DCO using --signoff
  • Commit changes are listed out in CHANGELOG.md file (See: Changelog)

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.

@github-actions
Copy link
Contributor

Gradle Check (Jenkins) Run Completed with:

@github-actions
Copy link
Contributor

Gradle Check (Jenkins) Run Completed with:

@github-actions
Copy link
Contributor

Gradle Check (Jenkins) Run Completed with:

@github-actions
Copy link
Contributor

Gradle Check (Jenkins) Run Completed with:

@sachinpkale sachinpkale force-pushed the new-metadata-integration branch from 9e8bcf8 to 018f7d0 Compare July 1, 2023 13:44
@github-actions
Copy link
Contributor

github-actions bot commented Jul 1, 2023

Gradle Check (Jenkins) Run Completed with:

@github-actions
Copy link
Contributor

github-actions bot commented Jul 1, 2023

Gradle Check (Jenkins) Run Completed with:

@github-actions
Copy link
Contributor

github-actions bot commented Jul 1, 2023

Gradle Check (Jenkins) Run Completed with:

@github-actions
Copy link
Contributor

github-actions bot commented Jul 2, 2023

Gradle Check (Jenkins) Run Completed with:

@github-actions
Copy link
Contributor

github-actions bot commented Jul 2, 2023

Gradle Check (Jenkins) Run Completed with:

@github-actions
Copy link
Contributor

github-actions bot commented Jul 2, 2023

Gradle Check (Jenkins) Run Completed with:

@github-actions
Copy link
Contributor

github-actions bot commented Jul 2, 2023

Gradle Check (Jenkins) Run Completed with:

@sachinpkale
Copy link
Member Author

Tagging @harishbhakuni21 to review changes to snapshot interoperability logic as part of this PR.

@sachinpkale sachinpkale changed the title [Remote Segment Store] New immutable metadata integration in RemoteSegmentStoreDirectory [Remote Segment Store] Make metadata file immutable Jul 2, 2023
@github-actions
Copy link
Contributor

github-actions bot commented Jul 2, 2023

Gradle Check (Jenkins) Run Completed with:

@github-actions
Copy link
Contributor

github-actions bot commented Jul 3, 2023

Gradle Check (Jenkins) Run Completed with:

  • RESULT: UNSTABLE ❕
  • TEST FAILURES:
      1 org.opensearch.remotestore.SegmentReplicationUsingRemoteStoreIT.testNodeDropWithOngoingReplication
      1 org.opensearch.index.IndexServiceTests.testAsyncTranslogTrimTaskOnClosedIndex
      1 org.opensearch.cluster.allocation.AwarenessAllocationIT.testThreeZoneOneReplicaWithForceZoneValueAndLoadAwareness

@codecov
Copy link

codecov bot commented Jul 3, 2023

Codecov Report

Merging #8363 (597a712) into main (eca5a6c) will increase coverage by 0.06%.
The diff coverage is 90.74%.

@@             Coverage Diff              @@
##               main    #8363      +/-   ##
============================================
+ Coverage     70.87%   70.93%   +0.06%     
- Complexity    56923    56944      +21     
============================================
  Files          4758     4758              
  Lines        269219   269221       +2     
  Branches      39407    39402       -5     
============================================
+ Hits         190800   190963     +163     
+ Misses        62352    62107     -245     
- Partials      16067    16151      +84     
Impacted Files Coverage Δ
...opensearch/index/translog/NoOpTranslogManager.java 63.63% <0.00%> (-1.99%) ⬇️
...search/index/shard/RemoteStoreRefreshListener.java 84.84% <66.66%> (-0.21%) ⬇️
...va/org/opensearch/index/store/RemoteDirectory.java 88.37% <87.50%> (-0.52%) ⬇️
...earch/index/store/RemoteSegmentStoreDirectory.java 92.09% <100.00%> (+0.17%) ⬆️
...search/index/translog/InternalTranslogManager.java 67.13% <100.00%> (-4.70%) ⬇️

... and 496 files with indirect coverage changes

@sachinpkale sachinpkale marked this pull request as ready for review July 3, 2023 01:34
Sachin Kale added 6 commits July 6, 2023 14:06
Signed-off-by: Sachin Kale <kalsac@amazon.com>
Signed-off-by: Sachin Kale <kalsac@amazon.com>
Signed-off-by: Sachin Kale <kalsac@amazon.com>
Signed-off-by: Sachin Kale <kalsac@amazon.com>
Signed-off-by: Sachin Kale <kalsac@amazon.com>
Signed-off-by: Sachin Kale <kalsac@amazon.com>
@sachinpkale sachinpkale force-pushed the new-metadata-integration branch from 1213cc9 to e0823f1 Compare July 6, 2023 08:37
@github-actions
Copy link
Contributor

github-actions bot commented Jul 6, 2023

Gradle Check (Jenkins) Run Completed with:

  • RESULT: UNSTABLE ❕
  • TEST FAILURES:
      1 org.opensearch.remotestore.RemoteStoreIT.testStaleCommitDeletionWithoutInvokeFlush

Signed-off-by: Sachin Kale <kalsac@amazon.com>
@github-actions
Copy link
Contributor

github-actions bot commented Jul 6, 2023

Gradle Check (Jenkins) Run Completed with:

  • RESULT: UNSTABLE ❕
  • TEST FAILURES:
      2 org.opensearch.remotestore.RemoteStoreIT.testStaleCommitDeletionWithInvokeFlush
      1 org.opensearch.repositories.azure.AzureBlobContainerRetriesTests.testReadNonexistentBlobThrowsNoSuchFileException
      1 org.opensearch.remotestore.RemoteStoreIT.testStaleCommitDeletionWithoutInvokeFlush

@gbbafna gbbafna merged commit 5c0e3c9 into opensearch-project:main Jul 6, 2023
@gbbafna gbbafna added the backport 2.x Backport to 2.x branch label Jul 6, 2023
@opensearch-trigger-bot
Copy link
Contributor

The backport to 2.x failed:

The process '/usr/bin/git' failed with exit code 128

To backport manually, run these commands in your terminal:

# Fetch latest updates from GitHub
git fetch
# Create a new working tree
git worktree add ../.worktrees/backport-2.x 2.x
# Navigate to the new working tree
pushd ../.worktrees/backport-2.x
# Create a new branch
git switch --create backport/backport-8363-to-2.x
# Cherry-pick the merged commit of this pull request and resolve the conflicts
git cherry-pick -x --mainline 1 5c0e3c94950796f7c99a20456528181ae9f16bbf
# Push it to GitHub
git push --set-upstream origin backport/backport-8363-to-2.x
# Go back to the original working tree
popd
# Delete the working tree
git worktree remove ../.worktrees/backport-2.x

Then, create a pull request where the base branch is 2.x and the compare/head branch is backport/backport-8363-to-2.x.

sachinpkale added a commit to sachinpkale/OpenSearch that referenced this pull request Jul 8, 2023
sachinpkale added a commit to sachinpkale/OpenSearch that referenced this pull request Jul 8, 2023
…ct#8363)

Authored-by: Sachin Kale <kalsac@amazon.com>
Signed-off-by: Sachin Kale <kalsac@amazon.com>
sachinpkale added a commit to sachinpkale/OpenSearch that referenced this pull request Jul 10, 2023
…ct#8363)

Authored-by: Sachin Kale <kalsac@amazon.com>
Signed-off-by: Sachin Kale <kalsac@amazon.com>
sachinpkale added a commit to sachinpkale/OpenSearch that referenced this pull request Jul 11, 2023
…ct#8363)

Authored-by: Sachin Kale <kalsac@amazon.com>
Signed-off-by: Sachin Kale <kalsac@amazon.com>
sachinpkale added a commit to sachinpkale/OpenSearch that referenced this pull request Jul 11, 2023
…ct#8363)

Authored-by: Sachin Kale <kalsac@amazon.com>
Signed-off-by: Sachin Kale <kalsac@amazon.com>
gbbafna pushed a commit that referenced this pull request Jul 11, 2023
vikasvb90 pushed a commit to raghuvanshraj/OpenSearch that referenced this pull request Jul 12, 2023
raghuvanshraj pushed a commit to raghuvanshraj/OpenSearch that referenced this pull request Jul 12, 2023
buddharajusahil pushed a commit to buddharajusahil/OpenSearch that referenced this pull request Jul 18, 2023
…ct#8363)

Authored-by: Sachin Kale <kalsac@amazon.com>
Signed-off-by: sahil buddharaju <sahilbud@amazon.com>
baba-devv pushed a commit to baba-devv/OpenSearch that referenced this pull request Jul 29, 2023
shiv0408 pushed a commit to Gaurav614/OpenSearch that referenced this pull request Apr 25, 2024
…ct#8363)

Authored-by: Sachin Kale <kalsac@amazon.com>
Signed-off-by: Shivansh Arora <hishiv@amazon.com>
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 skip-changelog
Projects
None yet
Development

Successfully merging this pull request may close these issues.

3 participants