incubator-ambari-commits mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From smoha...@apache.org
Subject svn commit: r1498799 - in /incubator/ambari/trunk/ambari-server: pom.xml src/main/resources/upgrade/ddl/Ambari-DDL-Postgres-UPGRADE-1.3.0.sql
Date Tue, 02 Jul 2013 06:32:30 GMT
Author: smohanty
Date: Tue Jul  2 06:32:29 2013
New Revision: 1498799

URL: http://svn.apache.org/r1498799
Log:
AMBARI-2447. Upgrade from 1.2.2/1.2.3.7 to 1.2.5 fails because the ddl script does not work
- metainfo version change is broken. (Vitaly Brodetsky via smohanty)

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

Modified: incubator/ambari/trunk/ambari-server/pom.xml
URL: http://svn.apache.org/viewvc/incubator/ambari/trunk/ambari-server/pom.xml?rev=1498799&r1=1498798&r2=1498799&view=diff
==============================================================================
--- incubator/ambari/trunk/ambari-server/pom.xml (original)
+++ incubator/ambari/trunk/ambari-server/pom.xml Tue Jul  2 06:32:29 2013
@@ -278,26 +278,22 @@
               <directory>/var/lib/ambari-server/resources</directory>
               <sources>
                 <source>
-                  <location>src/main/resources/Ambari-DDL-Postgres-CREATE.sql</location>
-                  <filter>true</filter>
+                  <location>target/classes/Ambari-DDL-Postgres-CREATE.sql</location>
                 </source>
                 <source>
                   <location>src/main/resources/Ambari-DDL-Postgres-DROP.sql</location>
                 </source>
                 <source>
-                  <location>src/main/resources/Ambari-DDL-Postgres-REMOTE-CREATE.sql</location>
-                  <filter>true</filter>
+                  <location>target/classes/Ambari-DDL-Postgres-REMOTE-CREATE.sql</location>
                 </source>
                 <source>
                   <location>src/main/resources/Ambari-DDL-Postgres-REMOTE-DROP.sql</location>
                 </source>
                 <source>
-                  <location>src/main/resources/Ambari-DDL-Oracle-CREATE.sql</location>
-                  <filter>true</filter>
+                  <location>target/classes/Ambari-DDL-Oracle-CREATE.sql</location>
                 </source>
                 <source>
-                  <location>src/main/resources/Ambari-DDL-MySQL-CREATE.sql</location>
-                  <filter>true</filter>
+                  <location>target/classes/Ambari-DDL-MySQL-CREATE.sql</location>
                 </source>
                 <source>
                   <location>src/main/resources/Ambari-DDL-Oracle-DROP.sql</location>
@@ -320,8 +316,7 @@
               <directory>/var/lib/ambari-server/resources/upgrade/ddl</directory>
               <sources>
                 <source>
-                  <location>src/main/resources/upgrade/ddl/Ambari-DDL-Postgres-UPGRADE-1.3.0.sql</location>
-                  <filter>true</filter>
+                  <location>target/classes/upgrade/ddl/Ambari-DDL-Postgres-UPGRADE-1.3.0.sql</location>
                 </source>
                 <source>
                   <location>src/main/resources/upgrade/ddl/Ambari-DDL-Postgres-UPGRADE-1.3.0.Fix.sql</location>

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=1498799&r1=1498798&r2=1498799&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
Tue Jul  2 06:32:29 2013
@@ -61,48 +61,10 @@ drop sequence ambari.clusters_cluster_id
 
 CREATE LANGUAGE plpgsql;
 
-BEGIN;
-
-CREATE OR REPLACE FUNCTION create_or_update_metainfo_table(ambariVersion VARCHAR, userName
TEXT) RETURNS text AS
-$$
-DECLARE
-    version VARCHAR(255) := 'version';
-    fqtn text := 'ambari.metainfo';
-BEGIN
-    IF NOT EXISTS (SELECT * FROM pg_tables WHERE tablename = 'metainfo') THEN
-        EXECUTE 'CREATE TABLE '
-        || fqtn
-        || ' (metainfo_key VARCHAR(255), metainfo_value VARCHAR, PRIMARY KEY(metainfo_key));';
-        EXECUTE 'GRANT ALL PRIVILEGES ON TABLE '
-        || fqtn
-        || ' TO '
-        || $2
-        || ';';
-        EXECUTE 'INSERT INTO '
-        || fqtn
-        || '(metainfo_key, metainfo_value) select '
-        || quote_literal(version)
-        || ','
-        || quote_literal($1)
-        || ';';
-        RETURN 'INFO: metainfo was created';
-    ELSE
-        EXECUTE 'UPDATE '
-        || fqtn
-        || ' SET metainfo_value = '
-        || quote_literal($1)
-        || ' WHERE metainfo_key = '
-        || quote_literal(version)
-        || ';';
-        RETURN 'INFO: metainfo was updated';
-    END IF;
-END;
-$$
-LANGUAGE 'plpgsql';
-
-SELECT create_or_update_metainfo_table('${ambariVersion}',:username);
-
-COMMIT;
+CREATE TABLE ambari.metainfo (metainfo_key VARCHAR(255), metainfo_value VARCHAR, PRIMARY
KEY(metainfo_key));
+INSERT INTO ambari.metainfo (metainfo_key, metainfo_value) select 'version', '${ambariVersion}';
+UPDATE ambari.metainfo SET metainfo_value = '${ambariVersion}' WHERE metainfo_key = 'version';
+GRANT ALL PRIVILEGES ON TABLE ambari.metainfo TO :username;
 
 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';



Mime
View raw message