You are viewing a plain text version of this content. The canonical link for it is here.
Posted to commits@hive.apache.org by mb...@apache.org on 2021/11/29 13:59:04 UTC

[hive] branch master updated: HIVE-25741: HiveProtoLoggingHook EventLogger should always close old writer (Marton Bod, reviewed by Peter Vary)

This is an automated email from the ASF dual-hosted git repository.

mbod pushed a commit to branch master
in repository https://gitbox.apache.org/repos/asf/hive.git


The following commit(s) were added to refs/heads/master by this push:
     new 1046f41  HIVE-25741: HiveProtoLoggingHook EventLogger should always close old writer (Marton Bod, reviewed by Peter Vary)
1046f41 is described below

commit 1046f41ea36ab3c8b036481128ba9b76dda2882a
Author: Marton Bod <mb...@cloudera.com>
AuthorDate: Mon Nov 29 14:58:48 2021 +0100

    HIVE-25741: HiveProtoLoggingHook EventLogger should always close old writer (Marton Bod, reviewed by Peter Vary)
---
 .../java/org/apache/hadoop/hive/ql/hooks/HiveProtoLoggingHook.java | 7 ++++---
 1 file changed, 4 insertions(+), 3 deletions(-)

diff --git a/ql/src/java/org/apache/hadoop/hive/ql/hooks/HiveProtoLoggingHook.java b/ql/src/java/org/apache/hadoop/hive/ql/hooks/HiveProtoLoggingHook.java
index e347002..e9ffc43 100644
--- a/ql/src/java/org/apache/hadoop/hive/ql/hooks/HiveProtoLoggingHook.java
+++ b/ql/src/java/org/apache/hadoop/hive/ql/hooks/HiveProtoLoggingHook.java
@@ -313,9 +313,10 @@ public class HiveProtoLoggingHook implements ExecuteWithHookContext {
       for (int retryCount = 0; retryCount <= MAX_RETRIES; ++retryCount) {
         try {
           if (eventPerFile) {
-            if (!maybeRolloverWriterForDay()) {
-              writer = logger.getWriter(logFileName + "_" + ++logFileCount);
+            if (writer != null) {
+              IOUtils.closeQuietly(writer);
             }
+            writer = logger.getWriter(logFileName + "_" + ++logFileCount);
             LOG.debug("Event per file enabled. New proto event file: {}", writer.getPath());
             writer.writeProto(event);
             IOUtils.closeQuietly(writer);
@@ -333,7 +334,7 @@ public class HiveProtoLoggingHook implements ExecuteWithHookContext {
           if (retryCount < MAX_RETRIES) {
             LOG.warn("Error writing proto message for query {}, eventType: {}, retryCount: {}," +
                 " error: {} ", event.getHiveQueryId(), event.getEventType(), retryCount,
-                e.getMessage());
+                e.getMessage(), e);
             LOG.trace("Exception", e);
           } else {
             LOG.error("Error writing proto message for query {}, eventType: {}: ",