incubator-ambari-commits mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From smoha...@apache.org
Subject svn commit: r1485518 - in /incubator/ambari/trunk: CHANGES.txt ambari-server/src/main/resources/Ambari-DDL-Postgres-DROP.sql ambari-server/src/main/resources/upgrade/ddl/Ambari-DDL-Postgres-UPGRADE-1.3.0.sql
Date Thu, 23 May 2013 00:25:34 GMT
Author: smohanty
Date: Thu May 23 00:25:34 2013
New Revision: 1485518

URL: http://svn.apache.org/r1485518
Log:
AMBARI-2159. After upgrading ambari from 1.2.2.5 to 1.2.3.6 the server throws 500 error when
starting/stopping any service. (smohanty)

Modified:
    incubator/ambari/trunk/CHANGES.txt
    incubator/ambari/trunk/ambari-server/src/main/resources/Ambari-DDL-Postgres-DROP.sql
    incubator/ambari/trunk/ambari-server/src/main/resources/upgrade/ddl/Ambari-DDL-Postgres-UPGRADE-1.3.0.sql

Modified: incubator/ambari/trunk/CHANGES.txt
URL: http://svn.apache.org/viewvc/incubator/ambari/trunk/CHANGES.txt?rev=1485518&r1=1485517&r2=1485518&view=diff
==============================================================================
--- incubator/ambari/trunk/CHANGES.txt (original)
+++ incubator/ambari/trunk/CHANGES.txt Thu May 23 00:25:34 2013
@@ -887,6 +887,9 @@ Trunk (unreleased changes):
 
  BUG FIXES
 
+ AMBARI-2159. After upgrading ambari from 1.2.2.5 to 1.2.3.6 the server
+ throws 500 error when starting/stopping any service. (smohanty)
+
  AMBARI-2186. Hadoop2 - Handle dfs include/exclude properties. (srimanth)
 
  AMBARI-2179. Fix JDBC URLs for Oozie connecting to MySQL server. (yusaku)

Modified: incubator/ambari/trunk/ambari-server/src/main/resources/Ambari-DDL-Postgres-DROP.sql
URL: http://svn.apache.org/viewvc/incubator/ambari/trunk/ambari-server/src/main/resources/Ambari-DDL-Postgres-DROP.sql?rev=1485518&r1=1485517&r2=1485518&view=diff
==============================================================================
--- incubator/ambari/trunk/ambari-server/src/main/resources/Ambari-DDL-Postgres-DROP.sql (original)
+++ incubator/ambari/trunk/ambari-server/src/main/resources/Ambari-DDL-Postgres-DROP.sql Thu
May 23 00:25:34 2013
@@ -15,71 +15,5 @@
 -- See the License for the specific language governing permissions and
 -- limitations under the License.
 --
-\connect ambari
-ALTER TABLE ambari.clusterconfig DROP CONSTRAINT FK_clusterconfig_cluster_id;
-ALTER TABLE ambari.clusterservices DROP CONSTRAINT FK_clusterservices_cluster_id;
-ALTER TABLE ambari.clusterstate DROP CONSTRAINT FK_clusterstate_cluster_id;
-ALTER TABLE ambari.clusterconfigmapping DROP CONSTRAINT FK_clusterconfigmapping_cluster_id;
-ALTER TABLE ambari.componentconfigmapping DROP CONSTRAINT FK_componentconfigmapping_component_name;
-ALTER TABLE ambari.hostcomponentconfigmapping DROP CONSTRAINT FK_hostcomponentconfigmapping_cluster_id;
-ALTER TABLE ambari.hostcomponentdesiredconfigmapping DROP CONSTRAINT FK_hostcomponentdesiredconfigmapping_config_tag;
-ALTER TABLE ambari.hostcomponentdesiredconfigmapping DROP CONSTRAINT FK_hostcomponentdesiredconfigmapping_cluster_id;
-ALTER TABLE ambari.hostcomponentdesiredstate DROP CONSTRAINT FK_hostcomponentdesiredstate_host_name;
-ALTER TABLE ambari.hostcomponentdesiredstate DROP CONSTRAINT FK_hostcomponentdesiredstate_component_name;
-ALTER TABLE ambari.hostcomponentstate DROP CONSTRAINT FK_hostcomponentstate_component_name;
-ALTER TABLE ambari.hostcomponentstate DROP CONSTRAINT FK_hostcomponentstate_host_name;
-ALTER TABLE ambari.hoststate DROP CONSTRAINT FK_hoststate_host_name;
-ALTER TABLE ambari.hostconfigmapping DROP CONSTRAINT FK_hostconfigmapping_cluster_id;
-ALTER TABLE ambari.hostconfigmapping DROP CONSTRAINT FK_hostconfigmapping_host_name;
-ALTER TABLE ambari.servicecomponentdesiredstate DROP CONSTRAINT FK_servicecomponentdesiredstate_service_name;
-ALTER TABLE ambari.serviceconfigmapping DROP CONSTRAINT FK_serviceconfigmapping_service_name;
-ALTER TABLE ambari.servicedesiredstate DROP CONSTRAINT FK_servicedesiredstate_service_name;
-ALTER TABLE ambari.execution_command DROP CONSTRAINT FK_execution_command_task_id;
-ALTER TABLE ambari.host_role_command DROP CONSTRAINT FK_host_role_command_stage_id;
-ALTER TABLE ambari.host_role_command DROP CONSTRAINT FK_host_role_command_host_name;
-ALTER TABLE ambari.role_success_criteria DROP CONSTRAINT FK_role_success_criteria_stage_id;
-ALTER TABLE ambari.stage DROP CONSTRAINT FK_stage_cluster_id;
-ALTER TABLE ambari.ClusterHostMapping DROP CONSTRAINT FK_ClusterHostMapping_host_name;
-ALTER TABLE ambari.ClusterHostMapping DROP CONSTRAINT FK_ClusterHostMapping_cluster_id;
-ALTER TABLE ambari.user_roles DROP CONSTRAINT FK_user_roles_ldap_user;
-ALTER TABLE ambari.user_roles DROP CONSTRAINT FK_user_roles_role_name;
-DROP TABLE ambari.clusters CASCADE;
-DROP TABLE ambari.clusterservices CASCADE;
-DROP TABLE ambari.clusterstate CASCADE; DROP TABLE ambari.componentconfigmapping CASCADE;
DROP TABLE ambari.hostcomponentconfigmapping CASCADE;
-DROP TABLE ambari.hostcomponentdesiredconfigmapping CASCADE;
-DROP TABLE ambari.hostcomponentdesiredstate CASCADE;
-DROP TABLE ambari.hostcomponentstate CASCADE;
-DROP TABLE ambari.hosts CASCADE;
-DROP TABLE ambari.hoststate CASCADE;
-DROP TABLE ambari.hostconfigmapping CASCADE;
-DROP TABLE ambari.servicecomponentdesiredstate CASCADE;
-DROP TABLE ambari.serviceconfigmapping CASCADE;
-DROP TABLE ambari.servicedesiredstate CASCADE;
-DROP TABLE ambari.roles CASCADE;
-DROP TABLE ambari.users CASCADE;
-DROP TABLE ambari.execution_command CASCADE;
-DROP TABLE ambari.host_role_command CASCADE;
-DROP TABLE ambari.role_success_criteria CASCADE;
-DROP TABLE ambari.stage CASCADE;
-DROP TABLE ambari.ClusterHostMapping CASCADE;
-DROP TABLE ambari.clusterconfig CASCADE;
-DROP TABLE ambari.clusterconfigmapping CASCADE;
-DROP TABLE ambari.user_roles CASCADE;
-DROP TABLE ambari.key_value_store CASCADE;
-DROP TABLE ambari.ambari_sequences CASCADE;
-DROP TABLE ambari.metainfo CASCADE;
-DROP SEQUENCE ambari.host_role_command_task_id_seq;
-DROP SEQUENCE ambari.clusters_cluster_id_seq;
-
-\connect ambarirca
-ALTER TABLE job DROP CONSTRAINT job_workflowid_fkey;
-ALTER TABLE task DROP CONSTRAINT task_jobid_fkey;
-ALTER TABLE taskattempt DROP CONSTRAINT taskattempt_jobid_fkey;
-ALTER TABLE taskattempt DROP CONSTRAINT taskattempt_taskid_fkey;
-DROP TABLE workflow;
-DROP TABLE job;
-DROP TABLE task;
-DROP TABLE taskAttempt;
-DROP TABLE hdfsEvent;
-DROP TABLE mapreduceEvent;
-DROP TABLE clusterEvent;
+drop database ambari;
+drop database ambarirca;

Modified: incubator/ambari/trunk/ambari-server/src/main/resources/upgrade/ddl/Ambari-DDL-Postgres-UPGRADE-1.3.0.sql
URL: http://svn.apache.org/viewvc/incubator/ambari/trunk/ambari-server/src/main/resources/upgrade/ddl/Ambari-DDL-Postgres-UPGRADE-1.3.0.sql?rev=1485518&r1=1485517&r2=1485518&view=diff
==============================================================================
--- incubator/ambari/trunk/ambari-server/src/main/resources/upgrade/ddl/Ambari-DDL-Postgres-UPGRADE-1.3.0.sql
(original)
+++ incubator/ambari/trunk/ambari-server/src/main/resources/upgrade/ddl/Ambari-DDL-Postgres-UPGRADE-1.3.0.sql
Thu May 23 00:25:34 2013
@@ -29,16 +29,7 @@ ALTER TABLE ambari.clusterstate
 CREATE TABLE ambari.metainfo ("metainfo_key" VARCHAR(255), "metainfo_value" VARCHAR, PRIMARY
KEY("metainfo_key"));
 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, user_name VARCHAR(255) NOT NULL DEFAULT '_db', 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, user_name
VARCHAR(255) NOT NULL DEFAULT '_db', PRIMARY KEY (cluster_id, host_name, type_name, create_timestamp));
+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;
 ALTER TABLE ambari.hostconfigmapping ADD CONSTRAINT FK_hostconfigmapping_cluster_id FOREIGN
KEY (cluster_id) REFERENCES ambari.clusters (cluster_id);
 ALTER TABLE ambari.hostconfigmapping ADD CONSTRAINT FK_hostconfigmapping_host_name FOREIGN
KEY (host_name) REFERENCES ambari.hosts (host_name);
@@ -79,3 +70,37 @@ COMMIT;
 
 UPDATE ambari.hostcomponentstate SET current_state = 'INSTALLED' WHERE current_state like
'STOP_FAILED';
 UPDATE ambari.hostcomponentstate SET current_state = 'INSTALLED' WHERE current_state like
'START_FAILED';
+
+-- service to cluster level config mappings move. idempotent update
+
+CREATE LANGUAGE plpgsql;
+
+CREATE OR REPLACE FUNCTION update_clusterconfigmapping()
+  RETURNS void AS
+$_$
+BEGIN
+
+IF NOT EXISTS (
+  SELECT *
+  FROM   pg_catalog.pg_tables
+  WHERE  schemaname = 'ambari'
+  AND    tablename  = 'clusterconfigmapping'
+  )
+  THEN
+
+    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, user_name VARCHAR(255) NOT NULL DEFAULT '_db', PRIMARY KEY (cluster_id,
type_name, create_timestamp));
+    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;
+
+END IF;
+
+END;
+$_$ LANGUAGE plpgsql;
+
+SELECT update_clusterconfigmapping();
+GRANT ALL PRIVILEGES ON TABLE ambari.clusterconfigmapping TO :username;
+



Mime
View raw message