You are viewing a plain text version of this content. The canonical link for it is here.
Posted to gitbox@hive.apache.org by "abstractdog (via GitHub)" <gi...@apache.org> on 2023/04/25 16:15:29 UTC

[GitHub] [hive] abstractdog opened a new pull request, #4268: HIVE-27295: Improve docker logging in AbstractExternalDB

abstractdog opened a new pull request, #4268:
URL: https://github.com/apache/hive/pull/4268

   <!--
   Thanks for sending a pull request!  Here are some tips for you:
     1. If this is your first time, please read our contributor guidelines: https://cwiki.apache.org/confluence/display/Hive/HowToContribute
     2. Ensure that you have created an issue on the Hive project JIRA: https://issues.apache.org/jira/projects/HIVE/summary
     3. Ensure you have added or run the appropriate tests for your PR: 
     4. If the PR is unfinished, add '[WIP]' in your PR title, e.g., '[WIP]HIVE-XXXXX:  Your PR title ...'.
     5. Be sure to keep the PR description updated to reflect all changes.
     6. Please write your PR title to summarize what this PR proposes.
     7. If possible, provide a concise example to reproduce the issue for a faster review.
   
   -->
   
   ### What changes were proposed in this pull request?
   <!--
   Please clarify what changes you are proposing. The purpose of this section is to outline the changes and how this PR fixes the issue. 
   If possible, please consider writing useful notes for better and faster reviews in your PR. See the examples below.
     1. If you refactor some codes with changing classes, showing the class hierarchy will help reviewers.
     2. If you fix some SQL features, you can provide some references of other DBMSes.
     3. If there is design documentation, please add the link.
     4. If there is a discussion in the mailing list, please add the link.
   -->
   
   
   ### Why are the changes needed?
   <!--
   Please clarify why the changes are needed. For instance,
     1. If you propose a new API, clarify the use case for a new API.
     2. If you fix a bug, you can clarify why it is a bug.
   -->
   
   
   ### Does this PR introduce _any_ user-facing change?
   <!--
   Note that it means *any* user-facing change including all aspects such as the documentation fix.
   If yes, please clarify the previous behavior and the change this PR proposes - provide the console output, description, screenshot and/or a reproducable example to show the behavior difference if possible.
   If possible, please also clarify if this is a user-facing change compared to the released Hive versions or within the unreleased branches such as master.
   If no, write 'No'.
   -->
   
   
   ### How was this patch tested?
   <!--
   If tests were added, say they were added here. Please make sure to add some test cases that check the changes thoroughly including negative and positive cases if possible.
   If it was tested in a way different from regular unit tests, please clarify how you tested step by step, ideally copy and paste-able, so that other reviewers can test and check, and descendants can verify in the future.
   If tests were not added, please describe why they were not added and/or why it was difficult to add.
   -->
   


-- 
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.

To unsubscribe, e-mail: gitbox-unsubscribe@hive.apache.org

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


[GitHub] [hive] TuroczyX commented on a diff in pull request #4268: HIVE-27295: Improve docker logging in AbstractExternalDB

Posted by "TuroczyX (via GitHub)" <gi...@apache.org>.
TuroczyX commented on code in PR #4268:
URL: https://github.com/apache/hive/pull/4268#discussion_r1176935426


##########
itests/util/src/main/java/org/apache/hadoop/hive/ql/externalDB/AbstractExternalDB.java:
##########
@@ -99,41 +98,52 @@ private ProcessResults runCmd(String[] cmd, long secondsToWait)
         reader = new BufferedReader(new InputStreamReader(proc.getErrorStream()));
         final StringBuilder errLines = new StringBuilder();
         reader.lines().forEach(s -> errLines.append(s).append('\n'));
-        LOG.info("Result size: " + lines.length() + ";" + errLines.length());
+        LOG.info("Result lines#: {}(stdout);{}(stderr)",lines.length(), errLines.length());
         return new ProcessResults(lines.toString(), errLines.toString(), proc.exitValue());
     }
 
-    private int runCmdAndPrintStreams(String[] cmd, long secondsToWait)
+    private ProcessResults runCmdAndPrintStreams(String[] cmd, long secondsToWait)
             throws InterruptedException, IOException {
         ProcessResults results = runCmd(cmd, secondsToWait);
         LOG.info("Stdout from proc: " + results.stdout);
         LOG.info("Stderr from proc: " + results.stderr);
-        return results.rc;
+        return results;
     }
 
 
     public void launchDockerContainer() throws Exception {
         runCmdAndPrintStreams(buildRmCmd(), 600);
-        if (runCmdAndPrintStreams(buildRunCmd(), 600) != 0) {
+        if (runCmdAndPrintStreams(buildRunCmd(), 600).rc != 0) {
             throw new RuntimeException("Unable to start docker container");
         }
         long startTime = System.currentTimeMillis();
         ProcessResults pr;
         do {
             Thread.sleep(1000);
-            pr = runCmd(buildLogCmd(), 30);
+            pr = runCmdAndPrintStreams(buildLogCmd(), 30);
             if (pr.rc != 0) {
-                throw new RuntimeException("Failed to get docker logs");
+              printDockerEvents();
+              throw new RuntimeException("Failed to get docker logs");
             }
         } while (startTime + MAX_STARTUP_WAIT >= System.currentTimeMillis() && !isContainerReady(pr));
         if (startTime + MAX_STARTUP_WAIT < System.currentTimeMillis()) {
-            throw new RuntimeException("Container failed to be ready in " + MAX_STARTUP_WAIT/1000 +
-                    " seconds");
+          printDockerEvents();
+          throw new RuntimeException("Container failed to be ready in " + MAX_STARTUP_WAIT/1000 +
+                  " seconds, check docker logs output in hive logs");
         }
     }
 
+    public void printDockerEvents() {
+      try {
+        runCmdAndPrintStreams(new String[] { "docker", "events", "--since", "24h", "--until", "0s" }, 3);
+      } catch (Exception e) {
+        LOG.info("Error while getting docker events, this was an analytical best effort step, no further actions...",

Review Comment:
   Alternative text: There was a problem encountered while attempting to retrieve Docker events. The system made an analytical best effort to resolve the issue, and at this point, no further actions are necessary.



-- 
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.

To unsubscribe, e-mail: gitbox-unsubscribe@hive.apache.org

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


[GitHub] [hive] abstractdog commented on a diff in pull request #4268: HIVE-27295: Improve docker logging in AbstractExternalDB

Posted by "abstractdog (via GitHub)" <gi...@apache.org>.
abstractdog commented on code in PR #4268:
URL: https://github.com/apache/hive/pull/4268#discussion_r1177128998


##########
itests/util/src/main/java/org/apache/hadoop/hive/ql/externalDB/AbstractExternalDB.java:
##########
@@ -99,41 +98,52 @@ private ProcessResults runCmd(String[] cmd, long secondsToWait)
         reader = new BufferedReader(new InputStreamReader(proc.getErrorStream()));
         final StringBuilder errLines = new StringBuilder();
         reader.lines().forEach(s -> errLines.append(s).append('\n'));
-        LOG.info("Result size: " + lines.length() + ";" + errLines.length());
+        LOG.info("Result lines#: {}(stdout);{}(stderr)",lines.length(), errLines.length());
         return new ProcessResults(lines.toString(), errLines.toString(), proc.exitValue());
     }
 
-    private int runCmdAndPrintStreams(String[] cmd, long secondsToWait)
+    private ProcessResults runCmdAndPrintStreams(String[] cmd, long secondsToWait)
             throws InterruptedException, IOException {
         ProcessResults results = runCmd(cmd, secondsToWait);
         LOG.info("Stdout from proc: " + results.stdout);
         LOG.info("Stderr from proc: " + results.stderr);
-        return results.rc;
+        return results;
     }
 
 
     public void launchDockerContainer() throws Exception {
         runCmdAndPrintStreams(buildRmCmd(), 600);
-        if (runCmdAndPrintStreams(buildRunCmd(), 600) != 0) {
+        if (runCmdAndPrintStreams(buildRunCmd(), 600).rc != 0) {
             throw new RuntimeException("Unable to start docker container");
         }
         long startTime = System.currentTimeMillis();
         ProcessResults pr;
         do {
             Thread.sleep(1000);
-            pr = runCmd(buildLogCmd(), 30);
+            pr = runCmdAndPrintStreams(buildLogCmd(), 30);
             if (pr.rc != 0) {
-                throw new RuntimeException("Failed to get docker logs");
+              printDockerEvents();
+              throw new RuntimeException("Failed to get docker logs");
             }
         } while (startTime + MAX_STARTUP_WAIT >= System.currentTimeMillis() && !isContainerReady(pr));
         if (startTime + MAX_STARTUP_WAIT < System.currentTimeMillis()) {
-            throw new RuntimeException("Container failed to be ready in " + MAX_STARTUP_WAIT/1000 +
-                    " seconds");
+          printDockerEvents();
+          throw new RuntimeException("Container failed to be ready in " + MAX_STARTUP_WAIT/1000 +
+                  " seconds, check docker logs output in hive logs");
         }
     }
 
+    public void printDockerEvents() {
+      try {
+        runCmdAndPrintStreams(new String[] { "docker", "events", "--since", "24h", "--until", "0s" }, 3);
+      } catch (Exception e) {
+        LOG.info("Error while getting docker events, this was an analytical best effort step, no further actions...",

Review Comment:
   ack



-- 
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.

To unsubscribe, e-mail: gitbox-unsubscribe@hive.apache.org

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


[GitHub] [hive] sonarcloud[bot] commented on pull request #4268: HIVE-27295: Improve docker logging in AbstractExternalDB

Posted by "sonarcloud[bot] (via GitHub)" <gi...@apache.org>.
sonarcloud[bot] commented on PR #4268:
URL: https://github.com/apache/hive/pull/4268#issuecomment-1522534529

   Kudos, SonarCloud Quality Gate passed!&nbsp; &nbsp; [![Quality Gate passed](https://sonarsource.github.io/sonarcloud-github-static-resources/v2/checks/QualityGateBadge/passed-16px.png 'Quality Gate passed')](https://sonarcloud.io/dashboard?id=apache_hive&pullRequest=4268)
   
   [![Bug](https://sonarsource.github.io/sonarcloud-github-static-resources/v2/common/bug-16px.png 'Bug')](https://sonarcloud.io/project/issues?id=apache_hive&pullRequest=4268&resolved=false&types=BUG) [![C](https://sonarsource.github.io/sonarcloud-github-static-resources/v2/checks/RatingBadge/C-16px.png 'C')](https://sonarcloud.io/project/issues?id=apache_hive&pullRequest=4268&resolved=false&types=BUG) [1 Bug](https://sonarcloud.io/project/issues?id=apache_hive&pullRequest=4268&resolved=false&types=BUG)  
   [![Vulnerability](https://sonarsource.github.io/sonarcloud-github-static-resources/v2/common/vulnerability-16px.png 'Vulnerability')](https://sonarcloud.io/project/issues?id=apache_hive&pullRequest=4268&resolved=false&types=VULNERABILITY) [![A](https://sonarsource.github.io/sonarcloud-github-static-resources/v2/checks/RatingBadge/A-16px.png 'A')](https://sonarcloud.io/project/issues?id=apache_hive&pullRequest=4268&resolved=false&types=VULNERABILITY) [0 Vulnerabilities](https://sonarcloud.io/project/issues?id=apache_hive&pullRequest=4268&resolved=false&types=VULNERABILITY)  
   [![Security Hotspot](https://sonarsource.github.io/sonarcloud-github-static-resources/v2/common/security_hotspot-16px.png 'Security Hotspot')](https://sonarcloud.io/project/security_hotspots?id=apache_hive&pullRequest=4268&resolved=false&types=SECURITY_HOTSPOT) [![A](https://sonarsource.github.io/sonarcloud-github-static-resources/v2/checks/RatingBadge/A-16px.png 'A')](https://sonarcloud.io/project/security_hotspots?id=apache_hive&pullRequest=4268&resolved=false&types=SECURITY_HOTSPOT) [0 Security Hotspots](https://sonarcloud.io/project/security_hotspots?id=apache_hive&pullRequest=4268&resolved=false&types=SECURITY_HOTSPOT)  
   [![Code Smell](https://sonarsource.github.io/sonarcloud-github-static-resources/v2/common/code_smell-16px.png 'Code Smell')](https://sonarcloud.io/project/issues?id=apache_hive&pullRequest=4268&resolved=false&types=CODE_SMELL) [![A](https://sonarsource.github.io/sonarcloud-github-static-resources/v2/checks/RatingBadge/A-16px.png 'A')](https://sonarcloud.io/project/issues?id=apache_hive&pullRequest=4268&resolved=false&types=CODE_SMELL) [0 Code Smells](https://sonarcloud.io/project/issues?id=apache_hive&pullRequest=4268&resolved=false&types=CODE_SMELL)
   
   [![No Coverage information](https://sonarsource.github.io/sonarcloud-github-static-resources/v2/checks/CoverageChart/NoCoverageInfo-16px.png 'No Coverage information')](https://sonarcloud.io/component_measures?id=apache_hive&pullRequest=4268&metric=coverage&view=list) No Coverage information  
   [![No Duplication information](https://sonarsource.github.io/sonarcloud-github-static-resources/v2/checks/Duplications/NoDuplicationInfo-16px.png 'No Duplication information')](https://sonarcloud.io/component_measures?id=apache_hive&pullRequest=4268&metric=duplicated_lines_density&view=list) No Duplication information
   
   


-- 
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.

To unsubscribe, e-mail: gitbox-unsubscribe@hive.apache.org

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


[GitHub] [hive] zabetak commented on a diff in pull request #4268: HIVE-27295: Improve docker logging in AbstractExternalDB

Posted by "zabetak (via GitHub)" <gi...@apache.org>.
zabetak commented on code in PR #4268:
URL: https://github.com/apache/hive/pull/4268#discussion_r1177577590


##########
itests/util/src/main/java/org/apache/hadoop/hive/ql/externalDB/AbstractExternalDB.java:
##########
@@ -99,41 +97,54 @@ private ProcessResults runCmd(String[] cmd, long secondsToWait)
         reader = new BufferedReader(new InputStreamReader(proc.getErrorStream()));
         final StringBuilder errLines = new StringBuilder();
         reader.lines().forEach(s -> errLines.append(s).append('\n'));
-        LOG.info("Result size: " + lines.length() + ";" + errLines.length());
+        LOG.info("Result lines#: {}(stdout);{}(stderr)",lines.length(), errLines.length());
         return new ProcessResults(lines.toString(), errLines.toString(), proc.exitValue());
     }
 
-    private int runCmdAndPrintStreams(String[] cmd, long secondsToWait)
+    private ProcessResults runCmdAndPrintStreams(String[] cmd, long secondsToWait)
             throws InterruptedException, IOException {
         ProcessResults results = runCmd(cmd, secondsToWait);
         LOG.info("Stdout from proc: " + results.stdout);
         LOG.info("Stderr from proc: " + results.stderr);
-        return results.rc;
+        return results;
     }
 
 
     public void launchDockerContainer() throws Exception {
         runCmdAndPrintStreams(buildRmCmd(), 600);
-        if (runCmdAndPrintStreams(buildRunCmd(), 600) != 0) {
-            throw new RuntimeException("Unable to start docker container");
+        if (runCmdAndPrintStreams(buildRunCmd(), 600).rc != 0) {
+          printDockerEvents();
+          throw new RuntimeException("Unable to start docker container");
         }
         long startTime = System.currentTimeMillis();
         ProcessResults pr;
         do {
             Thread.sleep(1000);
-            pr = runCmd(buildLogCmd(), 30);
+            pr = runCmdAndPrintStreams(buildLogCmd(), 30);
             if (pr.rc != 0) {
-                throw new RuntimeException("Failed to get docker logs");
+              printDockerEvents();
+              throw new RuntimeException("Failed to get docker logs");
             }
         } while (startTime + MAX_STARTUP_WAIT >= System.currentTimeMillis() && !isContainerReady(pr));
         if (startTime + MAX_STARTUP_WAIT < System.currentTimeMillis()) {
-            throw new RuntimeException("Container failed to be ready in " + MAX_STARTUP_WAIT/1000 +
-                    " seconds");
+          printDockerEvents();
+          throw new RuntimeException(
+              String.format("Container initialization failed within %d seconds. Please check the hive logs.",
+                  MAX_STARTUP_WAIT / 1000));
         }
-    }
+      }
+
+      public void printDockerEvents() {

Review Comment:
   Do we need this `public`?



-- 
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.

To unsubscribe, e-mail: gitbox-unsubscribe@hive.apache.org

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


[GitHub] [hive] abstractdog commented on a diff in pull request #4268: HIVE-27295: Improve docker logging in AbstractExternalDB

Posted by "abstractdog (via GitHub)" <gi...@apache.org>.
abstractdog commented on code in PR #4268:
URL: https://github.com/apache/hive/pull/4268#discussion_r1177594116


##########
itests/util/src/main/java/org/apache/hadoop/hive/ql/externalDB/AbstractExternalDB.java:
##########
@@ -99,41 +97,54 @@ private ProcessResults runCmd(String[] cmd, long secondsToWait)
         reader = new BufferedReader(new InputStreamReader(proc.getErrorStream()));
         final StringBuilder errLines = new StringBuilder();
         reader.lines().forEach(s -> errLines.append(s).append('\n'));
-        LOG.info("Result size: " + lines.length() + ";" + errLines.length());
+        LOG.info("Result lines#: {}(stdout);{}(stderr)",lines.length(), errLines.length());
         return new ProcessResults(lines.toString(), errLines.toString(), proc.exitValue());
     }
 
-    private int runCmdAndPrintStreams(String[] cmd, long secondsToWait)
+    private ProcessResults runCmdAndPrintStreams(String[] cmd, long secondsToWait)
             throws InterruptedException, IOException {
         ProcessResults results = runCmd(cmd, secondsToWait);
         LOG.info("Stdout from proc: " + results.stdout);
         LOG.info("Stderr from proc: " + results.stderr);
-        return results.rc;
+        return results;
     }
 
 
     public void launchDockerContainer() throws Exception {
         runCmdAndPrintStreams(buildRmCmd(), 600);
-        if (runCmdAndPrintStreams(buildRunCmd(), 600) != 0) {
-            throw new RuntimeException("Unable to start docker container");
+        if (runCmdAndPrintStreams(buildRunCmd(), 600).rc != 0) {
+          printDockerEvents();
+          throw new RuntimeException("Unable to start docker container");
         }
         long startTime = System.currentTimeMillis();
         ProcessResults pr;
         do {
             Thread.sleep(1000);
-            pr = runCmd(buildLogCmd(), 30);
+            pr = runCmdAndPrintStreams(buildLogCmd(), 30);
             if (pr.rc != 0) {
-                throw new RuntimeException("Failed to get docker logs");
+              printDockerEvents();
+              throw new RuntimeException("Failed to get docker logs");
             }
         } while (startTime + MAX_STARTUP_WAIT >= System.currentTimeMillis() && !isContainerReady(pr));
         if (startTime + MAX_STARTUP_WAIT < System.currentTimeMillis()) {
-            throw new RuntimeException("Container failed to be ready in " + MAX_STARTUP_WAIT/1000 +
-                    " seconds");
+          printDockerEvents();
+          throw new RuntimeException(
+              String.format("Container initialization failed within %d seconds. Please check the hive logs.",
+                  MAX_STARTUP_WAIT / 1000));
         }
-    }
+      }
+
+      public void printDockerEvents() {

Review Comment:
   absolutely not, I'll change,thanks



-- 
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.

To unsubscribe, e-mail: gitbox-unsubscribe@hive.apache.org

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


[GitHub] [hive] abstractdog commented on a diff in pull request #4268: HIVE-27295: Improve docker logging in AbstractExternalDB

Posted by "abstractdog (via GitHub)" <gi...@apache.org>.
abstractdog commented on code in PR #4268:
URL: https://github.com/apache/hive/pull/4268#discussion_r1177128319


##########
itests/util/src/main/java/org/apache/hadoop/hive/ql/externalDB/AbstractExternalDB.java:
##########
@@ -99,41 +98,52 @@ private ProcessResults runCmd(String[] cmd, long secondsToWait)
         reader = new BufferedReader(new InputStreamReader(proc.getErrorStream()));
         final StringBuilder errLines = new StringBuilder();
         reader.lines().forEach(s -> errLines.append(s).append('\n'));
-        LOG.info("Result size: " + lines.length() + ";" + errLines.length());
+        LOG.info("Result lines#: {}(stdout);{}(stderr)",lines.length(), errLines.length());
         return new ProcessResults(lines.toString(), errLines.toString(), proc.exitValue());
     }
 
-    private int runCmdAndPrintStreams(String[] cmd, long secondsToWait)
+    private ProcessResults runCmdAndPrintStreams(String[] cmd, long secondsToWait)
             throws InterruptedException, IOException {
         ProcessResults results = runCmd(cmd, secondsToWait);
         LOG.info("Stdout from proc: " + results.stdout);
         LOG.info("Stderr from proc: " + results.stderr);
-        return results.rc;
+        return results;
     }
 
 
     public void launchDockerContainer() throws Exception {
         runCmdAndPrintStreams(buildRmCmd(), 600);
-        if (runCmdAndPrintStreams(buildRunCmd(), 600) != 0) {
+        if (runCmdAndPrintStreams(buildRunCmd(), 600).rc != 0) {
             throw new RuntimeException("Unable to start docker container");
         }
         long startTime = System.currentTimeMillis();
         ProcessResults pr;
         do {
             Thread.sleep(1000);
-            pr = runCmd(buildLogCmd(), 30);
+            pr = runCmdAndPrintStreams(buildLogCmd(), 30);
             if (pr.rc != 0) {
-                throw new RuntimeException("Failed to get docker logs");
+              printDockerEvents();
+              throw new RuntimeException("Failed to get docker logs");
             }
         } while (startTime + MAX_STARTUP_WAIT >= System.currentTimeMillis() && !isContainerReady(pr));
         if (startTime + MAX_STARTUP_WAIT < System.currentTimeMillis()) {
-            throw new RuntimeException("Container failed to be ready in " + MAX_STARTUP_WAIT/1000 +
-                    " seconds");
+          printDockerEvents();
+          throw new RuntimeException("Container failed to be ready in " + MAX_STARTUP_WAIT/1000 +
+                  " seconds, check docker logs output in hive logs");
         }
     }
 
+    public void printDockerEvents() {
+      try {
+        runCmdAndPrintStreams(new String[] { "docker", "events", "--since", "24h", "--until", "0s" }, 3);
+      } catch (Exception e) {
+        LOG.info("Error while getting docker events, this was an analytical best effort step, no further actions...",

Review Comment:
   ack, I'll edit this one too
   your message makes sense, except that "to resolve the issue" is not 100% true, docker events cmd just lists the docker events to make us able to guess what happened, so this would be the ideal one:
   ```
   A problem was encountered while attempting to retrieve Docker events (the system made an analytical best effort to list the events to reveal the root cause). No further actions are necessary.
   ```



-- 
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.

To unsubscribe, e-mail: gitbox-unsubscribe@hive.apache.org

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


[GitHub] [hive] abstractdog commented on pull request #4268: HIVE-27295: Improve docker logging in AbstractExternalDB

Posted by "abstractdog (via GitHub)" <gi...@apache.org>.
abstractdog commented on PR #4268:
URL: https://github.com/apache/hive/pull/4268#issuecomment-1523079640

   > LGTM. Since `AbstractExternalDB` is more or less a copy (unfortunately :( ) of `DatabaseRule` we may want to apply the same improvements there; it can be done as part of this PR or a separate one.
   
   makes sense, I'm porting changes to DatabaseRule, otherwise I'll forget forever


-- 
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.

To unsubscribe, e-mail: gitbox-unsubscribe@hive.apache.org

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


[GitHub] [hive] abstractdog merged pull request #4268: HIVE-27295: Improve docker logging in AbstractExternalDB

Posted by "abstractdog (via GitHub)" <gi...@apache.org>.
abstractdog merged PR #4268:
URL: https://github.com/apache/hive/pull/4268


-- 
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.

To unsubscribe, e-mail: gitbox-unsubscribe@hive.apache.org

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


[GitHub] [hive] sonarcloud[bot] commented on pull request #4268: HIVE-27295: Improve docker logging in AbstractExternalDB

Posted by "sonarcloud[bot] (via GitHub)" <gi...@apache.org>.
sonarcloud[bot] commented on PR #4268:
URL: https://github.com/apache/hive/pull/4268#issuecomment-1523712975

   Kudos, SonarCloud Quality Gate passed!&nbsp; &nbsp; [![Quality Gate passed](https://sonarsource.github.io/sonarcloud-github-static-resources/v2/checks/QualityGateBadge/passed-16px.png 'Quality Gate passed')](https://sonarcloud.io/dashboard?id=apache_hive&pullRequest=4268)
   
   [![Bug](https://sonarsource.github.io/sonarcloud-github-static-resources/v2/common/bug-16px.png 'Bug')](https://sonarcloud.io/project/issues?id=apache_hive&pullRequest=4268&resolved=false&types=BUG) [![C](https://sonarsource.github.io/sonarcloud-github-static-resources/v2/checks/RatingBadge/C-16px.png 'C')](https://sonarcloud.io/project/issues?id=apache_hive&pullRequest=4268&resolved=false&types=BUG) [1 Bug](https://sonarcloud.io/project/issues?id=apache_hive&pullRequest=4268&resolved=false&types=BUG)  
   [![Vulnerability](https://sonarsource.github.io/sonarcloud-github-static-resources/v2/common/vulnerability-16px.png 'Vulnerability')](https://sonarcloud.io/project/issues?id=apache_hive&pullRequest=4268&resolved=false&types=VULNERABILITY) [![A](https://sonarsource.github.io/sonarcloud-github-static-resources/v2/checks/RatingBadge/A-16px.png 'A')](https://sonarcloud.io/project/issues?id=apache_hive&pullRequest=4268&resolved=false&types=VULNERABILITY) [0 Vulnerabilities](https://sonarcloud.io/project/issues?id=apache_hive&pullRequest=4268&resolved=false&types=VULNERABILITY)  
   [![Security Hotspot](https://sonarsource.github.io/sonarcloud-github-static-resources/v2/common/security_hotspot-16px.png 'Security Hotspot')](https://sonarcloud.io/project/security_hotspots?id=apache_hive&pullRequest=4268&resolved=false&types=SECURITY_HOTSPOT) [![A](https://sonarsource.github.io/sonarcloud-github-static-resources/v2/checks/RatingBadge/A-16px.png 'A')](https://sonarcloud.io/project/security_hotspots?id=apache_hive&pullRequest=4268&resolved=false&types=SECURITY_HOTSPOT) [0 Security Hotspots](https://sonarcloud.io/project/security_hotspots?id=apache_hive&pullRequest=4268&resolved=false&types=SECURITY_HOTSPOT)  
   [![Code Smell](https://sonarsource.github.io/sonarcloud-github-static-resources/v2/common/code_smell-16px.png 'Code Smell')](https://sonarcloud.io/project/issues?id=apache_hive&pullRequest=4268&resolved=false&types=CODE_SMELL) [![A](https://sonarsource.github.io/sonarcloud-github-static-resources/v2/checks/RatingBadge/A-16px.png 'A')](https://sonarcloud.io/project/issues?id=apache_hive&pullRequest=4268&resolved=false&types=CODE_SMELL) [8 Code Smells](https://sonarcloud.io/project/issues?id=apache_hive&pullRequest=4268&resolved=false&types=CODE_SMELL)
   
   [![No Coverage information](https://sonarsource.github.io/sonarcloud-github-static-resources/v2/checks/CoverageChart/NoCoverageInfo-16px.png 'No Coverage information')](https://sonarcloud.io/component_measures?id=apache_hive&pullRequest=4268&metric=coverage&view=list) No Coverage information  
   [![No Duplication information](https://sonarsource.github.io/sonarcloud-github-static-resources/v2/checks/Duplications/NoDuplicationInfo-16px.png 'No Duplication information')](https://sonarcloud.io/component_measures?id=apache_hive&pullRequest=4268&metric=duplicated_lines_density&view=list) No Duplication information
   
   


-- 
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.

To unsubscribe, e-mail: gitbox-unsubscribe@hive.apache.org

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


[GitHub] [hive] TuroczyX commented on a diff in pull request #4268: HIVE-27295: Improve docker logging in AbstractExternalDB

Posted by "TuroczyX (via GitHub)" <gi...@apache.org>.
TuroczyX commented on code in PR #4268:
URL: https://github.com/apache/hive/pull/4268#discussion_r1176940073


##########
itests/util/src/main/java/org/apache/hadoop/hive/ql/externalDB/AbstractExternalDB.java:
##########
@@ -99,41 +98,52 @@ private ProcessResults runCmd(String[] cmd, long secondsToWait)
         reader = new BufferedReader(new InputStreamReader(proc.getErrorStream()));
         final StringBuilder errLines = new StringBuilder();
         reader.lines().forEach(s -> errLines.append(s).append('\n'));
-        LOG.info("Result size: " + lines.length() + ";" + errLines.length());
+        LOG.info("Result lines#: {}(stdout);{}(stderr)",lines.length(), errLines.length());
         return new ProcessResults(lines.toString(), errLines.toString(), proc.exitValue());
     }
 
-    private int runCmdAndPrintStreams(String[] cmd, long secondsToWait)
+    private ProcessResults runCmdAndPrintStreams(String[] cmd, long secondsToWait)
             throws InterruptedException, IOException {
         ProcessResults results = runCmd(cmd, secondsToWait);
         LOG.info("Stdout from proc: " + results.stdout);
         LOG.info("Stderr from proc: " + results.stderr);
-        return results.rc;
+        return results;
     }
 
 
     public void launchDockerContainer() throws Exception {
         runCmdAndPrintStreams(buildRmCmd(), 600);
-        if (runCmdAndPrintStreams(buildRunCmd(), 600) != 0) {
+        if (runCmdAndPrintStreams(buildRunCmd(), 600).rc != 0) {
             throw new RuntimeException("Unable to start docker container");
         }
         long startTime = System.currentTimeMillis();
         ProcessResults pr;
         do {
             Thread.sleep(1000);
-            pr = runCmd(buildLogCmd(), 30);
+            pr = runCmdAndPrintStreams(buildLogCmd(), 30);
             if (pr.rc != 0) {
-                throw new RuntimeException("Failed to get docker logs");
+              printDockerEvents();
+              throw new RuntimeException("Failed to get docker logs");
             }
         } while (startTime + MAX_STARTUP_WAIT >= System.currentTimeMillis() && !isContainerReady(pr));
         if (startTime + MAX_STARTUP_WAIT < System.currentTimeMillis()) {
-            throw new RuntimeException("Container failed to be ready in " + MAX_STARTUP_WAIT/1000 +
-                    " seconds");
+          printDockerEvents();
+          throw new RuntimeException("Container failed to be ready in " + MAX_STARTUP_WAIT/1000 +
+                  " seconds, check docker logs output in hive logs");
         }
     }
 
+    public void printDockerEvents() {
+      try {
+        runCmdAndPrintStreams(new String[] { "docker", "events", "--since", "24h", "--until", "0s" }, 3);
+      } catch (Exception e) {
+        LOG.info("Error while getting docker events, this was an analytical best effort step, no further actions...",

Review Comment:
   It should be warning. I guess it is more then an info, but not as important as an error. In an info message an "Error" could be confusing.



-- 
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.

To unsubscribe, e-mail: gitbox-unsubscribe@hive.apache.org

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


[GitHub] [hive] TuroczyX commented on a diff in pull request #4268: HIVE-27295: Improve docker logging in AbstractExternalDB

Posted by "TuroczyX (via GitHub)" <gi...@apache.org>.
TuroczyX commented on code in PR #4268:
URL: https://github.com/apache/hive/pull/4268#discussion_r1176932328


##########
itests/util/src/main/java/org/apache/hadoop/hive/ql/externalDB/AbstractExternalDB.java:
##########
@@ -99,41 +98,52 @@ private ProcessResults runCmd(String[] cmd, long secondsToWait)
         reader = new BufferedReader(new InputStreamReader(proc.getErrorStream()));
         final StringBuilder errLines = new StringBuilder();
         reader.lines().forEach(s -> errLines.append(s).append('\n'));
-        LOG.info("Result size: " + lines.length() + ";" + errLines.length());
+        LOG.info("Result lines#: {}(stdout);{}(stderr)",lines.length(), errLines.length());
         return new ProcessResults(lines.toString(), errLines.toString(), proc.exitValue());
     }
 
-    private int runCmdAndPrintStreams(String[] cmd, long secondsToWait)
+    private ProcessResults runCmdAndPrintStreams(String[] cmd, long secondsToWait)
             throws InterruptedException, IOException {
         ProcessResults results = runCmd(cmd, secondsToWait);
         LOG.info("Stdout from proc: " + results.stdout);
         LOG.info("Stderr from proc: " + results.stderr);
-        return results.rc;
+        return results;
     }
 
 
     public void launchDockerContainer() throws Exception {
         runCmdAndPrintStreams(buildRmCmd(), 600);
-        if (runCmdAndPrintStreams(buildRunCmd(), 600) != 0) {
+        if (runCmdAndPrintStreams(buildRunCmd(), 600).rc != 0) {
             throw new RuntimeException("Unable to start docker container");
         }
         long startTime = System.currentTimeMillis();
         ProcessResults pr;
         do {
             Thread.sleep(1000);
-            pr = runCmd(buildLogCmd(), 30);
+            pr = runCmdAndPrintStreams(buildLogCmd(), 30);
             if (pr.rc != 0) {
-                throw new RuntimeException("Failed to get docker logs");
+              printDockerEvents();
+              throw new RuntimeException("Failed to get docker logs");
             }
         } while (startTime + MAX_STARTUP_WAIT >= System.currentTimeMillis() && !isContainerReady(pr));
         if (startTime + MAX_STARTUP_WAIT < System.currentTimeMillis()) {
-            throw new RuntimeException("Container failed to be ready in " + MAX_STARTUP_WAIT/1000 +
-                    " seconds");
+          printDockerEvents();
+          throw new RuntimeException("Container failed to be ready in " + MAX_STARTUP_WAIT/1000 +

Review Comment:
   Bit odd exception message. Minor stuff I know.
   Container initialization is failed within x seconds. Please check the hive logs.



-- 
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.

To unsubscribe, e-mail: gitbox-unsubscribe@hive.apache.org

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


[GitHub] [hive] abstractdog commented on a diff in pull request #4268: HIVE-27295: Improve docker logging in AbstractExternalDB

Posted by "abstractdog (via GitHub)" <gi...@apache.org>.
abstractdog commented on code in PR #4268:
URL: https://github.com/apache/hive/pull/4268#discussion_r1177123758


##########
itests/util/src/main/java/org/apache/hadoop/hive/ql/externalDB/AbstractExternalDB.java:
##########
@@ -99,41 +98,52 @@ private ProcessResults runCmd(String[] cmd, long secondsToWait)
         reader = new BufferedReader(new InputStreamReader(proc.getErrorStream()));
         final StringBuilder errLines = new StringBuilder();
         reader.lines().forEach(s -> errLines.append(s).append('\n'));
-        LOG.info("Result size: " + lines.length() + ";" + errLines.length());
+        LOG.info("Result lines#: {}(stdout);{}(stderr)",lines.length(), errLines.length());
         return new ProcessResults(lines.toString(), errLines.toString(), proc.exitValue());
     }
 
-    private int runCmdAndPrintStreams(String[] cmd, long secondsToWait)
+    private ProcessResults runCmdAndPrintStreams(String[] cmd, long secondsToWait)
             throws InterruptedException, IOException {
         ProcessResults results = runCmd(cmd, secondsToWait);
         LOG.info("Stdout from proc: " + results.stdout);
         LOG.info("Stderr from proc: " + results.stderr);
-        return results.rc;
+        return results;
     }
 
 
     public void launchDockerContainer() throws Exception {
         runCmdAndPrintStreams(buildRmCmd(), 600);
-        if (runCmdAndPrintStreams(buildRunCmd(), 600) != 0) {
+        if (runCmdAndPrintStreams(buildRunCmd(), 600).rc != 0) {
             throw new RuntimeException("Unable to start docker container");
         }
         long startTime = System.currentTimeMillis();
         ProcessResults pr;
         do {
             Thread.sleep(1000);
-            pr = runCmd(buildLogCmd(), 30);
+            pr = runCmdAndPrintStreams(buildLogCmd(), 30);
             if (pr.rc != 0) {
-                throw new RuntimeException("Failed to get docker logs");
+              printDockerEvents();
+              throw new RuntimeException("Failed to get docker logs");
             }
         } while (startTime + MAX_STARTUP_WAIT >= System.currentTimeMillis() && !isContainerReady(pr));
         if (startTime + MAX_STARTUP_WAIT < System.currentTimeMillis()) {
-            throw new RuntimeException("Container failed to be ready in " + MAX_STARTUP_WAIT/1000 +
-                    " seconds");
+          printDockerEvents();
+          throw new RuntimeException("Container failed to be ready in " + MAX_STARTUP_WAIT/1000 +

Review Comment:
   yeah, odd, I'll change it



-- 
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.

To unsubscribe, e-mail: gitbox-unsubscribe@hive.apache.org

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