-
Notifications
You must be signed in to change notification settings - Fork 1k
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] Retry if snapshot commit hint failed. #4701
Changes from 1 commit
File filter
Filter by extension
Conversations
Jump to
Diff view
Diff view
There are no files selected for viewing
Original file line number | Diff line number | Diff line change |
---|---|---|
|
@@ -44,4 +44,19 @@ public static FileIOLoader checkAccess(FileIOLoader fileIO, Path path, CatalogCo | |
io.exists(path); | ||
return fileIO; | ||
} | ||
|
||
public static void overwriteFileUtf8WithRetry( | ||
FileIO fileIO, Path path, String content, int times) throws IOException { | ||
int loopTime = times; | ||
while (loopTime-- > 0) { | ||
try { | ||
fileIO.overwriteFileUtf8(path, content); | ||
return; | ||
} catch (IOException e) { | ||
if (loopTime == 0) { | ||
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. Sleep a random value here? |
||
throw e; | ||
} | ||
} | ||
} | ||
} | ||
} |
Original file line number | Diff line number | Diff line change |
---|---|---|
|
@@ -21,6 +21,7 @@ | |
import org.apache.paimon.Changelog; | ||
import org.apache.paimon.Snapshot; | ||
import org.apache.paimon.fs.FileIO; | ||
import org.apache.paimon.fs.FileIOUtils; | ||
import org.apache.paimon.fs.FileStatus; | ||
import org.apache.paimon.fs.Path; | ||
|
||
|
@@ -883,6 +884,6 @@ public void commitEarliestHint(long snapshotId) throws IOException { | |
|
||
private void commitHint(long snapshotId, String fileName, Path dir) throws IOException { | ||
Path hintFile = new Path(dir, fileName); | ||
fileIO.overwriteFileUtf8(hintFile, String.valueOf(snapshotId)); | ||
FileIOUtils.overwriteFileUtf8WithRetry(fileIO, hintFile, String.valueOf(snapshotId), 3); | ||
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. Hard code here? Or make it configurable better? 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. ok |
||
} | ||
} |
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.
inline this in commitHint