ambari-commits mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From a...@apache.org
Subject ambari git commit: AMBARI-16692. Ambari Upgrade should clean older RCA Database tables (ajit)
Date Tue, 31 May 2016 23:01:12 GMT
Repository: ambari
Updated Branches:
  refs/heads/branch-2.4 2ed744dbb -> d316ed329


AMBARI-16692. Ambari Upgrade should clean older RCA Database tables (ajit)


Project: http://git-wip-us.apache.org/repos/asf/ambari/repo
Commit: http://git-wip-us.apache.org/repos/asf/ambari/commit/d316ed32
Tree: http://git-wip-us.apache.org/repos/asf/ambari/tree/d316ed32
Diff: http://git-wip-us.apache.org/repos/asf/ambari/diff/d316ed32

Branch: refs/heads/branch-2.4
Commit: d316ed32958b469e90add9e879adfe11367a9a1f
Parents: 2ed744d
Author: Ajit Kumar <ajit@apache.org>
Authored: Tue May 31 15:59:43 2016 -0700
Committer: Ajit Kumar <ajit@apache.org>
Committed: Tue May 31 16:00:53 2016 -0700

----------------------------------------------------------------------
 .../server/upgrade/SchemaUpgradeHelper.java     |  47 +++++
 .../main/resources/Ambari-DDL-Derby-CREATE.sql  |  76 --------
 .../main/resources/Ambari-DDL-MySQL-CREATE.sql  |  74 --------
 .../main/resources/Ambari-DDL-Oracle-CREATE.sql |  76 --------
 .../resources/Ambari-DDL-Postgres-CREATE.sql    |  76 --------
 .../Ambari-DDL-Postgres-EMBEDDED-CREATE.sql     |  94 ----------
 .../Ambari-DDL-Postgres-EMBEDDED-DROP.sql       |   3 +-
 .../resources/Ambari-DDL-SQLAnywhere-CREATE.sql |  74 --------
 .../resources/Ambari-DDL-SQLServer-CREATE.sql   | 178 -------------------
 .../resources/AmbariRCA-DML-Oracle-CLEANUP.sql  |  31 ----
 .../AmbariRCA-DML-Postgres-CLEANUP.sql          |  29 ---
 .../ddl/AmbariRCA-DDL-Oracle-UPGRADE.sql        |  77 --------
 .../ddl/AmbariRCA-DDL-Postgres-UPGRADE.sql      |  37 ----
 13 files changed, 48 insertions(+), 824 deletions(-)
----------------------------------------------------------------------


http://git-wip-us.apache.org/repos/asf/ambari/blob/d316ed32/ambari-server/src/main/java/org/apache/ambari/server/upgrade/SchemaUpgradeHelper.java
----------------------------------------------------------------------
diff --git a/ambari-server/src/main/java/org/apache/ambari/server/upgrade/SchemaUpgradeHelper.java
b/ambari-server/src/main/java/org/apache/ambari/server/upgrade/SchemaUpgradeHelper.java
index d4272ba..ebfb267 100644
--- a/ambari-server/src/main/java/org/apache/ambari/server/upgrade/SchemaUpgradeHelper.java
+++ b/ambari-server/src/main/java/org/apache/ambari/server/upgrade/SchemaUpgradeHelper.java
@@ -32,6 +32,8 @@ import org.apache.ambari.server.utils.VersionUtils;
 import org.slf4j.Logger;
 import org.slf4j.LoggerFactory;
 
+import java.sql.Connection;
+import java.sql.DriverManager;
 import java.sql.ResultSet;
 import java.sql.SQLException;
 import java.sql.Statement;
@@ -49,6 +51,7 @@ public class SchemaUpgradeHelper {
   private PersistService persistService;
   private DBAccessor dbAccessor;
   private Configuration configuration;
+  private static final String[] rcaTableNames = {"workflow", "job", "task", "taskAttempt",
"hdfsEvent", "mapreduceEvent", "clusterEvent"};
 
   @Inject
   public SchemaUpgradeHelper(Set<UpgradeCatalog> allUpgradeCatalogs,
@@ -265,6 +268,48 @@ public class SchemaUpgradeHelper {
     }
   }
 
+  public void cleanUpRCATables() {
+    LOG.info("Cleaning up RCA tables.");
+    for (String tableName : rcaTableNames) {
+      try {
+        if (dbAccessor.tableExists(tableName)) {
+          dbAccessor.truncateTable(tableName);
+        }
+      } catch (Exception e) {
+        LOG.warn("Error cleaning rca table " + tableName, e);
+      }
+    }
+    try {
+      cleanUpTablesFromRCADatabase();
+    } catch (Exception e) {
+      LOG.warn("Error cleaning rca tables from ambarirca db", e);
+    }
+  }
+
+  private void cleanUpTablesFromRCADatabase() throws ClassNotFoundException, SQLException
{
+    String driverName = configuration.getRcaDatabaseDriver();
+    String connectionURL = configuration.getRcaDatabaseUrl();
+    if (connectionURL.contains(Configuration.HOSTNAME_MACRO)) {
+      connectionURL = connectionURL.replace(Configuration.HOSTNAME_MACRO, "localhost");
+    }
+    String username = configuration.getRcaDatabaseUser();
+    String password = configuration.getRcaDatabasePassword();
+
+    Class.forName(driverName);
+    try (Connection connection = DriverManager.getConnection(connectionURL, username, password))
{
+      connection.setAutoCommit(true);
+      for (String tableName : rcaTableNames) {
+        String query = "DELETE FROM " + tableName;
+        try (Statement statement = connection.createStatement()) {
+          statement.execute(query);
+        } catch (Exception e) {
+          LOG.warn("Error while executing query: " + query, e);
+        }
+      }
+    }
+  }
+
+
   /**
    * Upgrade Ambari DB schema to the target version passed in as the only
    * argument.
@@ -313,6 +358,8 @@ public class SchemaUpgradeHelper {
 
       LOG.info("Upgrade successful.");
 
+      schemaUpgradeHelper.cleanUpRCATables();
+
       schemaUpgradeHelper.stopPersistenceService();
     } catch (Throwable e) {
       if (e instanceof AmbariException) {

http://git-wip-us.apache.org/repos/asf/ambari/blob/d316ed32/ambari-server/src/main/resources/Ambari-DDL-Derby-CREATE.sql
----------------------------------------------------------------------
diff --git a/ambari-server/src/main/resources/Ambari-DDL-Derby-CREATE.sql b/ambari-server/src/main/resources/Ambari-DDL-Derby-CREATE.sql
index e6d1e16..175fd59 100644
--- a/ambari-server/src/main/resources/Ambari-DDL-Derby-CREATE.sql
+++ b/ambari-server/src/main/resources/Ambari-DDL-Derby-CREATE.sql
@@ -1605,79 +1605,3 @@ create index idx_qrtz_ft_j_g on qrtz_fired_triggers(SCHED_NAME,JOB_NAME,JOB_GROU
 create index idx_qrtz_ft_jg on qrtz_fired_triggers(SCHED_NAME,JOB_GROUP);
 create index idx_qrtz_ft_t_g on qrtz_fired_triggers(SCHED_NAME,TRIGGER_NAME,TRIGGER_GROUP);
 create index idx_qrtz_ft_tg on qrtz_fired_triggers(SCHED_NAME,TRIGGER_GROUP);
-
--- ambari log4j DDL
-
-CREATE TABLE workflow (
-  workflowId       VARCHAR(3000), workflowName VARCHAR(3000),
-  parentWorkflowId VARCHAR(3000),
-  workflowContext  VARCHAR(3000), userName VARCHAR(3000),
-  startTime        BIGINT, lastUpdateTime BIGINT,
-  numJobsTotal     INTEGER, numJobsCompleted INTEGER,
-  inputBytes       BIGINT, outputBytes BIGINT,
-  duration         BIGINT,
-  CONSTRAINT PK_workflow PRIMARY KEY (workflowId),
-  FOREIGN KEY (parentWorkflowId) REFERENCES workflow (workflowId) ON DELETE CASCADE
-);
-
-CREATE TABLE job (
-  jobId        VARCHAR(3000), workflowId VARCHAR(3000), jobName VARCHAR(3000), workflowEntityName
VARCHAR(3000),
-  userName     VARCHAR(3000), queue VARCHAR(3000), acls VARCHAR(3000), confPath VARCHAR(3000),
-  submitTime   BIGINT, launchTime BIGINT, finishTime BIGINT,
-  maps         INTEGER, reduces INTEGER, status VARCHAR(3000), priority VARCHAR(3000),
-  finishedMaps INTEGER, finishedReduces INTEGER,
-  failedMaps   INTEGER, failedReduces INTEGER,
-  mapsRuntime  BIGINT, reducesRuntime BIGINT,
-  mapCounters  VARCHAR(3000), reduceCounters VARCHAR(3000), jobCounters VARCHAR(3000),
-  inputBytes   BIGINT, outputBytes BIGINT,
-  CONSTRAINT PK_job PRIMARY KEY (jobId),
-  FOREIGN KEY (workflowId) REFERENCES workflow (workflowId) ON DELETE CASCADE
-);
-
-CREATE TABLE task (
-  taskId        VARCHAR(3000), jobId VARCHAR(3000), taskType VARCHAR(3000), splits VARCHAR(3000),
-  startTime     BIGINT, finishTime BIGINT, status VARCHAR(3000), error VARCHAR(3000), counters
VARCHAR(3000),
-  failedAttempt VARCHAR(3000),
-  CONSTRAINT PK_task PRIMARY KEY (taskId),
-  FOREIGN KEY (jobId) REFERENCES job (jobId) ON DELETE CASCADE
-);
-
-CREATE TABLE taskAttempt (
-  taskAttemptId VARCHAR(3000), taskId VARCHAR(3000), jobId VARCHAR(3000), taskType VARCHAR(3000),
taskTracker VARCHAR(3000),
-  startTime     BIGINT, finishTime BIGINT,
-  mapFinishTime BIGINT, shuffleFinishTime BIGINT, sortFinishTime BIGINT,
-  locality      VARCHAR(3000), avataar VARCHAR(3000),
-  status        VARCHAR(3000), error VARCHAR(3000), counters VARCHAR(3000),
-  inputBytes    BIGINT, outputBytes BIGINT,
-  CONSTRAINT PK_taskAttempt PRIMARY KEY (taskAttemptId),
-  FOREIGN KEY (jobId) REFERENCES job (jobId) ON DELETE CASCADE,
-  FOREIGN KEY (taskId) REFERENCES task (taskId) ON DELETE CASCADE
-);
-
-CREATE TABLE hdfsEvent (
-  timestamp   BIGINT,
-  userName    VARCHAR(3000),
-  clientIP    VARCHAR(3000),
-  operation   VARCHAR(3000),
-  srcPath     VARCHAR(3000),
-  dstPath     VARCHAR(3000),
-  permissions VARCHAR(3000)
-);
-
-CREATE TABLE mapreduceEvent (
-  timestamp   BIGINT,
-  userName    VARCHAR(3000),
-  clientIP    VARCHAR(3000),
-  operation   VARCHAR(3000),
-  target      VARCHAR(3000),
-  result      VARCHAR(3000),
-  description VARCHAR(3000),
-  permissions VARCHAR(3000)
-);
-
-CREATE TABLE clusterEvent (
-  timestamp BIGINT,
-  service   VARCHAR(3000), status VARCHAR(3000),
-  error     VARCHAR(3000), data VARCHAR(3000),
-  host      VARCHAR(3000), rack VARCHAR(3000)
-);

http://git-wip-us.apache.org/repos/asf/ambari/blob/d316ed32/ambari-server/src/main/resources/Ambari-DDL-MySQL-CREATE.sql
----------------------------------------------------------------------
diff --git a/ambari-server/src/main/resources/Ambari-DDL-MySQL-CREATE.sql b/ambari-server/src/main/resources/Ambari-DDL-MySQL-CREATE.sql
index 38300b0..ffc47fa 100644
--- a/ambari-server/src/main/resources/Ambari-DDL-MySQL-CREATE.sql
+++ b/ambari-server/src/main/resources/Ambari-DDL-MySQL-CREATE.sql
@@ -1542,77 +1542,3 @@ create index idx_qrtz_ft_t_g on QRTZ_FIRED_TRIGGERS(SCHED_NAME,TRIGGER_NAME,TRIG
 create index idx_qrtz_ft_tg on QRTZ_FIRED_TRIGGERS(SCHED_NAME,TRIGGER_GROUP);
 
 commit;
-
-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,
-  CONSTRAINT PK_workflow PRIMARY KEY (workflowId),
-  FOREIGN KEY (parentWorkflowId) REFERENCES workflow(workflowId) ON DELETE CASCADE
-);
-
-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,
-  CONSTRAINT PK_job PRIMARY KEY (jobId),
-  FOREIGN KEY(workflowId) REFERENCES workflow(workflowId) ON DELETE CASCADE
-);
-
-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,
-  CONSTRAINT PK_task PRIMARY KEY (taskId),
-  FOREIGN KEY(jobId) REFERENCES job(jobId) ON DELETE CASCADE
-);
-
-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,
-  CONSTRAINT PK_taskAttempt PRIMARY KEY (taskAttemptId),
-  FOREIGN KEY(jobId) REFERENCES job(jobId) ON DELETE CASCADE,
-  FOREIGN KEY(taskId) REFERENCES task(taskId) ON DELETE CASCADE
-);
-
-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
-);

http://git-wip-us.apache.org/repos/asf/ambari/blob/d316ed32/ambari-server/src/main/resources/Ambari-DDL-Oracle-CREATE.sql
----------------------------------------------------------------------
diff --git a/ambari-server/src/main/resources/Ambari-DDL-Oracle-CREATE.sql b/ambari-server/src/main/resources/Ambari-DDL-Oracle-CREATE.sql
index a017388..e646ac5 100644
--- a/ambari-server/src/main/resources/Ambari-DDL-Oracle-CREATE.sql
+++ b/ambari-server/src/main/resources/Ambari-DDL-Oracle-CREATE.sql
@@ -1390,82 +1390,6 @@ insert into adminprivilege (privilege_id, permission_id, resource_id,
principal_
 
 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,
-  CONSTRAINT PK_workflow PRIMARY KEY (workflowId),
-  FOREIGN KEY (parentWorkflowId) REFERENCES workflow(workflowId) ON DELETE CASCADE
-);
-
-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,
-  CONSTRAINT PK_job PRIMARY KEY (jobId),
-  FOREIGN KEY(workflowId) REFERENCES workflow(workflowId) ON DELETE CASCADE
-);
-
-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),
-  CONSTRAINT PK_task PRIMARY KEY (taskId),
-  FOREIGN KEY(jobId) REFERENCES job(jobId) ON DELETE CASCADE
-);
-
-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,
-  CONSTRAINT PK_taskAttempt PRIMARY KEY (taskAttemptId),
-  FOREIGN KEY(jobId) REFERENCES job(jobId) ON DELETE CASCADE,
-  FOREIGN KEY(taskId) REFERENCES task(taskId) ON DELETE CASCADE
-);
-
-CREATE TABLE hdfsEvent (
-  timestamp INTEGER,
-  userName VARCHAR2(4000),
-  clientIP VARCHAR2(4000),
-  operation VARCHAR2(4000),
-  srcPath CLOB,
-  dstPath CLOB,
-  permissions VARCHAR2(4000)
-);
-
-CREATE TABLE mapreduceEvent (
-  timestamp INTEGER,
-  userName VARCHAR2(4000),
-  clientIP VARCHAR2(4000),
-  operation VARCHAR2(4000),
-  target VARCHAR2(4000),
-  result CLOB,
-  description CLOB,
-  permissions VARCHAR2(4000)
-);
-
-CREATE TABLE clusterEvent (
-  timestamp INTEGER,
-  service VARCHAR2(4000), status VARCHAR2(4000),
-  error CLOB, data CLOB ,
-  host VARCHAR2(4000), rack VARCHAR2(4000)
-);
-
 -- Quartz tables
 
 CREATE TABLE qrtz_job_details

http://git-wip-us.apache.org/repos/asf/ambari/blob/d316ed32/ambari-server/src/main/resources/Ambari-DDL-Postgres-CREATE.sql
----------------------------------------------------------------------
diff --git a/ambari-server/src/main/resources/Ambari-DDL-Postgres-CREATE.sql b/ambari-server/src/main/resources/Ambari-DDL-Postgres-CREATE.sql
index 7667a6b..c5734a7 100644
--- a/ambari-server/src/main/resources/Ambari-DDL-Postgres-CREATE.sql
+++ b/ambari-server/src/main/resources/Ambari-DDL-Postgres-CREATE.sql
@@ -1533,79 +1533,3 @@ create index idx_qrtz_ft_j_g on qrtz_fired_triggers(SCHED_NAME,JOB_NAME,JOB_GROU
 create index idx_qrtz_ft_jg on qrtz_fired_triggers(SCHED_NAME,JOB_GROUP);
 create index idx_qrtz_ft_t_g on qrtz_fired_triggers(SCHED_NAME,TRIGGER_NAME,TRIGGER_GROUP);
 create index idx_qrtz_ft_tg on qrtz_fired_triggers(SCHED_NAME,TRIGGER_GROUP);
-
--- ambari log4j DDL
-
-CREATE TABLE workflow (
-  workflowId       TEXT, workflowName TEXT,
-  parentWorkflowId TEXT,
-  workflowContext  TEXT, userName TEXT,
-  startTime        BIGINT, lastUpdateTime BIGINT,
-  numJobsTotal     INTEGER, numJobsCompleted INTEGER,
-  inputBytes       BIGINT, outputBytes BIGINT,
-  duration         BIGINT,
-  CONSTRAINT PK_workflow PRIMARY KEY (workflowId),
-  FOREIGN KEY (parentWorkflowId) REFERENCES workflow (workflowId) ON DELETE CASCADE
-);
-
-CREATE TABLE job (
-  jobId        TEXT, workflowId TEXT, 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,
-  CONSTRAINT PK_job PRIMARY KEY (jobId),
-  FOREIGN KEY (workflowId) REFERENCES workflow (workflowId) ON DELETE CASCADE
-);
-
-CREATE TABLE task (
-  taskId        TEXT, jobId TEXT, taskType TEXT, splits TEXT,
-  startTime     BIGINT, finishTime BIGINT, status TEXT, error TEXT, counters TEXT,
-  failedAttempt TEXT,
-  CONSTRAINT PK_task PRIMARY KEY (taskId),
-  FOREIGN KEY (jobId) REFERENCES job (jobId) ON DELETE CASCADE
-);
-
-CREATE TABLE taskAttempt (
-  taskAttemptId TEXT, taskId TEXT, jobId TEXT, 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,
-  CONSTRAINT PK_taskAttempt PRIMARY KEY (taskAttemptId),
-  FOREIGN KEY (jobId) REFERENCES job (jobId) ON DELETE CASCADE,
-  FOREIGN KEY (taskId) REFERENCES task (taskId) ON DELETE CASCADE
-);
-
-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
-);

http://git-wip-us.apache.org/repos/asf/ambari/blob/d316ed32/ambari-server/src/main/resources/Ambari-DDL-Postgres-EMBEDDED-CREATE.sql
----------------------------------------------------------------------
diff --git a/ambari-server/src/main/resources/Ambari-DDL-Postgres-EMBEDDED-CREATE.sql b/ambari-server/src/main/resources/Ambari-DDL-Postgres-EMBEDDED-CREATE.sql
index 9663d56..4b3c6e7 100644
--- a/ambari-server/src/main/resources/Ambari-DDL-Postgres-EMBEDDED-CREATE.sql
+++ b/ambari-server/src/main/resources/Ambari-DDL-Postgres-EMBEDDED-CREATE.sql
@@ -1707,97 +1707,3 @@ create index idx_qrtz_ft_j_g on ambari.qrtz_fired_triggers(SCHED_NAME,JOB_NAME,J
 create index idx_qrtz_ft_jg on ambari.qrtz_fired_triggers(SCHED_NAME,JOB_GROUP);
 create index idx_qrtz_ft_t_g on ambari.qrtz_fired_triggers(SCHED_NAME,TRIGGER_NAME,TRIGGER_GROUP);
 create index idx_qrtz_ft_tg on ambari.qrtz_fired_triggers(SCHED_NAME,TRIGGER_GROUP);
-
--- ambari log4j DDL
-
---------------------------------------------------
-----------initialisation of mapred db-------------
---------------------------------------------------
-CREATE DATABASE ambarirca;
-\connect ambarirca;
-
---CREATE ROLE "mapred" LOGIN ENCRYPTED PASSWORD 'mapred';
-CREATE USER "mapred" WITH PASSWORD 'mapred';
-GRANT ALL PRIVILEGES ON DATABASE ambarirca TO "mapred";
-
-------create tables ang grant privileges to db user---------
-CREATE TABLE workflow (
-  workflowId       TEXT, workflowName TEXT,
-  parentWorkflowId TEXT,
-  workflowContext  TEXT, userName TEXT,
-  startTime        BIGINT, lastUpdateTime BIGINT,
-  numJobsTotal     INTEGER, numJobsCompleted INTEGER,
-  inputBytes       BIGINT, outputBytes BIGINT,
-  duration         BIGINT,
-  CONSTRAINT PK_workflow PRIMARY KEY (workflowId),
-  FOREIGN KEY (parentWorkflowId) REFERENCES workflow (workflowId) ON DELETE CASCADE
-);
-GRANT ALL PRIVILEGES ON TABLE workflow TO "mapred";
-
-CREATE TABLE job (
-  jobId        TEXT, workflowId TEXT, 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,
-  CONSTRAINT PK_job PRIMARY KEY (jobId),
-  FOREIGN KEY (workflowId) REFERENCES workflow (workflowId) ON DELETE CASCADE
-);
-GRANT ALL PRIVILEGES ON TABLE job TO "mapred";
-
-CREATE TABLE task (
-  taskId        TEXT, jobId TEXT, taskType TEXT, splits TEXT,
-  startTime     BIGINT, finishTime BIGINT, status TEXT, error TEXT, counters TEXT,
-  failedAttempt TEXT,
-  CONSTRAINT PK_task PRIMARY KEY (taskId),
-  FOREIGN KEY (jobId) REFERENCES job (jobId) ON DELETE CASCADE
-);
-GRANT ALL PRIVILEGES ON TABLE task TO "mapred";
-
-CREATE TABLE taskAttempt (
-  taskAttemptId TEXT, taskId TEXT, jobId TEXT, 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,
-  CONSTRAINT PK_taskAttempt PRIMARY KEY (taskAttemptId),
-  FOREIGN KEY (jobId) REFERENCES job (jobId) ON DELETE CASCADE,
-  FOREIGN KEY (taskId) REFERENCES task (taskId) ON DELETE CASCADE
-);
-GRANT ALL PRIVILEGES ON TABLE taskAttempt TO "mapred";
-
-CREATE TABLE hdfsEvent (
-  timestamp   BIGINT,
-  userName    TEXT,
-  clientIP    TEXT,
-  operation   TEXT,
-  srcPath     TEXT,
-  dstPath     TEXT,
-  permissions TEXT
-);
-GRANT ALL PRIVILEGES ON TABLE hdfsEvent TO "mapred";
-
-CREATE TABLE mapreduceEvent (
-  timestamp   BIGINT,
-  userName    TEXT,
-  clientIP    TEXT,
-  operation   TEXT,
-  target      TEXT,
-  result      TEXT,
-  description TEXT,
-  permissions TEXT
-);
-GRANT ALL PRIVILEGES ON TABLE mapreduceEvent TO "mapred";
-
-CREATE TABLE clusterEvent (
-  timestamp BIGINT,
-  service   TEXT, status TEXT,
-  error     TEXT, data TEXT,
-  host      TEXT, rack TEXT
-);
-GRANT ALL PRIVILEGES ON TABLE clusterEvent TO "mapred";

http://git-wip-us.apache.org/repos/asf/ambari/blob/d316ed32/ambari-server/src/main/resources/Ambari-DDL-Postgres-EMBEDDED-DROP.sql
----------------------------------------------------------------------
diff --git a/ambari-server/src/main/resources/Ambari-DDL-Postgres-EMBEDDED-DROP.sql b/ambari-server/src/main/resources/Ambari-DDL-Postgres-EMBEDDED-DROP.sql
index a538043..3182bec 100644
--- a/ambari-server/src/main/resources/Ambari-DDL-Postgres-EMBEDDED-DROP.sql
+++ b/ambari-server/src/main/resources/Ambari-DDL-Postgres-EMBEDDED-DROP.sql
@@ -15,5 +15,4 @@
 -- See the License for the specific language governing permissions and
 -- limitations under the License.
 --
-DROP DATABASE :dbname;
-DROP DATABASE ambarirca;
+DROP DATABASE :dbname;
\ No newline at end of file

http://git-wip-us.apache.org/repos/asf/ambari/blob/d316ed32/ambari-server/src/main/resources/Ambari-DDL-SQLAnywhere-CREATE.sql
----------------------------------------------------------------------
diff --git a/ambari-server/src/main/resources/Ambari-DDL-SQLAnywhere-CREATE.sql b/ambari-server/src/main/resources/Ambari-DDL-SQLAnywhere-CREATE.sql
index d35dab3..74e85ef 100644
--- a/ambari-server/src/main/resources/Ambari-DDL-SQLAnywhere-CREATE.sql
+++ b/ambari-server/src/main/resources/Ambari-DDL-SQLAnywhere-CREATE.sql
@@ -1558,77 +1558,3 @@ create index idx_qrtz_ft_t_g on QRTZ_FIRED_TRIGGERS(SCHED_NAME,TRIGGER_NAME,TRIG
 create index idx_qrtz_ft_tg on QRTZ_FIRED_TRIGGERS(SCHED_NAME,TRIGGER_GROUP);
 
 commit;
-
-CREATE TABLE workflow (
-  workflowId VARCHAR(255), workflowName TEXT,
-  parentWorkflowId VARCHAR(255),
-  workflowContext TEXT, userName TEXT,
-  startTime NUMERIC(19), lastUpdateTime NUMERIC(19),
-  numJobsTotal INTEGER, numJobsCompleted INTEGER,
-  inputBytes NUMERIC(19), outputBytes NUMERIC(19),
-  duration NUMERIC(19),
-  CONSTRAINT PK_workflow PRIMARY KEY (workflowId),
-  FOREIGN KEY (parentWorkflowId) REFERENCES workflow(workflowId) ON DELETE CASCADE
-);
-
-CREATE TABLE job (
-  jobId VARCHAR(255), workflowId VARCHAR(255), jobName TEXT, workflowEntityName TEXT,
-  userName TEXT, queue TEXT, acls TEXT, confPath TEXT,
-  submitTime NUMERIC(19), launchTime NUMERIC(19), finishTime NUMERIC(19),
-  maps INTEGER, reduces INTEGER, status TEXT, priority TEXT,
-  finishedMaps INTEGER, finishedReduces INTEGER,
-  failedMaps INTEGER, failedReduces INTEGER,
-  mapsRuntime NUMERIC(19), reducesRuntime NUMERIC(19),
-  mapCounters TEXT, reduceCounters TEXT, jobCounters TEXT,
-  inputBytes NUMERIC(19), outputBytes NUMERIC(19),
-  CONSTRAINT PK_job PRIMARY KEY (jobId),
-  FOREIGN KEY(workflowId) REFERENCES workflow(workflowId) ON DELETE CASCADE
-);
-
-CREATE TABLE task (
-  taskId VARCHAR(255), jobId VARCHAR(255), taskType TEXT, splits TEXT,
-  startTime NUMERIC(19), finishTime NUMERIC(19), status TEXT, error TEXT, counters TEXT,
-  failedAttempt TEXT,
-  CONSTRAINT PK_task PRIMARY KEY (taskId),
-  FOREIGN KEY(jobId) REFERENCES job(jobId) ON DELETE CASCADE
-);
-
-CREATE TABLE taskAttempt (
-  taskAttemptId VARCHAR(255), taskId VARCHAR(255), jobId VARCHAR(255), taskType TEXT, taskTracker
TEXT,
-  startTime NUMERIC(19), finishTime NUMERIC(19),
-  mapFinishTime NUMERIC(19), shuffleFinishTime NUMERIC(19), sortFinishTime NUMERIC(19),
-  locality TEXT, avataar TEXT,
-  status TEXT, error TEXT, counters TEXT,
-  inputBytes NUMERIC(19), outputBytes NUMERIC(19),
-  CONSTRAINT PK_taskAttempt PRIMARY KEY (taskAttemptId),
-  FOREIGN KEY(jobId) REFERENCES job(jobId) ON DELETE CASCADE,
-  FOREIGN KEY(taskId) REFERENCES task(taskId) ON DELETE CASCADE
-);
-
-CREATE TABLE hdfsEvent (
-  timestamp NUMERIC(19),
-  userName TEXT,
-  clientIP TEXT,
-  operation TEXT,
-  srcPath TEXT,
-  dstPath TEXT,
-  permissions TEXT
-);
-
-CREATE TABLE mapreduceEvent (
-  timestamp NUMERIC(19),
-  userName TEXT,
-  clientIP TEXT,
-  operation TEXT,
-  target TEXT,
-  result TEXT,
-  description TEXT,
-  permissions TEXT
-);
-
-CREATE TABLE clusterEvent (
-  timestamp NUMERIC(19),
-  service TEXT, status TEXT,
-  error TEXT, data TEXT ,
-  host TEXT, rack TEXT
-);

http://git-wip-us.apache.org/repos/asf/ambari/blob/d316ed32/ambari-server/src/main/resources/Ambari-DDL-SQLServer-CREATE.sql
----------------------------------------------------------------------
diff --git a/ambari-server/src/main/resources/Ambari-DDL-SQLServer-CREATE.sql b/ambari-server/src/main/resources/Ambari-DDL-SQLServer-CREATE.sql
index 23ba2db..bd33290 100644
--- a/ambari-server/src/main/resources/Ambari-DDL-SQLServer-CREATE.sql
+++ b/ambari-server/src/main/resources/Ambari-DDL-SQLServer-CREATE.sql
@@ -1561,181 +1561,3 @@ create index idx_qrtz_ft_j_g on qrtz_fired_triggers(SCHED_NAME,JOB_NAME,JOB_GROU
 create index idx_qrtz_ft_jg on qrtz_fired_triggers(SCHED_NAME,JOB_GROUP);
 create index idx_qrtz_ft_t_g on qrtz_fired_triggers(SCHED_NAME,TRIGGER_NAME,TRIGGER_GROUP);
 create index idx_qrtz_ft_tg on qrtz_fired_triggers(SCHED_NAME,TRIGGER_GROUP);
-
--- ambari log4j DDL
-
-CREATE TABLE workflow (
-  workflowId       varchar(255),
-  workflowName     varchar(255),
-  parentWorkflowId varchar(255),
-  workflowContext  TEXT, userName varchar(255),
-  startTime        BIGINT, lastUpdateTime BIGINT,
-  numJobsTotal     INTEGER, numJobsCompleted INTEGER,
-  inputBytes       BIGINT, outputBytes BIGINT,
-  duration         BIGINT,
-  CONSTRAINT PK_workflow PRIMARY KEY CLUSTERED (workflowId),
-  FOREIGN KEY (parentWorkflowId) REFERENCES workflow (workflowId)
-);
-
-CREATE TABLE job (
-  jobId        varchar(255) NOT NULL,
-  workflowId   varchar(255) NOT NULL,
-  jobName      varchar(255), workflowEntityName varchar(255),
-  userName     varchar(255), queue varchar(255), acls varchar(2000), confPath varchar(260),
-  submitTime   BIGINT, launchTime BIGINT, finishTime BIGINT,
-  maps         INTEGER, reduces INTEGER, status varchar(255), priority varchar(255),
-  finishedMaps INTEGER, finishedReduces INTEGER,
-  failedMaps   INTEGER, failedReduces INTEGER,
-  mapsRuntime  BIGINT, reducesRuntime BIGINT,
-  mapCounters  TEXT, reduceCounters TEXT, jobCounters TEXT,
-  inputBytes   BIGINT, outputBytes BIGINT,
-  CONSTRAINT PK_job PRIMARY KEY CLUSTERED (jobId),
-  FOREIGN KEY (workflowId) REFERENCES workflow (workflowId)
-);
-
-CREATE TABLE task (
-  taskId        varchar(255) NOT NULL,
-  jobId         varchar(255) NOT NULL,
-  taskType      varchar(255), splits varchar(2000),
-  startTime     BIGINT, finishTime BIGINT, status TEXT, error TEXT, counters TEXT,
-  failedAttempt TEXT,
-  CONSTRAINT PK_task PRIMARY KEY CLUSTERED (taskId),
-  FOREIGN KEY (jobId) REFERENCES job (jobId)
-);
-
-CREATE TABLE taskAttempt (
-  taskAttemptId varchar(255) NOT NULL,
-  taskId        varchar(255) NOT NULL,
-  jobId         varchar(255) NOT NULL,
-  taskType      varchar(255), taskTracker varchar(255),
-  startTime     BIGINT, finishTime BIGINT,
-  mapFinishTime BIGINT, shuffleFinishTime BIGINT, sortFinishTime BIGINT,
-  locality      TEXT, avataar TEXT,
-  status        TEXT, error TEXT, counters TEXT,
-  inputBytes    BIGINT, outputBytes BIGINT,
-  CONSTRAINT PK_taskAttempt PRIMARY KEY CLUSTERED (taskAttemptId),
-  FOREIGN KEY (jobId) REFERENCES job (jobId),
-  FOREIGN KEY (taskId) REFERENCES task (taskId)
-);
-
-CREATE TABLE hdfsEvent (
-  timestamp   BIGINT,
-  userName    varchar(255),
-  clientIP    varchar(255),
-  operation   varchar(255),
-  srcPath     varchar(260),
-  dstPath     varchar(260),
-  permissions TEXT
-);
-
-CREATE TABLE mapreduceEvent (
-  timestamp   BIGINT,
-  userName    varchar(255),
-  clientIP    varchar(255),
-  operation   varchar(255),
-  target      varchar(255),
-  result      TEXT,
-  description TEXT,
-  permissions TEXT
-);
-
-CREATE TABLE clusterEvent (
-  timestamp BIGINT,
-  service   varchar(255), status TEXT,
-  error     TEXT, data TEXT,
-  host      TEXT, rack TEXT
-);
-
-GO
-
-IF OBJECT_ID ('trigger_workflow_delete','TR') IS NOT NULL
-    DROP TRIGGER trigger_workflow_delete;
-GO
-
-exec('CREATE TRIGGER trigger_workflow_delete
-ON workflow
-INSTEAD OF DELETE
-AS
-BEGIN
-    declare @cteTmp table
-	(
-	    rowid int identity,
-		workflowId varchar(255)
-	);
-
-    declare @cteTmpRev table
-	(
-	    rowid int identity,
-		workflowId varchar(255)
-	);
-
-	--the trigger does not get called recursively, so we need to store the child node ids in
a temp table
-    with cte as
-	(
-        select wr.workflowId workflowId
-        from workflow wr inner join deleted d ON wr.workflowId = d.workflowId
-
-        union all
-
-        select w.workflowId
-        from cte
-        inner join workflow w on cte.workflowId = w.parentWorkflowId
-    )
-	insert into @cteTmp
-	select workflowId from cte;
-
-	--order by is invalid in subqueries and common table expression queries, do whatever we
can
-	-- watch out for scalability issues due to data duplication
-	insert into @cteTmpRev
-	select workflowId from @cteTmp
-	order by rowid desc;
-
-    --delete from the referred tables
-    delete from job
-    from job j inner join @cteTmpRev r on j.workflowId = r.workflowId;
-
-    --finally delete from the master table
-    delete from workflow
-    from workflow w inner join @cteTmpRev r on w.workflowId = r.workflowId
-END
-')
-GO
-
-IF OBJECT_ID ('trigger_job_delete','TR') IS NOT NULL
-    DROP TRIGGER trigger_job_delete;
-GO
-
-exec('CREATE TRIGGER trigger_job_delete
-ON job
-INSTEAD OF DELETE
-AS
-BEGIN
-    --delete from referred tables
-    delete from task
-    from task t inner join deleted d on t.jobId = d.jobId
-
-    delete from job
-    from job j inner join deleted d on j.jobId = d.jobId
-END')
-
-GO
-
-IF OBJECT_ID ('trigger_task_delete','TR') IS NOT NULL
-    DROP TRIGGER trigger_task_delete;
-GO
-
-exec('CREATE TRIGGER trigger_task_delete
-ON task
-INSTEAD OF DELETE
-AS
-BEGIN
-    --delete from referred tables
-    delete from taskAttempt
-    from taskAttempt ta inner join task t on ta.taskId = t.taskId
-        inner join deleted d on t.jobId = d.jobId
-
-    delete from task
-    from task t inner join deleted d on t.taskId = d.taskId
-END')
-
-GO

http://git-wip-us.apache.org/repos/asf/ambari/blob/d316ed32/ambari-server/src/main/resources/AmbariRCA-DML-Oracle-CLEANUP.sql
----------------------------------------------------------------------
diff --git a/ambari-server/src/main/resources/AmbariRCA-DML-Oracle-CLEANUP.sql b/ambari-server/src/main/resources/AmbariRCA-DML-Oracle-CLEANUP.sql
deleted file mode 100644
index 1f0f3c2..0000000
--- a/ambari-server/src/main/resources/AmbariRCA-DML-Oracle-CLEANUP.sql
+++ /dev/null
@@ -1,31 +0,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.
---
--- Cleanup info about old MR jobs. Keep &1 latest MR job info's
--- &1 - how many latest MR job infos to keep
-
-DELETE FROM workflow
-WHERE workflowid IN (
-  SELECT workflowid
-  FROM (
-    SELECT workflowid, row_number() OVER (ORDER BY lastupdatetime  ) AS rnum, count(1) OVER()
AS tnum
-    FROM workflow
-  )
-  WHERE rnum <= tnum - &1
-);
-
-COMMIT;

http://git-wip-us.apache.org/repos/asf/ambari/blob/d316ed32/ambari-server/src/main/resources/AmbariRCA-DML-Postgres-CLEANUP.sql
----------------------------------------------------------------------
diff --git a/ambari-server/src/main/resources/AmbariRCA-DML-Postgres-CLEANUP.sql b/ambari-server/src/main/resources/AmbariRCA-DML-Postgres-CLEANUP.sql
deleted file mode 100644
index 3f07096..0000000
--- a/ambari-server/src/main/resources/AmbariRCA-DML-Postgres-CLEANUP.sql
+++ /dev/null
@@ -1,29 +0,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.
---
-
--- RCA cleanup script
--- :keep_latest - how many latest MR jobs to keep in RCA
-
-DELETE FROM workflow
-WHERE workflowid NOT IN (
-  SELECT workflowid
-  FROM workflow
-  ORDER BY lastupdatetime
-  DESC
-  LIMIT :keep_latest
-);

http://git-wip-us.apache.org/repos/asf/ambari/blob/d316ed32/ambari-server/src/main/resources/upgrade/ddl/AmbariRCA-DDL-Oracle-UPGRADE.sql
----------------------------------------------------------------------
diff --git a/ambari-server/src/main/resources/upgrade/ddl/AmbariRCA-DDL-Oracle-UPGRADE.sql
b/ambari-server/src/main/resources/upgrade/ddl/AmbariRCA-DDL-Oracle-UPGRADE.sql
deleted file mode 100644
index f402768..0000000
--- a/ambari-server/src/main/resources/upgrade/ddl/AmbariRCA-DDL-Oracle-UPGRADE.sql
+++ /dev/null
@@ -1,77 +0,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.
---
-
-
-
--- Removing current foreign key constraints.
-DECLARE
-  l_statement VARCHAR2(32676);
-BEGIN
-  SELECT 'ALTER TABLE WORKFLOW DROP CONSTRAINT ' || constraint_name
-  INTO l_statement
-  FROM user_cons_columns
-  WHERE table_name = 'WORKFLOW' AND column_name = 'PARENTWORKFLOWID';
-  EXECUTE IMMEDIATE l_statement;
-
-  SELECT 'ALTER TABLE JOB DROP CONSTRAINT ' || constraint_name
-  INTO l_statement
-  FROM user_cons_columns
-  WHERE table_name = 'JOB' AND column_name = 'WORKFLOWID';
-  EXECUTE IMMEDIATE l_statement;
-
-  SELECT 'ALTER TABLE TASK DROP CONSTRAINT ' || constraint_name
-  INTO l_statement
-  FROM user_cons_columns
-  WHERE table_name = 'TASK' AND column_name = 'JOBID';
-  EXECUTE IMMEDIATE l_statement;
-
-  SELECT 'ALTER TABLE TASKATTEMPT DROP CONSTRAINT ' || constraint_name
-  INTO l_statement
-  FROM user_cons_columns
-  WHERE table_name = 'TASKATTEMPT' AND column_name = 'TASKID';
-  EXECUTE IMMEDIATE l_statement;
-
-  SELECT 'ALTER TABLE TASKATTEMPT DROP CONSTRAINT ' || constraint_name
-  INTO l_statement
-  FROM user_cons_columns
-  WHERE table_name = 'TASKATTEMPT' AND column_name = 'JOBID';
-  EXECUTE IMMEDIATE l_statement;
-
-END;
-/
-
-COMMIT;
-
---Adding ON DELETE CASCADE foreign key constraints for convenient RCA cleanup
-ALTER TABLE workflow
-ADD FOREIGN KEY(parentworkflowid) REFERENCES workflow(workflowid) ON DELETE CASCADE ;
-
-ALTER TABLE job
-ADD FOREIGN KEY (workflowId) REFERENCES workflow (workflowId) ON DELETE CASCADE;
-
-ALTER TABLE task
-ADD FOREIGN KEY ( jobid ) REFERENCES job ( jobid ) ON DELETE CASCADE;
-
-ALTER TABLE taskAttempt
-ADD FOREIGN KEY (taskid) REFERENCES task(taskid) ON DELETE CASCADE;
-
-ALTER TABLE taskAttempt
-ADD FOREIGN KEY ( jobid ) REFERENCES job ( jobid ) ON DELETE CASCADE;
-
-
-COMMIT;

http://git-wip-us.apache.org/repos/asf/ambari/blob/d316ed32/ambari-server/src/main/resources/upgrade/ddl/AmbariRCA-DDL-Postgres-UPGRADE.sql
----------------------------------------------------------------------
diff --git a/ambari-server/src/main/resources/upgrade/ddl/AmbariRCA-DDL-Postgres-UPGRADE.sql
b/ambari-server/src/main/resources/upgrade/ddl/AmbariRCA-DDL-Postgres-UPGRADE.sql
deleted file mode 100644
index d9a7a75..0000000
--- a/ambari-server/src/main/resources/upgrade/ddl/AmbariRCA-DDL-Postgres-UPGRADE.sql
+++ /dev/null
@@ -1,37 +0,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.
---
-
-
---Adding ON DELETE CASCADE constrain for convenient RCA cleanup
-ALTER TABLE workflow
-DROP CONSTRAINT workflow_parentworkflowid_fkey,
-ADD FOREIGN KEY(parentworkflowid) REFERENCES workflow(workflowid) ON DELETE CASCADE ;
-
-ALTER TABLE job
-DROP CONSTRAINT job_workflowid_fkey,
-ADD FOREIGN KEY (workflowId) REFERENCES workflow (workflowId) ON DELETE CASCADE;
-
-ALTER TABLE task
-DROP CONSTRAINT task_jobid_fkey,
-ADD FOREIGN KEY ( jobid ) REFERENCES job ( jobid ) ON DELETE CASCADE;
-
-ALTER TABLE taskAttempt
-DROP CONSTRAINT taskattempt_taskid_fkey,
-DROP CONSTRAINT taskattempt_jobid_fkey,
-ADD FOREIGN KEY (taskid) REFERENCES task(taskid) ON DELETE CASCADE,
-ADD FOREIGN KEY ( jobid ) REFERENCES job ( jobid ) ON DELETE CASCADE;


Mime
View raw message