You are viewing a plain text version of this content. The canonical link for it is here.
Posted to commits@ambari.apache.org by ma...@apache.org on 2012/11/07 09:13:24 UTC

svn commit: r1406489 [10/19] - in /incubator/ambari/branches/AMBARI-666: ./ ambari-agent/ ambari-agent/conf/ ambari-agent/conf/unix/ ambari-agent/src/main/puppet/manifestloader/ ambari-agent/src/main/puppet/modules/configgenerator/manifests/ ambari-age...

Added: incubator/ambari/branches/AMBARI-666/ambari-server/src/main/python/rrd.py
URL: http://svn.apache.org/viewvc/incubator/ambari/branches/AMBARI-666/ambari-server/src/main/python/rrd.py?rev=1406489&view=auto
==============================================================================
--- incubator/ambari/branches/AMBARI-666/ambari-server/src/main/python/rrd.py (added)
+++ incubator/ambari/branches/AMBARI-666/ambari-server/src/main/python/rrd.py Wed Nov  7 08:13:12 2012
@@ -0,0 +1,140 @@
+#!/usr/bin/env python
+
+'''
+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
+regarding copyright ownership.  The ASF licenses this file
+to you under the Apache License, Version 2.0 (the
+"License"); you may not use this file except in compliance
+with the License.  You may obtain a copy of the License at
+
+    http://www.apache.org/licenses/LICENSE-2.0
+
+Unless required by applicable law or agreed to in writing, software
+distributed under the License is distributed on an "AS IS" BASIS,
+WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+See the License for the specific language governing permissions and
+limitations under the License.
+'''
+
+import cgi
+#import cgitb
+import os
+import rrdtool
+import sys
+
+# place this script in /var/www/cgi-bin of the Ganglia collector
+# requires 'yum install rrdtool-python' on the Ganglia collector
+
+#cgitb.enable()
+
+def printMetric(clusterName, hostName, metricName, file, cf, start, end, resolution):
+  if clusterName.endswith("rrds"):
+    clusterName = ""
+
+  args = [file, cf]
+
+  if start is not None:
+   args.extend(["-s", start])
+
+  if end is not None:
+   args.extend(["-e", end])
+
+  if resolution is not None:
+   args.extend(["-r", resolution])
+
+  rrdMetric = rrdtool.fetch(args)
+
+  time = rrdMetric[0][0]
+  step = rrdMetric[0][2]
+
+  sys.stdout.write("  {\n    \"ds_name\":\"" + rrdMetric[1][0] +\
+                   "\",\n    \"cluster_name\":\"" + clusterName +\
+                   "\",\n    \"host_name\":\"" + hostName +\
+                   "\",\n    \"metric_name\":\"" + metricName + "\",\n")
+
+  first = True
+  sys.stdout.write("    \"datapoints\":[\n")
+  for tuple in rrdMetric[2]:
+    if tuple[0] is not None:
+      if not first:
+        sys.stdout.write(",\n")
+      sys.stdout.write("      [")
+      sys.stdout.write(str(tuple[0]))
+      sys.stdout.write(",")
+      sys.stdout.write(str(time))
+      sys.stdout.write("]")
+    time = time + step
+    first = False
+  sys.stdout.write("\n    ]\n  }")
+  return
+
+def stripList(l):
+  return([x.strip() for x in l])
+
+sys.stdout.write("Content-type: application/json\n\n")
+
+queryString = dict(cgi.parse_qsl(os.environ['QUERY_STRING']));
+
+sys.stdout.write("[\n")
+
+first = True
+
+if "m" in queryString:
+  metricParts = queryString["m"].split(",")
+else:
+  metricParts = [""]
+metricParts = stripList(metricParts)
+
+hostParts = []
+if "h" in queryString:
+  hostParts = queryString["h"].split(",")
+hostParts = stripList(hostParts)
+
+if "c" in queryString:
+  clusterParts = queryString["c"].split(",")
+else:
+  clusterParts = [""]
+clusterParts = stripList(clusterParts)
+
+if "p" in queryString:
+  rrdPath = queryString["p"]
+else:
+  rrdPath = "/var/lib/ganglia/rrds/"
+
+start = None
+if "s" in queryString:
+  start = queryString["s"]
+
+end = None
+if "e" in queryString:
+  end = queryString["e"]
+
+resolution = None
+if "r" in queryString:
+  resolution = queryString["r"]
+
+if "cf" in queryString:
+  cf = queryString["cf"]
+else:
+  cf = "AVERAGE"
+
+for cluster in clusterParts:
+  for path, dirs, files in os.walk(rrdPath + cluster):
+    pathParts = path.split("/")
+    if len(hostParts) == 0 or pathParts[-1] in hostParts:
+      for file in files:
+        for metric in metricParts:
+          if file.endswith(metric + ".rrd"):
+            if not first:
+              sys.stdout.write(",\n")
+
+            printMetric(pathParts[-2], pathParts[-1], file[:-4], os.path.join(path, file), cf, start, end, resolution)
+
+            first = False
+
+sys.stdout.write("\n]\n")
+sys.stdout.flush
+
+

Added: incubator/ambari/branches/AMBARI-666/ambari-server/src/main/resources/Ambari-DDL-Postgres-CREATE.sql
URL: http://svn.apache.org/viewvc/incubator/ambari/branches/AMBARI-666/ambari-server/src/main/resources/Ambari-DDL-Postgres-CREATE.sql?rev=1406489&view=auto
==============================================================================
--- incubator/ambari/branches/AMBARI-666/ambari-server/src/main/resources/Ambari-DDL-Postgres-CREATE.sql (added)
+++ incubator/ambari/branches/AMBARI-666/ambari-server/src/main/resources/Ambari-DDL-Postgres-CREATE.sql Wed Nov  7 08:13:12 2012
@@ -0,0 +1,64 @@
+CREATE TABLE ambari.clusters (cluster_id BIGINT NOT NULL, cluster_info VARCHAR(255) NOT NULL, cluster_name VARCHAR(255) NOT NULL UNIQUE, desired_cluster_state VARCHAR(255) NOT NULL, PRIMARY KEY (cluster_id))
+CREATE TABLE ambari.clusterconfig (version_tag VARCHAR(255) NOT NULL, type_name VARCHAR(255) NOT NULL, cluster_id BIGINT NOT NULL, config_data VARCHAR(4000) NOT NULL, create_timestamp BIGINT NOT NULL, PRIMARY KEY (version_tag, type_name, cluster_id))
+CREATE TABLE ambari.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 ambari.clusterstate (cluster_id BIGINT NOT NULL, current_cluster_state VARCHAR(255) NOT NULL, PRIMARY KEY (cluster_id))
+CREATE TABLE ambari.componentconfigmapping (cluster_id BIGINT NOT NULL, component_name VARCHAR(255) NOT NULL, config_type VARCHAR(255) NOT NULL, service_name VARCHAR(255) NOT NULL, timestamp BIGINT NOT NULL, config_tag VARCHAR(255) NOT NULL, PRIMARY KEY (cluster_id, component_name, service_name))
+CREATE TABLE ambari.hostcomponentconfigmapping (cluster_id BIGINT NOT NULL, component_name VARCHAR(255) NOT NULL, config_type VARCHAR(255) NOT NULL, host_name VARCHAR(255) NOT NULL, service_name VARCHAR(255) NOT NULL, timestamp BIGINT NOT NULL, config_tag VARCHAR(255) NOT NULL, PRIMARY KEY (cluster_id, component_name, host_name, service_name))
+CREATE TABLE ambari.hostcomponentdesiredstate (cluster_id BIGINT NOT NULL, component_name VARCHAR(255) NOT NULL, desired_config_version VARCHAR(255) NOT NULL, desired_stack_version VARCHAR(255) NOT NULL, desired_state INTEGER 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 ambari.hostcomponentstate (cluster_id BIGINT NOT NULL, component_name VARCHAR(255) NOT NULL, current_config_version 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 ambari.hostcomponentmapping (host_component_mapping_id INTEGER NOT NULL, cluster_id BIGINT NOT NULL, host_component_mapping_snapshot VARCHAR(255) NOT NULL, service_name VARCHAR(255) NOT NULL, PRIMARY KEY (host_component_mapping_id, cluster_id, service_name))
+CREATE TABLE ambari.hosts (host_name VARCHAR(255) NOT NULL, cpu_count INTEGER NOT NULL, cpu_info VARCHAR(255) NOT NULL, discovery_status VARCHAR(255) NOT NULL, disks_info VARCHAR(2000) NOT NULL, host_attributes VARCHAR(255) NOT NULL, ipv4 VARCHAR(255), ipv6 VARCHAR(255), last_registration_time BIGINT NOT NULL, os_arch VARCHAR(255) NOT NULL, os_info VARCHAR(255) NOT NULL, os_type VARCHAR(255) NOT NULL, rack_info VARCHAR(255) NOT NULL, total_mem BIGINT NOT NULL, PRIMARY KEY (host_name))
+CREATE TABLE ambari.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, last_heartbeat_time BIGINT NOT NULL, PRIMARY KEY (host_name))
+CREATE TABLE ambari.servicecomponentconfig (config_version INTEGER NOT NULL, component_name VARCHAR(255) NOT NULL, config_snapshot VARCHAR(255) NOT NULL, config_snapshot_time TIMESTAMP NOT NULL, cluster_id BIGINT NOT NULL, service_name VARCHAR(255) NOT NULL, PRIMARY KEY (config_version))
+CREATE TABLE ambari.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 ambari.servicecomponenthostconfig (config_version INTEGER NOT NULL, component_name VARCHAR(255) NOT NULL, config_snapshot VARCHAR(255) NOT NULL, config_snapshot_time TIMESTAMP NOT NULL, cluster_id BIGINT NOT NULL, service_name VARCHAR(255) NOT NULL, host_name VARCHAR(255) NOT NULL, PRIMARY KEY (config_version))
+CREATE TABLE ambari.serviceconfig (config_version INTEGER NOT NULL, config_snapshot VARCHAR(255) NOT NULL, config_snapshot_time TIMESTAMP NOT NULL, cluster_id BIGINT NOT NULL, service_name VARCHAR(255) NOT NULL, PRIMARY KEY (config_version))
+CREATE TABLE ambari.serviceconfigmapping (cluster_id BIGINT NOT NULL, config_type VARCHAR(255) NOT NULL, service_name VARCHAR(255) NOT NULL, timestamp BIGINT NOT NULL, config_tag VARCHAR(255) NOT NULL, PRIMARY KEY (cluster_id, service_name))
+CREATE TABLE ambari.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 ambari.roles (role_name VARCHAR(255) NOT NULL, PRIMARY KEY (role_name))
+CREATE TABLE ambari.users (ldap_user BOOLEAN NOT NULL, user_name VARCHAR(255) NOT NULL, create_time TIMESTAMP, user_password VARCHAR(255), PRIMARY KEY (ldap_user, user_name))
+CREATE TABLE ambari.execution_command (command VARCHAR(32000), task_id BIGINT NOT NULL, PRIMARY KEY (task_id))
+CREATE TABLE ambari.host_role_command (task_id BIGINT NOT NULL, attempt_count SMALLINT NOT NULL, command VARCHAR(255) NOT NULL, event VARCHAR(255) 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), stage_id BIGINT NOT NULL, start_time BIGINT NOT NULL, status VARCHAR(255), std_error VARCHAR(32000) NOT NULL, std_out VARCHAR(32000) NOT NULL, PRIMARY KEY (task_id))
+CREATE TABLE ambari.role_success_criteria (role VARCHAR(255) NOT NULL, request_id BIGINT NOT NULL, stage_id BIGINT NOT NULL, success_factor FLOAT NOT NULL, PRIMARY KEY (role, request_id, stage_id))
+CREATE TABLE ambari.stage (stage_id BIGINT NOT NULL, request_id BIGINT NOT NULL, cluster_id BIGINT NOT NULL, log_info VARCHAR(255) NOT NULL, PRIMARY KEY (stage_id, request_id))
+CREATE TABLE ambari.ClusterHostMapping (cluster_id BIGINT NOT NULL, host_name VARCHAR(255) NOT NULL, PRIMARY KEY (cluster_id, host_name))
+CREATE TABLE ambari.user_roles (role_name VARCHAR(255) NOT NULL, user_name VARCHAR(255) NOT NULL, ldap_user BOOLEAN NOT NULL, PRIMARY KEY (role_name, user_name, ldap_user))
+ALTER TABLE ambari.clusterconfig ADD CONSTRAINT FK_clusterconfig_cluster_id FOREIGN KEY (cluster_id) REFERENCES ambari.clusters (cluster_id)
+ALTER TABLE ambari.clusterservices ADD CONSTRAINT FK_clusterservices_cluster_id FOREIGN KEY (cluster_id) REFERENCES ambari.clusters (cluster_id)
+ALTER TABLE ambari.clusterstate ADD CONSTRAINT FK_clusterstate_cluster_id FOREIGN KEY (cluster_id) REFERENCES ambari.clusters (cluster_id)
+ALTER TABLE ambari.componentconfigmapping ADD CONSTRAINT FK_componentconfigmapping_component_name FOREIGN KEY (component_name, cluster_id, service_name) REFERENCES ambari.servicecomponentdesiredstate (component_name, cluster_id, service_name)
+ALTER TABLE ambari.hostcomponentconfigmapping ADD CONSTRAINT FK_hostcomponentconfigmapping_cluster_id FOREIGN KEY (cluster_id, component_name, host_name, service_name) REFERENCES ambari.hostcomponentdesiredstate (cluster_id, component_name, host_name, service_name)
+ALTER TABLE ambari.hostcomponentdesiredstate ADD CONSTRAINT FK_hostcomponentdesiredstate_host_name FOREIGN KEY (host_name) REFERENCES ambari.hosts (host_name)
+ALTER TABLE ambari.hostcomponentdesiredstate ADD CONSTRAINT FK_hostcomponentdesiredstate_component_name FOREIGN KEY (component_name, cluster_id, service_name) REFERENCES ambari.servicecomponentdesiredstate (component_name, cluster_id, service_name)
+ALTER TABLE ambari.hostcomponentstate ADD CONSTRAINT FK_hostcomponentstate_component_name FOREIGN KEY (component_name, cluster_id, service_name) REFERENCES ambari.servicecomponentdesiredstate (component_name, cluster_id, service_name)
+ALTER TABLE ambari.hostcomponentstate ADD CONSTRAINT FK_hostcomponentstate_host_name FOREIGN KEY (host_name) REFERENCES ambari.hosts (host_name)
+ALTER TABLE ambari.hostcomponentmapping ADD CONSTRAINT FK_hostcomponentmapping_service_name FOREIGN KEY (service_name, cluster_id) REFERENCES ambari.clusterservices (service_name, cluster_id)
+ALTER TABLE ambari.hoststate ADD CONSTRAINT FK_hoststate_host_name FOREIGN KEY (host_name) REFERENCES ambari.hosts (host_name)
+ALTER TABLE ambari.servicecomponentconfig ADD CONSTRAINT FK_servicecomponentconfig_service_name FOREIGN KEY (service_name, cluster_id) REFERENCES ambari.clusterservices (service_name, cluster_id)
+ALTER TABLE ambari.servicecomponentdesiredstate ADD CONSTRAINT FK_servicecomponentdesiredstate_service_name FOREIGN KEY (service_name, cluster_id) REFERENCES ambari.clusterservices (service_name, cluster_id)
+ALTER TABLE ambari.servicecomponenthostconfig ADD CONSTRAINT FK_servicecomponenthostconfig_host_name FOREIGN KEY (host_name) REFERENCES ambari.hosts (host_name)
+ALTER TABLE ambari.servicecomponenthostconfig ADD CONSTRAINT FK_servicecomponenthostconfig_service_name FOREIGN KEY (service_name, cluster_id) REFERENCES ambari.clusterservices (service_name, cluster_id)
+ALTER TABLE ambari.serviceconfig ADD CONSTRAINT FK_serviceconfig_service_name FOREIGN KEY (service_name, cluster_id) REFERENCES ambari.clusterservices (service_name, cluster_id)
+ALTER TABLE ambari.serviceconfigmapping ADD CONSTRAINT FK_serviceconfigmapping_service_name FOREIGN KEY (service_name, cluster_id) REFERENCES ambari.clusterservices (service_name, cluster_id)
+ALTER TABLE ambari.servicedesiredstate ADD CONSTRAINT FK_servicedesiredstate_service_name FOREIGN KEY (service_name, cluster_id) REFERENCES ambari.clusterservices (service_name, cluster_id)
+ALTER TABLE ambari.execution_command ADD CONSTRAINT FK_execution_command_task_id FOREIGN KEY (task_id) REFERENCES ambari.host_role_command (task_id)
+ALTER TABLE ambari.host_role_command ADD CONSTRAINT FK_host_role_command_stage_id FOREIGN KEY (stage_id, request_id) REFERENCES ambari.stage (stage_id, request_id)
+ALTER TABLE ambari.host_role_command ADD CONSTRAINT FK_host_role_command_host_name FOREIGN KEY (host_name) REFERENCES ambari.hosts (host_name)
+ALTER TABLE ambari.role_success_criteria ADD CONSTRAINT FK_role_success_criteria_stage_id FOREIGN KEY (stage_id, request_id) REFERENCES ambari.stage (stage_id, request_id)
+ALTER TABLE ambari.stage ADD CONSTRAINT FK_stage_cluster_id FOREIGN KEY (cluster_id) REFERENCES ambari.clusters (cluster_id)
+ALTER TABLE ambari.ClusterHostMapping ADD CONSTRAINT FK_ClusterHostMapping_host_name FOREIGN KEY (host_name) REFERENCES ambari.hosts (host_name)
+ALTER TABLE ambari.ClusterHostMapping ADD CONSTRAINT FK_ClusterHostMapping_cluster_id FOREIGN KEY (cluster_id) REFERENCES ambari.clusters (cluster_id)
+ALTER TABLE ambari.user_roles ADD CONSTRAINT FK_user_roles_ldap_user FOREIGN KEY (ldap_user, user_name) REFERENCES ambari.users (ldap_user, user_name)
+ALTER TABLE ambari.user_roles ADD CONSTRAINT FK_user_roles_role_name FOREIGN KEY (role_name) REFERENCES ambari.roles (role_name)
+CREATE SEQUENCE ambari.serviceconfig_config_version_seq START WITH 1
+CREATE SEQUENCE ambari.host_role_command_task_id_seq START WITH 1
+CREATE SEQUENCE ambari.clusters_cluster_id_seq START WITH 1
+CREATE SEQUENCE ambari.servicecomponenthostconfig_config_version_seq START WITH 1
+CREATE SEQUENCE ambari.hostcomponentmapping_host_component_mapping_id_seq START WITH 1
+CREATE SEQUENCE ambari.servicecomponentconfig_config_version_seq START WITH 1
+CREATE SEQUENCE ambari.serviceconfig_config_version_seq START WITH 1
+CREATE SEQUENCE ambari.servicecomponenthostconfig_config_version_seq START WITH 1
+CREATE SEQUENCE ambari.hostcomponentmapping_host_component_mapping_id_seq START WITH 1
+CREATE SEQUENCE ambari.servicecomponentconfig_config_version_seq START WITH 1
+CREATE SEQUENCE ambari.clusters_cluster_id_seq START WITH 1
+CREATE SEQUENCE ambari.host_role_command_task_id_seq START WITH 1

Added: incubator/ambari/branches/AMBARI-666/ambari-server/src/main/resources/Ambari-DDL-Postgres-DROP.sql
URL: http://svn.apache.org/viewvc/incubator/ambari/branches/AMBARI-666/ambari-server/src/main/resources/Ambari-DDL-Postgres-DROP.sql?rev=1406489&view=auto
==============================================================================
--- incubator/ambari/branches/AMBARI-666/ambari-server/src/main/resources/Ambari-DDL-Postgres-DROP.sql (added)
+++ incubator/ambari/branches/AMBARI-666/ambari-server/src/main/resources/Ambari-DDL-Postgres-DROP.sql Wed Nov  7 08:13:12 2012
@@ -0,0 +1,58 @@
+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.componentconfigmapping DROP CONSTRAINT FK_componentconfigmapping_component_name
+ALTER TABLE ambari.hostcomponentconfigmapping DROP CONSTRAINT FK_hostcomponentconfigmapping_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.hostcomponentmapping DROP CONSTRAINT FK_hostcomponentmapping_service_name
+ALTER TABLE ambari.hoststate DROP CONSTRAINT FK_hoststate_host_name
+ALTER TABLE ambari.servicecomponentconfig DROP CONSTRAINT FK_servicecomponentconfig_service_name
+ALTER TABLE ambari.servicecomponentdesiredstate DROP CONSTRAINT FK_servicecomponentdesiredstate_service_name
+ALTER TABLE ambari.servicecomponenthostconfig DROP CONSTRAINT FK_servicecomponenthostconfig_host_name
+ALTER TABLE ambari.servicecomponenthostconfig DROP CONSTRAINT FK_servicecomponenthostconfig_service_name
+ALTER TABLE ambari.serviceconfig DROP CONSTRAINT FK_serviceconfig_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
+DROP TABLE ambari.clusterconfig
+DROP TABLE ambari.clusterservices
+DROP TABLE ambari.clusterstate
+DROP TABLE ambari.componentconfigmapping
+DROP TABLE ambari.hostcomponentconfigmapping
+DROP TABLE ambari.hostcomponentdesiredstate
+DROP TABLE ambari.hostcomponentstate
+DROP TABLE ambari.hostcomponentmapping
+DROP TABLE ambari.hosts
+DROP TABLE ambari.hoststate
+DROP TABLE ambari.servicecomponentconfig
+DROP TABLE ambari.servicecomponentdesiredstate
+DROP TABLE ambari.servicecomponenthostconfig
+DROP TABLE ambari.serviceconfig
+DROP TABLE ambari.serviceconfigmapping
+DROP TABLE ambari.servicedesiredstate
+DROP TABLE ambari.roles
+DROP TABLE ambari.users
+DROP TABLE ambari.execution_command
+DROP TABLE ambari.host_role_command
+DROP TABLE ambari.role_success_criteria
+DROP TABLE ambari.stage
+DROP TABLE ambari.ClusterHostMapping
+DROP TABLE ambari.user_roles
+DROP SEQUENCE ambari.serviceconfig_config_version_seq
+DROP SEQUENCE ambari.servicecomponenthostconfig_config_version_seq
+DROP SEQUENCE ambari.hostcomponentmapping_host_component_mapping_id_seq
+DROP SEQUENCE ambari.servicecomponentconfig_config_version_seq
+DROP SEQUENCE ambari.clusters_cluster_id_seq
+DROP SEQUENCE ambari.host_role_command_task_id_seq

Modified: incubator/ambari/branches/AMBARI-666/ambari-server/src/main/resources/META-INF/persistence.xml
URL: http://svn.apache.org/viewvc/incubator/ambari/branches/AMBARI-666/ambari-server/src/main/resources/META-INF/persistence.xml?rev=1406489&r1=1406488&r2=1406489&view=diff
==============================================================================
--- incubator/ambari/branches/AMBARI-666/ambari-server/src/main/resources/META-INF/persistence.xml (original)
+++ incubator/ambari/branches/AMBARI-666/ambari-server/src/main/resources/META-INF/persistence.xml Wed Nov  7 08:13:12 2012
@@ -1,89 +1,122 @@
 <?xml version="1.0" encoding="UTF-8"?>
-<!--
-   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 regarding copyright ownership.
-   The ASF licenses this file to You under the Apache License, Version 2.0
-   (the "License"); you may not use this file except in compliance with
-   the License.  You may obtain a copy of the License at
-
-       http://www.apache.org/licenses/LICENSE-2.0
-
-   Unless required by applicable law or agreed to in writing, software
-   distributed under the License is distributed on an "AS IS" BASIS,
-   WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
-   See the License for the specific language governing permissions and
-   limitations under the License.
--->
-<persistence xmlns="http://java.sun.com/xml/ns/persistence" version="2.0">
+<!-- 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 regarding copyright ownership. The ASF licenses this file to 
+  You under the Apache License, Version 2.0 (the "License"); you may not use 
+  this file except in compliance with the License. You may obtain a copy of 
+  the License at http://www.apache.org/licenses/LICENSE-2.0 Unless required 
+  by applicable law or agreed to in writing, software distributed under the 
+  License is distributed on an "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS 
+  OF ANY KIND, either express or implied. See the License for the specific 
+  language governing permissions and limitations under the License. -->
+<persistence xmlns="http://java.sun.com/xml/ns/persistence"
+  version="2.0">
 
   <persistence-unit name="ambari-postgres">
-    <class>org.apache.ambari.server.orm.entities.ActionStatusEntity</class>
     <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.HostComponentDesiredStateEntity</class>
-    <class>org.apache.ambari.server.orm.entities.HostComponentStateEntity</class>
-    <class>org.apache.ambari.server.orm.entities.HostComponentMappingEntity</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.HostComponentDesiredStateEntity
+    </class>
+    <class>org.apache.ambari.server.orm.entities.HostComponentStateEntity
+    </class>
+    <class>org.apache.ambari.server.orm.entities.HostComponentMappingEntity
+    </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.ServiceComponentConfigEntity</class>
-    <class>org.apache.ambari.server.orm.entities.ServiceComponentDesiredStateEntity</class>
-    <class>org.apache.ambari.server.orm.entities.ServiceComponentHostConfigEntity</class>
-    <class>org.apache.ambari.server.orm.entities.ServiceConfigEntity</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.ServiceComponentConfigEntity
+    </class>
+    <class>org.apache.ambari.server.orm.entities.ServiceComponentDesiredStateEntity
+    </class>
+    <class>org.apache.ambari.server.orm.entities.ServiceComponentHostConfigEntity
+    </class>
+    <class>org.apache.ambari.server.orm.entities.ServiceConfigEntity
+    </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.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>
 
     <properties>
-      <property name="javax.persistence.jdbc.url" value="jdbc:postgresql://localhost/postgres"/>
-      <property name="javax.persistence.jdbc.driver" value="org.postgresql.Driver"/>
-      <property name="javax.persistence.jdbc.user" value="ambari-server"/>
-      <property name="javax.persistence.jdbc.password" value="bigdata"/>
+      <property name="javax.persistence.jdbc.url" value="jdbc:postgresql://localhost/postgres" />
+      <property name="javax.persistence.jdbc.driver" value="org.postgresql.Driver" />
+      <property name="javax.persistence.jdbc.user" value="ambari-server" />
+      <property name="javax.persistence.jdbc.password" value="bigdata" />
     </properties>
   </persistence-unit>
 
   <persistence-unit name="ambari-javadb">
-    <class>org.apache.ambari.server.orm.entities.ActionStatusEntity</class>
     <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.HostComponentDesiredStateEntity</class>
-    <class>org.apache.ambari.server.orm.entities.HostComponentStateEntity</class>
-    <class>org.apache.ambari.server.orm.entities.HostComponentMappingEntity</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.HostComponentDesiredStateEntity
+    </class>
+    <class>org.apache.ambari.server.orm.entities.HostComponentStateEntity
+    </class>
+    <class>org.apache.ambari.server.orm.entities.HostComponentMappingEntity
+    </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.ServiceComponentConfigEntity</class>
-    <class>org.apache.ambari.server.orm.entities.ServiceComponentDesiredStateEntity</class>
-    <class>org.apache.ambari.server.orm.entities.ServiceComponentHostConfigEntity</class>
-    <class>org.apache.ambari.server.orm.entities.ServiceConfigEntity</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.ServiceComponentConfigEntity
+    </class>
+    <class>org.apache.ambari.server.orm.entities.ServiceComponentDesiredStateEntity
+    </class>
+    <class>org.apache.ambari.server.orm.entities.ServiceComponentHostConfigEntity
+    </class>
+    <class>org.apache.ambari.server.orm.entities.ServiceConfigEntity
+    </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.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>
 
+
     <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="javax.persistence.jdbc.user" value="ambari-server"/>-->
-      <!--<property name="javax.persistence.jdbc.password" value="bigdata"/>-->
-      <property name="eclipselink.orm.throw.exceptions" value="true"/>
+      <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="javax.persistence.jdbc.user" value="ambari-server"/> -->
+      <!--<property name="javax.persistence.jdbc.password" value="bigdata"/> -->
+      <property name="eclipselink.orm.throw.exceptions" value="true" />
+      <!-- <property name="eclipselink.cache.shared.default" value="false"/> -->
+      <property name="eclipselink.cache.shared.default" value="false" />
+      <property name="eclipselink.cache.size.default" value="0" />
+      <property name="eclipselink.cache.type.default" value="None" />
+      <property name="eclipselink.query-results-cache" value="false" />
     </properties>
   </persistence-unit>
 </persistence>