You are viewing a plain text version of this content. The canonical link for it is here.
Posted to commits@oozie.apache.org by rk...@apache.org on 2014/05/28 00:19:02 UTC

[1/3] git commit: OOZIE-1801 ZKLocksService instrumentation should say how many locks this server has (rkanter)

Repository: oozie
Updated Branches:
  refs/heads/master 252300c62 -> 373a52ff2


OOZIE-1801 ZKLocksService instrumentation should say how many locks this server has (rkanter)


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

Branch: refs/heads/master
Commit: 503134a750b718ef6f29bb6f11de274753cd4bab
Parents: 252300c
Author: Robert Kanter <rk...@cloudera.com>
Authored: Tue May 27 13:45:33 2014 -0700
Committer: Robert Kanter <rk...@cloudera.com>
Committed: Tue May 27 13:45:33 2014 -0700

----------------------------------------------------------------------
 .../org/apache/oozie/service/MemoryLocksService.java   |  2 +-
 .../java/org/apache/oozie/service/ZKLocksService.java  | 13 ++++++++++++-
 release-log.txt                                        |  1 +
 3 files changed, 14 insertions(+), 2 deletions(-)
----------------------------------------------------------------------


http://git-wip-us.apache.org/repos/asf/oozie/blob/503134a7/core/src/main/java/org/apache/oozie/service/MemoryLocksService.java
----------------------------------------------------------------------
diff --git a/core/src/main/java/org/apache/oozie/service/MemoryLocksService.java b/core/src/main/java/org/apache/oozie/service/MemoryLocksService.java
index 110fe8d..f827c87 100644
--- a/core/src/main/java/org/apache/oozie/service/MemoryLocksService.java
+++ b/core/src/main/java/org/apache/oozie/service/MemoryLocksService.java
@@ -26,7 +26,7 @@ import org.apache.oozie.lock.MemoryLocks;
  * Service that provides in-memory locks.  Assumes no other Oozie servers are using the database.
  */
 public class MemoryLocksService implements Service, Instrumentable {
-    private static final String INSTRUMENTATION_GROUP = "locks";
+    protected static final String INSTRUMENTATION_GROUP = "locks";
     private MemoryLocks locks;
 
     /**

http://git-wip-us.apache.org/repos/asf/oozie/blob/503134a7/core/src/main/java/org/apache/oozie/service/ZKLocksService.java
----------------------------------------------------------------------
diff --git a/core/src/main/java/org/apache/oozie/service/ZKLocksService.java b/core/src/main/java/org/apache/oozie/service/ZKLocksService.java
index 17a9209..d03a899 100644
--- a/core/src/main/java/org/apache/oozie/service/ZKLocksService.java
+++ b/core/src/main/java/org/apache/oozie/service/ZKLocksService.java
@@ -18,6 +18,7 @@
 package org.apache.oozie.service;
 
 import java.util.concurrent.TimeUnit;
+import java.util.concurrent.atomic.AtomicLong;
 import org.apache.curator.framework.recipes.locks.InterProcessMutex;
 import org.apache.curator.framework.recipes.locks.InterProcessReadWriteLock;
 import org.apache.oozie.ErrorCode;
@@ -37,6 +38,7 @@ public class ZKLocksService extends MemoryLocksService implements Service, Instr
     private ZKUtils zk;
     private static XLog LOG = XLog.getLog(ZKLocksService.class);
     private static final String LOCKS_NODE = "/locks/";
+    private final AtomicLong lockCount = new AtomicLong();
 
     /**
      * Initialize the zookeeper locks service
@@ -52,6 +54,7 @@ public class ZKLocksService extends MemoryLocksService implements Service, Instr
         catch (Exception ex) {
             throw new ServiceException(ErrorCode.E1700, ex.getMessage(), ex);
         }
+        lockCount.set(0);
     }
 
     /**
@@ -73,7 +76,13 @@ public class ZKLocksService extends MemoryLocksService implements Service, Instr
      */
     @Override
     public void instrument(Instrumentation instr) {
-        // nothing to instrument
+        // Similar to MemoryLocksService's instrumentation, though this is only the number of locks this Oozie server currently has
+        instr.addVariable(INSTRUMENTATION_GROUP, "locks", new Instrumentation.Variable<Long>() {
+            @Override
+            public Long getValue() {
+                return lockCount.get();
+            }
+        });
     }
 
     /**
@@ -131,6 +140,7 @@ public class ZKLocksService extends MemoryLocksService implements Service, Instr
 
         private ZKLockToken(InterProcessMutex lock) {
             this.lock = lock;
+            lockCount.incrementAndGet();
         }
 
         /**
@@ -140,6 +150,7 @@ public class ZKLocksService extends MemoryLocksService implements Service, Instr
         public void release() {
             try {
                 lock.release();
+                lockCount.decrementAndGet();
             }
             catch (Exception ex) {
                 LOG.warn("Could not release lock: " + ex.getMessage(), ex);

http://git-wip-us.apache.org/repos/asf/oozie/blob/503134a7/release-log.txt
----------------------------------------------------------------------
diff --git a/release-log.txt b/release-log.txt
index 8769744..04cc79a 100644
--- a/release-log.txt
+++ b/release-log.txt
@@ -1,5 +1,6 @@
 -- Oozie 4.1.0 release (trunk - unreleased)
 
+OOZIE-1801 ZKLocksService instrumentation should say how many locks this server has (rkanter)
 OOZIE-1819 Avoid early queueing of CoordActionInputCheckXCommand (shwethags via rohini)
 OOZIE-1783 Sharelib purging only occurs at Oozie startup (rkanter)
 OOZIE-1689 HA support for OOZIE-7(Ability to view the log information corresponding to particular coordinator action) (puru via mona)


[2/3] git commit: OOZIE-1838 jdbc.connections.active sampler does not show up (rkanter)

Posted by rk...@apache.org.
OOZIE-1838 jdbc.connections.active sampler does not show up (rkanter)


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

Branch: refs/heads/master
Commit: 2a85bfe253e8f289051797eddf4b52de0b9e475a
Parents: 503134a
Author: Robert Kanter <rk...@cloudera.com>
Authored: Tue May 27 14:06:19 2014 -0700
Committer: Robert Kanter <rk...@cloudera.com>
Committed: Tue May 27 14:06:19 2014 -0700

----------------------------------------------------------------------
 .../org/apache/oozie/service/JPAService.java    | 33 +++++++++++++++
 .../util/db/InstrumentedBasicDataSource.java    | 44 --------------------
 .../src/main/resources/META-INF/persistence.xml | 12 +++---
 release-log.txt                                 |  1 +
 4 files changed, 40 insertions(+), 50 deletions(-)
----------------------------------------------------------------------


http://git-wip-us.apache.org/repos/asf/oozie/blob/2a85bfe2/core/src/main/java/org/apache/oozie/service/JPAService.java
----------------------------------------------------------------------
diff --git a/core/src/main/java/org/apache/oozie/service/JPAService.java b/core/src/main/java/org/apache/oozie/service/JPAService.java
index aba8709..1b8f53e 100644
--- a/core/src/main/java/org/apache/oozie/service/JPAService.java
+++ b/core/src/main/java/org/apache/oozie/service/JPAService.java
@@ -30,6 +30,7 @@ import javax.persistence.Persistence;
 import javax.persistence.PersistenceException;
 import javax.persistence.Query;
 
+import org.apache.commons.dbcp.BasicDataSource;
 import org.apache.hadoop.conf.Configuration;
 import org.apache.oozie.BundleActionBean;
 import org.apache.oozie.BundleJobBean;
@@ -51,6 +52,7 @@ import org.apache.oozie.util.IOUtils;
 import org.apache.oozie.util.Instrumentable;
 import org.apache.oozie.util.Instrumentation;
 import org.apache.oozie.util.XLog;
+import org.apache.openjpa.lib.jdbc.DecoratingDataSource;
 import org.apache.openjpa.persistence.OpenJPAEntityManagerFactorySPI;
 
 /**
@@ -94,6 +96,37 @@ public class JPAService implements Service, Instrumentable {
     @Override
     public void instrument(Instrumentation instr) {
         this.instr = instr;
+
+        final BasicDataSource dataSource = getBasicDataSource();
+        if (dataSource != null) {
+            instr.addSampler("jdbc", "connections.active", 60, 1, new Instrumentation.Variable<Long>() {
+                @Override
+                public Long getValue() {
+                    return (long) dataSource.getNumActive();
+                }
+            });
+            instr.addSampler("jdbc", "connections.idle", 60, 1, new Instrumentation.Variable<Long>() {
+                @Override
+                public Long getValue() {
+                    return (long) dataSource.getNumIdle();
+                }
+            });
+        }
+    }
+
+    private BasicDataSource getBasicDataSource() {
+        // Get the BasicDataSource object; it could be wrapped in a DecoratingDataSource
+        // It might also not be a BasicDataSource if the user configured something different
+        BasicDataSource basicDataSource = null;
+        OpenJPAEntityManagerFactorySPI spi = (OpenJPAEntityManagerFactorySPI) factory;
+        Object connectionFactory = spi.getConfiguration().getConnectionFactory();
+        if (connectionFactory instanceof DecoratingDataSource) {
+            DecoratingDataSource decoratingDataSource = (DecoratingDataSource) connectionFactory;
+            basicDataSource = (BasicDataSource) decoratingDataSource.getInnermostDelegate();
+        } else if (connectionFactory instanceof BasicDataSource) {
+            basicDataSource = (BasicDataSource) connectionFactory;
+        }
+        return basicDataSource;
     }
 
     /**

http://git-wip-us.apache.org/repos/asf/oozie/blob/2a85bfe2/core/src/main/java/org/apache/oozie/util/db/InstrumentedBasicDataSource.java
----------------------------------------------------------------------
diff --git a/core/src/main/java/org/apache/oozie/util/db/InstrumentedBasicDataSource.java b/core/src/main/java/org/apache/oozie/util/db/InstrumentedBasicDataSource.java
deleted file mode 100644
index 2705704..0000000
--- a/core/src/main/java/org/apache/oozie/util/db/InstrumentedBasicDataSource.java
+++ /dev/null
@@ -1,44 +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.
- */
-package org.apache.oozie.util.db;
-
-import org.apache.commons.dbcp.BasicDataSource;
-import org.apache.oozie.service.InstrumentationService;
-import org.apache.oozie.service.Services;
-import org.apache.oozie.util.Instrumentation;
-
-public class InstrumentedBasicDataSource extends BasicDataSource {
-    public static final String INSTR_GROUP = "jdbc";
-    public static final String INSTR_NAME = "connections.active";
-
-    /**
-     * The created datasource instruments the active DB connections.
-     */
-    public InstrumentedBasicDataSource() {
-        InstrumentationService instrumentationService = Services.get().get(InstrumentationService.class);
-        if (instrumentationService != null) {
-            Instrumentation instr = instrumentationService.get();
-            instr.addSampler(INSTR_GROUP, INSTR_NAME, 60, 1, new Instrumentation.Variable<Long>() {
-                public Long getValue() {
-                    return (long) getNumActive();
-                }
-            });
-        }
-    }
-
-}

http://git-wip-us.apache.org/repos/asf/oozie/blob/2a85bfe2/core/src/main/resources/META-INF/persistence.xml
----------------------------------------------------------------------
diff --git a/core/src/main/resources/META-INF/persistence.xml b/core/src/main/resources/META-INF/persistence.xml
index a9b79f4..edda2d5 100644
--- a/core/src/main/resources/META-INF/persistence.xml
+++ b/core/src/main/resources/META-INF/persistence.xml
@@ -43,7 +43,7 @@
         <class>org.apache.oozie.util.db.ValidateConnectionBean</class>
 
         <properties>
-            <property name="openjpa.ConnectionDriverName" value="org.apache.oozie.util.db.InstrumentedBasicDataSource"/>
+            <property name="openjpa.ConnectionDriverName" value="org.apache.commons.dbcp.BasicDataSource"/>
 
             <property name="openjpa.ConnectionProperties" value="**INVALID**"/> <!--Set by StoreService at init time -->
 
@@ -102,7 +102,7 @@
         <class>org.apache.oozie.util.db.ValidateConnectionBean</class>
 
         <properties>
-            <property name="openjpa.ConnectionDriverName" value="org.apache.oozie.util.db.InstrumentedBasicDataSource"/>
+            <property name="openjpa.ConnectionDriverName" value="org.apache.commons.dbcp.BasicDataSource"/>
 
             <property name="openjpa.ConnectionProperties" value="**INVALID**"/> <!--Set by StoreService at init time -->
 
@@ -163,7 +163,7 @@
         <class>org.apache.oozie.util.db.ValidateConnectionBean</class>
 
         <properties>
-            <property name="openjpa.ConnectionDriverName" value="org.apache.oozie.util.db.InstrumentedBasicDataSource"/>
+            <property name="openjpa.ConnectionDriverName" value="org.apache.commons.dbcp.BasicDataSource"/>
 
             <property name="openjpa.ConnectionProperties" value="**INVALID**"/> <!--Set by StoreService at init time -->
 
@@ -222,7 +222,7 @@
         <class>org.apache.oozie.util.db.ValidateConnectionBean</class>
 
         <properties>
-            <property name="openjpa.ConnectionDriverName" value="org.apache.oozie.util.db.InstrumentedBasicDataSource"/>
+            <property name="openjpa.ConnectionDriverName" value="org.apache.commons.dbcp.BasicDataSource"/>
 
             <property name="openjpa.ConnectionProperties" value="**INVALID**"/> <!--Set by StoreService at init time -->
 
@@ -282,7 +282,7 @@
         <class>org.apache.oozie.util.db.ValidateConnectionBean</class>
 
         <properties>
-            <property name="openjpa.ConnectionDriverName" value="org.apache.oozie.util.db.InstrumentedBasicDataSource"/>
+            <property name="openjpa.ConnectionDriverName" value="org.apache.commons.dbcp.BasicDataSource"/>
 
             <property name="openjpa.ConnectionProperties" value="**INVALID**"/> <!--Set by StoreService at init time -->
 
@@ -342,7 +342,7 @@
         <class>org.apache.oozie.util.db.ValidateConnectionBean</class>
 
         <properties>
-            <property name="openjpa.ConnectionDriverName" value="org.apache.oozie.util.db.InstrumentedBasicDataSource"/>
+            <property name="openjpa.ConnectionDriverName" value="org.apache.commons.dbcp.BasicDataSource"/>
 
             <property name="openjpa.ConnectionProperties" value="**INVALID**"/> <!--Set by StoreService at init time -->
 

http://git-wip-us.apache.org/repos/asf/oozie/blob/2a85bfe2/release-log.txt
----------------------------------------------------------------------
diff --git a/release-log.txt b/release-log.txt
index 04cc79a..008c089 100644
--- a/release-log.txt
+++ b/release-log.txt
@@ -1,5 +1,6 @@
 -- Oozie 4.1.0 release (trunk - unreleased)
 
+OOZIE-1838 jdbc.connections.active sampler does not show up (rkanter)
 OOZIE-1801 ZKLocksService instrumentation should say how many locks this server has (rkanter)
 OOZIE-1819 Avoid early queueing of CoordActionInputCheckXCommand (shwethags via rohini)
 OOZIE-1783 Sharelib purging only occurs at Oozie startup (rkanter)


[3/3] git commit: OOZIE-1834 sla should-start is supposed to be optional but it is not (rkanter)

Posted by rk...@apache.org.
OOZIE-1834 sla should-start is supposed to be optional but it is not (rkanter)


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

Branch: refs/heads/master
Commit: 373a52ff28a2b41aed9a8950f24f974523fc19e9
Parents: 2a85bfe
Author: Robert Kanter <rk...@cloudera.com>
Authored: Tue May 27 15:15:39 2014 -0700
Committer: Robert Kanter <rk...@cloudera.com>
Committed: Tue May 27 15:15:39 2014 -0700

----------------------------------------------------------------------
 .../apache/oozie/util/db/SLADbOperations.java   | 39 +++++++-------
 .../apache/oozie/util/db/SLADbXOperations.java  | 21 ++++----
 .../oozie/util/db/TestSLADbOperations.java      | 55 ++++++++++++++++++++
 .../oozie/util/db/TestSLADbXOperations.java     | 47 +++++++++++++++++
 release-log.txt                                 |  1 +
 5 files changed, 134 insertions(+), 29 deletions(-)
----------------------------------------------------------------------


http://git-wip-us.apache.org/repos/asf/oozie/blob/373a52ff/core/src/main/java/org/apache/oozie/util/db/SLADbOperations.java
----------------------------------------------------------------------
diff --git a/core/src/main/java/org/apache/oozie/util/db/SLADbOperations.java b/core/src/main/java/org/apache/oozie/util/db/SLADbOperations.java
index 155434b..15a37cf 100644
--- a/core/src/main/java/org/apache/oozie/util/db/SLADbOperations.java
+++ b/core/src/main/java/org/apache/oozie/util/db/SLADbOperations.java
@@ -53,17 +53,18 @@ public class SLADbOperations {
         Date nominalTime = DateUtils.parseDateOozieTZ(strNominalTime);
         // Setting expected start time
         String strRelExpectedStart = getTagElement(eSla, "should-start");
-        if (strRelExpectedStart == null || strRelExpectedStart.length() == 0) {
-            throw new RuntimeException("should-start can't be empty");
-        }
-        int relExpectedStart = Integer.parseInt(strRelExpectedStart);
-        if (relExpectedStart < 0) {
+        if (strRelExpectedStart != null && strRelExpectedStart.length() > 0) {
+            int relExpectedStart = Integer.parseInt(strRelExpectedStart);
+            if (relExpectedStart < 0) {
+                sla.setExpectedStart(null);
+            }
+            else {
+                Date expectedStart = new Date(nominalTime.getTime() + relExpectedStart * 60 * 1000);
+                sla.setExpectedStart(expectedStart);
+            }
+        } else {
             sla.setExpectedStart(null);
         }
-        else {
-            Date expectedStart = new Date(nominalTime.getTime() + relExpectedStart * 60 * 1000);
-            sla.setExpectedStart(expectedStart);
-        }
 
         // Setting expected end time
         String strRelExpectedEnd = getTagElement(eSla, "should-end");
@@ -120,18 +121,18 @@ public class SLADbOperations {
         Date nominalTime = DateUtils.parseDateOozieTZ(strNominalTime);
         // Setting expected start time
         String strRelExpectedStart = getTagElement(eSla, "should-start");
-        if (strRelExpectedStart == null || strRelExpectedStart.length() == 0) {
-            throw new RuntimeException("should-start can't be empty");
-        }
-        int relExpectedStart = Integer.parseInt(strRelExpectedStart);
-        if (relExpectedStart < 0) {
+        if (strRelExpectedStart != null && strRelExpectedStart.length() > 0) {
+            int relExpectedStart = Integer.parseInt(strRelExpectedStart);
+            if (relExpectedStart < 0) {
+                sla.setExpectedStart(null);
+            }
+            else {
+                Date expectedStart = new Date(nominalTime.getTime() + relExpectedStart * 60 * 1000);
+                sla.setExpectedStart(expectedStart);
+            }
+        } else {
             sla.setExpectedStart(null);
         }
-        else {
-            Date expectedStart = new Date(nominalTime.getTime()
-                    + relExpectedStart * 60 * 1000);
-            sla.setExpectedStart(expectedStart);
-        }
 
         // Setting expected end time
         String strRelExpectedEnd = getTagElement(eSla, "should-end");

http://git-wip-us.apache.org/repos/asf/oozie/blob/373a52ff/core/src/main/java/org/apache/oozie/util/db/SLADbXOperations.java
----------------------------------------------------------------------
diff --git a/core/src/main/java/org/apache/oozie/util/db/SLADbXOperations.java b/core/src/main/java/org/apache/oozie/util/db/SLADbXOperations.java
index 1474f1f..f313a4a 100644
--- a/core/src/main/java/org/apache/oozie/util/db/SLADbXOperations.java
+++ b/core/src/main/java/org/apache/oozie/util/db/SLADbXOperations.java
@@ -61,18 +61,19 @@ public class SLADbXOperations {
         Date nominalTime = DateUtils.parseDateOozieTZ(strNominalTime);
         // Setting expected start time
         String strRelExpectedStart = getTagElement(eSla, "should-start");
-        if (strRelExpectedStart == null || strRelExpectedStart.length() == 0) {
-            throw new CommandException(ErrorCode.E1101);
-        }
-        int relExpectedStart = Integer.parseInt(strRelExpectedStart);
-        if (relExpectedStart < 0) {
+        if (strRelExpectedStart != null && strRelExpectedStart.length() > 0) {
+            int relExpectedStart = Integer.parseInt(strRelExpectedStart);
+            if (relExpectedStart < 0) {
+                sla.setExpectedStart(null);
+            }
+            else {
+                Date expectedStart = new Date(nominalTime.getTime()
+                        + relExpectedStart * 60 * 1000);
+                sla.setExpectedStart(expectedStart);
+            }
+        } else {
             sla.setExpectedStart(null);
         }
-        else {
-            Date expectedStart = new Date(nominalTime.getTime()
-                    + relExpectedStart * 60 * 1000);
-            sla.setExpectedStart(expectedStart);
-        }
 
         // Setting expected end time
         String strRelExpectedEnd = getTagElement(eSla, "should-end");

http://git-wip-us.apache.org/repos/asf/oozie/blob/373a52ff/core/src/test/java/org/apache/oozie/util/db/TestSLADbOperations.java
----------------------------------------------------------------------
diff --git a/core/src/test/java/org/apache/oozie/util/db/TestSLADbOperations.java b/core/src/test/java/org/apache/oozie/util/db/TestSLADbOperations.java
new file mode 100644
index 0000000..3e9452e
--- /dev/null
+++ b/core/src/test/java/org/apache/oozie/util/db/TestSLADbOperations.java
@@ -0,0 +1,55 @@
+/**
+ * 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.
+ */
+package org.apache.oozie.util.db;
+
+import java.util.Date;
+import org.apache.oozie.SLAEventBean;
+import org.apache.oozie.client.SLAEvent;
+import org.apache.oozie.test.XTestCase;
+import org.apache.oozie.util.DateUtils;
+import org.apache.oozie.util.XmlUtils;
+import org.jdom.Element;
+
+public class TestSLADbOperations extends XTestCase {
+
+    @SuppressWarnings("deprecation")
+    public void testCreateSlaRegistrationEventMinReqFields() throws Exception {
+        Date nomDate = DateUtils.parseDateOozieTZ("2014-01-01T01:01Z");
+        String slaXML = " <sla:info xmlns:sla='uri:oozie:sla:0.2'>"
+                + " <sla:nominal-time>" + DateUtils.formatDateOozieTZ(nomDate) + "</sla:nominal-time>"
+                + " <sla:should-end>5</sla:should-end>"
+                + "</sla:info>";
+        Element eSla = XmlUtils.parseXml(slaXML);
+
+        SLAEventBean regEvent =
+            SLADbOperations.createSlaRegistrationEvent(eSla, null, "id1", SLAEvent.SlaAppType.WORKFLOW_JOB, "user1", "group1");
+        assertEquals(SLAEvent.SlaAppType.WORKFLOW_JOB, regEvent.getAppType());
+        assertEquals(new Date(nomDate.getTime() + 5 * 60 * 1000), regEvent.getExpectedEnd());
+        assertEquals("group1", regEvent.getGroupName());
+        assertEquals("id1", regEvent.getSlaId());
+        assertEquals("user1", regEvent.getUser());
+
+        regEvent =
+            SLADbOperations.createSlaRegistrationEvent(eSla, "id1", SLAEvent.SlaAppType.WORKFLOW_JOB, "user1", "group1", null);
+        assertEquals(SLAEvent.SlaAppType.WORKFLOW_JOB, regEvent.getAppType());
+        assertEquals(new Date(nomDate.getTime() + 5 * 60 * 1000), regEvent.getExpectedEnd());
+        assertEquals("group1", regEvent.getGroupName());
+        assertEquals("id1", regEvent.getSlaId());
+        assertEquals("user1", regEvent.getUser());
+    }
+}

http://git-wip-us.apache.org/repos/asf/oozie/blob/373a52ff/core/src/test/java/org/apache/oozie/util/db/TestSLADbXOperations.java
----------------------------------------------------------------------
diff --git a/core/src/test/java/org/apache/oozie/util/db/TestSLADbXOperations.java b/core/src/test/java/org/apache/oozie/util/db/TestSLADbXOperations.java
new file mode 100644
index 0000000..2ab609f
--- /dev/null
+++ b/core/src/test/java/org/apache/oozie/util/db/TestSLADbXOperations.java
@@ -0,0 +1,47 @@
+/**
+ * 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.
+ */
+package org.apache.oozie.util.db;
+
+import java.util.Date;
+import org.apache.oozie.SLAEventBean;
+import org.apache.oozie.client.SLAEvent;
+import org.apache.oozie.test.XTestCase;
+import org.apache.oozie.util.DateUtils;
+import org.apache.oozie.util.XmlUtils;
+import org.jdom.Element;
+
+public class TestSLADbXOperations extends XTestCase {
+
+    @SuppressWarnings("deprecation")
+    public void testCreateSlaRegistrationEventMinReqFields() throws Exception {
+        Date nomDate = DateUtils.parseDateOozieTZ("2014-01-01T01:01Z");
+        String slaXML = " <sla:info xmlns:sla='uri:oozie:sla:0.2'>"
+                + " <sla:nominal-time>" + DateUtils.formatDateOozieTZ(nomDate) + "</sla:nominal-time>"
+                + " <sla:should-end>5</sla:should-end>"
+                + "</sla:info>";
+        Element eSla = XmlUtils.parseXml(slaXML);
+
+        SLAEventBean regEvent =
+            SLADbXOperations.createSlaRegistrationEvent(eSla, "id1", SLAEvent.SlaAppType.WORKFLOW_JOB, "user1", "group1");
+        assertEquals(SLAEvent.SlaAppType.WORKFLOW_JOB, regEvent.getAppType());
+        assertEquals(new Date(nomDate.getTime() + 5 * 60 * 1000), regEvent.getExpectedEnd());
+        assertEquals("group1", regEvent.getGroupName());
+        assertEquals("id1", regEvent.getSlaId());
+        assertEquals("user1", regEvent.getUser());
+    }
+}

http://git-wip-us.apache.org/repos/asf/oozie/blob/373a52ff/release-log.txt
----------------------------------------------------------------------
diff --git a/release-log.txt b/release-log.txt
index 008c089..7d1d339 100644
--- a/release-log.txt
+++ b/release-log.txt
@@ -1,5 +1,6 @@
 -- Oozie 4.1.0 release (trunk - unreleased)
 
+OOZIE-1834 sla should-start is supposed to be optional but it is not (rkanter)
 OOZIE-1838 jdbc.connections.active sampler does not show up (rkanter)
 OOZIE-1801 ZKLocksService instrumentation should say how many locks this server has (rkanter)
 OOZIE-1819 Avoid early queueing of CoordActionInputCheckXCommand (shwethags via rohini)