incubator-ambari-commits mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From smoha...@apache.org
Subject svn commit: r1464222 [3/3] - in /incubator/ambari/trunk: ./ ambari-agent/src/main/puppet/modules/hdp-hadoop/manifests/ ambari-agent/src/main/puppet/modules/hdp-hadoop/templates/ ambari-server/src/main/java/org/apache/ambari/eventdb/db/ ambari-server/sr...
Date Wed, 03 Apr 2013 22:35:43 GMT
Modified: incubator/ambari/trunk/ambari-server/src/main/resources/META-INF/persistence.xml
URL: http://svn.apache.org/viewvc/incubator/ambari/trunk/ambari-server/src/main/resources/META-INF/persistence.xml?rev=1464222&r1=1464221&r2=1464222&view=diff
==============================================================================
--- incubator/ambari/trunk/ambari-server/src/main/resources/META-INF/persistence.xml (original)
+++ incubator/ambari/trunk/ambari-server/src/main/resources/META-INF/persistence.xml Wed Apr  3 22:35:41 2013
@@ -12,7 +12,7 @@
 <persistence xmlns="http://java.sun.com/xml/ns/persistence"
   version="2.0">
 
-  <persistence-unit name="ambari-postgres" transaction-type="RESOURCE_LOCAL">
+  <persistence-unit name="ambari-server" transaction-type="RESOURCE_LOCAL">
     <provider>org.eclipse.persistence.jpa.PersistenceProvider</provider>
     <class>org.apache.ambari.server.orm.entities.ClusterEntity</class>
     <class>org.apache.ambari.server.orm.entities.ClusterConfigEntity</class>
@@ -40,46 +40,46 @@
     <class>org.apache.ambari.server.orm.entities.MetainfoEntity</class>
 
     <properties>
-      <property name="javax.persistence.jdbc.url" value="jdbc:postgresql://localhost/ambari" />
-      <property name="javax.persistence.jdbc.driver" value="org.postgresql.Driver" />
+      <!--<property name="javax.persistence.jdbc.url" value="jdbc:postgresql://localhost/ambari" />-->
+      <!--<property name="javax.persistence.jdbc.driver" value="org.postgresql.Driver" />-->
       <property name="eclipselink.cache.size.default" value="3000" />
     </properties>
   </persistence-unit>
 
-  <persistence-unit name="ambari-javadb" transaction-type="RESOURCE_LOCAL">
-    <provider>org.eclipse.persistence.jpa.PersistenceProvider</provider>
-    <class>org.apache.ambari.server.orm.entities.ClusterEntity</class>
-    <class>org.apache.ambari.server.orm.entities.ClusterConfigEntity</class>
-    <class>org.apache.ambari.server.orm.entities.ClusterServiceEntity</class>
-    <class>org.apache.ambari.server.orm.entities.ClusterStateEntity</class>
-    <class>org.apache.ambari.server.orm.entities.ComponentConfigMappingEntity</class>
-    <class>org.apache.ambari.server.orm.entities.HostComponentConfigMappingEntity</class>
-    <class>org.apache.ambari.server.orm.entities.HostComponentDesiredConfigMappingEntity</class>
-    <class>org.apache.ambari.server.orm.entities.HostComponentDesiredStateEntity</class>
-    <class>org.apache.ambari.server.orm.entities.HostComponentStateEntity</class>
-    <class>org.apache.ambari.server.orm.entities.HostEntity</class>
-    <class>org.apache.ambari.server.orm.entities.HostStateEntity</class>
-    <class>org.apache.ambari.server.orm.entities.ServiceComponentDesiredStateEntity</class>
-    <class>org.apache.ambari.server.orm.entities.ServiceConfigMappingEntity</class>
-    <class>org.apache.ambari.server.orm.entities.ServiceDesiredStateEntity</class>
-    <class>org.apache.ambari.server.orm.entities.RoleEntity</class>
-    <class>org.apache.ambari.server.orm.entities.UserEntity</class>
-    <class>org.apache.ambari.server.orm.entities.ExecutionCommandEntity</class>
-    <class>org.apache.ambari.server.orm.entities.HostRoleCommandEntity</class>
-    <class>org.apache.ambari.server.orm.entities.RoleSuccessCriteriaEntity</class>
-    <class>org.apache.ambari.server.orm.entities.StageEntity</class>
-    <class>org.apache.ambari.server.orm.entities.KeyValueEntity</class>
-    <class>org.apache.ambari.server.orm.entities.ClusterConfigMappingEntity</class>
-    <class>org.apache.ambari.server.orm.entities.HostConfigMappingEntity</class>
-    <class>org.apache.ambari.server.orm.entities.MetainfoEntity</class>
+  <!--<persistence-unit name="ambari-javadb" transaction-type="RESOURCE_LOCAL">-->
+    <!--<provider>org.eclipse.persistence.jpa.PersistenceProvider</provider>-->
+    <!--<class>org.apache.ambari.server.orm.entities.ClusterEntity</class>-->
+    <!--<class>org.apache.ambari.server.orm.entities.ClusterConfigEntity</class>-->
+    <!--<class>org.apache.ambari.server.orm.entities.ClusterServiceEntity</class>-->
+    <!--<class>org.apache.ambari.server.orm.entities.ClusterStateEntity</class>-->
+    <!--<class>org.apache.ambari.server.orm.entities.ComponentConfigMappingEntity</class>-->
+    <!--<class>org.apache.ambari.server.orm.entities.HostComponentConfigMappingEntity</class>-->
+    <!--<class>org.apache.ambari.server.orm.entities.HostComponentDesiredConfigMappingEntity</class>-->
+    <!--<class>org.apache.ambari.server.orm.entities.HostComponentDesiredStateEntity</class>-->
+    <!--<class>org.apache.ambari.server.orm.entities.HostComponentStateEntity</class>-->
+    <!--<class>org.apache.ambari.server.orm.entities.HostEntity</class>-->
+    <!--<class>org.apache.ambari.server.orm.entities.HostStateEntity</class>-->
+    <!--<class>org.apache.ambari.server.orm.entities.ServiceComponentDesiredStateEntity</class>-->
+    <!--<class>org.apache.ambari.server.orm.entities.ServiceConfigMappingEntity</class>-->
+    <!--<class>org.apache.ambari.server.orm.entities.ServiceDesiredStateEntity</class>-->
+    <!--<class>org.apache.ambari.server.orm.entities.RoleEntity</class>-->
+    <!--<class>org.apache.ambari.server.orm.entities.UserEntity</class>-->
+    <!--<class>org.apache.ambari.server.orm.entities.ExecutionCommandEntity</class>-->
+    <!--<class>org.apache.ambari.server.orm.entities.HostRoleCommandEntity</class>-->
+    <!--<class>org.apache.ambari.server.orm.entities.RoleSuccessCriteriaEntity</class>-->
+    <!--<class>org.apache.ambari.server.orm.entities.StageEntity</class>-->
+    <!--<class>org.apache.ambari.server.orm.entities.KeyValueEntity</class>-->
+    <!--<class>org.apache.ambari.server.orm.entities.ClusterConfigMappingEntity</class>-->
+    <!--<class>org.apache.ambari.server.orm.entities.HostConfigMappingEntity</class>-->
+    <!--<class>org.apache.ambari.server.orm.entities.MetainfoEntity</class>-->
 
-    <properties>
-      <property name="javax.persistence.jdbc.url" value="jdbc:derby:memory:myDB;create=true" />
-      <property name="javax.persistence.jdbc.driver" value="org.apache.derby.jdbc.EmbeddedDriver" />
-      <property name="eclipselink.ddl-generation" value="drop-and-create-tables" />
-      <property name="eclipselink.orm.throw.exceptions" value="true" />
-      <property name="eclipselink.cache.size.default" value="3000" />
-      <!--<property name="eclipselink.logging.level" value="FINEST"/>-->
-    </properties>
-  </persistence-unit>
+    <!--<properties>-->
+      <!--<property name="javax.persistence.jdbc.url" value="jdbc:derby:memory:myDB/ambari;create=true" />-->
+      <!--<property name="javax.persistence.jdbc.driver" value="org.apache.derby.jdbc.EmbeddedDriver" />-->
+      <!--<property name="eclipselink.ddl-generation" value="drop-and-create-tables" />-->
+      <!--<property name="eclipselink.orm.throw.exceptions" value="true" />-->
+      <!--<property name="eclipselink.cache.size.default" value="3000" />-->
+      <!--&lt;!&ndash;<property name="eclipselink.logging.level" value="FINEST"/>&ndash;&gt;-->
+    <!--</properties>-->
+  <!--</persistence-unit>-->
 </persistence>

Added: incubator/ambari/trunk/ambari-server/src/main/resources/mysql-ddl.sql
URL: http://svn.apache.org/viewvc/incubator/ambari/trunk/ambari-server/src/main/resources/mysql-ddl.sql?rev=1464222&view=auto
==============================================================================
--- incubator/ambari/trunk/ambari-server/src/main/resources/mysql-ddl.sql (added)
+++ incubator/ambari/trunk/ambari-server/src/main/resources/mysql-ddl.sql Wed Apr  3 22:35:41 2013
@@ -0,0 +1,172 @@
+DROP DATABASE IF EXISTS `ambari`;
+DROP DATABASE IF EXISTS `ambarirca`;
+DROP USER `ambari-server`;
+-- DROP USER `mapred`;
+
+delimiter ;
+
+CREATE DATABASE `ambari` /*!40100 DEFAULT CHARACTER SET utf8 */;
+
+CREATE USER 'ambari-server' IDENTIFIED BY 'bigdata';
+
+USE ambari;
+
+CREATE TABLE clusters (cluster_id BIGINT NOT NULL, cluster_info VARCHAR(255) NOT NULL, cluster_name VARCHAR(100) NOT NULL UNIQUE, desired_cluster_state VARCHAR(255) NOT NULL, desired_stack_version VARCHAR(255) NOT NULL, PRIMARY KEY (cluster_id));
+CREATE TABLE clusterconfig (version_tag VARCHAR(255) NOT NULL, type_name VARCHAR(255) NOT NULL, cluster_id BIGINT NOT NULL, config_data LONGTEXT NOT NULL, create_timestamp BIGINT NOT NULL, PRIMARY KEY (version_tag, type_name, cluster_id));
+CREATE TABLE clusterservices (service_name VARCHAR(255) NOT NULL, cluster_id BIGINT NOT NULL, service_enabled INTEGER NOT NULL, PRIMARY KEY (service_name, cluster_id));
+CREATE TABLE clusterstate (cluster_id BIGINT NOT NULL, current_cluster_state VARCHAR(255) NOT NULL, current_stack_version VARCHAR(255) NOT NULL, PRIMARY KEY (cluster_id));
+CREATE TABLE componentconfigmapping (config_type VARCHAR(255) NOT NULL, cluster_id BIGINT NOT NULL, component_name VARCHAR(255) NOT NULL, config_tag VARCHAR(255) NOT NULL, service_name VARCHAR(255) NOT NULL, timestamp BIGINT NOT NULL, PRIMARY KEY (config_type, cluster_id, component_name, service_name));
+CREATE TABLE hostcomponentconfigmapping (config_type VARCHAR(255) NOT NULL, cluster_id BIGINT NOT NULL, component_name VARCHAR(255) NOT NULL, config_tag VARCHAR(255) NOT NULL, host_name VARCHAR(255) NOT NULL, service_name VARCHAR(255) NOT NULL, timestamp BIGINT NOT NULL, PRIMARY KEY (config_type, cluster_id, component_name, host_name, service_name));
+CREATE TABLE hcdesiredconfigmapping (config_type VARCHAR(255) NOT NULL, cluster_id BIGINT NOT NULL, component_name VARCHAR(255) NOT NULL, config_tag VARCHAR(255) NOT NULL, host_name VARCHAR(255) NOT NULL, service_name VARCHAR(255) NOT NULL, timestamp BIGINT NOT NULL, PRIMARY KEY (config_type, cluster_id, component_name, host_name, service_name));
+CREATE TABLE hostcomponentdesiredstate (cluster_id BIGINT NOT NULL, component_name VARCHAR(255) NOT NULL, desired_stack_version VARCHAR(255) NOT NULL, desired_state VARCHAR(255) NOT NULL, host_name VARCHAR(255) NOT NULL, service_name VARCHAR(255) NOT NULL, PRIMARY KEY (cluster_id, component_name, host_name, service_name));
+CREATE TABLE hostcomponentstate (cluster_id BIGINT NOT NULL, component_name VARCHAR(255) NOT NULL, current_stack_version VARCHAR(255) NOT NULL, current_state VARCHAR(255) NOT NULL, host_name VARCHAR(255) NOT NULL, service_name VARCHAR(255) NOT NULL, PRIMARY KEY (cluster_id, component_name, host_name, service_name));
+CREATE TABLE hosts (host_name VARCHAR(255) NOT NULL, cpu_count INTEGER NOT NULL, cpu_info VARCHAR(255) NOT NULL, discovery_status VARCHAR(2000) NOT NULL, disks_info LONGTEXT NOT NULL, host_attributes LONGTEXT, ipv4 VARCHAR(255), ipv6 VARCHAR(255), last_registration_time BIGINT NOT NULL, os_arch VARCHAR(255) NOT NULL, os_info VARCHAR(1000) NOT NULL, os_type VARCHAR(255) NOT NULL, ph_cpu_count INTEGER NOT NULL, public_host_name VARCHAR(255), rack_info VARCHAR(255) NOT NULL, total_mem BIGINT NOT NULL, PRIMARY KEY (host_name));
+CREATE TABLE hoststate (agent_version VARCHAR(255) NOT NULL, available_mem BIGINT NOT NULL, current_state VARCHAR(255) NOT NULL, health_status VARCHAR(255), host_name VARCHAR(255) NOT NULL, time_in_state BIGINT NOT NULL, PRIMARY KEY (host_name));
+CREATE TABLE servicecomponentdesiredstate (component_name VARCHAR(255) NOT NULL, cluster_id BIGINT NOT NULL, desired_stack_version VARCHAR(255) NOT NULL, desired_state VARCHAR(255) NOT NULL, service_name VARCHAR(255) NOT NULL, PRIMARY KEY (component_name, cluster_id, service_name));
+CREATE TABLE serviceconfigmapping (config_type VARCHAR(255) NOT NULL, cluster_id BIGINT NOT NULL, config_tag VARCHAR(255) NOT NULL, service_name VARCHAR(255) NOT NULL, timestamp BIGINT NOT NULL, PRIMARY KEY (config_type, cluster_id, service_name));
+CREATE TABLE servicedesiredstate (cluster_id BIGINT NOT NULL, desired_host_role_mapping INTEGER NOT NULL, desired_stack_version VARCHAR(255) NOT NULL, desired_state VARCHAR(255) NOT NULL, service_name VARCHAR(255) NOT NULL, PRIMARY KEY (cluster_id, service_name));
+CREATE TABLE roles (role_name VARCHAR(255) NOT NULL, PRIMARY KEY (role_name));
+CREATE TABLE users (user_id INTEGER NOT NULL, create_time DATETIME, ldap_user INTEGER, user_name VARCHAR(255), user_password VARCHAR(255), PRIMARY KEY (user_id));
+CREATE TABLE execution_command (task_id BIGINT NOT NULL, command LONGBLOB, PRIMARY KEY (task_id));
+CREATE TABLE host_role_command (task_id BIGINT NOT NULL, attempt_count SMALLINT NOT NULL, event LONGTEXT NOT NULL, exitcode INTEGER NOT NULL, host_name VARCHAR(255) NOT NULL, last_attempt_time BIGINT NOT NULL, request_id BIGINT NOT NULL, role VARCHAR(255), role_command VARCHAR(255), stage_id BIGINT NOT NULL, start_time BIGINT NOT NULL, status VARCHAR(255), std_error LONGBLOB, std_out LONGBLOB, PRIMARY KEY (task_id));
+CREATE TABLE role_success_criteria (role VARCHAR(255) NOT NULL, request_id BIGINT NOT NULL, stage_id BIGINT NOT NULL, success_factor DOUBLE NOT NULL, PRIMARY KEY (role, request_id, stage_id));
+CREATE TABLE stage (stage_id BIGINT NOT NULL, request_id BIGINT NOT NULL, cluster_id BIGINT, log_info VARCHAR(255) NOT NULL, request_context VARCHAR(255), PRIMARY KEY (stage_id, request_id));
+CREATE TABLE key_value_store (`key` VARCHAR(255) NOT NULL, `value` LONGTEXT, PRIMARY KEY (`key`));
+CREATE TABLE clusterconfigmapping (type_name VARCHAR(255) NOT NULL, create_timestamp BIGINT NOT NULL, cluster_id BIGINT NOT NULL, selected INTEGER NOT NULL, version_tag VARCHAR(255) NOT NULL, PRIMARY KEY (type_name, create_timestamp, cluster_id));
+CREATE TABLE hostconfigmapping (create_timestamp BIGINT NOT NULL, host_name VARCHAR(255) NOT NULL, cluster_id BIGINT NOT NULL, type_name VARCHAR(255) NOT NULL, selected INTEGER NOT NULL, service_name VARCHAR(255), version_tag VARCHAR(255) NOT NULL, PRIMARY KEY (create_timestamp, host_name, cluster_id, type_name));
+CREATE TABLE metainfo (`metainfo_key` VARCHAR(255) NOT NULL, `metainfo_value` LONGTEXT, PRIMARY KEY (`metainfo_key`));
+CREATE TABLE ClusterHostMapping (cluster_id BIGINT NOT NULL, host_name VARCHAR(255) NOT NULL, PRIMARY KEY (cluster_id, host_name));
+CREATE TABLE user_roles (role_name VARCHAR(255) NOT NULL, user_id INTEGER NOT NULL, PRIMARY KEY (role_name, user_id));
+CREATE TABLE ambari_sequences (sequence_name VARCHAR(50) NOT NULL, value DECIMAL(38), PRIMARY KEY (sequence_name));
+
+
+ALTER TABLE users ADD CONSTRAINT UNQ_users_0 UNIQUE (user_name, ldap_user);
+ALTER TABLE clusterconfig ADD CONSTRAINT FK_clusterconfig_cluster_id FOREIGN KEY (cluster_id) REFERENCES clusters (cluster_id);
+ALTER TABLE clusterservices ADD CONSTRAINT FK_clusterservices_cluster_id FOREIGN KEY (cluster_id) REFERENCES clusters (cluster_id);
+ALTER TABLE clusterstate ADD CONSTRAINT FK_clusterstate_cluster_id FOREIGN KEY (cluster_id) REFERENCES clusters (cluster_id);
+ALTER TABLE componentconfigmapping ADD CONSTRAINT FK_componentconfigmapping_config_tag FOREIGN KEY (config_tag, config_type, cluster_id) REFERENCES clusterconfig (version_tag, type_name, cluster_id);
+ALTER TABLE componentconfigmapping ADD CONSTRAINT FK_componentconfigmapping_component_name FOREIGN KEY (component_name, cluster_id, service_name) REFERENCES servicecomponentdesiredstate (component_name, cluster_id, service_name);
+ALTER TABLE hostcomponentconfigmapping ADD CONSTRAINT FK_hostcomponentconfigmapping_config_tag FOREIGN KEY (config_tag, config_type, cluster_id) REFERENCES clusterconfig (version_tag, type_name, cluster_id);
+ALTER TABLE hostcomponentconfigmapping ADD CONSTRAINT FK_hostcomponentconfigmapping_cluster_id FOREIGN KEY (cluster_id, component_name, host_name, service_name) REFERENCES hostcomponentstate (cluster_id, component_name, host_name, service_name);
+ALTER TABLE hcdesiredconfigmapping ADD CONSTRAINT FK_hcdesiredconfigmapping_config_tag FOREIGN KEY (config_tag, config_type, cluster_id) REFERENCES clusterconfig (version_tag, type_name, cluster_id);
+ALTER TABLE hcdesiredconfigmapping ADD CONSTRAINT FK_hcdesiredconfigmapping_cluster_id FOREIGN KEY (cluster_id, component_name, host_name, service_name) REFERENCES hostcomponentdesiredstate (cluster_id, component_name, host_name, service_name);
+ALTER TABLE hostcomponentdesiredstate ADD CONSTRAINT FK_hostcomponentdesiredstate_host_name FOREIGN KEY (host_name) REFERENCES hosts (host_name);
+ALTER TABLE hostcomponentdesiredstate ADD CONSTRAINT FK_hostcomponentdesiredstate_component_name FOREIGN KEY (component_name, cluster_id, service_name) REFERENCES servicecomponentdesiredstate (component_name, cluster_id, service_name);
+ALTER TABLE hostcomponentstate ADD CONSTRAINT FK_hostcomponentstate_component_name FOREIGN KEY (component_name, cluster_id, service_name) REFERENCES servicecomponentdesiredstate (component_name, cluster_id, service_name);
+ALTER TABLE hostcomponentstate ADD CONSTRAINT FK_hostcomponentstate_host_name FOREIGN KEY (host_name) REFERENCES hosts (host_name);
+ALTER TABLE hoststate ADD CONSTRAINT FK_hoststate_host_name FOREIGN KEY (host_name) REFERENCES hosts (host_name);
+ALTER TABLE servicecomponentdesiredstate ADD CONSTRAINT FK_servicecomponentdesiredstate_service_name FOREIGN KEY (service_name, cluster_id) REFERENCES clusterservices (service_name, cluster_id);
+ALTER TABLE serviceconfigmapping ADD CONSTRAINT FK_serviceconfigmapping_config_tag FOREIGN KEY (config_tag, config_type, cluster_id) REFERENCES clusterconfig (version_tag, type_name, cluster_id);
+ALTER TABLE serviceconfigmapping ADD CONSTRAINT FK_serviceconfigmapping_service_name FOREIGN KEY (service_name, cluster_id) REFERENCES clusterservices (service_name, cluster_id);
+ALTER TABLE servicedesiredstate ADD CONSTRAINT FK_servicedesiredstate_service_name FOREIGN KEY (service_name, cluster_id) REFERENCES clusterservices (service_name, cluster_id);
+ALTER TABLE execution_command ADD CONSTRAINT FK_execution_command_task_id FOREIGN KEY (task_id) REFERENCES host_role_command (task_id);
+ALTER TABLE host_role_command ADD CONSTRAINT FK_host_role_command_stage_id FOREIGN KEY (stage_id, request_id) REFERENCES stage (stage_id, request_id);
+ALTER TABLE host_role_command ADD CONSTRAINT FK_host_role_command_host_name FOREIGN KEY (host_name) REFERENCES hosts (host_name);
+ALTER TABLE role_success_criteria ADD CONSTRAINT FK_role_success_criteria_stage_id FOREIGN KEY (stage_id, request_id) REFERENCES stage (stage_id, request_id);
+ALTER TABLE stage ADD CONSTRAINT FK_stage_cluster_id FOREIGN KEY (cluster_id) REFERENCES clusters (cluster_id);
+ALTER TABLE clusterconfigmapping ADD CONSTRAINT FK_clusterconfigmapping_cluster_id FOREIGN KEY (cluster_id) REFERENCES clusters (cluster_id);
+ALTER TABLE ClusterHostMapping ADD CONSTRAINT FK_ClusterHostMapping_host_name FOREIGN KEY (host_name) REFERENCES hosts (host_name);
+ALTER TABLE ClusterHostMapping ADD CONSTRAINT FK_ClusterHostMapping_cluster_id FOREIGN KEY (cluster_id) REFERENCES clusters (cluster_id);
+ALTER TABLE user_roles ADD CONSTRAINT FK_user_roles_user_id FOREIGN KEY (user_id) REFERENCES users (user_id);
+ALTER TABLE user_roles ADD CONSTRAINT FK_user_roles_role_name FOREIGN KEY (role_name) REFERENCES roles (role_name);
+
+
+INSERT INTO ambari_sequences(sequence_name, value) values ('cluster_id_seq', 0);
+INSERT INTO ambari_sequences(sequence_name, value) values ('host_role_command_id_seq', 0);
+INSERT INTO ambari_sequences(sequence_name, value) values ('user_id_seq', 1);
+
+insert into ambari.Roles(role_name)
+select 'admin'
+union all
+select 'user';
+
+insert into ambari.Users(user_id, user_name, user_password)
+select 1,'admin','538916f8943ec225d97a9a86a2c6ec0818c1cd400e09e03b660fdaaec4af29ddbb6f2b1033b81b00';
+
+insert into ambari.user_roles(role_name, user_id)
+select 'admin',1;
+
+insert into ambari.metainfo(`metainfo_key`, `metainfo_value`)
+select 'version','1.3.0';
+
+
+
+CREATE TABLE workflow (
+  workflowId VARCHAR(255), workflowName TEXT,
+  parentWorkflowId VARCHAR(255),  
+  workflowContext TEXT, userName TEXT,
+  startTime BIGINT, lastUpdateTime BIGINT,
+  numJobsTotal INTEGER, numJobsCompleted INTEGER,
+  inputBytes BIGINT, outputBytes BIGINT,
+  duration BIGINT,
+  PRIMARY KEY (workflowId),
+  FOREIGN KEY (parentWorkflowId) REFERENCES workflow(workflowId)
+);
+
+CREATE TABLE job (
+  jobId VARCHAR(255), workflowId VARCHAR(255), jobName TEXT, workflowEntityName TEXT,
+  userName TEXT, queue TEXT, acls TEXT, confPath TEXT, 
+  submitTime BIGINT, launchTime BIGINT, finishTime BIGINT, 
+  maps INTEGER, reduces INTEGER, status TEXT, priority TEXT, 
+  finishedMaps INTEGER, finishedReduces INTEGER, 
+  failedMaps INTEGER, failedReduces INTEGER, 
+  mapsRuntime BIGINT, reducesRuntime BIGINT,
+  mapCounters TEXT, reduceCounters TEXT, jobCounters TEXT, 
+  inputBytes BIGINT, outputBytes BIGINT,
+  PRIMARY KEY(jobId),
+  FOREIGN KEY(workflowId) REFERENCES workflow(workflowId)
+);
+
+CREATE TABLE task (
+  taskId VARCHAR(255), jobId VARCHAR(255), taskType TEXT, splits TEXT, 
+  startTime BIGINT, finishTime BIGINT, status TEXT, error TEXT, counters TEXT, 
+  failedAttempt TEXT, 
+  PRIMARY KEY(taskId), 
+  FOREIGN KEY(jobId) REFERENCES job(jobId)
+);
+
+CREATE TABLE taskAttempt (
+  taskAttemptId VARCHAR(255), taskId VARCHAR(255), jobId VARCHAR(255), taskType TEXT, taskTracker TEXT, 
+  startTime BIGINT, finishTime BIGINT, 
+  mapFinishTime BIGINT, shuffleFinishTime BIGINT, sortFinishTime BIGINT, 
+  locality TEXT, avataar TEXT, 
+  status TEXT, error TEXT, counters TEXT, 
+  inputBytes BIGINT, outputBytes BIGINT,
+  PRIMARY KEY(taskAttemptId), 
+  FOREIGN KEY(jobId) REFERENCES job(jobId), 
+  FOREIGN KEY(taskId) REFERENCES task(taskId)
+); 
+
+CREATE TABLE hdfsEvent (
+  timestamp BIGINT,
+  userName TEXT,
+  clientIP TEXT,
+  operation TEXT,
+  srcPath TEXT,
+  dstPath TEXT,
+  permissions TEXT
+);
+
+CREATE TABLE mapreduceEvent (
+  timestamp BIGINT,
+  userName TEXT,
+  clientIP TEXT,
+  operation TEXT,
+  target TEXT,
+  result TEXT,
+  description TEXT,
+  permissions TEXT
+);
+
+CREATE TABLE clusterEvent (
+  timestamp BIGINT, 
+  service TEXT, status TEXT, 
+  error TEXT, data TEXT , 
+  host TEXT, rack TEXT
+);
+
+GRANT ALL ON ambari.* TO `ambari-server`;
+
+
+
+

Added: incubator/ambari/trunk/ambari-server/src/main/resources/oracle-DDL.sql
URL: http://svn.apache.org/viewvc/incubator/ambari/trunk/ambari-server/src/main/resources/oracle-DDL.sql?rev=1464222&view=auto
==============================================================================
--- incubator/ambari/trunk/ambari-server/src/main/resources/oracle-DDL.sql (added)
+++ incubator/ambari/trunk/ambari-server/src/main/resources/oracle-DDL.sql Wed Apr  3 22:35:41 2013
@@ -0,0 +1,209 @@
+-- PL/SQL script
+DROP USER &1 CASCADE;
+CREATE USER &1 IDENTIFIED BY &2 DEFAULT TABLESPACE "USERS" TEMPORARY TABLESPACE "TEMP";
+
+GRANT UNLIMITED TABLESPACE TO &1;
+GRANT CREATE SESSION TO &1;
+GRANT CREATE TABLE TO &1;
+
+ALTER SESSION SET CURRENT_SCHEMA= &1;
+
+CREATE TABLE clusters (cluster_id NUMBER(19) NOT NULL, cluster_info VARCHAR2(255) NULL, cluster_name VARCHAR2(100) NOT NULL UNIQUE, desired_cluster_state VARCHAR2(255) NULL, desired_stack_version VARCHAR2(255) NULL, PRIMARY KEY (cluster_id));
+CREATE TABLE clusterconfig (version_tag VARCHAR2(255) NOT NULL, type_name VARCHAR2(255) NOT NULL, cluster_id NUMBER(19) NOT NULL, config_data CLOB NOT NULL, create_timestamp NUMBER(19) NOT NULL, PRIMARY KEY (version_tag, type_name, cluster_id));
+CREATE TABLE clusterservices (service_name VARCHAR2(255) NOT NULL, cluster_id NUMBER(19) NOT NULL, service_enabled NUMBER(10) NOT NULL, PRIMARY KEY (service_name, cluster_id));
+CREATE TABLE clusterstate (cluster_id NUMBER(19) NOT NULL, current_cluster_state VARCHAR2(255) NULL, current_stack_version VARCHAR2(255) NULL, PRIMARY KEY (cluster_id));
+CREATE TABLE componentconfigmapping (config_type VARCHAR2(255) NOT NULL, cluster_id NUMBER(19) NOT NULL, component_name VARCHAR2(255) NOT NULL, config_tag VARCHAR2(255) NOT NULL, service_name VARCHAR2(255) NOT NULL, timestamp NUMBER(19) NOT NULL, PRIMARY KEY (config_type, cluster_id, component_name, service_name));
+CREATE TABLE hostcomponentconfigmapping (config_type VARCHAR2(255) NOT NULL, cluster_id NUMBER(19) NOT NULL, component_name VARCHAR2(255) NOT NULL, config_tag VARCHAR2(255) NOT NULL, host_name VARCHAR2(255) NOT NULL, service_name VARCHAR2(255) NOT NULL, timestamp NUMBER(19) NOT NULL, PRIMARY KEY (config_type, cluster_id, component_name, host_name, service_name));
+CREATE TABLE hcdesiredconfigmapping (config_type VARCHAR2(255) NOT NULL, cluster_id NUMBER(19) NOT NULL, component_name VARCHAR2(255) NOT NULL, config_tag VARCHAR2(255) NOT NULL, host_name VARCHAR2(255) NOT NULL, service_name VARCHAR2(255) NOT NULL, timestamp NUMBER(19) NOT NULL, PRIMARY KEY (config_type, cluster_id, component_name, host_name, service_name));
+CREATE TABLE hostcomponentdesiredstate (cluster_id NUMBER(19) NOT NULL, component_name VARCHAR2(255) NOT NULL, desired_stack_version VARCHAR2(255) NULL, desired_state VARCHAR2(255) NOT NULL, host_name VARCHAR2(255) NOT NULL, service_name VARCHAR2(255) NOT NULL, PRIMARY KEY (cluster_id, component_name, host_name, service_name));
+CREATE TABLE hostcomponentstate (cluster_id NUMBER(19) NOT NULL, component_name VARCHAR2(255) NOT NULL, current_stack_version VARCHAR2(255) NOT NULL, current_state VARCHAR2(255) NOT NULL, host_name VARCHAR2(255) NOT NULL, service_name VARCHAR2(255) NOT NULL, PRIMARY KEY (cluster_id, component_name, host_name, service_name));
+CREATE TABLE hosts (host_name VARCHAR2(255) NOT NULL, cpu_count INTEGER NOT NULL, cpu_info VARCHAR2(255) NULL, discovery_status VARCHAR2(2000) NULL, disks_info CLOB NOT NULL, host_attributes CLOB NULL, ipv4 VARCHAR2(255) NULL, ipv6 VARCHAR2(255) NULL, last_registration_time INTEGER NOT NULL, os_arch VARCHAR2(255) NULL, os_info VARCHAR2(1000) NULL, os_type VARCHAR2(255) NULL, ph_cpu_count INTEGER NOT NULL, public_host_name VARCHAR2(255) NULL, rack_info VARCHAR2(255) NOT NULL, total_mem INTEGER NOT NULL, PRIMARY KEY (host_name));
+CREATE TABLE hoststate (agent_version VARCHAR2(255) NULL, available_mem NUMBER(19) NOT NULL, current_state VARCHAR2(255) NOT NULL, health_status VARCHAR2(255) NULL, host_name VARCHAR2(255) NOT NULL, time_in_state NUMBER(19) NOT NULL, PRIMARY KEY (host_name));
+CREATE TABLE servicecomponentdesiredstate (component_name VARCHAR2(255) NOT NULL, cluster_id NUMBER(19) NOT NULL, desired_stack_version VARCHAR2(255) NULL, desired_state VARCHAR2(255) NOT NULL, service_name VARCHAR2(255) NOT NULL, PRIMARY KEY (component_name, cluster_id, service_name));
+CREATE TABLE serviceconfigmapping (config_type VARCHAR2(255) NOT NULL, cluster_id NUMBER(19) NOT NULL, config_tag VARCHAR2(255) NOT NULL, service_name VARCHAR2(255) NOT NULL, timestamp NUMBER(19) NOT NULL, PRIMARY KEY (config_type, cluster_id, service_name));
+CREATE TABLE servicedesiredstate (cluster_id NUMBER(19) NOT NULL, desired_host_role_mapping NUMBER(10) NOT NULL, desired_stack_version VARCHAR2(255) NULL, desired_state VARCHAR2(255) NOT NULL, service_name VARCHAR2(255) NOT NULL, PRIMARY KEY (cluster_id, service_name));
+CREATE TABLE roles (role_name VARCHAR2(255) NOT NULL, PRIMARY KEY (role_name));
+CREATE TABLE users (user_id NUMBER(10) NOT NULL, create_time TIMESTAMP NULL, ldap_user NUMBER(10) DEFAULT 0, user_name VARCHAR2(255) NULL, user_password VARCHAR2(255) NULL, PRIMARY KEY (user_id));
+CREATE TABLE execution_command (task_id NUMBER(19) NOT NULL, command BLOB NULL, PRIMARY KEY (task_id));
+CREATE TABLE host_role_command (task_id NUMBER(19) NOT NULL, attempt_count NUMBER(5) NOT NULL, event CLOB NULL, exitcode NUMBER(10) NOT NULL, host_name VARCHAR2(255) NOT NULL, last_attempt_time NUMBER(19) NOT NULL, request_id NUMBER(19) NOT NULL, role VARCHAR2(255) NULL, role_command VARCHAR2(255) NULL, stage_id NUMBER(19) NOT NULL, start_time NUMBER(19) NOT NULL, status VARCHAR2(255) NULL, std_error BLOB NULL, std_out BLOB NULL, PRIMARY KEY (task_id));
+CREATE TABLE role_success_criteria (role VARCHAR2(255) NOT NULL, request_id NUMBER(19) NOT NULL, stage_id NUMBER(19) NOT NULL, success_factor NUMBER(19,4) NOT NULL, PRIMARY KEY (role, request_id, stage_id));
+CREATE TABLE stage (stage_id NUMBER(19) NOT NULL, request_id NUMBER(19) NOT NULL, cluster_id NUMBER(19) NULL, log_info VARCHAR2(255) NULL, request_context VARCHAR2(255) NULL, PRIMARY KEY (stage_id, request_id));
+CREATE TABLE key_value_store ("key" VARCHAR2(255) NOT NULL, "value" CLOB NULL, PRIMARY KEY ("key"));
+CREATE TABLE clusterconfigmapping (type_name VARCHAR2(255) NOT NULL, create_timestamp NUMBER(19) NOT NULL, cluster_id NUMBER(19) NOT NULL, selected NUMBER(10) NOT NULL, version_tag VARCHAR2(255) NOT NULL, PRIMARY KEY (type_name, create_timestamp, cluster_id));
+CREATE TABLE hostconfigmapping (create_timestamp NUMBER(19) NOT NULL, host_name VARCHAR2(255) NOT NULL, cluster_id NUMBER(19) NOT NULL, type_name VARCHAR2(255) NOT NULL, selected NUMBER(10) NOT NULL, service_name VARCHAR2(255) NULL, version_tag VARCHAR2(255) NOT NULL, PRIMARY KEY (create_timestamp, host_name, cluster_id, type_name));
+CREATE TABLE metainfo ("metainfo_key" VARCHAR2(255) NOT NULL, "metainfo_value" CLOB NULL, PRIMARY KEY ("metainfo_key"));
+CREATE TABLE ClusterHostMapping (cluster_id NUMBER(19) NOT NULL, host_name VARCHAR2(255) NOT NULL, PRIMARY KEY (cluster_id, host_name));
+CREATE TABLE user_roles (role_name VARCHAR2(255) NOT NULL, user_id NUMBER(10) NOT NULL, PRIMARY KEY (role_name, user_id));
+CREATE TABLE ambari_sequences (sequence_name VARCHAR2(50) NOT NULL, value NUMBER(38) NULL, PRIMARY KEY (sequence_name));
+
+
+ALTER TABLE users ADD CONSTRAINT UNQ_users_0 UNIQUE (user_name, ldap_user);
+ALTER TABLE clusterconfig ADD CONSTRAINT FK_clusterconfig_cluster_id FOREIGN KEY (cluster_id) REFERENCES clusters (cluster_id);
+ALTER TABLE clusterservices ADD CONSTRAINT FK_clusterservices_cluster_id FOREIGN KEY (cluster_id) REFERENCES clusters (cluster_id);
+ALTER TABLE clusterstate ADD CONSTRAINT FK_clusterstate_cluster_id FOREIGN KEY (cluster_id) REFERENCES clusters (cluster_id);
+ALTER TABLE componentconfigmapping ADD CONSTRAINT cmponentconfigmappingconfigtag FOREIGN KEY (config_tag, config_type, cluster_id) REFERENCES clusterconfig (version_tag, type_name, cluster_id);
+ALTER TABLE componentconfigmapping ADD CONSTRAINT cmpnntconfigmappingcmpnentname FOREIGN KEY (component_name, cluster_id, service_name) REFERENCES servicecomponentdesiredstate (component_name, cluster_id, service_name);
+ALTER TABLE hostcomponentconfigmapping ADD CONSTRAINT hstcmponentconfigmappingclstrd FOREIGN KEY (cluster_id, component_name, host_name, service_name) REFERENCES hostcomponentstate (cluster_id, component_name, host_name, service_name);
+ALTER TABLE hostcomponentconfigmapping ADD CONSTRAINT hstcmponentconfigmappingcnfgtg FOREIGN KEY (config_tag, config_type, cluster_id) REFERENCES clusterconfig (version_tag, type_name, cluster_id);
+ALTER TABLE hcdesiredconfigmapping ADD CONSTRAINT hcdesiredconfigmappingcnfigtag FOREIGN KEY (config_tag, config_type, cluster_id) REFERENCES clusterconfig (version_tag, type_name, cluster_id);
+ALTER TABLE hcdesiredconfigmapping ADD CONSTRAINT hcdesiredconfigmappingclsterid FOREIGN KEY (cluster_id, component_name, host_name, service_name) REFERENCES hostcomponentdesiredstate (cluster_id, component_name, host_name, service_name);
+ALTER TABLE hostcomponentdesiredstate ADD CONSTRAINT hstcmponentdesiredstatehstname FOREIGN KEY (host_name) REFERENCES hosts (host_name);
+ALTER TABLE hostcomponentdesiredstate ADD CONSTRAINT hstcmpnntdesiredstatecmpnntnme FOREIGN KEY (component_name, cluster_id, service_name) REFERENCES servicecomponentdesiredstate (component_name, cluster_id, service_name);
+ALTER TABLE hostcomponentstate ADD CONSTRAINT hstcomponentstatecomponentname FOREIGN KEY (component_name, cluster_id, service_name) REFERENCES servicecomponentdesiredstate (component_name, cluster_id, service_name);
+ALTER TABLE hostcomponentstate ADD CONSTRAINT hostcomponentstate_host_name FOREIGN KEY (host_name) REFERENCES hosts (host_name);
+ALTER TABLE hoststate ADD CONSTRAINT FK_hoststate_host_name FOREIGN KEY (host_name) REFERENCES hosts (host_name);
+ALTER TABLE servicecomponentdesiredstate ADD CONSTRAINT srvccmponentdesiredstatesrvcnm FOREIGN KEY (service_name, cluster_id) REFERENCES clusterservices (service_name, cluster_id);
+ALTER TABLE serviceconfigmapping ADD CONSTRAINT srviceconfigmappingservicename FOREIGN KEY (service_name, cluster_id) REFERENCES clusterservices (service_name, cluster_id);
+ALTER TABLE serviceconfigmapping ADD CONSTRAINT serviceconfigmappingconfig_tag FOREIGN KEY (config_tag, config_type, cluster_id) REFERENCES clusterconfig (version_tag, type_name, cluster_id);
+ALTER TABLE servicedesiredstate ADD CONSTRAINT servicedesiredstateservicename FOREIGN KEY (service_name, cluster_id) REFERENCES clusterservices (service_name, cluster_id);
+ALTER TABLE execution_command ADD CONSTRAINT FK_execution_command_task_id FOREIGN KEY (task_id) REFERENCES host_role_command (task_id);
+ALTER TABLE host_role_command ADD CONSTRAINT FK_host_role_command_stage_id FOREIGN KEY (stage_id, request_id) REFERENCES stage (stage_id, request_id);
+ALTER TABLE host_role_command ADD CONSTRAINT FK_host_role_command_host_name FOREIGN KEY (host_name) REFERENCES hosts (host_name);
+ALTER TABLE role_success_criteria ADD CONSTRAINT role_success_criteria_stage_id FOREIGN KEY (stage_id, request_id) REFERENCES stage (stage_id, request_id);
+ALTER TABLE stage ADD CONSTRAINT FK_stage_cluster_id FOREIGN KEY (cluster_id) REFERENCES clusters (cluster_id);
+ALTER TABLE clusterconfigmapping ADD CONSTRAINT clusterconfigmappingcluster_id FOREIGN KEY (cluster_id) REFERENCES clusters (cluster_id);
+ALTER TABLE ClusterHostMapping ADD CONSTRAINT ClusterHostMapping_cluster_id FOREIGN KEY (cluster_id) REFERENCES clusters (cluster_id);
+ALTER TABLE ClusterHostMapping ADD CONSTRAINT ClusterHostMapping_host_name FOREIGN KEY (host_name) REFERENCES hosts (host_name);
+ALTER TABLE user_roles ADD CONSTRAINT FK_user_roles_user_id FOREIGN KEY (user_id) REFERENCES users (user_id);
+ALTER TABLE user_roles ADD CONSTRAINT FK_user_roles_role_name FOREIGN KEY (role_name) REFERENCES roles (role_name);
+
+
+GRANT ALL ON clusters TO &1;
+GRANT ALL ON clusterconfig TO &1;
+GRANT ALL ON clusterconfigmapping TO &1;
+GRANT ALL ON clusterservices TO &1;
+GRANT ALL ON clusterstate TO &1;
+GRANT ALL ON componentconfigmapping TO &1;
+GRANT ALL ON hostcomponentconfigmapping TO &1;
+GRANT ALL ON hcdesiredconfigmapping TO &1;
+GRANT ALL ON hostcomponentdesiredstate TO &1;
+GRANT ALL ON hostcomponentstate TO &1;
+GRANT ALL ON hosts TO &1;
+GRANT ALL ON hoststate TO &1;
+GRANT ALL ON servicecomponentdesiredstate TO &1;
+GRANT ALL ON serviceconfigmapping TO &1;
+GRANT ALL ON servicedesiredstate TO &1;
+GRANT ALL ON roles TO &1;
+GRANT ALL ON users TO &1;
+GRANT ALL ON execution_command TO &1;
+GRANT ALL ON host_role_command TO &1;
+GRANT ALL ON role_success_criteria TO &1;
+GRANT ALL ON stage TO &1;
+GRANT ALL ON ClusterHostMapping TO &1;
+GRANT ALL ON user_roles TO &1;
+GRANT ALL ON key_value_store TO &1;
+GRANT ALL ON hostconfigmapping TO &1;
+GRANT ALL ON ambari_sequences TO &1;
+GRANT ALL ON metainfo TO &1;
+
+
+INSERT INTO ambari_sequences(sequence_name, value) values ('host_role_command_id_seq', 0);
+INSERT INTO ambari_sequences(sequence_name, value) values ('user_id_seq', 1);
+INSERT INTO ambari_sequences(sequence_name, value) values ('cluster_id_seq', 0);
+INSERT INTO metainfo("metainfo_key", "metainfo_value") values ('version', '1.3.0');
+
+insert into Roles(role_name)
+select 'admin' from dual
+union all
+select 'user' from dual;
+
+insert into Users(user_id, user_name, user_password)
+select 1,'admin','538916f8943ec225d97a9a86a2c6ec0818c1cd400e09e03b660fdaaec4af29ddbb6f2b1033b81b00' from dual;
+
+insert into user_roles(role_name, user_id)
+select 'admin',1 from dual;
+
+
+
+commit;
+
+-- ambari rca
+
+CREATE TABLE workflow (
+  workflowId VARCHAR2(4000), workflowName VARCHAR2(4000),
+  parentWorkflowId VARCHAR2(4000),  
+  workflowContext VARCHAR2(4000), userName VARCHAR2(4000),
+  startTime INTEGER, lastUpdateTime INTEGER,
+  numJobsTotal INTEGER, numJobsCompleted INTEGER,
+  inputBytes INTEGER, outputBytes INTEGER,
+  duration INTEGER,
+  PRIMARY KEY (workflowId),
+  FOREIGN KEY (parentWorkflowId) REFERENCES workflow(workflowId)
+);
+
+GRANT ALL ON workflow TO &1;
+
+CREATE TABLE job (
+  jobId VARCHAR2(4000), workflowId VARCHAR2(4000), jobName VARCHAR2(4000), workflowEntityName VARCHAR2(4000),
+  userName VARCHAR2(4000), queue CLOB, acls CLOB, confPath CLOB, 
+  submitTime INTEGER, launchTime INTEGER, finishTime INTEGER, 
+  maps INTEGER, reduces INTEGER, status VARCHAR2(4000), priority VARCHAR2(4000), 
+  finishedMaps INTEGER, finishedReduces INTEGER, 
+  failedMaps INTEGER, failedReduces INTEGER, 
+  mapsRuntime INTEGER, reducesRuntime INTEGER,
+  mapCounters VARCHAR2(4000), reduceCounters VARCHAR2(4000), jobCounters VARCHAR2(4000), 
+  inputBytes INTEGER, outputBytes INTEGER,
+  PRIMARY KEY(jobId),
+  FOREIGN KEY(workflowId) REFERENCES workflow(workflowId)
+);
+
+GRANT ALL ON job TO &1;
+
+CREATE TABLE task (
+  taskId VARCHAR2(4000), jobId VARCHAR2(4000), taskType VARCHAR2(4000), splits VARCHAR2(4000), 
+  startTime INTEGER, finishTime INTEGER, status VARCHAR2(4000), error CLOB, counters VARCHAR2(4000), 
+  failedAttempt VARCHAR2(4000), 
+  PRIMARY KEY(taskId), 
+  FOREIGN KEY(jobId) REFERENCES job(jobId)
+);
+
+GRANT ALL ON task TO &1;
+
+CREATE TABLE taskAttempt (
+  taskAttemptId VARCHAR2(4000), taskId VARCHAR2(4000), jobId VARCHAR2(4000), taskType VARCHAR2(4000), taskTracker VARCHAR2(4000), 
+  startTime INTEGER, finishTime INTEGER, 
+  mapFinishTime INTEGER, shuffleFinishTime INTEGER, sortFinishTime INTEGER, 
+  locality VARCHAR2(4000), avataar VARCHAR2(4000), 
+  status VARCHAR2(4000), error CLOB, counters VARCHAR2(4000), 
+  inputBytes INTEGER, outputBytes INTEGER,
+  PRIMARY KEY(taskAttemptId), 
+  FOREIGN KEY(jobId) REFERENCES job(jobId), 
+  FOREIGN KEY(taskId) REFERENCES task(taskId)
+); 
+
+GRANT ALL ON taskAttempt TO &1;
+
+CREATE TABLE hdfsEvent (
+  timestamp INTEGER,
+  userName VARCHAR2(4000),
+  clientIP VARCHAR2(4000),
+  operation VARCHAR2(4000),
+  srcPath CLOB,
+  dstPath CLOB,
+  permissions VARCHAR2(4000)
+);
+
+GRANT ALL ON hdfsEvent TO &1;
+
+CREATE TABLE mapreduceEvent (
+  timestamp INTEGER,
+  userName VARCHAR2(4000),
+  clientIP VARCHAR2(4000),
+  operation VARCHAR2(4000),
+  target VARCHAR2(4000),
+  result CLOB,
+  description CLOB,
+  permissions VARCHAR2(4000)
+);
+
+GRANT ALL ON mapreduceEvent TO &1;
+
+CREATE TABLE clusterEvent (
+  timestamp INTEGER, 
+  service VARCHAR2(4000), status VARCHAR2(4000), 
+  error CLOB, data CLOB , 
+  host VARCHAR2(4000), rack VARCHAR2(4000)
+);
+
+GRANT ALL ON clusterEvent TO &1;
+

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=1464222&r1=1464221&r2=1464222&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 Wed Apr  3 22:35:41 2013
@@ -38,10 +38,32 @@ GRANT ALL PRIVILEGES ON TABLE ambari.hos
 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);
 
+ALTER ROLE :username SET search_path to 'ambari';
+
 ALTER SEQUENCE ambari.host_role_command_task_id_seq INCREMENT BY 50;
 SELECT nextval('ambari.host_role_command_task_id_seq');
 
-ALTER TABLE ambari.stage ADD COLUMN request_context VARCHAR(255);
+ALTER TABLE ambari.stage ADD COLUMN request_context VARCHAR(255);SELECT nextval('ambari.host_role_command_task_id_seq');
+
+
+-- portability changes for MySQL/Oracle support
+alter table ambari.hostcomponentdesiredconfigmapping rename to hcdesiredconfigmapping;
+alter table ambari.users alter column user_id drop default;
+alter table ambari.users alter column ldap_user type INTEGER using case when ldap_user=true then 1 else 0 END;
+
+CREATE TABLE ambari.ambari_sequences (sequence_name VARCHAR(255) PRIMARY KEY, "value" BIGINT NOT NULL);
+GRANT ALL PRIVILEGES ON TABLE ambari.ambari_sequences TO :username;
+
+insert into ambari.ambari_sequences(sequence_name, "value")
+  select 'cluster_id_seq', nextval('ambari.clusters_cluster_id_seq')
+  union all
+  select 'user_id_seq', nextval('ambari.users_user_id_seq')
+  union all
+  select 'host_role_command_id_seq', nextval('ambari.host_role_command_task_id_seq');
+
+drop sequence ambari.host_role_command_task_id_seq;
+drop sequence ambari.users_user_id_seq;
+drop sequence ambari.clusters_cluster_id_seq;
 
 BEGIN;
 

Modified: incubator/ambari/trunk/ambari-server/src/test/java/org/apache/ambari/server/agent/DummyHeartbeatConstants.java
URL: http://svn.apache.org/viewvc/incubator/ambari/trunk/ambari-server/src/test/java/org/apache/ambari/server/agent/DummyHeartbeatConstants.java?rev=1464222&r1=1464221&r2=1464222&view=diff
==============================================================================
--- incubator/ambari/trunk/ambari-server/src/test/java/org/apache/ambari/server/agent/DummyHeartbeatConstants.java (original)
+++ incubator/ambari/trunk/ambari-server/src/test/java/org/apache/ambari/server/agent/DummyHeartbeatConstants.java Wed Apr  3 22:35:41 2013
@@ -1,4 +1,4 @@
-/**
+/*
  * Licensed to the Apache Software Foundation (ASF) under one
  * or more contributor license agreements.  See the NOTICE file
  * distributed with this work for additional information

Modified: incubator/ambari/trunk/ambari-server/src/test/java/org/apache/ambari/server/controller/AmbariManagementControllerImplTest.java
URL: http://svn.apache.org/viewvc/incubator/ambari/trunk/ambari-server/src/test/java/org/apache/ambari/server/controller/AmbariManagementControllerImplTest.java?rev=1464222&r1=1464221&r2=1464222&view=diff
==============================================================================
--- incubator/ambari/trunk/ambari-server/src/test/java/org/apache/ambari/server/controller/AmbariManagementControllerImplTest.java (original)
+++ incubator/ambari/trunk/ambari-server/src/test/java/org/apache/ambari/server/controller/AmbariManagementControllerImplTest.java Wed Apr  3 22:35:41 2013
@@ -1474,7 +1474,8 @@ public class AmbariManagementControllerI
       @Override
       protected void configure() {
         Properties properties = new Properties();
-        properties.setProperty(Configuration.PERSISTENCE_IN_MEMORY_KEY, "true");
+        properties.setProperty(Configuration.SERVER_PERSISTENCE_TYPE_KEY, "in-memory");
+
         properties.setProperty(Configuration.METADETA_DIR_PATH,
             "src/main/resources/stacks");
         properties.setProperty(Configuration.SERVER_VERSION_FILE,
@@ -1532,6 +1533,7 @@ public class AmbariManagementControllerI
     );
     amc.createConfiguration(configurationRequest);
 
+
     serviceRequests.clear();
     serviceRequests.add(new ServiceRequest("c1", "HDFS",
         gson.<Map<String, String>>fromJson("{\"core-site\": \"version1\", \"hdfs-site\": \"version1\", \"global\" : \"version1\" }", confType)
@@ -1548,6 +1550,7 @@ public class AmbariManagementControllerI
 
     amc.updateServices(serviceRequests, mapRequestProps, true);
 
+
     Set<ServiceComponentRequest> serviceComponentRequests = new HashSet<ServiceComponentRequest>();
     serviceComponentRequests.add(new ServiceComponentRequest("c1", "HDFS", "NAMENODE", null, null));
     serviceComponentRequests.add(new ServiceComponentRequest("c1", "HDFS", "SECONDARY_NAMENODE", null, null));
@@ -1570,6 +1573,7 @@ public class AmbariManagementControllerI
     componentHostRequests.add(new ServiceComponentHostRequest("c1", null, "DATANODE", "host2", null, null));
     componentHostRequests.add(new ServiceComponentHostRequest("c1", null, "DATANODE", "host3", null, null));
 
+
     amc.createHostComponents(componentHostRequests);
 
     serviceRequests.clear();

Modified: incubator/ambari/trunk/ambari-server/src/test/java/org/apache/ambari/server/controller/internal/RequestResourceProviderTest.java
URL: http://svn.apache.org/viewvc/incubator/ambari/trunk/ambari-server/src/test/java/org/apache/ambari/server/controller/internal/RequestResourceProviderTest.java?rev=1464222&r1=1464221&r2=1464222&view=diff
==============================================================================
--- incubator/ambari/trunk/ambari-server/src/test/java/org/apache/ambari/server/controller/internal/RequestResourceProviderTest.java (original)
+++ incubator/ambari/trunk/ambari-server/src/test/java/org/apache/ambari/server/controller/internal/RequestResourceProviderTest.java Wed Apr  3 22:35:41 2013
@@ -1,4 +1,4 @@
-/**
+/*
  * Licensed to the Apache Software Foundation (ASF) under one
  * or more contributor license agreements.  See the NOTICE file
  * distributed with this work for additional information

Modified: incubator/ambari/trunk/ambari-server/src/test/java/org/apache/ambari/server/orm/InMemoryDefaultTestModule.java
URL: http://svn.apache.org/viewvc/incubator/ambari/trunk/ambari-server/src/test/java/org/apache/ambari/server/orm/InMemoryDefaultTestModule.java?rev=1464222&r1=1464221&r2=1464222&view=diff
==============================================================================
--- incubator/ambari/trunk/ambari-server/src/test/java/org/apache/ambari/server/orm/InMemoryDefaultTestModule.java (original)
+++ incubator/ambari/trunk/ambari-server/src/test/java/org/apache/ambari/server/orm/InMemoryDefaultTestModule.java Wed Apr  3 22:35:41 2013
@@ -28,7 +28,8 @@ public class InMemoryDefaultTestModule e
   @Override
   protected void configure() {
     Properties properties = new Properties();
-    properties.setProperty(Configuration.PERSISTENCE_IN_MEMORY_KEY, "true");
+    properties.setProperty(Configuration.SERVER_PERSISTENCE_TYPE_KEY, "in-memory");
+//    properties.setProperty(Configuration.SERVER_PERSISTENCE_TYPE_KEY, "local");
     properties.setProperty(Configuration.METADETA_DIR_PATH,
         "src/test/resources/stacks");
     properties.setProperty(Configuration.SERVER_VERSION_FILE,

Modified: incubator/ambari/trunk/ambari-server/src/test/java/org/apache/ambari/server/security/authorization/AmbariLdapAuthenticationProviderTest.java
URL: http://svn.apache.org/viewvc/incubator/ambari/trunk/ambari-server/src/test/java/org/apache/ambari/server/security/authorization/AmbariLdapAuthenticationProviderTest.java?rev=1464222&r1=1464221&r2=1464222&view=diff
==============================================================================
--- incubator/ambari/trunk/ambari-server/src/test/java/org/apache/ambari/server/security/authorization/AmbariLdapAuthenticationProviderTest.java (original)
+++ incubator/ambari/trunk/ambari-server/src/test/java/org/apache/ambari/server/security/authorization/AmbariLdapAuthenticationProviderTest.java Wed Apr  3 22:35:41 2013
@@ -25,6 +25,7 @@ import com.google.inject.Injector;
 import com.google.inject.persist.jpa.JpaPersistModule;
 import org.apache.ambari.server.configuration.Configuration;
 import org.apache.ambari.server.orm.GuiceJpaInitializer;
+import org.apache.ambari.server.orm.InMemoryDefaultTestModule;
 import org.apache.ambari.server.orm.dao.RoleDAO;
 import org.apache.ambari.server.orm.dao.UserDAO;
 import org.apache.ambari.server.orm.entities.RoleEntity;
@@ -57,7 +58,7 @@ public class AmbariLdapAuthenticationPro
 
   @BeforeClass
   public static void beforeClass() throws Exception{
-    injector = Guice.createInjector(new AuthorizationTestModule(), new JpaPersistModule("ambari-javadb"));
+    injector = Guice.createInjector(new AuthorizationTestModule());
     injector.getInstance(GuiceJpaInitializer.class);
 
     apacheDSContainer = new ApacheDSContainer("dc=ambari,dc=apache,dc=org", "classpath:/users.ldif");

Modified: incubator/ambari/trunk/ambari-server/src/test/java/org/apache/ambari/server/security/authorization/AmbariLocalUserDetailsServiceTest.java
URL: http://svn.apache.org/viewvc/incubator/ambari/trunk/ambari-server/src/test/java/org/apache/ambari/server/security/authorization/AmbariLocalUserDetailsServiceTest.java?rev=1464222&r1=1464221&r2=1464222&view=diff
==============================================================================
--- incubator/ambari/trunk/ambari-server/src/test/java/org/apache/ambari/server/security/authorization/AmbariLocalUserDetailsServiceTest.java (original)
+++ incubator/ambari/trunk/ambari-server/src/test/java/org/apache/ambari/server/security/authorization/AmbariLocalUserDetailsServiceTest.java Wed Apr  3 22:35:41 2013
@@ -22,6 +22,7 @@ import com.google.inject.Inject;
 import com.google.inject.Injector;
 import com.google.inject.persist.jpa.JpaPersistModule;
 import org.apache.ambari.server.orm.GuiceJpaInitializer;
+import org.apache.ambari.server.orm.InMemoryDefaultTestModule;
 import org.apache.ambari.server.orm.OrmTestHelper;
 import org.apache.ambari.server.orm.dao.UserDAO;
 import org.apache.ambari.server.orm.entities.UserEntity;
@@ -49,7 +50,7 @@ public class AmbariLocalUserDetailsServi
 
   @BeforeClass
   public static void prepareData() {
-    injector = Guice.createInjector(new AuthorizationTestModule(), new JpaPersistModule("ambari-javadb"));
+    injector = Guice.createInjector(new AuthorizationTestModule());
     injector.getInstance(GuiceJpaInitializer.class);
     injector.getInstance(OrmTestHelper.class).createTestUsers();
   }

Modified: incubator/ambari/trunk/ambari-server/src/test/java/org/apache/ambari/server/security/authorization/AuthorizationTestModule.java
URL: http://svn.apache.org/viewvc/incubator/ambari/trunk/ambari-server/src/test/java/org/apache/ambari/server/security/authorization/AuthorizationTestModule.java?rev=1464222&r1=1464221&r2=1464222&view=diff
==============================================================================
--- incubator/ambari/trunk/ambari-server/src/test/java/org/apache/ambari/server/security/authorization/AuthorizationTestModule.java (original)
+++ incubator/ambari/trunk/ambari-server/src/test/java/org/apache/ambari/server/security/authorization/AuthorizationTestModule.java Wed Apr  3 22:35:41 2013
@@ -19,6 +19,7 @@ package org.apache.ambari.server.securit
 
 import com.google.inject.AbstractModule;
 import org.apache.ambari.server.configuration.Configuration;
+import org.apache.ambari.server.controller.ControllerModule;
 import org.springframework.security.crypto.password.PasswordEncoder;
 import org.springframework.security.crypto.password.StandardPasswordEncoder;
 
@@ -28,23 +29,20 @@ import java.util.Properties;
 public class AuthorizationTestModule extends AbstractModule {
   @Override
   protected void configure() {
-
-    bind(PasswordEncoder.class).to(StandardPasswordEncoder.class);
-    bind(Properties.class).toInstance(buildTestProperties());
-    bind(Configuration.class).toConstructor(getConfigurationConstructor());
-  }
-
-  protected Properties buildTestProperties() {
     Properties properties = new Properties();
     properties.setProperty(Configuration.CLIENT_SECURITY_KEY, "ldap");
-    return properties;
-  }
+    properties.setProperty(Configuration.SERVER_PERSISTENCE_TYPE_KEY, "in-memory");
+    properties.setProperty(Configuration.METADETA_DIR_PATH,
+        "src/test/resources/stacks");
+    properties.setProperty(Configuration.SERVER_VERSION_FILE,
+        "../version");
+    properties.setProperty(Configuration.OS_VERSION_KEY,
+        "centos5");
 
-  protected Constructor<Configuration> getConfigurationConstructor() {
     try {
-      return Configuration.class.getConstructor(Properties.class);
-    } catch (NoSuchMethodException e) {
-      throw new RuntimeException("Expected constructor not found in Configuration.java", e);
+      install(new ControllerModule(properties));
+    } catch (Exception e) {
+      throw new RuntimeException(e);
     }
   }
 }

Modified: incubator/ambari/trunk/ambari-server/src/test/java/org/apache/ambari/server/utils/TestStageUtils.java
URL: http://svn.apache.org/viewvc/incubator/ambari/trunk/ambari-server/src/test/java/org/apache/ambari/server/utils/TestStageUtils.java?rev=1464222&r1=1464221&r2=1464222&view=diff
==============================================================================
--- incubator/ambari/trunk/ambari-server/src/test/java/org/apache/ambari/server/utils/TestStageUtils.java (original)
+++ incubator/ambari/trunk/ambari-server/src/test/java/org/apache/ambari/server/utils/TestStageUtils.java Wed Apr  3 22:35:41 2013
@@ -177,7 +177,7 @@ public class TestStageUtils {
     addHdfsService(fsm.getCluster("c1"), hostList, injector);
     addHbaseService(fsm.getCluster("c1"), hostList, injector);
     Map<String, List<String>> info = StageUtils.getClusterHostInfo(fsm
-        .getCluster("c1"), new HostsMap(injector.getInstance(Configuration.class)));
+        .getCluster("c1"), new HostsMap(injector.getInstance(Configuration.class)), injector);
     assertEquals(2, info.get("slave_hosts").size());
     assertEquals(1, info.get("hbase_master_hosts").size());
     assertEquals("h1", info.get("hbase_master_hosts").get(0));

Modified: incubator/ambari/trunk/ambari-server/src/test/python/TestAmbaryServer.py
URL: http://svn.apache.org/viewvc/incubator/ambari/trunk/ambari-server/src/test/python/TestAmbaryServer.py?rev=1464222&r1=1464221&r2=1464222&view=diff
==============================================================================
--- incubator/ambari/trunk/ambari-server/src/test/python/TestAmbaryServer.py (original)
+++ incubator/ambari/trunk/ambari-server/src/test/python/TestAmbaryServer.py Wed Apr  3 22:35:41 2013
@@ -907,9 +907,10 @@ class TestAmbariServer(TestCase):
   @patch.object(ambari_server, "check_postgre_up")
   @patch.object(ambari_server, "check_iptables")
   @patch.object(ambari_server, "check_selinux")
-  def test_setup(self, check_selinux_mock, check_iptables_mock,
+  @patch.object(ambari_server, "setup_remote_db")
+  def test_setup(self, setup_remote_db_mock, check_selinux_mock, check_iptables_mock,
                  check_postgre_up_mock, setup_db_mock, configure_postgres_mock,
-                 download_jdk_mock, configure_os_settings_mock):
+                 download_jdk_mock, configure_os_settings_mock, ):
 
     out = StringIO.StringIO()
     sys.stdout = out
@@ -920,6 +921,7 @@ class TestAmbariServer(TestCase):
     check_iptables_mock.return_value = (0, "other")
     check_postgre_up_mock.return_value = 0
     setup_db_mock.return_value = 0
+    setup_remote_db_mock.return_value = 0
     configure_postgres_mock.return_value = 0
     download_jdk_mock.return_value = 0
     configure_os_settings_mock.return_value = 0



Mime
View raw message