Просмотр исходного кода

AMBARI-1865. Copy service configs to cluster-level on upgrade

git-svn-id: https://svn.apache.org/repos/asf/incubator/ambari/trunk@1466887 13f79535-47bb-0310-9956-ffa450edef68
Nate Cole 12 лет назад
Родитель
Сommit
63a327e877

+ 2 - 0
CHANGES.txt

@@ -943,6 +943,8 @@ Trunk (unreleased changes):
  AMBARI-1657. User directories on HDFS do not get created with custom names 
  provided from Ambari UI. (swagle)
 
+ AMBARI-1865. Fix for upgrade script to copy configurations. (ncole)
+
  AMBARI-1703. Fix for smoke tests getting configurations. (ncole)
 
  AMBARI-1678. Fix when there are no service overrides. (ncole)

+ 5 - 0
ambari-server/src/main/resources/upgrade/ddl/Ambari-DDL-Postgres-UPGRADE-1.3.0.sql

@@ -32,6 +32,11 @@ GRANT ALL PRIVILEGES ON TABLE ambari.metainfo TO :username;
 CREATE TABLE ambari.clusterconfigmapping (cluster_id bigint NOT NULL, type_name VARCHAR(255) NOT NULL, version_tag VARCHAR(255) NOT NULL, create_timestamp BIGINT NOT NULL, selected INTEGER NOT NULL DEFAULT 0, PRIMARY KEY (cluster_id, type_name, create_timestamp));
 GRANT ALL PRIVILEGES ON TABLE ambari.clusterconfigmapping TO :username;
 ALTER TABLE ambari.clusterconfigmapping ADD CONSTRAINT FK_clusterconfigmapping_cluster_id FOREIGN KEY (cluster_id) REFERENCES ambari.clusters (cluster_id);
+INSERT INTO ambari.clusterconfigmapping(cluster_id, type_name, version_tag, create_timestamp, selected)
+  (SELECT DISTINCT cluster_id, config_type, config_tag, cast(date_part('epoch', now()) as bigint), 1
+    FROM ambari.serviceconfigmapping scm
+    WHERE timestamp = (SELECT max(timestamp) FROM ambari.serviceconfigmapping WHERE cluster_id = scm.cluster_id AND config_type = scm.config_type));
+DELETE FROM ambari.serviceconfigmapping;
 
 CREATE TABLE ambari.hostconfigmapping (cluster_id bigint NOT NULL, host_name VARCHAR(255) NOT NULL, type_name VARCHAR(255) NOT NULL, version_tag VARCHAR(255) NOT NULL, service_name VARCHAR(255), create_timestamp BIGINT NOT NULL, selected INTEGER NOT NULL DEFAULT 0, PRIMARY KEY (cluster_id, host_name, type_name, create_timestamp));
 GRANT ALL PRIVILEGES ON TABLE ambari.hostconfigmapping TO :username;