-
Notifications
You must be signed in to change notification settings - Fork 3.6k
Do not close Hadoop FileSystem instances #13810
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
Changes from all commits
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 |
|---|---|---|
|
|
@@ -40,7 +40,6 @@ | |
| import io.trino.spi.type.VarbinaryType; | ||
| import io.trino.spi.type.VarcharType; | ||
| import org.apache.hadoop.conf.Configuration; | ||
| import org.apache.hadoop.fs.FileSystem; | ||
| import org.apache.hadoop.fs.Path; | ||
| import org.apache.hadoop.hive.ql.io.IOConstants; | ||
| import org.apache.hadoop.hive.ql.io.orc.OrcFile; | ||
|
|
@@ -217,10 +216,10 @@ private static OrcSerde createSerializer(Properties properties) | |
|
|
||
| private static RecordWriter createRecordWriter(Path target, List<Long> columnIds, List<Type> columnTypes, boolean writeMetadata) | ||
| { | ||
| try (FileSystem fileSystem = new SyncingFileSystem(CONFIGURATION)) { | ||
|
||
| try { | ||
| OrcFile.WriterOptions options = OrcFile.writerOptions(CONFIGURATION) | ||
| .memory(new NullMemoryManager()) | ||
| .fileSystem(fileSystem) | ||
| .fileSystem(new SyncingFileSystem(CONFIGURATION)) | ||
| .compress(SNAPPY); | ||
|
|
||
| if (writeMetadata) { | ||
|
|
||
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.
Will this be caught when the code uses explicit type, eg. SyncingFileSystem?
i'd guess the code might be compiled with actual implementation method name.
Maybe the shared FileSystem instances should be wrapped with something that prevents inadvertent close?
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.
Yes, as long as it's not cast to
Closeable. We're getting rid ofFileSystemusage so I'd rather not make an invasive change like that.