diff --git a/paimon-common/src/main/java/org/apache/paimon/fs/FileIO.java b/paimon-common/src/main/java/org/apache/paimon/fs/FileIO.java index bbc69d6f3c54..cd9022e232bf 100644 --- a/paimon-common/src/main/java/org/apache/paimon/fs/FileIO.java +++ b/paimon-common/src/main/java/org/apache/paimon/fs/FileIO.java @@ -335,6 +335,10 @@ default Optional readOverwrittenFileUtf8(Path path) throws IOException { */ static FileIO get(Path path, CatalogContext config) throws IOException { URI uri = path.toUri(); + if (LOG.isDebugEnabled()) { + LOG.debug("Getting FileIO by scheme {}.", uri.getScheme()); + } + if (uri.getScheme() == null) { return new LocalFileIO(); } @@ -362,6 +366,12 @@ static FileIO get(Path path, CatalogContext config) throws IOException { FileIOLoader preferIOLoader = config.preferIO(); try { loader = checkAccess(preferIOLoader, path, config); + if (loader != null && LOG.isDebugEnabled()) { + LOG.debug( + "Found preferIOLoader {} with scheme {}.", + loader.getClass().getName(), + loader.getScheme()); + } } catch (IOException ioException) { ioExceptionList.add(ioException); } @@ -369,6 +379,18 @@ static FileIO get(Path path, CatalogContext config) throws IOException { if (loader == null) { Map loaders = discoverLoaders(); loader = loaders.get(uri.getScheme()); + if (!loaders.isEmpty() && LOG.isDebugEnabled()) { + LOG.debug( + "Discovered FileIOLoaders: {}.", + loaders.entrySet().stream() + .map( + e -> + String.format( + "{%s,%s}", + e.getKey(), + e.getValue().getClass().getName())) + .collect(Collectors.joining(","))); + } } // load fallbackIO @@ -401,6 +423,11 @@ static FileIO get(Path path, CatalogContext config) throws IOException { + "%s", String.join("\n", missOptions))); ioExceptionList.add(exception); + if (LOG.isDebugEnabled()) { + LOG.debug( + "Got {} but miss options. Will try to get fallback IO and Hadoop IO respectively.", + loader.getClass().getName()); + } loader = null; } } @@ -408,6 +435,9 @@ static FileIO get(Path path, CatalogContext config) throws IOException { if (loader == null) { try { loader = checkAccess(fallbackIO, path, config); + if (loader != null && LOG.isDebugEnabled()) { + LOG.debug("Got fallback FileIOLoader: {}.", loader.getClass().getName()); + } } catch (IOException ioException) { ioExceptionList.add(ioException); } @@ -417,6 +447,9 @@ static FileIO get(Path path, CatalogContext config) throws IOException { if (loader == null) { try { loader = checkAccess(new HadoopFileIOLoader(), path, config); + if (loader != null && LOG.isDebugEnabled()) { + LOG.debug("Got hadoop FileIOLoader: {}.", loader.getClass().getName()); + } } catch (IOException ioException) { ioExceptionList.add(ioException); }