You are viewing a plain text version of this content. The canonical link for it is here.
Posted to gitbox@hive.apache.org by GitBox <gi...@apache.org> on 2020/09/11 05:45:24 UTC

[GitHub] [hive] rbalamohan commented on a change in pull request #1485: HIVE-24145 Fix preemption issues in reducers and file sink operators

rbalamohan commented on a change in pull request #1485:
URL: https://github.com/apache/hive/pull/1485#discussion_r486786544



##########
File path: ql/src/java/org/apache/hadoop/hive/ql/exec/FileSinkOperator.java
##########
@@ -216,29 +216,47 @@ public FSPaths(Path specPath, boolean isMmTable, boolean isDirectInsert, boolean
     }
 
     public void closeWriters(boolean abort) throws HiveException {
+      Exception exception = null;
       for (int idx = 0; idx < outWriters.length; idx++) {
         if (outWriters[idx] != null) {
           try {
             outWriters[idx].close(abort);
             updateProgress();
           } catch (IOException e) {
-            throw new HiveException(e);
+            exception = e;
+            LOG.error("Error closing " + outWriters[idx].toString(), e);
+            // continue closing others
           }
         }
       }
-      try {
+      for (int i = 0; i < updaters.length; i++) {
+        if (updaters[i] != null) {
+          SerDeStats stats = updaters[i].getStats();
+          // Ignore 0 row files except in case of insert overwrite
+          if (isDirectInsert && (stats.getRowCount() > 0 || isInsertOverwrite)) {
+            outPathsCommitted[i] = updaters[i].getUpdatedFilePath();
+          }
+          try {
+            updaters[i].close(abort);
+          } catch (IOException e) {
+            exception = e;
+            LOG.error("Error closing " + updaters[i].toString(), e);
+            // continue closing others
+          }
+        }
+      }
+      // Made an attempt to close all writers.
+      if (exception != null) {
         for (int i = 0; i < updaters.length; i++) {
           if (updaters[i] != null) {
-            SerDeStats stats = updaters[i].getStats();
-            // Ignore 0 row files except in case of insert overwrite
-            if (isDirectInsert && (stats.getRowCount() > 0 || isInsertOverwrite)) {
-              outPathsCommitted[i] = updaters[i].getUpdatedFilePath();
+            try {
+              fs.delete(updaters[i].getUpdatedFilePath(), true);
+            } catch (IOException e) {
+              e.printStackTrace();

Review comment:
       LOG?




----------------------------------------------------------------
This is an automated message from the Apache Git Service.
To respond to the message, please log on to GitHub and use the
URL above to go to the specific comment.

For queries about this service, please contact Infrastructure at:
users@infra.apache.org



---------------------------------------------------------------------
To unsubscribe, e-mail: gitbox-unsubscribe@hive.apache.org
For additional commands, e-mail: gitbox-help@hive.apache.org