|
@@ -19,6 +19,7 @@
|
|
package org.apache.ambari.server.state;
|
|
package org.apache.ambari.server.state;
|
|
|
|
|
|
import java.util.HashMap;
|
|
import java.util.HashMap;
|
|
|
|
+import java.util.List;
|
|
import java.util.Map;
|
|
import java.util.Map;
|
|
import java.util.concurrent.locks.ReadWriteLock;
|
|
import java.util.concurrent.locks.ReadWriteLock;
|
|
import java.util.concurrent.locks.ReentrantReadWriteLock;
|
|
import java.util.concurrent.locks.ReentrantReadWriteLock;
|
|
@@ -33,12 +34,14 @@ import org.apache.ambari.server.events.ServiceRemovedEvent;
|
|
import org.apache.ambari.server.events.publishers.AmbariEventPublisher;
|
|
import org.apache.ambari.server.events.publishers.AmbariEventPublisher;
|
|
import org.apache.ambari.server.orm.dao.ClusterDAO;
|
|
import org.apache.ambari.server.orm.dao.ClusterDAO;
|
|
import org.apache.ambari.server.orm.dao.ClusterServiceDAO;
|
|
import org.apache.ambari.server.orm.dao.ClusterServiceDAO;
|
|
|
|
+import org.apache.ambari.server.orm.dao.ServiceConfigDAO;
|
|
import org.apache.ambari.server.orm.dao.ServiceDesiredStateDAO;
|
|
import org.apache.ambari.server.orm.dao.ServiceDesiredStateDAO;
|
|
import org.apache.ambari.server.orm.dao.StackDAO;
|
|
import org.apache.ambari.server.orm.dao.StackDAO;
|
|
import org.apache.ambari.server.orm.entities.ClusterEntity;
|
|
import org.apache.ambari.server.orm.entities.ClusterEntity;
|
|
import org.apache.ambari.server.orm.entities.ClusterServiceEntity;
|
|
import org.apache.ambari.server.orm.entities.ClusterServiceEntity;
|
|
import org.apache.ambari.server.orm.entities.ClusterServiceEntityPK;
|
|
import org.apache.ambari.server.orm.entities.ClusterServiceEntityPK;
|
|
import org.apache.ambari.server.orm.entities.ServiceComponentDesiredStateEntity;
|
|
import org.apache.ambari.server.orm.entities.ServiceComponentDesiredStateEntity;
|
|
|
|
+import org.apache.ambari.server.orm.entities.ServiceConfigEntity;
|
|
import org.apache.ambari.server.orm.entities.ServiceDesiredStateEntity;
|
|
import org.apache.ambari.server.orm.entities.ServiceDesiredStateEntity;
|
|
import org.apache.ambari.server.orm.entities.StackEntity;
|
|
import org.apache.ambari.server.orm.entities.StackEntity;
|
|
import org.slf4j.Logger;
|
|
import org.slf4j.Logger;
|
|
@@ -67,6 +70,8 @@ public class ServiceImpl implements Service {
|
|
private Map<String, ServiceComponent> components;
|
|
private Map<String, ServiceComponent> components;
|
|
private final boolean isClientOnlyService;
|
|
private final boolean isClientOnlyService;
|
|
|
|
|
|
|
|
+ @Inject
|
|
|
|
+ private ServiceConfigDAO serviceConfigDAO;
|
|
@Inject
|
|
@Inject
|
|
private ClusterServiceDAO clusterServiceDAO;
|
|
private ClusterServiceDAO clusterServiceDAO;
|
|
@Inject
|
|
@Inject
|
|
@@ -538,6 +543,20 @@ public class ServiceImpl implements Service {
|
|
}
|
|
}
|
|
}
|
|
}
|
|
|
|
|
|
|
|
+ @Transactional
|
|
|
|
+ void deleteAllServiceConfigs() throws AmbariException {
|
|
|
|
+ LOG.info("Deleting all serviceconfigs for service"
|
|
|
|
+ + ", clusterName=" + cluster.getClusterName()
|
|
|
|
+ + ", serviceName=" + getName());
|
|
|
|
+
|
|
|
|
+ List<ServiceConfigEntity> serviceConfigEntities = serviceConfigDAO.findByService(cluster.getClusterId(), getName());
|
|
|
|
+
|
|
|
|
+ for (ServiceConfigEntity serviceConfigEntity : serviceConfigEntities) {
|
|
|
|
+ serviceConfigDAO.remove(serviceConfigEntity);
|
|
|
|
+ }
|
|
|
|
+
|
|
|
|
+ }
|
|
|
|
+
|
|
@Override
|
|
@Override
|
|
@Transactional
|
|
@Transactional
|
|
public void deleteAllComponents() throws AmbariException {
|
|
public void deleteAllComponents() throws AmbariException {
|
|
@@ -617,6 +636,7 @@ public class ServiceImpl implements Service {
|
|
readWriteLock.writeLock().lock();
|
|
readWriteLock.writeLock().lock();
|
|
try {
|
|
try {
|
|
deleteAllComponents();
|
|
deleteAllComponents();
|
|
|
|
+ deleteAllServiceConfigs();
|
|
|
|
|
|
if (persisted) {
|
|
if (persisted) {
|
|
removeEntities();
|
|
removeEntities();
|