Skip to content

Commit 17f3c1e

Browse files
authored
[core] RemoteLookupFileManager#tryToDownload should return false when faced with exceptions (#6646)
1 parent 4d6987a commit 17f3c1e

File tree

1 file changed

+15
-9
lines changed

1 file changed

+15
-9
lines changed

paimon-core/src/main/java/org/apache/paimon/mergetree/compact/RemoteLookupFileManager.java

Lines changed: 15 additions & 9 deletions
Original file line numberDiff line numberDiff line change
@@ -32,6 +32,8 @@
3232
import org.apache.paimon.types.RowType;
3333

3434
import org.apache.commons.io.IOUtils;
35+
import org.slf4j.Logger;
36+
import org.slf4j.LoggerFactory;
3537

3638
import java.io.File;
3739
import java.io.FileInputStream;
@@ -46,6 +48,8 @@
4648
/** Manager to manage remote files for lookup. */
4749
public class RemoteLookupFileManager<T> implements RemoteFileDownloader {
4850

51+
private static final Logger LOG = LoggerFactory.getLogger(RemoteLookupFileManager.class);
52+
4953
private final FileIO fileIO;
5054
private final DataFilePathFactory pathFactory;
5155
private final TableSchema schema;
@@ -110,17 +114,19 @@ public boolean tryToDownload(DataFileMeta dataFile, File localFile) {
110114
}
111115

112116
Optional<String> remoteSst = remoteSst(dataFile);
113-
if (remoteSst.isPresent()) {
114-
Path remoteSstPath = remoteSstPath(dataFile, remoteSst.get());
115-
try (SeekableInputStream is = fileIO.newInputStream(remoteSstPath);
116-
FileOutputStream os = new FileOutputStream(localFile)) {
117-
IOUtils.copy(is, os);
118-
} catch (IOException e) {
119-
throw new RuntimeException(e);
120-
}
117+
if (!remoteSst.isPresent()) {
118+
return false;
119+
}
120+
121+
Path remoteSstPath = remoteSstPath(dataFile, remoteSst.get());
122+
try (SeekableInputStream is = fileIO.newInputStream(remoteSstPath);
123+
FileOutputStream os = new FileOutputStream(localFile)) {
124+
IOUtils.copy(is, os);
121125
return true;
126+
} catch (Exception e) {
127+
LOG.warn("Failed to download remote lookup file {}, skipping.", remoteSstPath, e);
128+
return false;
122129
}
123-
return false;
124130
}
125131

126132
private Optional<String> remoteSst(DataFileMeta file) {

0 commit comments

Comments
 (0)