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

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

commit d78608c4cec174817f5526065adc43fee78ed7c0
Author: Stamatis Zampetakis <zabe...@gmail.com>
AuthorDate: Fri Nov 5 14:35:50 2021 +0100

    HIVE-25676: Uncaught exception in QTestDatabaseHandler causes unrelated 
test failures (Stamatis Zampetakis, reviewed by Alessandro Solimando, Zoltan 
Haindrich)
    
    Catch the exception, log the problem and continue cleaning up the
    environment to avoid unrelated failures in other tests and invalid
    internal state.
    
    Minor refactoring removing redundant isEmpty() check.
    
    Closes #2766
---
 .../apache/hadoop/hive/ql/qoption/QTestDatabaseHandler.java  | 12 +++++-------
 1 file changed, 5 insertions(+), 7 deletions(-)

diff --git 
a/itests/util/src/main/java/org/apache/hadoop/hive/ql/qoption/QTestDatabaseHandler.java
 
b/itests/util/src/main/java/org/apache/hadoop/hive/ql/qoption/QTestDatabaseHandler.java
index 1c1e7db..85a09b5 100644
--- 
a/itests/util/src/main/java/org/apache/hadoop/hive/ql/qoption/QTestDatabaseHandler.java
+++ 
b/itests/util/src/main/java/org/apache/hadoop/hive/ql/qoption/QTestDatabaseHandler.java
@@ -104,9 +104,6 @@ public class QTestDatabaseHandler implements 
QTestOptionHandler {
 
   @Override
   public void beforeTest(QTestUtil qt) throws Exception {
-    if (databaseToScript.isEmpty()) {
-      return;
-    }
     for (Map.Entry<DatabaseType, String> dbEntry : 
databaseToScript.entrySet()) {
       String scriptsDir = QTestUtil.getScriptsDir(qt.getConf());
       Path dbScript = Paths.get(scriptsDir, dbEntry.getValue());
@@ -122,12 +119,13 @@ public class QTestDatabaseHandler implements 
QTestOptionHandler {
 
   @Override
   public void afterTest(QTestUtil qt) throws Exception {
-    if (databaseToScript.isEmpty()) {
-      return;
-    }
     for (Map.Entry<DatabaseType, String> dbEntry : 
databaseToScript.entrySet()) {
       AbstractExternalDB db = dbEntry.getKey().create();
-      db.cleanupDockerContainer();
+      try {
+        db.cleanupDockerContainer();
+      } catch (Exception e) {
+        LOG.error("Failed to cleanup database {}", dbEntry.getKey(), e);
+      }
     }
     databaseToScript.clear();
   }

Reply via email to