Return-Path: X-Original-To: archive-asf-public-internal@cust-asf2.ponee.io Delivered-To: archive-asf-public-internal@cust-asf2.ponee.io Received: from cust-asf.ponee.io (cust-asf.ponee.io [163.172.22.183]) by cust-asf2.ponee.io (Postfix) with ESMTP id 21DE8200BC3 for ; Thu, 3 Nov 2016 16:26:06 +0100 (CET) Received: by cust-asf.ponee.io (Postfix) id 20AD9160B10; Thu, 3 Nov 2016 15:26:06 +0000 (UTC) Delivered-To: archive-asf-public@cust-asf.ponee.io Received: from mail.apache.org (hermes.apache.org [140.211.11.3]) by cust-asf.ponee.io (Postfix) with SMTP id 15082160B0D for ; Thu, 3 Nov 2016 16:26:04 +0100 (CET) Received: (qmail 27916 invoked by uid 500); 3 Nov 2016 15:26:04 -0000 Mailing-List: contact commits-help@ambari.apache.org; run by ezmlm Precedence: bulk List-Help: List-Unsubscribe: List-Post: List-Id: Reply-To: ambari-dev@ambari.apache.org Delivered-To: mailing list commits@ambari.apache.org Received: (qmail 26460 invoked by uid 99); 3 Nov 2016 15:26:03 -0000 Received: from git1-us-west.apache.org (HELO git1-us-west.apache.org) (140.211.11.23) by apache.org (qpsmtpd/0.29) with ESMTP; Thu, 03 Nov 2016 15:26:03 +0000 Received: by git1-us-west.apache.org (ASF Mail Server at git1-us-west.apache.org, from userid 33) id 08EE3F16C1; Thu, 3 Nov 2016 15:26:03 +0000 (UTC) Content-Type: text/plain; charset="us-ascii" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit From: ncole@apache.org To: commits@ambari.apache.org Date: Thu, 03 Nov 2016 15:26:18 -0000 Message-Id: <2dcee92a8a664e76970aedddf1f39a73@git.apache.org> In-Reply-To: References: X-Mailer: ASF-Git Admin Mailer Subject: [17/30] ambari git commit: AMBARI-18776. DB consistency check should inform user about warnings but not fail ambari-server start.(vbrodetskyi) archived-at: Thu, 03 Nov 2016 15:26:06 -0000 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-feature-AMBARI-18634 Commit: 41442ce794a8199e58e68a97c89b619ef179fe80 Parents: be6b6b8 Author: Vitaly Brodetskyi Authored: Thu Nov 3 00:23:47 2016 +0200 Committer: Vitaly Brodetskyi 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)