-
Notifications
You must be signed in to change notification settings - Fork 990
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
[core] Introduce timeout for commit retry avoid long time loop #4668
Merged
Merged
Changes from 11 commits
Commits
Show all changes
12 commits
Select commit
Hold shift + click to select a range
e60a720
[core] Introduce max-timeout for commit retry avoid long time loop
a047998
fix style
416a2d0
fix
38b13c7
fix
ae475ef
fix
ba648c7
fix
4303d95
fix doc
d51d7a7
fix name
3a0b504
fix mills
5aaa389
1
d16020b
fix doc
ce9cb25
remove nullabl
File filter
Filter by extension
Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
|
@@ -134,6 +134,7 @@ public class FileStoreCommitImpl implements FileStoreCommit { | |
private final List<CommitCallback> commitCallbacks; | ||
private final StatsFileHandler statsFileHandler; | ||
private final BucketMode bucketMode; | ||
@Nullable private long commitTimeout; | ||
private final int commitMaxRetries; | ||
|
||
@Nullable private Lock lock; | ||
|
@@ -166,7 +167,8 @@ public FileStoreCommitImpl( | |
BucketMode bucketMode, | ||
@Nullable Integer manifestReadParallelism, | ||
List<CommitCallback> commitCallbacks, | ||
int commitMaxRetries) { | ||
int commitMaxRetries, | ||
@Nullable long commitTimeout) { | ||
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. remove @nullable There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. Done. Thanks for reminder @JingsongLi |
||
this.fileIO = fileIO; | ||
this.schemaManager = schemaManager; | ||
this.tableName = tableName; | ||
|
@@ -193,6 +195,7 @@ public FileStoreCommitImpl( | |
this.manifestReadParallelism = manifestReadParallelism; | ||
this.commitCallbacks = commitCallbacks; | ||
this.commitMaxRetries = commitMaxRetries; | ||
this.commitTimeout = commitTimeout; | ||
|
||
this.lock = null; | ||
this.ignoreEmptyCommit = true; | ||
|
@@ -723,6 +726,7 @@ private int tryCommit( | |
@Nullable String statsFileName) { | ||
int retryCount = 0; | ||
RetryResult retryResult = null; | ||
long startMillis = System.currentTimeMillis(); | ||
while (true) { | ||
Snapshot latestSnapshot = snapshotManager.latestSnapshot(); | ||
CommitResult result = | ||
|
@@ -746,13 +750,15 @@ private int tryCommit( | |
|
||
retryResult = (RetryResult) result; | ||
|
||
if (retryCount >= commitMaxRetries) { | ||
if (System.currentTimeMillis() - startMillis > commitTimeout | ||
|| retryCount >= commitMaxRetries) { | ||
retryResult.cleanAll(); | ||
throw new RuntimeException( | ||
String.format( | ||
"Commit failed after %s retries, there maybe exist commit conflicts between multiple jobs.", | ||
commitMaxRetries)); | ||
"Commit failed after %s millis with %s retries, there maybe exist commit conflicts between multiple jobs.", | ||
commitTimeout, retryCount)); | ||
} | ||
|
||
retryCount++; | ||
} | ||
return retryCount + 1; | ||
|
@@ -1052,19 +1058,22 @@ CommitResult tryCommitOnce( | |
public void compactManifest() { | ||
int retryCount = 0; | ||
ManifestCompactResult retryResult = null; | ||
long startMillis = System.currentTimeMillis(); | ||
while (true) { | ||
retryResult = compactManifest(retryResult); | ||
if (retryResult.isSuccess()) { | ||
break; | ||
} | ||
|
||
if (retryCount >= commitMaxRetries) { | ||
if (System.currentTimeMillis() - startMillis > commitTimeout | ||
|| retryCount >= commitMaxRetries) { | ||
retryResult.cleanAll(); | ||
throw new RuntimeException( | ||
String.format( | ||
"Commit compact manifest failed after %s retries, there maybe exist commit conflicts between multiple jobs.", | ||
commitMaxRetries)); | ||
"Commit failed after %s millis with %s retries, there maybe exist commit conflicts between multiple jobs.", | ||
commitTimeout, retryCount)); | ||
} | ||
|
||
retryCount++; | ||
} | ||
} | ||
|
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Oops, something went wrong.
Add this suggestion to a batch that can be applied as a single commit.
This suggestion is invalid because no changes were made to the code.
Suggestions cannot be applied while the pull request is closed.
Suggestions cannot be applied while viewing a subset of changes.
Only one suggestion per line can be applied in a batch.
Add this suggestion to a batch that can be applied as a single commit.
Applying suggestions on deleted lines is not supported.
You must change the existing code in this line in order to create a valid suggestion.
Outdated suggestions cannot be applied.
This suggestion has been applied or marked resolved.
Suggestions cannot be applied from pending reviews.
Suggestions cannot be applied on multi-line comments.
Suggestions cannot be applied while the pull request is queued to merge.
Suggestion cannot be applied right now. Please check back later.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
remove @nullable