ambari-commits mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From nc...@apache.org
Subject [19/50] [abbrv] ambari git commit: AMBARI-18776. DB consistency check should inform user about warnings but not fail ambari-server start.(vbrodetskyi)
Date Fri, 04 Nov 2016 16:55:00 GMT
AMBARI-18776. DB consistency check should inform user about warnings but not fail ambari-server
start.(vbrodetskyi)


Project: http://git-wip-us.apache.org/repos/asf/ambari/repo
Commit: http://git-wip-us.apache.org/repos/asf/ambari/commit/41442ce7
Tree: http://git-wip-us.apache.org/repos/asf/ambari/tree/41442ce7
Diff: http://git-wip-us.apache.org/repos/asf/ambari/diff/41442ce7

Branch: refs/heads/branch-dev-patch-upgrade
Commit: 41442ce794a8199e58e68a97c89b619ef179fe80
Parents: be6b6b8
Author: Vitaly Brodetskyi <vbrodetskyi@hortonworks.com>
Authored: Thu Nov 3 00:23:47 2016 +0200
Committer: Vitaly Brodetskyi <vbrodetskyi@hortonworks.com>
Committed: Thu Nov 3 00:23:47 2016 +0200

----------------------------------------------------------------------
 .../server/checks/DatabaseConsistencyChecker.java       | 12 +++++++++---
 .../apache/ambari/server/controller/AmbariServer.java   |  2 ++
 ambari-server/src/main/python/ambari_server/utils.py    |  5 ++++-
 ambari-server/src/test/python/TestUtils.py              |  4 ++--
 4 files changed, 17 insertions(+), 6 deletions(-)
----------------------------------------------------------------------


http://git-wip-us.apache.org/repos/asf/ambari/blob/41442ce7/ambari-server/src/main/java/org/apache/ambari/server/checks/DatabaseConsistencyChecker.java
----------------------------------------------------------------------
diff --git a/ambari-server/src/main/java/org/apache/ambari/server/checks/DatabaseConsistencyChecker.java
b/ambari-server/src/main/java/org/apache/ambari/server/checks/DatabaseConsistencyChecker.java
index 2045e40..d2b7c52 100644
--- a/ambari-server/src/main/java/org/apache/ambari/server/checks/DatabaseConsistencyChecker.java
+++ b/ambari-server/src/main/java/org/apache/ambari/server/checks/DatabaseConsistencyChecker.java
@@ -120,7 +120,7 @@ public class DatabaseConsistencyChecker {
       }
     } finally {
         DatabaseConsistencyCheckHelper.closeConnection();
-        if (DatabaseConsistencyCheckHelper.ifErrorsFound()) {
+        if (DatabaseConsistencyCheckHelper.ifErrorsFound() || DatabaseConsistencyCheckHelper.ifWarningsFound())
{
           String ambariDBConsistencyCheckLog = "ambari-server-check-database.log";
           if (LOG instanceof Log4jLoggerAdapter) {
             org.apache.log4j.Logger dbConsistencyCheckHelperLogger = org.apache.log4j.Logger.getLogger(DatabaseConsistencyCheckHelper.class);
@@ -134,12 +134,18 @@ public class DatabaseConsistencyChecker {
             }
           }
           ambariDBConsistencyCheckLog = ambariDBConsistencyCheckLog.replace("//", "/");
-          System.out.print(String.format("DB configs consistency check failed. Run \"ambari-server
start --skip-database-check\" to skip. " +
+
+          if (DatabaseConsistencyCheckHelper.ifErrorsFound()) {
+            System.out.print(String.format("DB configs consistency check failed. Run \"ambari-server
start --skip-database-check\" to skip. " +
                   "If you use this \"--skip-database-check\" option, do not make any changes
to your cluster topology " +
                   "or perform a cluster upgrade until you correct the database consistency
issues. See \"%s\" " +
                   "for more details on the consistency issues.", ambariDBConsistencyCheckLog));
+          } else {
+            System.out.print(String.format("DB configs consistency check found warnings.
See \"%s\" " +
+                    "for more details.", ambariDBConsistencyCheckLog));
+          }
         } else {
-          System.out.print("No errors were found.");
+          System.out.print("No errors and warnings were found.");
         }
 
     }

http://git-wip-us.apache.org/repos/asf/ambari/blob/41442ce7/ambari-server/src/main/java/org/apache/ambari/server/controller/AmbariServer.java
----------------------------------------------------------------------
diff --git a/ambari-server/src/main/java/org/apache/ambari/server/controller/AmbariServer.java
b/ambari-server/src/main/java/org/apache/ambari/server/controller/AmbariServer.java
index 7ff351d..7c6fe1e 100644
--- a/ambari-server/src/main/java/org/apache/ambari/server/controller/AmbariServer.java
+++ b/ambari-server/src/main/java/org/apache/ambari/server/controller/AmbariServer.java
@@ -684,6 +684,8 @@ public class AmbariServer {
         if (DatabaseConsistencyCheckHelper.ifErrorsFound()) {
           System.out.println("Database consistency check: failed");
           System.exit(1);
+        } else if (DatabaseConsistencyCheckHelper.ifWarningsFound()) {
+          System.out.println("Database consistency check: warning");
         } else {
           System.out.println("Database consistency check: successful");
         }

http://git-wip-us.apache.org/repos/asf/ambari/blob/41442ce7/ambari-server/src/main/python/ambari_server/utils.py
----------------------------------------------------------------------
diff --git a/ambari-server/src/main/python/ambari_server/utils.py b/ambari-server/src/main/python/ambari_server/utils.py
index 348d5df..757c333 100644
--- a/ambari-server/src/main/python/ambari_server/utils.py
+++ b/ambari-server/src/main/python/ambari_server/utils.py
@@ -185,8 +185,11 @@ def wait_for_pid(pids, server_init_timeout, occupy_port_timeout, init_web_ui_tim
           "If you use this \"--skip-database-check\" option, do not make any changes to your
cluster topology " \
           "or perform a cluster upgrade until you correct the database consistency issues.
See " + \
           db_check_log + "for more details on the consistency issues."
+  elif 'Database consistency check: warning' in open(server_out_file).read():
+    print "\nDB configs consistency check found warnings. See " + db_check_log + " for more
details."
   else:
-    print "\nDB consistency check: no errors were found."
+    print "\nDB configs consistency check: no errors and warnings were found."
+
 
   if not server_ui_port_occupied:
     raise FatalException(1, "Server not yet listening on http port " + str(ambari_server_ui_port)
+

http://git-wip-us.apache.org/repos/asf/ambari/blob/41442ce7/ambari-server/src/test/python/TestUtils.py
----------------------------------------------------------------------
diff --git a/ambari-server/src/test/python/TestUtils.py b/ambari-server/src/test/python/TestUtils.py
index 5d32125..367b7fe 100644
--- a/ambari-server/src/test/python/TestUtils.py
+++ b/ambari-server/src/test/python/TestUtils.py
@@ -144,8 +144,8 @@ class TestUtils(TestCase):
                                     "cmd": ""
                                     },
                                    ], 5, 40, 10, '', '', get_properties_mock)
-    self.assertEqual(".\nServer started listening on 8080\n\nDB consistency check: no errors
were found.\nWaiting for 10 seconds,"
-                     " for server WEB UI initialization\n........", out.getvalue())
+    self.assertEqual(".\nServer started listening on 8080\n\nDB configs consistency check:
no errors and warnings were "
+                     "found.\nWaiting for 10 seconds, for server WEB UI initialization\n........",
out.getvalue())
     sys.stdout = sys.__stdout__
 
     self.assertEquals(2, live_pids)


Mime
View raw message