Repository: ambari Updated Branches: refs/heads/branch-2.5 ebfd3b5cf -> 769c09a42
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/769c09a4 Tree: http://git-wip-us.apache.org/repos/asf/ambari/tree/769c09a4 Diff: http://git-wip-us.apache.org/repos/asf/ambari/diff/769c09a4 Branch: refs/heads/branch-2.5 Commit: 769c09a42d9d50f7f43b89ba94e843ffd3fc10c3 Parents: ebfd3b5 Author: Vitaly Brodetskyi <[email protected]> Authored: Thu Nov 3 00:21:07 2016 +0200 Committer: Vitaly Brodetskyi <[email protected]> Committed: Thu Nov 3 00:22:09 2016 +0200 ---------------------------------------------------------------------- .../server/checks/DatabaseConsistencyChecker.java | 12 +++++++++--- .../apache/ambari/server/controller/AmbariServer.java | 2 ++ ambari-server/src/main/python/ambari_server_main.py | 5 ++++- 3 files changed, 15 insertions(+), 4 deletions(-) ---------------------------------------------------------------------- http://git-wip-us.apache.org/repos/asf/ambari/blob/769c09a4/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 f979b7e..6fa36d4 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 @@ -117,7 +117,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); @@ -131,12 +131,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/769c09a4/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 c1ba7f5..4b939fe 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 @@ -664,6 +664,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/769c09a4/ambari-server/src/main/python/ambari_server_main.py ---------------------------------------------------------------------- diff --git a/ambari-server/src/main/python/ambari_server_main.py b/ambari-server/src/main/python/ambari_server_main.py index 313ff66..b35cfc9 100644 --- a/ambari-server/src/main/python/ambari_server_main.py +++ b/ambari-server/src/main/python/ambari_server_main.py @@ -212,8 +212,11 @@ def wait_for_server_start(pidFile, scmStatus): "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 " + \ configDefaults.DB_CHECK_LOG + "for more details on the consistency issues." + elif 'Database consistency check: warning' in open(configDefaults.SERVER_OUT_FILE).read(): + print "DB configs consistency check found warnings. See " + \ + configDefaults.DB_CHECK_LOG + " for more details." else: - print "DB consistency check: no errors were found." + print "DB configs consistency check: no errors and warnings were found." if found_pids <= 0:
