From b57605294a34e77302be60b546123e0fa1bebed5 Mon Sep 17 00:00:00 2001 From: James Sun Date: Tue, 29 Aug 2017 19:47:37 -0700 Subject: [PATCH] Make sure RcFileWriter closer registers all streams We have seen in production where writeRowGroup() throws an exception that causes output streams fail to close. --- .../src/main/java/com/facebook/presto/rcfile/RcFileWriter.java | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/presto-rcfile/src/main/java/com/facebook/presto/rcfile/RcFileWriter.java b/presto-rcfile/src/main/java/com/facebook/presto/rcfile/RcFileWriter.java index 81b6d0311c28..bf67e4d50732 100644 --- a/presto-rcfile/src/main/java/com/facebook/presto/rcfile/RcFileWriter.java +++ b/presto-rcfile/src/main/java/com/facebook/presto/rcfile/RcFileWriter.java @@ -192,12 +192,12 @@ public void close() throws IOException { try (Closer closer = Closer.create()) { - writeRowGroup(); closer.register(output); closer.register(keySectionOutput::destroy); for (ColumnEncoder columnEncoder : columnEncoders) { closer.register(columnEncoder::destroy); } + writeRowGroup(); } }