ambari-commits mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From mpapirkovs...@apache.org
Subject [1/2] ambari git commit: Revert "temp scv"
Date Mon, 28 Nov 2016 16:41:44 GMT
Repository: ambari
Updated Branches:
  refs/heads/branch-2.5 ce4d4fa76 -> 568d1e656


Revert "temp scv"

This reverts commit 59d11cf36b9fa283ba9592c8440f6be53debadd0.


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

Branch: refs/heads/branch-2.5
Commit: 1df9b46615710a2232eb38e975fbcd6f9dec8cb9
Parents: ce4d4fa
Author: Myroslav Papirkovskyi <mpapyrkovskyy@hortonworks.com>
Authored: Mon Nov 28 18:41:12 2016 +0200
Committer: Myroslav Papirkovskyi <mpapyrkovskyy@hortonworks.com>
Committed: Mon Nov 28 18:41:12 2016 +0200

----------------------------------------------------------------------
 .../internal/ClusterControllerImpl.java         |  2 +-
 .../ServiceConfigVersionResourceProvider.java   |  3 +--
 .../logging/LoggingSearchPropertyProvider.java  | 11 ++-------
 .../ambari/server/orm/dao/ClusterDAO.java       | 24 --------------------
 .../ambari/server/orm/dao/ServiceConfigDAO.java | 13 ++++++-----
 .../orm/entities/ClusterConfigEntity.java       |  7 +-----
 .../entities/ClusterConfigMappingEntity.java    |  6 -----
 .../orm/entities/ServiceConfigEntity.java       |  5 ++--
 8 files changed, 14 insertions(+), 57 deletions(-)
----------------------------------------------------------------------


http://git-wip-us.apache.org/repos/asf/ambari/blob/1df9b466/ambari-server/src/main/java/org/apache/ambari/server/controller/internal/ClusterControllerImpl.java
----------------------------------------------------------------------
diff --git a/ambari-server/src/main/java/org/apache/ambari/server/controller/internal/ClusterControllerImpl.java
b/ambari-server/src/main/java/org/apache/ambari/server/controller/internal/ClusterControllerImpl.java
index c752e80..32bed7b 100644
--- a/ambari-server/src/main/java/org/apache/ambari/server/controller/internal/ClusterControllerImpl.java
+++ b/ambari-server/src/main/java/org/apache/ambari/server/controller/internal/ClusterControllerImpl.java
@@ -858,7 +858,7 @@ public class ClusterControllerImpl implements ClusterController {
       if (compVal == 0) {
         Schema schema = getSchema(resourceType);
 
-        for (Type type : schema.getKeyTypes()) {
+        for (Type type : Type.values()) {
           String keyPropertyId = schema.getKeyPropertyId(type);
           if (keyPropertyId != null) {
             compVal = compareValues(resource1.getPropertyValue(keyPropertyId),

http://git-wip-us.apache.org/repos/asf/ambari/blob/1df9b466/ambari-server/src/main/java/org/apache/ambari/server/controller/internal/ServiceConfigVersionResourceProvider.java
----------------------------------------------------------------------
diff --git a/ambari-server/src/main/java/org/apache/ambari/server/controller/internal/ServiceConfigVersionResourceProvider.java
b/ambari-server/src/main/java/org/apache/ambari/server/controller/internal/ServiceConfigVersionResourceProvider.java
index e5ca389..2edbe9b 100644
--- a/ambari-server/src/main/java/org/apache/ambari/server/controller/internal/ServiceConfigVersionResourceProvider.java
+++ b/ambari-server/src/main/java/org/apache/ambari/server/controller/internal/ServiceConfigVersionResourceProvider.java
@@ -91,9 +91,8 @@ public class ServiceConfigVersionResourceProvider extends
     PROPERTY_IDS.add(SERVICE_CONFIG_VERSION_IS_COMPATIBLE_PROPERTY_ID);
 
     // keys
-    KEY_PROPERTY_IDS.put(Resource.Type.Service,SERVICE_CONFIG_VERSION_SERVICE_NAME_PROPERTY_ID);
+    KEY_PROPERTY_IDS.put(Resource.Type.ServiceConfigVersion,SERVICE_CONFIG_VERSION_SERVICE_NAME_PROPERTY_ID);
     KEY_PROPERTY_IDS.put(Resource.Type.Cluster,SERVICE_CONFIG_VERSION_CLUSTER_NAME_PROPERTY_ID);
-    KEY_PROPERTY_IDS.put(Resource.Type.ServiceConfigVersion,SERVICE_CONFIG_VERSION_PROPERTY_ID);
   }
 
 

http://git-wip-us.apache.org/repos/asf/ambari/blob/1df9b466/ambari-server/src/main/java/org/apache/ambari/server/controller/logging/LoggingSearchPropertyProvider.java
----------------------------------------------------------------------
diff --git a/ambari-server/src/main/java/org/apache/ambari/server/controller/logging/LoggingSearchPropertyProvider.java
b/ambari-server/src/main/java/org/apache/ambari/server/controller/logging/LoggingSearchPropertyProvider.java
index 16788ed..d9db290 100644
--- a/ambari-server/src/main/java/org/apache/ambari/server/controller/logging/LoggingSearchPropertyProvider.java
+++ b/ambari-server/src/main/java/org/apache/ambari/server/controller/logging/LoggingSearchPropertyProvider.java
@@ -39,10 +39,8 @@ import org.apache.log4j.Logger;
 
 import java.util.Collections;
 import java.util.EnumSet;
-import java.util.HashMap;
 import java.util.LinkedList;
 import java.util.List;
-import java.util.Map;
 import java.util.Set;
 import java.util.concurrent.atomic.AtomicInteger;
 
@@ -75,7 +73,7 @@ public class LoggingSearchPropertyProvider implements PropertyProvider {
 
   @Override
   public Set<Resource> populateResources(Set<Resource> resources, Request request,
Predicate predicate) throws SystemException {
-    Map<String, Boolean> isLogSearchRunning = new HashMap<>();
+
     for (Resource resource : resources) {
       // obtain the required identifying properties on the host component resource
       final String componentName = (String)resource.getPropertyValue(PropertyHelper.getPropertyId("HostRoles",
"component_name"));
@@ -92,12 +90,7 @@ public class LoggingSearchPropertyProvider implements PropertyProvider
{
         continue;
       }
 
-      Boolean isLogSearchRunningForSpecifiedCluster = isLogSearchRunning.get(clusterName);
-      if (isLogSearchRunningForSpecifiedCluster == null) {
-        isLogSearchRunningForSpecifiedCluster = logSearchServerRunning(clusterName);
-        isLogSearchRunning.put(clusterName, isLogSearchRunningForSpecifiedCluster);
-      }
-      if (!isLogSearchRunningForSpecifiedCluster) {
+      if (!logSearchServerRunning(clusterName)) {
         continue;
       }
 

http://git-wip-us.apache.org/repos/asf/ambari/blob/1df9b466/ambari-server/src/main/java/org/apache/ambari/server/orm/dao/ClusterDAO.java
----------------------------------------------------------------------
diff --git a/ambari-server/src/main/java/org/apache/ambari/server/orm/dao/ClusterDAO.java
b/ambari-server/src/main/java/org/apache/ambari/server/orm/dao/ClusterDAO.java
index b727c72..e93ac0e 100644
--- a/ambari-server/src/main/java/org/apache/ambari/server/orm/dao/ClusterDAO.java
+++ b/ambari-server/src/main/java/org/apache/ambari/server/orm/dao/ClusterDAO.java
@@ -116,18 +116,6 @@ public class ClusterDAO {
   }
 
   @RequiresSession
-  public List<ClusterConfigEntity> getLatestClusterConfigsByTypes(Long clusterId, List<String>
types) {
-    TypedQuery<ClusterConfigEntity> query = entityManagerProvider.get().createNamedQuery(
-      "ClusterConfigEntity.findLatestClusterConfigsByTypes",
-      ClusterConfigEntity.class);
-
-    query.setParameter("clusterId", clusterId);
-    query.setParameter("types", types);
-
-    return daoUtils.selectList(query);
-  }
-
-  @RequiresSession
   public ClusterConfigEntity findConfig(Long clusterId, String type, Long version) {
     CriteriaBuilder cb = entityManagerProvider.get().getCriteriaBuilder();
     CriteriaQuery<ClusterConfigEntity> cq = cb.createQuery(ClusterConfigEntity.class);
@@ -252,18 +240,6 @@ public class ClusterDAO {
     return daoUtils.selectList(query);
   }
 
-  @RequiresSession
-  public List<ClusterConfigMappingEntity> getLatestClusterConfigMappingsEntityByType(long
clusterId, String configType) {
-    TypedQuery<ClusterConfigMappingEntity> query = entityManagerProvider.get().createNamedQuery(
-      "ClusterConfigMappingEntity.findLatestClusterConfigMappingsByType",
-      ClusterConfigMappingEntity.class);
-
-    query.setParameter("clusterId", clusterId);
-    query.setParameter("typeName", configType);
-
-    return daoUtils.selectList(query);
-  }
-
   /**
    * Gets selected mappings for provided config types
    * @param clusterId cluster id

http://git-wip-us.apache.org/repos/asf/ambari/blob/1df9b466/ambari-server/src/main/java/org/apache/ambari/server/orm/dao/ServiceConfigDAO.java
----------------------------------------------------------------------
diff --git a/ambari-server/src/main/java/org/apache/ambari/server/orm/dao/ServiceConfigDAO.java
b/ambari-server/src/main/java/org/apache/ambari/server/orm/dao/ServiceConfigDAO.java
index 212a9f0..2cbee8d 100644
--- a/ambari-server/src/main/java/org/apache/ambari/server/orm/dao/ServiceConfigDAO.java
+++ b/ambari-server/src/main/java/org/apache/ambari/server/orm/dao/ServiceConfigDAO.java
@@ -115,13 +115,14 @@ public class ServiceConfigDAO {
 
   @RequiresSession
   public List<ServiceConfigEntity> getLastServiceConfigs(Long clusterId) {
-    TypedQuery<ServiceConfigEntity> query = entityManagerProvider.get().createNamedQuery(
-      "ServiceConfigEntity.findLatestServiceConfigsByCluster",
-      ServiceConfigEntity.class);
-
-    query.setParameter("clusterId", clusterId);
+    TypedQuery<ServiceConfigEntity> query = entityManagerProvider.get().
+      createQuery("SELECT scv FROM ServiceConfigEntity scv " +
+        "WHERE scv.clusterId = ?1 AND scv.createTimestamp = (" +
+        "SELECT MAX(scv2.createTimestamp) FROM ServiceConfigEntity scv2 " +
+        "WHERE scv2.serviceName = scv.serviceName AND scv2.clusterId = ?1 AND scv2.groupId
IS NULL)",
+        ServiceConfigEntity.class);
 
-    return daoUtils.selectList(query);
+    return daoUtils.selectList(query, clusterId);
   }
 
   /**

http://git-wip-us.apache.org/repos/asf/ambari/blob/1df9b466/ambari-server/src/main/java/org/apache/ambari/server/orm/entities/ClusterConfigEntity.java
----------------------------------------------------------------------
diff --git a/ambari-server/src/main/java/org/apache/ambari/server/orm/entities/ClusterConfigEntity.java
b/ambari-server/src/main/java/org/apache/ambari/server/orm/entities/ClusterConfigEntity.java
index 937e872..bf0faee 100644
--- a/ambari-server/src/main/java/org/apache/ambari/server/orm/entities/ClusterConfigEntity.java
+++ b/ambari-server/src/main/java/org/apache/ambari/server/orm/entities/ClusterConfigEntity.java
@@ -55,12 +55,7 @@ import javax.persistence.UniqueConstraint;
     @NamedQuery(name = "ClusterConfigEntity.findClusterConfigMappingsByStack",
       query = "SELECT mapping FROM ClusterConfigMappingEntity mapping " +
         "JOIN ClusterConfigEntity config ON mapping.typeName = config.type AND mapping.tag
= config.tag " +
-        "WHERE mapping.clusterId = :clusterId AND config.stack = :stack"),
-    @NamedQuery(name = "ClusterConfigEntity.findLatestClusterConfigsByTypes",
-      query = "SELECT cc FROM ClusterConfigEntity cc " +
-        "JOIN ClusterConfigMappingEntity ccm " +
-        "ON cc.clusterId = ccm.clusterId AND cc.type = ccm.typeName AND cc.tag = ccm.tag
" +
-        "WHERE cc.clusterId = :clusterId AND ccm.selectedInd > 0 AND ccm.typeName IN :types")
+        "WHERE mapping.clusterId = :clusterId AND config.stack = :stack")
 })
 
 public class ClusterConfigEntity {

http://git-wip-us.apache.org/repos/asf/ambari/blob/1df9b466/ambari-server/src/main/java/org/apache/ambari/server/orm/entities/ClusterConfigMappingEntity.java
----------------------------------------------------------------------
diff --git a/ambari-server/src/main/java/org/apache/ambari/server/orm/entities/ClusterConfigMappingEntity.java
b/ambari-server/src/main/java/org/apache/ambari/server/orm/entities/ClusterConfigMappingEntity.java
index 04c6030..c3c3e9e 100644
--- a/ambari-server/src/main/java/org/apache/ambari/server/orm/entities/ClusterConfigMappingEntity.java
+++ b/ambari-server/src/main/java/org/apache/ambari/server/orm/entities/ClusterConfigMappingEntity.java
@@ -23,8 +23,6 @@ import javax.persistence.Id;
 import javax.persistence.IdClass;
 import javax.persistence.JoinColumn;
 import javax.persistence.ManyToOne;
-import javax.persistence.NamedQueries;
-import javax.persistence.NamedQuery;
 import javax.persistence.Table;
 
 /**
@@ -33,10 +31,6 @@ import javax.persistence.Table;
 @Table(name = "clusterconfigmapping")
 @Entity
 @IdClass(ClusterConfigMappingEntityPK.class)
-@NamedQueries({
-  @NamedQuery(name = "ClusterConfigMappingEntity.findLatestClusterConfigMappingsByType",
-    query = "SELECT mapping FROM ClusterConfigMappingEntity mapping WHERE mapping.clusterId
= :clusterId AND mapping.selectedInd > 0 AND mapping.typeName = :typeName")})
-
 public class ClusterConfigMappingEntity {
 
   @Id

http://git-wip-us.apache.org/repos/asf/ambari/blob/1df9b466/ambari-server/src/main/java/org/apache/ambari/server/orm/entities/ServiceConfigEntity.java
----------------------------------------------------------------------
diff --git a/ambari-server/src/main/java/org/apache/ambari/server/orm/entities/ServiceConfigEntity.java
b/ambari-server/src/main/java/org/apache/ambari/server/orm/entities/ServiceConfigEntity.java
index 0df6f68..7c28835 100644
--- a/ambari-server/src/main/java/org/apache/ambari/server/orm/entities/ServiceConfigEntity.java
+++ b/ambari-server/src/main/java/org/apache/ambari/server/orm/entities/ServiceConfigEntity.java
@@ -51,8 +51,7 @@ import javax.persistence.TableGenerator;
     @NamedQuery(name = "ServiceConfigEntity.findNextServiceConfigVersion", query = "SELECT
COALESCE(MAX(serviceConfig.version), 0) + 1 AS nextVersion FROM ServiceConfigEntity serviceConfig
WHERE serviceConfig.serviceName=:serviceName AND serviceConfig.clusterId=:clusterId"),
     @NamedQuery(name = "ServiceConfigEntity.findAllServiceConfigsByStack", query = "SELECT
serviceConfig FROM ServiceConfigEntity serviceConfig WHERE serviceConfig.clusterId=:clusterId
AND serviceConfig.stack=:stack"),
     @NamedQuery(name = "ServiceConfigEntity.findLatestServiceConfigsByStack", query = "SELECT
serviceConfig FROM ServiceConfigEntity serviceConfig WHERE serviceConfig.clusterId = :clusterId
AND serviceConfig.version = (SELECT MAX(serviceConfig2.version) FROM ServiceConfigEntity serviceConfig2
WHERE serviceConfig2.clusterId=:clusterId AND serviceConfig2.stack=:stack AND serviceConfig2.serviceName
= serviceConfig.serviceName)"),
-    @NamedQuery(name = "ServiceConfigEntity.findLatestServiceConfigsByService", query = "SELECT
scv FROM ServiceConfigEntity scv WHERE scv.clusterId = :clusterId AND scv.serviceName = :serviceName
AND scv.version = (SELECT MAX(scv2.version) FROM ServiceConfigEntity scv2 WHERE (scv2.serviceName
= :serviceName AND scv2.clusterId = :clusterId) AND (scv2.groupId = scv.groupId OR (scv2.groupId
IS NULL AND scv.groupId IS NULL)))"),
-    @NamedQuery(name = "ServiceConfigEntity.findLatestServiceConfigsByCluster", query = "SELECT
scv FROM ServiceConfigEntity scv WHERE scv.clusterId = :clusterId AND scv.serviceConfigId
IN (SELECT MAX(scv1.serviceConfigId) FROM ServiceConfigEntity scv1 WHERE (scv1.clusterId =
:clusterId) AND (scv1.groupId IS NULL) GROUP BY scv1.serviceName)")})
+    @NamedQuery(name = "ServiceConfigEntity.findLatestServiceConfigsByService", query = "SELECT
scv FROM ServiceConfigEntity scv WHERE scv.clusterId = :clusterId AND scv.serviceName = :serviceName
AND scv.version = (SELECT MAX(scv2.version) FROM ServiceConfigEntity scv2 WHERE (scv2.serviceName
= :serviceName AND scv2.clusterId = :clusterId) AND (scv2.groupId = scv.groupId OR (scv2.groupId
IS NULL AND scv.groupId IS NULL)))")})
 public class ServiceConfigEntity {
   @Id
   @Column(name = "service_config_id")
@@ -264,4 +263,4 @@ public class ServiceConfigEntity {
     }
     return true;
   }
-}
+}
\ No newline at end of file


Mime
View raw message