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 Translog] Trimming based on remote segment upload and cleaning older tlog files #5662

Merged
merged 8 commits into from
Jan 10, 2023

Conversation

gbbafna
Copy link
Collaborator

@gbbafna gbbafna commented Dec 30, 2022

Signed-off-by: Gaurav Bafna gbbafna@amazon.com

Description

After any segment uploaded to remote store , we will update minSeqNoRequired for Translog. This is implemented only for RemoteFSTranslog .

minSeqNoRequired will be used to preserve generations to be trimmed till it is uploaded to remote store.

Once uploaded , post trimming, remote translog will be cleaned up as well along with local tlog files.

Issues Resolved

#5567

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:

@gbbafna gbbafna force-pushed the remote-txlog-minGen branch 2 times, most recently from a8e3ba0 to e1f2c43 Compare January 2, 2023 09:14
@github-actions
Copy link
Contributor

github-actions bot commented Jan 2, 2023

Gradle Check (Jenkins) Run Completed with:

@github-actions
Copy link
Contributor

github-actions bot commented Jan 2, 2023

Gradle Check (Jenkins) Run Completed with:

@github-actions
Copy link
Contributor

github-actions bot commented Jan 2, 2023

Gradle Check (Jenkins) Run Completed with:

@codecov-commenter
Copy link

codecov-commenter commented Jan 2, 2023

Codecov Report

Merging #5662 (0037a24) into main (12782f7) will increase coverage by 0.02%.
The diff coverage is 71.05%.

@@             Coverage Diff              @@
##               main    #5662      +/-   ##
============================================
+ Coverage     71.02%   71.04%   +0.02%     
- Complexity    58708    58727      +19     
============================================
  Files          4766     4766              
  Lines        280049   280087      +38     
  Branches      40434    40436       +2     
============================================
+ Hits         198892   198989      +97     
+ Misses        64945    64786     -159     
- Partials      16212    16312     +100     
Impacted Files Coverage Δ
...n/java/org/opensearch/index/engine/NoOpEngine.java 63.01% <0.00%> (-0.88%) ⬇️
...opensearch/index/translog/NoOpTranslogManager.java 64.51% <0.00%> (-2.16%) ⬇️
.../org/opensearch/index/translog/TranslogWriter.java 73.51% <ø> (-0.40%) ⬇️
...rg/opensearch/index/translog/RemoteFsTranslog.java 72.26% <52.63%> (-1.47%) ⬇️
...search/index/shard/RemoteStoreRefreshListener.java 79.81% <100.00%> (+0.57%) ⬆️
...search/index/translog/InternalTranslogManager.java 71.42% <100.00%> (+0.41%) ⬆️
...n/java/org/opensearch/index/translog/Translog.java 79.75% <100.00%> (+0.02%) ⬆️
...ex/translog/transfer/BlobStoreTransferService.java 86.66% <100.00%> (+0.95%) ⬆️
...h/index/translog/transfer/FileTransferTracker.java 88.23% <100.00%> (+3.86%) ⬆️
...dex/translog/transfer/TranslogTransferManager.java 82.97% <100.00%> (+1.36%) ⬆️
... and 489 more

Help us with your feedback. Take ten seconds to tell us how you rate us. Have a feature suggestion? Share it here.

@@ -47,6 +47,8 @@ public class RemoteFsTranslog extends Translog {
private final FileTransferTracker fileTransferTracker;
private volatile long maxRemoteTranslogGenerationUploaded;

private volatile long minSeqNoToKeep;
Copy link
Member

Choose a reason for hiding this comment

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

The default value of 0 should be good when minSeqNoToKeep has not been set ever?

Copy link
Member

Choose a reason for hiding this comment

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

Could there be a case when a replica-primary promotion has happened and this has not been initialised or primary-primary relocation (peer recovery) in which case this can be problematic?

Copy link
Collaborator Author

Choose a reason for hiding this comment

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

In worst case, the default value of 0 would prevent further truncations. There would be some assertion failures , which would be disabled in prod.

@github-actions
Copy link
Contributor

github-actions bot commented Jan 9, 2023

Gradle Check (Jenkins) Run Completed with:

Comment on lines +308 to +313
protected void setMinSeqNoToKeep(long seqNo) {
if (seqNo < this.minSeqNoToKeep) {
throw new IllegalArgumentException(
"min seq number required can't go backwards: " + "current [" + this.minSeqNoToKeep + "] new [" + seqNo + "]"
);
}
this.minSeqNoToKeep = seqNo;
Copy link
Collaborator

Choose a reason for hiding this comment

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

For my understanding min should be able to go lower right?

Copy link
Collaborator Author

Choose a reason for hiding this comment

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

No, once it is set to x +10, then we should not be able to set it to x ,as 0..x operations could have been deleted by then . We can set it to x+20 after that .

Signed-off-by: Gaurav Bafna <gbbafna@amazon.com>
Signed-off-by: Gaurav Bafna <gbbafna@amazon.com>
Signed-off-by: Gaurav Bafna <gbbafna@amazon.com>
Signed-off-by: Gaurav Bafna <gbbafna@amazon.com>
Signed-off-by: Gaurav Bafna <gbbafna@amazon.com>
Signed-off-by: Gaurav Bafna <gbbafna@amazon.com>
@gbbafna gbbafna force-pushed the remote-txlog-minGen branch from 463c931 to 3186594 Compare January 10, 2023 10:08
@github-actions
Copy link
Contributor

Gradle Check (Jenkins) Run Completed with:

Signed-off-by: Gaurav Bafna <gbbafna@amazon.com>
@github-actions
Copy link
Contributor

Gradle Check (Jenkins) Run Completed with:

Signed-off-by: Gaurav Bafna <gbbafna@amazon.com>
@github-actions
Copy link
Contributor

Gradle Check (Jenkins) Run Completed with:

@gbbafna
Copy link
Collaborator Author

gbbafna commented Jan 10, 2023

Created #5791 as per @Bukhtawar's suggestion .

@gbbafna gbbafna merged commit ff8a3af into opensearch-project:main Jan 10, 2023
sachinpkale pushed a commit to sachinpkale/OpenSearch that referenced this pull request Jan 10, 2023
…g older tlog files (opensearch-project#5662)

* RemoteFSTranslog Trimming and GC Logic

Signed-off-by: Gaurav Bafna <gbbafna@amazon.com>
Signed-off-by: Sachin Kale <kalsac@amazon.com>
sachinpkale pushed a commit to sachinpkale/OpenSearch that referenced this pull request Jan 10, 2023
…g older tlog files (opensearch-project#5662)

* RemoteFSTranslog Trimming and GC Logic

Signed-off-by: Gaurav Bafna <gbbafna@amazon.com>
Signed-off-by: Sachin Kale <kalsac@amazon.com>
sachinpkale pushed a commit to sachinpkale/OpenSearch that referenced this pull request Jan 10, 2023
…g older tlog files (opensearch-project#5662)

* RemoteFSTranslog Trimming and GC Logic

Signed-off-by: Gaurav Bafna <gbbafna@amazon.com>
Signed-off-by: Sachin Kale <kalsac@amazon.com>
gbbafna pushed a commit that referenced this pull request Jan 10, 2023
…g older tlog files (#5662) (#5793)

* RemoteFSTranslog Trimming and GC Logic

Signed-off-by: Gaurav Bafna <gbbafna@amazon.com>
gbbafna pushed a commit to gbbafna/OpenSearch that referenced this pull request Jan 10, 2023
…g older tlog files (opensearch-project#5662) (opensearch-project#5793)

* RemoteFSTranslog Trimming and GC Logic

Signed-off-by: Gaurav Bafna <gbbafna@amazon.com>
gbbafna pushed a commit that referenced this pull request Jan 10, 2023
…g older tlog files (#5662) (#5792)

* RemoteFSTranslog Trimming and GC Logic

Signed-off-by: Gaurav Bafna <gbbafna@amazon.com>
kotwanikunal pushed a commit that referenced this pull request Jan 25, 2023
…g older tlog files (#5662) (#5792)

* RemoteFSTranslog Trimming and GC Logic

Signed-off-by: Gaurav Bafna <gbbafna@amazon.com>
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
Development

Successfully merging this pull request may close these issues.

5 participants