WencongLiu commented on code in PR #453:
URL: https://github.com/apache/flink-table-store/pull/453#discussion_r1061142837
##########
flink-table-store-core/src/main/java/org/apache/flink/table/store/file/utils/SnapshotManager.java:
##########
@@ -214,13 +217,22 @@ public Optional<Snapshot> latestSnapshotOfUser(String
user) {
public Long readHint(String fileName) {
Path snapshotDir = snapshotDirectory();
Path path = new Path(snapshotDir, fileName);
+ int retryNumber = 0;
try {
- if (path.getFileSystem().exists(path)) {
- return Long.parseLong(FileUtils.readFileUtf8(path));
+ while (retryNumber++ < READ_HINT_RETRY_NUM) {
+ if (path.getFileSystem().exists(path)) {
+ return Long.parseLong(FileUtils.readFileUtf8(path));
Review Comment:
Done.
##########
flink-table-store-core/src/main/java/org/apache/flink/table/store/file/utils/SnapshotManager.java:
##########
@@ -211,16 +214,18 @@ public Optional<Snapshot> latestSnapshotOfUser(String
user) {
return findByListFiles(Math::min);
}
- public Long readHint(String fileName) {
+ public Long readHint(String fileName) throws IOException,
InterruptedException{
Path snapshotDir = snapshotDirectory();
Path path = new Path(snapshotDir, fileName);
- try {
+ int retryNumber = 0;
+ while (retryNumber++ < READ_HINT_RETRY_NUM) {
if (path.getFileSystem().exists(path)) {
- return Long.parseLong(FileUtils.readFileUtf8(path));
+ try {
+ return Long.parseLong(FileUtils.readFileUtf8(path));
+ } catch (IOException ignored) {
+ }
}
- } catch (Exception e) {
- LOG.info(
- "Failed to read hint file " + fileName + ". Falling back
to listing files.", e);
+ TimeUnit.MILLISECONDS.sleep(READ_HINT_RETRY_INTERVAL);
Review Comment:
Done.
--
This is an automated message from the Apache Git Service.
To respond to the message, please log on to GitHub and use the
URL above to go to the specific comment.
To unsubscribe, e-mail: [email protected]
For queries about this service, please contact Infrastructure at:
[email protected]