You are viewing a plain text version of this content. The canonical link for it is here.
Posted to commits@ambari.apache.org by sw...@apache.org on 2014/01/09 21:51:07 UTC

git commit: AMBARI-4237. Allow unlimited size for request_body of the RequestSchedule entity. (swagle)

Updated Branches:
  refs/heads/trunk 7349a5249 -> 95b71281f


AMBARI-4237. Allow unlimited size for request_body of the RequestSchedule entity. (swagle)


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

Branch: refs/heads/trunk
Commit: 95b71281f7fc17c4838903cfa334d83422b9dd4e
Parents: 7349a52
Author: Siddharth Wagle <sw...@hortonworks.com>
Authored: Thu Jan 9 12:38:28 2014 -0800
Committer: Siddharth Wagle <sw...@hortonworks.com>
Committed: Thu Jan 9 12:38:35 2014 -0800

----------------------------------------------------------------------
 .../server/configuration/Configuration.java     |  3 +-
 .../controller/RequestScheduleResponse.java     | 11 +++++
 .../RequestScheduleResourceProvider.java        |  8 +++-
 .../RequestScheduleBatchRequestEntity.java      | 21 +++++++--
 .../scheduler/ExecutionScheduleManager.java     | 24 ++++++++--
 .../scheduler/ExecutionSchedulerImpl.java       | 32 ++++++++-----
 .../state/scheduler/RequestExecution.java       | 16 +++++++
 .../state/scheduler/RequestExecutionImpl.java   | 49 ++++++++++++++++++--
 .../main/resources/Ambari-DDL-MySQL-CREATE.sql  |  2 +-
 .../main/resources/Ambari-DDL-Oracle-CREATE.sql |  2 +-
 .../resources/Ambari-DDL-Postgres-CREATE.sql    |  2 +-
 .../Ambari-DDL-Postgres-REMOTE-CREATE.sql       |  2 +-
 .../src/main/resources/properties.json          |  1 +
 .../RequestScheduleResourceProviderTest.java    |  4 ++
 .../server/orm/dao/RequestScheduleDAOTest.java  |  2 +-
 .../scheduler/ExecutionSchedulerTest.java       | 38 ++++++++++++++-
 .../server/state/RequestExecutionTest.java      | 47 +++++++++++++++++++
 17 files changed, 234 insertions(+), 30 deletions(-)
----------------------------------------------------------------------


http://git-wip-us.apache.org/repos/asf/ambari/blob/95b71281/ambari-server/src/main/java/org/apache/ambari/server/configuration/Configuration.java
----------------------------------------------------------------------
diff --git a/ambari-server/src/main/java/org/apache/ambari/server/configuration/Configuration.java b/ambari-server/src/main/java/org/apache/ambari/server/configuration/Configuration.java
index 909e6e1..a1a25e0 100644
--- a/ambari-server/src/main/java/org/apache/ambari/server/configuration/Configuration.java
+++ b/ambari-server/src/main/java/org/apache/ambari/server/configuration/Configuration.java
@@ -92,7 +92,8 @@ public class Configuration {
   public static final String CLIENT_API_SSL_CRT_PASS_KEY = "client.api.ssl.crt_pass";
   public static final String CLIENT_API_SSL_KEY_NAME_KEY = "client.api.ssl.key_name";
   public static final String SERVER_DB_NAME_KEY = "server.jdbc.database";
-  public static final String SERVER_DB_NAME_DEFAULT = "postgres";
+  public static final String SERVER_DB_NAME_DEFAULT = "ambari";
+  public static final String POSTGRES_DB_NAME = "postgres";
   public static final String ORACLE_DB_NAME = "oracle";
   public static final String MYSQL_DB_NAME = "mysql";
 

http://git-wip-us.apache.org/repos/asf/ambari/blob/95b71281/ambari-server/src/main/java/org/apache/ambari/server/controller/RequestScheduleResponse.java
----------------------------------------------------------------------
diff --git a/ambari-server/src/main/java/org/apache/ambari/server/controller/RequestScheduleResponse.java b/ambari-server/src/main/java/org/apache/ambari/server/controller/RequestScheduleResponse.java
index a94e972..17f69c9 100644
--- a/ambari-server/src/main/java/org/apache/ambari/server/controller/RequestScheduleResponse.java
+++ b/ambari-server/src/main/java/org/apache/ambari/server/controller/RequestScheduleResponse.java
@@ -26,6 +26,7 @@ public class RequestScheduleResponse {
   private String clusterName;
   private String description;
   private String status;
+  private String lastExecutionStatus;
   private Batch batch;
   private Schedule schedule;
   private String createUser;
@@ -35,6 +36,7 @@ public class RequestScheduleResponse {
 
   public RequestScheduleResponse(Long id, String clusterName,
                                  String description, String status,
+                                 String lastExecutionStatus,
                                  Batch batch, Schedule schedule,
                                  String createUser, String createTime,
                                  String updateUser, String updateTime) {
@@ -42,6 +44,7 @@ public class RequestScheduleResponse {
     this.clusterName = clusterName;
     this.description = description;
     this.status = status;
+    this.lastExecutionStatus = lastExecutionStatus;
     this.batch = batch;
     this.schedule = schedule;
     this.createUser = createUser;
@@ -129,4 +132,12 @@ public class RequestScheduleResponse {
   public void setUpdateTime(String updateTime) {
     this.updateTime = updateTime;
   }
+
+  public String getLastExecutionStatus() {
+    return lastExecutionStatus;
+  }
+
+  public void setLastExecutionStatus(String lastExecutionStatus) {
+    this.lastExecutionStatus = lastExecutionStatus;
+  }
 }

http://git-wip-us.apache.org/repos/asf/ambari/blob/95b71281/ambari-server/src/main/java/org/apache/ambari/server/controller/internal/RequestScheduleResourceProvider.java
----------------------------------------------------------------------
diff --git a/ambari-server/src/main/java/org/apache/ambari/server/controller/internal/RequestScheduleResourceProvider.java b/ambari-server/src/main/java/org/apache/ambari/server/controller/internal/RequestScheduleResourceProvider.java
index 2d3826e..dc937c6 100644
--- a/ambari-server/src/main/java/org/apache/ambari/server/controller/internal/RequestScheduleResourceProvider.java
+++ b/ambari-server/src/main/java/org/apache/ambari/server/controller/internal/RequestScheduleResourceProvider.java
@@ -31,6 +31,7 @@ import org.apache.ambari.server.controller.spi.Request;
 import org.apache.ambari.server.controller.spi.RequestStatus;
 import org.apache.ambari.server.controller.spi.Resource;
 import org.apache.ambari.server.controller.spi.ResourceAlreadyExistsException;
+import org.apache.ambari.server.controller.spi.ResourcePredicateEvaluator;
 import org.apache.ambari.server.controller.spi.SystemException;
 import org.apache.ambari.server.controller.spi.UnsupportedPropertyException;
 import org.apache.ambari.server.controller.utilities.PropertyHelper;
@@ -66,6 +67,8 @@ public class RequestScheduleResourceProvider extends AbstractControllerResourceP
     PropertyHelper.getPropertyId("RequestSchedule", "description");
   protected static final String REQUEST_SCHEDULE_STATUS_PROPERTY_ID =
     PropertyHelper.getPropertyId("RequestSchedule", "status");
+  protected static final String REQUEST_SCHEDULE_LAST_STATUS_PROPERTY_ID =
+    PropertyHelper.getPropertyId("RequestSchedule", "last_execution_status");
   protected static final String REQUEST_SCHEDULE_BATCH_PROPERTY_ID =
     PropertyHelper.getPropertyId("RequestSchedule", "batch");
   protected static final String REQUEST_SCHEDULE_SCHEDULE_PROPERTY_ID =
@@ -198,6 +201,8 @@ public class RequestScheduleResourceProvider extends AbstractControllerResourceP
         response.getDescription(), requestedIds);
       setResourceProperty(resource, REQUEST_SCHEDULE_STATUS_PROPERTY_ID,
         response.getStatus(), requestedIds);
+      setResourceProperty(resource, REQUEST_SCHEDULE_LAST_STATUS_PROPERTY_ID,
+        response.getLastExecutionStatus(), requestedIds);
       setResourceProperty(resource, REQUEST_SCHEDULE_BATCH_PROPERTY_ID,
         response.getBatch(), requestedIds);
       setResourceProperty(resource, REQUEST_SCHEDULE_SCHEDULE_PROPERTY_ID,
@@ -438,6 +443,7 @@ public class RequestScheduleResourceProvider extends AbstractControllerResourceP
       RequestScheduleResponse response = new RequestScheduleResponse
         (requestExecution.getId(), requestExecution.getClusterName(),
           requestExecution.getDescription(), requestExecution.getStatus(),
+          requestExecution.getLastExecutionStatus(),
           requestExecution.getBatch(), request.getSchedule(),
           requestExecution.getCreateUser(), requestExecution.getCreateTime(),
           requestExecution.getUpdateUser(), requestExecution.getUpdateTime());
@@ -499,7 +505,7 @@ public class RequestScheduleResourceProvider extends AbstractControllerResourceP
           RequestExecution requestExecution = allRequestExecutions.get
             (request.getId());
           if (requestExecution != null) {
-            responses.add(requestExecution.convertToResponse());
+            responses.add(requestExecution.convertToResponseWithBody());
           }
           continue;
         }

http://git-wip-us.apache.org/repos/asf/ambari/blob/95b71281/ambari-server/src/main/java/org/apache/ambari/server/orm/entities/RequestScheduleBatchRequestEntity.java
----------------------------------------------------------------------
diff --git a/ambari-server/src/main/java/org/apache/ambari/server/orm/entities/RequestScheduleBatchRequestEntity.java b/ambari-server/src/main/java/org/apache/ambari/server/orm/entities/RequestScheduleBatchRequestEntity.java
index 48a4db9..79ee689 100644
--- a/ambari-server/src/main/java/org/apache/ambari/server/orm/entities/RequestScheduleBatchRequestEntity.java
+++ b/ambari-server/src/main/java/org/apache/ambari/server/orm/entities/RequestScheduleBatchRequestEntity.java
@@ -17,12 +17,15 @@
  */
 package org.apache.ambari.server.orm.entities;
 
+import javax.persistence.Basic;
 import javax.persistence.Column;
 import javax.persistence.Entity;
+import javax.persistence.FetchType;
 import javax.persistence.Id;
 import javax.persistence.IdClass;
 import javax.persistence.JoinColumn;
 import javax.persistence.JoinColumns;
+import javax.persistence.Lob;
 import javax.persistence.ManyToOne;
 import javax.persistence.NamedQueries;
 import javax.persistence.NamedQuery;
@@ -53,8 +56,10 @@ public class RequestScheduleBatchRequestEntity {
   @Column(name = "request_uri")
   private String requestUri;
 
+  @Lob
+  @Basic(fetch = FetchType.LAZY)
   @Column(name = "request_body")
-  private String requestBody;
+  private byte[] requestBody;
 
   @Column(name = "request_status")
   private String requestStatus;
@@ -110,14 +115,24 @@ public class RequestScheduleBatchRequestEntity {
     this.requestUri = requestUri;
   }
 
-  public String getRequestBody() {
+  public byte[] getRequestBody() {
     return requestBody;
   }
 
-  public void setRequestBody(String requestBody) {
+  public String getRequestBodyAsString() {
+    return requestBody != null ? new String(requestBody) : null;
+  }
+
+  public void setRequestBody(byte[] requestBody) {
     this.requestBody = requestBody;
   }
 
+  public void setRequestBody(String requestBodyStr) {
+    if (requestBodyStr != null) {
+      requestBody = requestBodyStr.getBytes();
+    }
+  }
+
   public String getRequestStatus() {
     return requestStatus;
   }

http://git-wip-us.apache.org/repos/asf/ambari/blob/95b71281/ambari-server/src/main/java/org/apache/ambari/server/scheduler/ExecutionScheduleManager.java
----------------------------------------------------------------------
diff --git a/ambari-server/src/main/java/org/apache/ambari/server/scheduler/ExecutionScheduleManager.java b/ambari-server/src/main/java/org/apache/ambari/server/scheduler/ExecutionScheduleManager.java
index a3199e4..9813cee 100644
--- a/ambari-server/src/main/java/org/apache/ambari/server/scheduler/ExecutionScheduleManager.java
+++ b/ambari-server/src/main/java/org/apache/ambari/server/scheduler/ExecutionScheduleManager.java
@@ -179,8 +179,10 @@ public class ExecutionScheduleManager {
       try {
         String startTime = schedule.getStartTime();
         String endTime = schedule.getEndTime();
-        startDate = startTime != null ? DateUtils.convertToDate(startTime) : new Date();
-        endDate = endTime != null ? DateUtils.convertToDate(endTime) : null;
+        startDate = startTime != null && !startTime.isEmpty() ?
+          DateUtils.convertToDate(startTime) : new Date();
+        endDate = endTime != null && !endTime.isEmpty() ?
+          DateUtils.convertToDate(endTime) : null;
       } catch (ParseException e) {
         LOG.error("Unable to parse startTime / endTime.", e);
       }
@@ -288,10 +290,12 @@ public class ExecutionScheduleManager {
    * @return
    */
   public void validateSchedule(Schedule schedule) throws AmbariException {
+    Date startDate = null;
+    Date endDate = null;
     if (!schedule.isEmpty()) {
       if (schedule.getStartTime() != null && !schedule.getStartTime().isEmpty()) {
         try {
-          DateUtils.convertToDate(schedule.getStartTime());
+          startDate = DateUtils.convertToDate(schedule.getStartTime());
         } catch (ParseException pe) {
           throw new AmbariException("Start time in invalid format. startTime "
             + "= " + schedule.getStartTime() + ", Allowed format = "
@@ -300,13 +304,23 @@ public class ExecutionScheduleManager {
       }
       if (schedule.getEndTime() != null && !schedule.getEndTime().isEmpty()) {
         try {
-          DateUtils.convertToDate(schedule.getEndTime());
+          endDate = DateUtils.convertToDate(schedule.getEndTime());
         } catch (ParseException pe) {
           throw new AmbariException("End time in invalid format. endTime "
             + "= " + schedule.getEndTime() + ", Allowed format = "
             + DateUtils.ALLOWED_DATE_FORMAT);
         }
       }
+      if (endDate != null) {
+        if (endDate.before(new Date())) {
+          throw new AmbariException("End date should be in the future. " +
+            "endDate = " + endDate);
+        }
+        if (startDate != null && endDate.before(startDate)) {
+          throw new AmbariException("End date cannot be before start date. " +
+            "startDate = " + startDate + ", endDate = " + endDate);
+        }
+      }
       String cronExpression = schedule.getScheduleExpression();
       if (cronExpression != null && !cronExpression.trim().isEmpty()) {
         if (!CronExpression.isValidExpression(cronExpression)) {
@@ -372,7 +386,7 @@ public class ExecutionScheduleManager {
 
       type = batchRequestEntity.getRequestType();
       uri = batchRequestEntity.getRequestUri();
-      body = batchRequestEntity.getRequestBody();
+      body = batchRequestEntity.getRequestBodyAsString();
 
     } catch (Exception e) {
 

http://git-wip-us.apache.org/repos/asf/ambari/blob/95b71281/ambari-server/src/main/java/org/apache/ambari/server/scheduler/ExecutionSchedulerImpl.java
----------------------------------------------------------------------
diff --git a/ambari-server/src/main/java/org/apache/ambari/server/scheduler/ExecutionSchedulerImpl.java b/ambari-server/src/main/java/org/apache/ambari/server/scheduler/ExecutionSchedulerImpl.java
index 84abf0e..2b938bc 100644
--- a/ambari-server/src/main/java/org/apache/ambari/server/scheduler/ExecutionSchedulerImpl.java
+++ b/ambari-server/src/main/java/org/apache/ambari/server/scheduler/ExecutionSchedulerImpl.java
@@ -93,17 +93,10 @@ public class ExecutionSchedulerImpl implements ExecutionScheduler {
     properties.setProperty("org.quartz.jobStore.isClustered",
       configuration.isExecutionSchedulerClusterd());
 
-    String dbType = configuration.getServerDBName();
-    String dbDelegate = "org.quartz.impl.jdbcjobstore.StdJDBCDelegate";
-    String dbValidate = "select 0";
+    String[] subProps = getQuartzDbDelegateClassAndValidationQuery();
 
-    if (dbType.equals(Configuration.SERVER_DB_NAME_DEFAULT)) {
-      dbDelegate = "org.quartz.impl.jdbcjobstore.PostgreSQLDelegate";
-    } else if (dbType.equals(Configuration.ORACLE_DB_NAME)) {
-      dbDelegate = "org.quartz.impl.jdbcjobstore.oracle.OracleDelegate";
-      dbValidate = "select 0 from dual";
-    }
-    properties.setProperty("org.quartz.jobStore.driverDelegateClass", dbDelegate);
+    properties.setProperty("org.quartz.jobStore.driverDelegateClass",
+      subProps[0]);
     // Allow only strings in the jobDataMap which is serialized
     properties.setProperty("org.quartz.jobStore.useProperties", "false");
 
@@ -120,11 +113,12 @@ public class ExecutionSchedulerImpl implements ExecutionScheduler {
     properties.setProperty("org.quartz.dataSource.myDS.maxConnections",
       configuration.getExecutionSchedulerConnections());
     properties.setProperty("org.quartz.dataSource.myDS.validationQuery",
-      dbValidate);
+      subProps[1]);
 
     // Skip update check
     properties.setProperty("org.quartz.scheduler.skipUpdateCheck", "true");
 
+    LOG.debug("Using quartz properties: " + properties);
     return properties;
   }
 
@@ -132,6 +126,22 @@ public class ExecutionSchedulerImpl implements ExecutionScheduler {
     return isInitialized;
   }
 
+
+  protected String[] getQuartzDbDelegateClassAndValidationQuery() {
+    String dbUrl = configuration.getDatabaseUrl();
+    String dbDelegate = "org.quartz.impl.jdbcjobstore.StdJDBCDelegate";
+    String dbValidate = "select 0";
+
+    if (dbUrl.contains(Configuration.POSTGRES_DB_NAME)) {
+      dbDelegate = "org.quartz.impl.jdbcjobstore.PostgreSQLDelegate";
+    } else if (dbUrl.contains(Configuration.ORACLE_DB_NAME)) {
+      dbDelegate = "org.quartz.impl.jdbcjobstore.oracle.OracleDelegate";
+      dbValidate = "select 0 from dual";
+    }
+
+    return new String[] { dbDelegate, dbValidate };
+  }
+
   @Override
   public synchronized void startScheduler() throws AmbariException {
     try {

http://git-wip-us.apache.org/repos/asf/ambari/blob/95b71281/ambari-server/src/main/java/org/apache/ambari/server/state/scheduler/RequestExecution.java
----------------------------------------------------------------------
diff --git a/ambari-server/src/main/java/org/apache/ambari/server/state/scheduler/RequestExecution.java b/ambari-server/src/main/java/org/apache/ambari/server/state/scheduler/RequestExecution.java
index 9a7570d..bbeece3 100644
--- a/ambari-server/src/main/java/org/apache/ambari/server/state/scheduler/RequestExecution.java
+++ b/ambari-server/src/main/java/org/apache/ambari/server/state/scheduler/RequestExecution.java
@@ -135,6 +135,22 @@ public interface RequestExecution {
   public String getUpdateUser();
 
   /**
+   * Get status of the last batch of requests
+   * @return
+   */
+  public String getLastExecutionStatus();
+
+  /**
+   * Get response with request body
+   */
+  public RequestScheduleResponse convertToResponseWithBody();
+
+  /**
+   * Get the request body for a batch request
+   */
+  public String getRequestBody(Long batchId);
+
+  /**
    * Status of the Request execution
    */
   public enum Status {

http://git-wip-us.apache.org/repos/asf/ambari/blob/95b71281/ambari-server/src/main/java/org/apache/ambari/server/state/scheduler/RequestExecutionImpl.java
----------------------------------------------------------------------
diff --git a/ambari-server/src/main/java/org/apache/ambari/server/state/scheduler/RequestExecutionImpl.java b/ambari-server/src/main/java/org/apache/ambari/server/state/scheduler/RequestExecutionImpl.java
index 014e6bd..a13944d 100644
--- a/ambari-server/src/main/java/org/apache/ambari/server/state/scheduler/RequestExecutionImpl.java
+++ b/ambari-server/src/main/java/org/apache/ambari/server/state/scheduler/RequestExecutionImpl.java
@@ -109,9 +109,9 @@ public class RequestExecutionImpl implements RequestExecution {
       for (RequestScheduleBatchRequestEntity batchRequestEntity :
           batchRequestEntities) {
         BatchRequest batchRequest = new BatchRequest();
+        batchRequest.setOrderId(batchRequestEntity.getBatchId());
         batchRequest.setType(BatchRequest.Type.valueOf(batchRequestEntity.getRequestType()));
         batchRequest.setUri(batchRequestEntity.getRequestUri());
-        batchRequest.setBody(batchRequestEntity.getRequestBody());
         batchRequest.setStatus(batchRequestEntity.getRequestStatus());
         batchRequest.setReturnCode(batchRequestEntity.getReturnCode());
         batchRequest.setResponseMsg(batchRequestEntity.getReturnMessage());
@@ -166,8 +166,9 @@ public class RequestExecutionImpl implements RequestExecution {
     readWriteLock.readLock().lock();
     try{
       RequestScheduleResponse response = new RequestScheduleResponse(
-        getId(), getClusterName(), getDescription(), getStatus(), getBatch(),
-        getSchedule(), requestScheduleEntity.getCreateUser(),
+        getId(), getClusterName(), getDescription(), getStatus(),
+        getLastExecutionStatus(), getBatch(), getSchedule(),
+        requestScheduleEntity.getCreateUser(),
         DateUtils.convertToReadableTime(requestScheduleEntity.getCreateTimestamp()),
         requestScheduleEntity.getUpdateUser(),
         DateUtils.convertToReadableTime(requestScheduleEntity.getUpdateTimestamp())
@@ -367,4 +368,46 @@ public class RequestExecutionImpl implements RequestExecution {
     return requestScheduleEntity.getUpdateUser();
   }
 
+  @Override
+  public String getLastExecutionStatus() {
+    return requestScheduleEntity.getLastExecutionStatus();
+  }
+
+  @Override
+  public RequestScheduleResponse convertToResponseWithBody() {
+    readWriteLock.readLock().lock();
+    try{
+      RequestScheduleResponse response = convertToResponse();
+      Batch batch = response.getBatch();
+      if (batch != null) {
+        List<BatchRequest> batchRequests = batch.getBatchRequests();
+        if (batchRequests != null) {
+          for (BatchRequest batchRequest : batchRequests) {
+            batchRequest.setBody(getRequestBody(batchRequest.getOrderId()));
+          }
+        }
+      }
+      return response;
+    } finally {
+      readWriteLock.readLock().unlock();
+    }
+  }
+
+  @Override
+  public String getRequestBody(Long batchId) {
+    String body = null;
+    if (requestScheduleEntity != null) {
+      Collection<RequestScheduleBatchRequestEntity> requestEntities =
+        requestScheduleEntity.getRequestScheduleBatchRequestEntities();
+      if (requestEntities != null) {
+        for (RequestScheduleBatchRequestEntity requestEntity : requestEntities) {
+          if (requestEntity.getBatchId().equals(batchId)) {
+            body = requestEntity.getRequestBodyAsString();
+          }
+        }
+      }
+    }
+    return body;
+  }
+
 }

http://git-wip-us.apache.org/repos/asf/ambari/blob/95b71281/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 97a17ea..b5f75b6 100644
--- a/ambari-server/src/main/resources/Ambari-DDL-MySQL-CREATE.sql
+++ b/ambari-server/src/main/resources/Ambari-DDL-MySQL-CREATE.sql
@@ -53,7 +53,7 @@ CREATE TABLE confgroupclusterconfigmapping (config_group_id BIGINT NOT NULL, clu
 CREATE TABLE configgroup (group_id BIGINT, cluster_id BIGINT NOT NULL, group_name VARCHAR(255) NOT NULL, tag VARCHAR(1024) NOT NULL, description VARCHAR(1024), create_timestamp BIGINT NOT NULL, PRIMARY KEY(group_id));
 CREATE TABLE configgrouphostmapping (config_group_id BIGINT NOT NULL, host_name VARCHAR(255) NOT NULL, PRIMARY KEY(config_group_id, host_name));
 CREATE TABLE requestschedule (schedule_id bigint, cluster_id BIGINT NOT NULL, description varchar(255), status varchar(255), batch_separation_minutes smallint, batch_toleration_limit smallint, create_user varchar(255), create_timestamp bigint, update_user varchar(255), update_timestamp bigint, minutes varchar(10), hours varchar(10), days_of_month varchar(10), month varchar(10), day_of_week varchar(10), yearToSchedule varchar(10), startTime varchar(50), endTime varchar(50), last_execution_status varchar(255), PRIMARY KEY(schedule_id));
-CREATE TABLE requestschedulebatchrequest (schedule_id bigint, batch_id bigint, request_id bigint, request_type varchar(255), request_uri varchar(1024), request_body varchar(4000), request_status varchar(255), return_code smallint, return_message varchar(255), PRIMARY KEY(schedule_id, batch_id));
+CREATE TABLE requestschedulebatchrequest (schedule_id bigint, batch_id bigint, request_id bigint, request_type varchar(255), request_uri varchar(1024), request_body LONGBLOB, request_status varchar(255), return_code smallint, return_message varchar(255), PRIMARY KEY(schedule_id, batch_id));
 CREATE TABLE action (action_name VARCHAR(255) NOT NULL, action_type VARCHAR(32) NOT NULL, inputs VARCHAR(1000), target_service VARCHAR(255), target_component VARCHAR(255), default_timeout SMALLINT NOT NULL, description VARCHAR(1000), target_type VARCHAR(32), PRIMARY KEY (action_name));
 
 ALTER TABLE users ADD CONSTRAINT UNQ_users_0 UNIQUE (user_name, ldap_user);

http://git-wip-us.apache.org/repos/asf/ambari/blob/95b71281/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 071469a..5a81610 100644
--- a/ambari-server/src/main/resources/Ambari-DDL-Oracle-CREATE.sql
+++ b/ambari-server/src/main/resources/Ambari-DDL-Oracle-CREATE.sql
@@ -44,7 +44,7 @@ CREATE TABLE confgroupclusterconfigmapping (config_group_id NUMBER(19) NOT NULL,
 CREATE TABLE configgrouphostmapping (config_group_id NUMBER(19) NOT NULL, host_name VARCHAR2(255) NOT NULL, PRIMARY KEY(config_group_id, host_name));
 CREATE TABLE action (action_name VARCHAR2(255) NOT NULL, action_type VARCHAR2(255) NOT NULL, inputs VARCHAR2(1024), target_service VARCHAR2(255), target_component VARCHAR2(255), default_timeout NUMBER(10) NOT NULL, description VARCHAR2(1024), target_type VARCHAR2(255), PRIMARY KEY (action_name));
 CREATE TABLE ambari.requestschedule (schedule_id NUMBER(19), cluster_id NUMBER(19) NOT NULL, description VARCHAR2(255), status VARCHAR2(255), batch_separation_minutes smallint, batch_toleration_limit smallint, create_user VARCHAR2(255), create_timestamp NUMBER(19), update_user VARCHAR2(255), update_timestamp NUMBER(19), minutes VARCHAR2(10), hours VARCHAR2(10), days_of_month VARCHAR2(10), month VARCHAR2(10), day_of_week VARCHAR2(10), yearToSchedule VARCHAR2(10), startTime VARCHAR2(50), endTime VARCHAR2(50), last_execution_status VARCHAR2(255), PRIMARY KEY(schedule_id));
-CREATE TABLE ambari.requestschedulebatchrequest (schedule_id NUMBER(19), batch_id NUMBER(19), request_id NUMBER(19), request_type VARCHAR2(255), request_uri VARCHAR2(1024), request_body VARCHAR2(4000), request_status VARCHAR2(255), return_code smallint, return_message VARCHAR2(255), PRIMARY KEY(schedule_id, batch_id));
+CREATE TABLE ambari.requestschedulebatchrequest (schedule_id NUMBER(19), batch_id NUMBER(19), request_id NUMBER(19), request_type VARCHAR2(255), request_uri VARCHAR2(1024), request_body BLOB, request_status VARCHAR2(255), return_code smallint, return_message VARCHAR2(255), PRIMARY KEY(schedule_id, batch_id));
 
 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);

http://git-wip-us.apache.org/repos/asf/ambari/blob/95b71281/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 047b6ab..78ffe4b 100644
--- a/ambari-server/src/main/resources/Ambari-DDL-Postgres-CREATE.sql
+++ b/ambari-server/src/main/resources/Ambari-DDL-Postgres-CREATE.sql
@@ -113,7 +113,7 @@ GRANT ALL PRIVILEGES ON TABLE ambari.action TO :username;
 CREATE TABLE ambari.requestschedule (schedule_id bigint, cluster_id bigint NOT NULL, description varchar(255), status varchar(255), batch_separation_minutes smallint, batch_toleration_limit smallint, create_user varchar(255), create_timestamp bigint, update_user varchar(255), update_timestamp bigint, minutes varchar(10), hours varchar(10), days_of_month varchar(10), month varchar(10), day_of_week varchar(10), yearToSchedule varchar(10), startTime varchar(50), endTime varchar(50), last_execution_status varchar(255), PRIMARY KEY(schedule_id));
 GRANT ALL PRIVILEGES ON TABLE ambari.requestschedule TO :username;
 
-CREATE TABLE ambari.requestschedulebatchrequest (schedule_id bigint, batch_id bigint, request_id bigint, request_type varchar(255), request_uri varchar(1024), request_body varchar(4000), request_status varchar(255), return_code smallint, return_message varchar(255), PRIMARY KEY(schedule_id, batch_id));
+CREATE TABLE ambari.requestschedulebatchrequest (schedule_id bigint, batch_id bigint, request_id bigint, request_type varchar(255), request_uri varchar(1024), request_body BYTEA, request_status varchar(255), return_code smallint, return_message varchar(255), PRIMARY KEY(schedule_id, batch_id));
 GRANT ALL PRIVILEGES ON TABLE ambari.requestschedulebatchrequest TO :username;
 
 --------altering tables by creating foreign keys----------

http://git-wip-us.apache.org/repos/asf/ambari/blob/95b71281/ambari-server/src/main/resources/Ambari-DDL-Postgres-REMOTE-CREATE.sql
----------------------------------------------------------------------
diff --git a/ambari-server/src/main/resources/Ambari-DDL-Postgres-REMOTE-CREATE.sql b/ambari-server/src/main/resources/Ambari-DDL-Postgres-REMOTE-CREATE.sql
index ff251c8..32fa80b 100644
--- a/ambari-server/src/main/resources/Ambari-DDL-Postgres-REMOTE-CREATE.sql
+++ b/ambari-server/src/main/resources/Ambari-DDL-Postgres-REMOTE-CREATE.sql
@@ -46,7 +46,7 @@ CREATE TABLE ambari.configgroup (group_id BIGINT, cluster_id BIGINT NOT NULL, gr
 CREATE TABLE ambari.confgroupclusterconfigmapping (config_group_id BIGINT NOT NULL, cluster_id BIGINT NOT NULL, config_type VARCHAR(255) NOT NULL, version_tag VARCHAR(255) NOT NULL, user_name VARCHAR(255) DEFAULT '_db', create_timestamp BIGINT NOT NULL, PRIMARY KEY(config_group_id, cluster_id, config_type));
 CREATE TABLE ambari.configgrouphostmapping (config_group_id BIGINT NOT NULL, host_name VARCHAR(255) NOT NULL, PRIMARY KEY(config_group_id, host_name));
 CREATE TABLE ambari.requestschedule (schedule_id bigint, cluster_id BIGINT NOT NULL, status varchar(255), batch_separation_minutes smallint, batch_toleration_limit smallint, create_user varchar(255), create_timestamp bigint, update_user varchar(255), update_timestamp bigint, minutes varchar(10), hours varchar(10), days_of_month varchar(10), month varchar(10), day_of_week varchar(10), yearToSchedule varchar(10), startTime varchar(50), endTime varchar(50), last_execution_status varchar(255), PRIMARY KEY(schedule_id));
-CREATE TABLE ambari.requestschedulebatchrequest (schedule_id bigint, batch_id bigint, request_id bigint, request_type varchar(255), request_uri varchar(1024), request_body varchar(4000), request_status varchar(255), return_code smallint, return_message varchar(255), PRIMARY KEY(schedule_id, batch_id));
+CREATE TABLE ambari.requestschedulebatchrequest (schedule_id bigint, batch_id bigint, request_id bigint, request_type varchar(255), request_uri varchar(1024), request_body BYTEA, request_status varchar(255), return_code smallint, return_message varchar(255), PRIMARY KEY(schedule_id, batch_id));
 
 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);

http://git-wip-us.apache.org/repos/asf/ambari/blob/95b71281/ambari-server/src/main/resources/properties.json
----------------------------------------------------------------------
diff --git a/ambari-server/src/main/resources/properties.json b/ambari-server/src/main/resources/properties.json
index 952197b..9c9529f 100644
--- a/ambari-server/src/main/resources/properties.json
+++ b/ambari-server/src/main/resources/properties.json
@@ -110,6 +110,7 @@
         "RequestSchedule/cluster_name",
         "RequestSchedule/description",
         "RequestSchedule/status",
+        "RequestSchedule/last_execution_status",
         "RequestSchedule/batch",
         "RequestSchedule/schedule",
         "_"

http://git-wip-us.apache.org/repos/asf/ambari/blob/95b71281/ambari-server/src/test/java/org/apache/ambari/server/controller/internal/RequestScheduleResourceProviderTest.java
----------------------------------------------------------------------
diff --git a/ambari-server/src/test/java/org/apache/ambari/server/controller/internal/RequestScheduleResourceProviderTest.java b/ambari-server/src/test/java/org/apache/ambari/server/controller/internal/RequestScheduleResourceProviderTest.java
index e391a3b..cb4d8aa 100644
--- a/ambari-server/src/test/java/org/apache/ambari/server/controller/internal/RequestScheduleResourceProviderTest.java
+++ b/ambari-server/src/test/java/org/apache/ambari/server/controller/internal/RequestScheduleResourceProviderTest.java
@@ -202,6 +202,8 @@ public class RequestScheduleResourceProviderTest {
     expect(requestExecution.getId()).andReturn(25L).anyTimes();
     expect(requestExecution.convertToResponse()).andReturn
       (requestScheduleResponse).anyTimes();
+    expect(requestExecution.convertToResponseWithBody()).andReturn
+      (requestScheduleResponse).anyTimes();
     expect(requestScheduleResponse.getId()).andReturn(25L).anyTimes();
     expect(requestScheduleResponse.getClusterName()).andReturn("Cluster100")
       .anyTimes();
@@ -310,6 +312,8 @@ public class RequestScheduleResourceProviderTest {
       .SCHEDULED.name()).anyTimes();
     expect(requestExecution.convertToResponse()).andReturn
       (requestScheduleResponse).anyTimes();
+    expect(requestExecution.convertToResponseWithBody()).andReturn
+      (requestScheduleResponse).anyTimes();
     expect(requestScheduleResponse.getId()).andReturn(25L).anyTimes();
     expect(requestScheduleResponse.getClusterName()).andReturn("Cluster100")
       .anyTimes();

http://git-wip-us.apache.org/repos/asf/ambari/blob/95b71281/ambari-server/src/test/java/org/apache/ambari/server/orm/dao/RequestScheduleDAOTest.java
----------------------------------------------------------------------
diff --git a/ambari-server/src/test/java/org/apache/ambari/server/orm/dao/RequestScheduleDAOTest.java b/ambari-server/src/test/java/org/apache/ambari/server/orm/dao/RequestScheduleDAOTest.java
index 4c0d656..50b4086 100644
--- a/ambari-server/src/test/java/org/apache/ambari/server/orm/dao/RequestScheduleDAOTest.java
+++ b/ambari-server/src/test/java/org/apache/ambari/server/orm/dao/RequestScheduleDAOTest.java
@@ -117,7 +117,7 @@ public class RequestScheduleDAOTest {
     Assert.assertNotNull(batchRequestEntity);
     Assert.assertEquals(testUri, batchRequestEntity.getRequestUri());
     Assert.assertEquals(testType, batchRequestEntity.getRequestType());
-    Assert.assertEquals(testBody, batchRequestEntity.getRequestBody());
+    Assert.assertEquals(testBody, batchRequestEntity.getRequestBodyAsString());
   }
 
   @Test

http://git-wip-us.apache.org/repos/asf/ambari/blob/95b71281/ambari-server/src/test/java/org/apache/ambari/server/scheduler/ExecutionSchedulerTest.java
----------------------------------------------------------------------
diff --git a/ambari-server/src/test/java/org/apache/ambari/server/scheduler/ExecutionSchedulerTest.java b/ambari-server/src/test/java/org/apache/ambari/server/scheduler/ExecutionSchedulerTest.java
index 34a5d38..ebf54ac 100644
--- a/ambari-server/src/test/java/org/apache/ambari/server/scheduler/ExecutionSchedulerTest.java
+++ b/ambari-server/src/test/java/org/apache/ambari/server/scheduler/ExecutionSchedulerTest.java
@@ -64,7 +64,6 @@ public class ExecutionSchedulerTest {
   public void teardown() throws Exception {
   }
 
-
   @Test
   public void testSchedulerInitialize() throws Exception {
 
@@ -108,4 +107,41 @@ public class ExecutionSchedulerTest {
 
     Assert.assertTrue(executionScheduler.isInitialized());
   }
+
+  @Test
+  public void testGetQuartzDbDelegateClassAndValidationQuery() throws Exception {
+    Properties testProperties = new Properties();
+    testProperties.setProperty(Configuration.SERVER_JDBC_URL_KEY,
+      "jdbc:postgresql://host:port/dbname");
+    testProperties.setProperty(Configuration.SERVER_DB_NAME_KEY, "ambari");
+    Configuration configuration1 = new Configuration(testProperties);
+    ExecutionSchedulerImpl executionScheduler =
+      spy(new ExecutionSchedulerImpl(configuration1));
+
+    String[] subProps = executionScheduler
+      .getQuartzDbDelegateClassAndValidationQuery();
+
+    Assert.assertEquals("org.quartz.impl.jdbcjobstore.PostgreSQLDelegate", subProps[0]);
+    Assert.assertEquals("select 0", subProps[1]);
+
+    testProperties.setProperty(Configuration.SERVER_JDBC_URL_KEY,
+      "jdbc:mysql://host:port/dbname");
+    configuration1 = new Configuration(testProperties);
+    executionScheduler = spy(new ExecutionSchedulerImpl(configuration1));
+
+    subProps = executionScheduler.getQuartzDbDelegateClassAndValidationQuery();
+
+    Assert.assertEquals("org.quartz.impl.jdbcjobstore.StdJDBCDelegate", subProps[0]);
+    Assert.assertEquals("select 0", subProps[1]);
+
+    testProperties.setProperty(Configuration.SERVER_JDBC_URL_KEY,
+      "jdbc:oracle:thin://host:port/dbname");
+    configuration1 = new Configuration(testProperties);
+    executionScheduler = spy(new ExecutionSchedulerImpl(configuration1));
+
+    subProps = executionScheduler.getQuartzDbDelegateClassAndValidationQuery();
+
+    Assert.assertEquals("org.quartz.impl.jdbcjobstore.oracle.OracleDelegate", subProps[0]);
+    Assert.assertEquals("select 0 from dual", subProps[1]);
+  }
 }

http://git-wip-us.apache.org/repos/asf/ambari/blob/95b71281/ambari-server/src/test/java/org/apache/ambari/server/state/RequestExecutionTest.java
----------------------------------------------------------------------
diff --git a/ambari-server/src/test/java/org/apache/ambari/server/state/RequestExecutionTest.java b/ambari-server/src/test/java/org/apache/ambari/server/state/RequestExecutionTest.java
index c2e3243..9d29ebf 100644
--- a/ambari-server/src/test/java/org/apache/ambari/server/state/RequestExecutionTest.java
+++ b/ambari-server/src/test/java/org/apache/ambari/server/state/RequestExecutionTest.java
@@ -23,6 +23,7 @@ import com.google.inject.persist.PersistService;
 import com.google.inject.persist.Transactional;
 import junit.framework.Assert;
 import org.apache.ambari.server.api.services.AmbariMetaInfo;
+import org.apache.ambari.server.controller.RequestScheduleResponse;
 import org.apache.ambari.server.orm.GuiceJpaInitializer;
 import org.apache.ambari.server.orm.InMemoryDefaultTestModule;
 import org.apache.ambari.server.orm.dao.RequestScheduleDAO;
@@ -272,4 +273,50 @@ public class RequestExecutionTest {
     Assert.assertNull(requestScheduleDAO.findById(id));
     Assert.assertNull(cluster.getAllRequestExecutions().get(id));
   }
+
+  @Test
+  public void testGetRequestScheduleWithRequestBody() throws Exception {
+    RequestExecution requestExecution = createRequestSchedule();
+    Assert.assertNotNull(requestExecution);
+    Assert.assertNotNull(cluster.getAllRequestExecutions().get
+      (requestExecution.getId()));
+
+    RequestScheduleEntity scheduleEntity = requestScheduleDAO.findById
+      (requestExecution.getId());
+    Assert.assertNotNull(scheduleEntity);
+
+    // Default Read
+    requestExecution = requestExecutionFactory.createExisting(cluster,
+      scheduleEntity);
+
+    BatchRequest postBatchRequest = null;
+    List<BatchRequest> batchRequests = requestExecution.getBatch()
+      .getBatchRequests();
+    Assert.assertNotNull(batchRequests);
+    for (BatchRequest batchRequest : batchRequests) {
+      if (batchRequest.getType().equals(BatchRequest.Type.POST.name())) {
+        postBatchRequest = batchRequest;
+      }
+    }
+    Assert.assertNotNull(postBatchRequest);
+    // Not read by default
+    Assert.assertNull(postBatchRequest.getBody());
+
+    RequestScheduleResponse requestScheduleResponse = requestExecution
+      .convertToResponseWithBody();
+
+    Assert.assertNotNull(requestScheduleResponse);
+
+    batchRequests = requestExecution.getBatch().getBatchRequests();
+    Assert.assertNotNull(batchRequests);
+    for (BatchRequest batchRequest : batchRequests) {
+      if (batchRequest.getType().equals(BatchRequest.Type.POST.name())) {
+        postBatchRequest = batchRequest;
+      }
+    }
+    Assert.assertNotNull(postBatchRequest);
+    // Request Body loaded lazily
+    Assert.assertNotNull(postBatchRequest.getBody());
+  }
+
 }