Skip to content

Commit

Permalink
Merge pull request #614 from snehashisp/disable-auto-close
Browse files Browse the repository at this point in the history
FIX: Set fs.automatic.close to false in Hadoop configuration
  • Loading branch information
snehashisp authored Apr 28, 2022
2 parents 10e8c6a + 22d3403 commit f2bddbd
Showing 1 changed file with 11 additions and 0 deletions.
11 changes: 11 additions & 0 deletions src/main/java/io/confluent/connect/hdfs/DataWriter.java
Original file line number Diff line number Diff line change
Expand Up @@ -132,6 +132,17 @@ public DataWriter(
hadoopConfiguration.addResource(new Path(config.hadoopConfDir() + "/hdfs-site.xml"));
}

// By default all FileSystem clients created through the java Hadoop clients are auto
// closed at JVM shutdown. This can interfere with the normal shutdown logic of the connector
// where the created clients are used to clean up temporary files (if the client was closed
// prior, then this operation throws a Filesystem Closed error). To prevent this behavior we
// set the Hadoop configuration fs.automatic.close to false. All created clients are closed as
// part of the connector lifecycle. This is anyways necessary as during connector deletion the
// connector lifecycle needs to close the clients, as the JVM shutdown hooks don't come into the
// picture. Hence we should always operate with fs.automatic.close as false. If in future we
// find that we are leaking client connections, we need to fix the lifecycle to close those.
hadoopConfiguration.setBoolean("fs.automatic.close", false);

if (config.kerberosAuthentication()) {
configureKerberosAuthentication(hadoopConfiguration);
}
Expand Down

0 comments on commit f2bddbd

Please sign in to comment.