You are viewing a plain text version of this content. The canonical link for it is here.
Posted to commits@oozie.apache.org by ro...@apache.org on 2014/06/24 00:13:25 UTC
git commit: OOZIE-1877 Setting to fail oozie server startup in case
of sharelib misconfiguration (puru via rohini)
Repository: oozie
Updated Branches:
refs/heads/master 1add349e0 -> 06a2241c0
OOZIE-1877 Setting to fail oozie server startup in case of sharelib misconfiguration (puru via rohini)
Project: http://git-wip-us.apache.org/repos/asf/oozie/repo
Commit: http://git-wip-us.apache.org/repos/asf/oozie/commit/06a2241c
Tree: http://git-wip-us.apache.org/repos/asf/oozie/tree/06a2241c
Diff: http://git-wip-us.apache.org/repos/asf/oozie/diff/06a2241c
Branch: refs/heads/master
Commit: 06a2241c0d33c0604a005d57c6bd32f816424891
Parents: 1add349
Author: Rohini Palaniswamy <ro...@apache.org>
Authored: Mon Jun 23 15:13:21 2014 -0700
Committer: Rohini Palaniswamy <ro...@apache.org>
Committed: Mon Jun 23 15:13:21 2014 -0700
----------------------------------------------------------------------
.../apache/oozie/service/ShareLibService.java | 25 ++++++++++++++------
core/src/main/resources/oozie-default.xml | 8 +++++++
.../oozie/service/TestShareLibService.java | 19 +++++++++++++++
release-log.txt | 1 +
4 files changed, 46 insertions(+), 7 deletions(-)
----------------------------------------------------------------------
http://git-wip-us.apache.org/repos/asf/oozie/blob/06a2241c/core/src/main/java/org/apache/oozie/service/ShareLibService.java
----------------------------------------------------------------------
diff --git a/core/src/main/java/org/apache/oozie/service/ShareLibService.java b/core/src/main/java/org/apache/oozie/service/ShareLibService.java
index 3ef5e07..c31d587 100644
--- a/core/src/main/java/org/apache/oozie/service/ShareLibService.java
+++ b/core/src/main/java/org/apache/oozie/service/ShareLibService.java
@@ -39,7 +39,6 @@ import java.util.Set;
import java.util.TimeZone;
import org.apache.commons.lang.StringUtils;
-import org.apache.hadoop.conf.Configuration;
import org.apache.hadoop.fs.FileStatus;
import org.apache.hadoop.fs.FileSystem;
import org.apache.hadoop.fs.Path;
@@ -53,6 +52,7 @@ import org.apache.oozie.util.Instrumentation;
import org.apache.oozie.util.XLog;
import com.google.common.annotations.VisibleForTesting;
+
import org.apache.oozie.ErrorCode;
public class ShareLibService implements Service, Instrumentable {
@@ -65,6 +65,8 @@ public class ShareLibService implements Service, Instrumentable {
public static final String PURGE_INTERVAL = CONF_PREFIX + "ShareLibService.purge.interval";
+ public static final String FAIL_FAST_ON_STARTUP = CONF_PREFIX + "ShareLibService.fail.fast.on.startup";
+
private static final String PERMISSION_STRING = "-rwxr-xr-x";
public static final String LAUNCHER_PREFIX = "launcher_";
@@ -102,6 +104,7 @@ public class ShareLibService implements Service, Instrumentable {
this.services = services;
sharelibMappingFile = services.getConf().get(SHARELIB_MAPPING_FILE, "");
isShipLauncherEnabled = services.getConf().getBoolean(SHIP_LAUNCHER_JAR, false);
+ boolean failOnfailure = services.getConf().getBoolean(FAIL_FAST_ON_STARTUP, false);
Path launcherlibPath = getLauncherlibPath();
HadoopAccessorService has = Services.get().get(HadoopAccessorService.class);
URI uri = launcherlibPath.toUri();
@@ -109,12 +112,20 @@ public class ShareLibService implements Service, Instrumentable {
fs = FileSystem.get(has.createJobConf(uri.getAuthority()));
updateLauncherLib();
updateShareLib();
- } catch(IOException ioe) {
- // We don't want to actually fail init by throwing an Exception, so only create the ServiceException and log it
- ServiceException se = new ServiceException(ErrorCode.E0104, getClass().getName(),
- "Not able to cache sharelib. An Admin needs to install the sharelib with oozie-setup.sh and issue the "
- + "'oozie admin' CLI command to update the sharelib", ioe);
- LOG.error(se);
+ } catch(Throwable e) {
+ if (failOnfailure) {
+ LOG.error("Sharelib initialization fails", e);
+ throw new ServiceException(ErrorCode.E0104, getClass().getName(), "Sharelib initialization fails. "
+ + e.getMessage());
+ }
+ else {
+ // We don't want to actually fail init by throwing an Exception, so only create the ServiceException and
+ // log it
+ ServiceException se = new ServiceException(ErrorCode.E0104, getClass().getName(),
+ "Not able to cache sharelib. An Admin needs to install the sharelib with oozie-setup.sh and issue the "
+ + "'oozie admin' CLI command to update the sharelib", e);
+ LOG.error(se);
+ }
}
Runnable purgeLibsRunnable = new Runnable() {
@Override
http://git-wip-us.apache.org/repos/asf/oozie/blob/06a2241c/core/src/main/resources/oozie-default.xml
----------------------------------------------------------------------
diff --git a/core/src/main/resources/oozie-default.xml b/core/src/main/resources/oozie-default.xml
index 1edc5c9..4dedeef 100644
--- a/core/src/main/resources/oozie-default.xml
+++ b/core/src/main/resources/oozie-default.xml
@@ -2057,6 +2057,14 @@
oozie.pig=hdfs:///share/lib/pig/pig-0.11.1/lib/
oozie.distcp=hdfs:///share/lib/hadoop-2.2.0/share/hadoop/tools/lib/hadoop-distcp-2.2.0.jar
</description>
+
+ </property>
+ <property>
+ <name>oozie.service.ShareLibService.fail.fast.on.startup</name>
+ <value>false</value>
+ <description>
+ Fails server starup if sharelib initilzation fails.
+ </description>
</property>
<property>
http://git-wip-us.apache.org/repos/asf/oozie/blob/06a2241c/core/src/test/java/org/apache/oozie/service/TestShareLibService.java
----------------------------------------------------------------------
diff --git a/core/src/test/java/org/apache/oozie/service/TestShareLibService.java b/core/src/test/java/org/apache/oozie/service/TestShareLibService.java
index 5fcbbda..05460b4 100644
--- a/core/src/test/java/org/apache/oozie/service/TestShareLibService.java
+++ b/core/src/test/java/org/apache/oozie/service/TestShareLibService.java
@@ -101,6 +101,25 @@ public class TestShareLibService extends XFsTestCase {
}
@Test
+ public void testfailFast() throws Exception {
+ services = new Services();
+ setSystemProps();
+ Configuration conf = services.getConf();
+ conf.set(ShareLibService.FAIL_FAST_ON_STARTUP, "true");
+ //Set dummyfile as metafile which doesn't exist.
+ conf.set(ShareLibService.SHARELIB_MAPPING_FILE, String.valueOf(new Date().getTime()));
+ try {
+ services.init();
+ fail("Should throw exception");
+ }
+ catch(Throwable e){
+ assertTrue(e.getMessage().contains("E0104: Could not fully initialize service"));
+ } finally {
+ services.destroy();
+ }
+ }
+
+ @Test
public void testCreateLauncherLibPath() throws Exception {
services = new Services();
setSystemProps();
http://git-wip-us.apache.org/repos/asf/oozie/blob/06a2241c/release-log.txt
----------------------------------------------------------------------
diff --git a/release-log.txt b/release-log.txt
index a879090..45b2414 100644
--- a/release-log.txt
+++ b/release-log.txt
@@ -1,5 +1,6 @@
-- Oozie 4.1.0 release (trunk - unreleased)
+OOZIE-1877 Setting to fail oozie server startup in case of sharelib misconfiguration (puru via rohini)
OOZIE-1388 Add a admin servlet to show thread stack trace and CPU usage per thread (rohini)
OOZIE-1893 Recovery service will never recover bundle action if CoordSubmitXCommand command is lost (puru via rohini)
OOZIE-1878 Can't execute dryrun on the CLI (puru via rohini)