AMBARI-18988. [Intermittent]Ambari-server check-database command took longer (~3) minutes to complete.(vbrodetskyi)
Project: http://git-wip-us.apache.org/repos/asf/ambari/repo Commit: http://git-wip-us.apache.org/repos/asf/ambari/commit/c2555596 Tree: http://git-wip-us.apache.org/repos/asf/ambari/tree/c2555596 Diff: http://git-wip-us.apache.org/repos/asf/ambari/diff/c2555596 Branch: refs/heads/branch-feature-AMBARI-18634 Commit: c2555596e62a5ce592f7b02a9b2885bdef80af8d Parents: fc46088 Author: Vitaly Brodetskyi <vbrodets...@hortonworks.com> Authored: Fri Nov 25 14:13:46 2016 +0200 Committer: Vitaly Brodetskyi <vbrodets...@hortonworks.com> Committed: Fri Nov 25 14:13:46 2016 +0200 ---------------------------------------------------------------------- .../server/checks/DatabaseConsistencyCheckHelper.java | 10 +++++++++- 1 file changed, 9 insertions(+), 1 deletion(-) ---------------------------------------------------------------------- http://git-wip-us.apache.org/repos/asf/ambari/blob/c2555596/ambari-server/src/main/java/org/apache/ambari/server/checks/DatabaseConsistencyCheckHelper.java ---------------------------------------------------------------------- diff --git a/ambari-server/src/main/java/org/apache/ambari/server/checks/DatabaseConsistencyCheckHelper.java b/ambari-server/src/main/java/org/apache/ambari/server/checks/DatabaseConsistencyCheckHelper.java index 6248a92..89ed987 100644 --- a/ambari-server/src/main/java/org/apache/ambari/server/checks/DatabaseConsistencyCheckHelper.java +++ b/ambari-server/src/main/java/org/apache/ambari/server/checks/DatabaseConsistencyCheckHelper.java @@ -460,11 +460,13 @@ public class DatabaseConsistencyCheckHelper { connection = dbAccessor.getConnection(); } + LOG.info("Getting ambari metainfo instance"); if (ambariMetaInfo == null) { ambariMetaInfo = injector.getInstance(AmbariMetaInfo.class); } try { + LOG.info("Executing query 'GET_SERVICES_WITHOUT_CONFIGS'"); statement = connection.createStatement(ResultSet.TYPE_SCROLL_SENSITIVE, ResultSet.CONCUR_UPDATABLE); rs = statement.executeQuery(GET_SERVICES_WITHOUT_CONFIGS_QUERY); @@ -479,7 +481,7 @@ public class DatabaseConsistencyCheckHelper { } } - + LOG.info("Executing query 'GET_SERVICE_CONFIG_WITHOUT_MAPPING'"); rs = statement.executeQuery(GET_SERVICE_CONFIG_WITHOUT_MAPPING_QUERY); if (rs != null) { String serviceName = null, version = null, clusterName = null; @@ -509,6 +511,7 @@ public class DatabaseConsistencyCheckHelper { } //get stack info from db + LOG.info("Getting stack info from database"); rs = statement.executeQuery(GET_STACK_NAME_VERSION_QUERY); if (rs != null) { while (rs.next()) { @@ -523,6 +526,7 @@ public class DatabaseConsistencyCheckHelper { Map<String, Map<Integer, Multimap<String, String>>> dbClusterServiceVersionConfigs = new HashMap<>(); Multimap<String, String> stackServiceConfigs = HashMultimap.create(); + LOG.info("Executing query 'GET_SERVICES_WITH_CONFIGS'"); rs = statement.executeQuery(GET_SERVICES_WITH_CONFIGS_QUERY); if (rs != null) { String serviceName = null, configType = null, clusterName = null; @@ -557,12 +561,14 @@ public class DatabaseConsistencyCheckHelper { } //compare service configs from stack with configs that we got from db + LOG.info("Comparing service configs from stack with configs that we got from db"); for (Map.Entry<String, Map<String, String>> clusterStackInfoEntry : clusterStackInfo.entrySet()) { //collect required configs for all services from stack String clusterName = clusterStackInfoEntry.getKey(); Map<String, String> stackInfo = clusterStackInfoEntry.getValue(); String stackName = stackInfo.keySet().iterator().next(); String stackVersion = stackInfo.get(stackName); + LOG.info("Getting services from metainfo"); Map<String, ServiceInfo> serviceInfoMap = ambariMetaInfo.getServices(stackName, stackVersion); for (String serviceName : serviceNames) { LOG.info("Processing {}-{} / {}", stackName, stackVersion, serviceName); @@ -580,6 +586,7 @@ public class DatabaseConsistencyCheckHelper { } //compare required service configs from stack with mapped service configs from db + LOG.info("Comparing required service configs from stack with mapped service configs from db"); Map<Integer, Multimap<String, String>> dbServiceVersionConfigs = dbClusterServiceVersionConfigs.get(clusterName); if (dbServiceVersionConfigs != null) { for (Integer serviceVersion : dbServiceVersionConfigs.keySet()) { @@ -603,6 +610,7 @@ public class DatabaseConsistencyCheckHelper { } //getting services which has mapped configs which are not selected in clusterconfigmapping + LOG.info("Getting services which has mapped configs which are not selected in clusterconfigmapping"); rs = statement.executeQuery(GET_NOT_SELECTED_SERVICE_CONFIGS_QUERY); if (rs != null) { String serviceName = null, configType = null, clusterName = null;