ambari-commits mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From hapyles...@apache.org
Subject [1/2] ambari git commit: AMBARI-21364 DB consistency checker throws errors for missing 'parquet-logging' and 'product-info' configs after Ambari upgrade (dlysnichenko via dgrinenko)
Date Wed, 05 Jul 2017 13:17:59 GMT
Repository: ambari
Updated Branches:
  refs/heads/branch-2.5 9cd94a795 -> 0ac6a1e74
  refs/heads/trunk 29203a15d -> 19d4200e7


AMBARI-21364 DB consistency checker throws errors for missing 'parquet-logging' and 'product-info'
configs after Ambari upgrade (dlysnichenko via dgrinenko)


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

Branch: refs/heads/branch-2.5
Commit: 0ac6a1e74c72831eaf496bd1f1f1648890c65ca4
Parents: 9cd94a7
Author: Dmytro Grinenko <hapylestat@apache.org>
Authored: Wed Jul 5 16:14:20 2017 +0300
Committer: Dmytro Grinenko <hapylestat@apache.org>
Committed: Wed Jul 5 16:14:20 2017 +0300

----------------------------------------------------------------------
 .../checks/DatabaseConsistencyCheckHelper.java       | 14 ++++++++++++++
 .../server/state/ClientConfigFileDefinition.java     | 15 +++++++++++++--
 .../common-services/HIVE/0.12.0.2.0/metainfo.xml     |  1 +
 3 files changed, 28 insertions(+), 2 deletions(-)
----------------------------------------------------------------------


http://git-wip-us.apache.org/repos/asf/ambari/blob/0ac6a1e7/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 29c1222..c6239d8 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
@@ -54,6 +54,8 @@ import org.apache.ambari.server.orm.entities.ClusterConfigEntity;
 import org.apache.ambari.server.orm.entities.HostComponentDesiredStateEntity;
 import org.apache.ambari.server.orm.entities.HostComponentStateEntity;
 import org.apache.ambari.server.orm.entities.MetainfoEntity;
+import org.apache.ambari.server.state.ClientConfigFileDefinition;
+import org.apache.ambari.server.state.ComponentInfo;
 import org.apache.ambari.server.state.SecurityState;
 import org.apache.ambari.server.state.ServiceInfo;
 import org.apache.ambari.server.state.State;
@@ -1040,10 +1042,22 @@ public class DatabaseConsistencyCheckHelper {
             Multimap<String, String> dbServiceConfigs = dbServiceVersionConfigs.get(serviceVersion);
             if (dbServiceConfigs != null) {
               for (String serviceName : dbServiceConfigs.keySet()) {
+                ServiceInfo serviceInfo = serviceInfoMap.get(serviceName);
                 Collection<String> serviceConfigsFromStack = stackServiceConfigs.get(serviceName);
                 Collection<String> serviceConfigsFromDB = dbServiceConfigs.get(serviceName);
                 if (serviceConfigsFromDB != null && serviceConfigsFromStack != null)
{
                   serviceConfigsFromStack.removeAll(serviceConfigsFromDB);
+                  if (serviceInfo != null && serviceInfo.getComponents() != null)
{
+                    for (ComponentInfo componentInfo : serviceInfo.getComponents()) {
+                      if (componentInfo.getClientConfigFiles() != null) {
+                        for (ClientConfigFileDefinition clientConfigFileDefinition : componentInfo.getClientConfigFiles())
{
+                          if (clientConfigFileDefinition.isOptional()) {
+                            serviceConfigsFromStack.remove(clientConfigFileDefinition.getDictionaryName());
+                          }
+                        }
+                      }
+                    }
+                  }
 
                   // skip ranger-{service_name}-* from being checked, unless ranger is installed
                   if(!dbServiceConfigs.containsKey("RANGER")) {

http://git-wip-us.apache.org/repos/asf/ambari/blob/0ac6a1e7/ambari-server/src/main/java/org/apache/ambari/server/state/ClientConfigFileDefinition.java
----------------------------------------------------------------------
diff --git a/ambari-server/src/main/java/org/apache/ambari/server/state/ClientConfigFileDefinition.java
b/ambari-server/src/main/java/org/apache/ambari/server/state/ClientConfigFileDefinition.java
index 6d31d98..3f7d42d 100644
--- a/ambari-server/src/main/java/org/apache/ambari/server/state/ClientConfigFileDefinition.java
+++ b/ambari-server/src/main/java/org/apache/ambari/server/state/ClientConfigFileDefinition.java
@@ -32,6 +32,15 @@ public class ClientConfigFileDefinition {
   private String type;
   private String fileName;
   private String dictionaryName;
+  private boolean optional = false;
+
+  public boolean isOptional() {
+    return optional;
+  }
+
+  public void setOptional(boolean optional) {
+    this.optional = optional;
+  }
 
   public void setType(String type) {
     this.type = type;
@@ -73,7 +82,8 @@ public class ClientConfigFileDefinition {
     return new EqualsBuilder().
             append(type, rhs.type).
             append(fileName, rhs.fileName).
-            append(dictionaryName, rhs.dictionaryName).isEquals();
+        append(dictionaryName, rhs.dictionaryName).
+        append(optional, rhs.optional).isEquals();
   }
 
   @Override
@@ -81,6 +91,7 @@ public class ClientConfigFileDefinition {
     return new HashCodeBuilder(17, 31).
             append(type).
             append(fileName).
-            append(dictionaryName).toHashCode();
+        append(dictionaryName).
+        append(optional).toHashCode();
   }
 }

http://git-wip-us.apache.org/repos/asf/ambari/blob/0ac6a1e7/ambari-server/src/main/resources/common-services/HIVE/0.12.0.2.0/metainfo.xml
----------------------------------------------------------------------
diff --git a/ambari-server/src/main/resources/common-services/HIVE/0.12.0.2.0/metainfo.xml
b/ambari-server/src/main/resources/common-services/HIVE/0.12.0.2.0/metainfo.xml
index fee90cf..1fd6ee9 100644
--- a/ambari-server/src/main/resources/common-services/HIVE/0.12.0.2.0/metainfo.xml
+++ b/ambari-server/src/main/resources/common-services/HIVE/0.12.0.2.0/metainfo.xml
@@ -229,6 +229,7 @@
               <type>env</type>
               <fileName>parquet-logging.properties</fileName>
               <dictionaryName>parquet-logging</dictionaryName>
+              <optional>true</optional>
             </configFile>
           </configFiles>
           <configuration-dependencies>


Mime
View raw message