Index: ql/src/java/org/apache/hadoop/hive/ql/io/orc/OrcRecordUpdater.java =================================================================== --- ql/src/java/org/apache/hadoop/hive/ql/io/orc/OrcRecordUpdater.java (revision 1626924) +++ ql/src/java/org/apache/hadoop/hive/ql/io/orc/OrcRecordUpdater.java (working copy) @@ -211,19 +211,30 @@ this.bucket.set(options.getBucket()); this.path = AcidUtils.createFilename(path, options); FileSystem fs = options.getFilesystem(); + FSDataOutputStream strm = null; if (fs == null) { fs = path.getFileSystem(options.getConfiguration()); } this.fs = fs; try { - FSDataOutputStream strm = fs.create(new Path(path, ACID_FORMAT), false); + strm = fs.create(new Path(path, ACID_FORMAT), false); strm.writeInt(ORC_ACID_VERSION); - strm.close(); } catch (IOException ioe) { if (LOG.isDebugEnabled()) { LOG.debug("Failed to create " + path + "/" + ACID_FORMAT + " with " + ioe); } + } finally { + try { + if (strm != null) { + strm.close(); + } + } catch (IOException ioe) { + if (LOG.isDebugEnabled()) { + LOG.debug("Failed to close FSDataOutputStream, with " + + ioe); + } + } } if (options.getMinimumTransactionId() != options.getMaximumTransactionId() && !options.isWritingBase()){