Author: rkanter
Date: Sat Dec 22 23:53:37 2012
New Revision: 1425376
URL: http://svn.apache.org/viewvc?rev=1425376&view=rev
Log:
OOZIE-1144 OOZIE-1137 breaks the sharelib (rkanter)
Modified:
oozie/trunk/core/src/main/java/org/apache/oozie/action/hadoop/JavaActionExecutor.java
oozie/trunk/core/src/test/java/org/apache/oozie/action/hadoop/TestJavaActionExecutor.java
oozie/trunk/release-log.txt
Modified:
oozie/trunk/core/src/main/java/org/apache/oozie/action/hadoop/JavaActionExecutor.java
URL:
http://svn.apache.org/viewvc/oozie/trunk/core/src/main/java/org/apache/oozie/action/hadoop/JavaActionExecutor.java?rev=1425376&r1=1425375&r2=1425376&view=diff
==============================================================================
---
oozie/trunk/core/src/main/java/org/apache/oozie/action/hadoop/JavaActionExecutor.java
(original)
+++
oozie/trunk/core/src/main/java/org/apache/oozie/action/hadoop/JavaActionExecutor.java
Sat Dec 22 23:53:37 2012
@@ -389,7 +389,7 @@ public class JavaActionExecutor extends
}
}
- protected void addShareLib(Configuration conf, String actionShareLibName)
+ protected void addShareLib(Path appPath, Configuration conf, String
actionShareLibName)
throws ActionExecutorException {
if (actionShareLibName != null) {
try {
@@ -397,8 +397,16 @@ public class JavaActionExecutor extends
if (systemLibPath != null) {
Path actionLibPath = new Path(systemLibPath,
actionShareLibName);
String user = conf.get("user.name");
- FileSystem fs =
-
Services.get().get(HadoopAccessorService.class).createFileSystem(user,
actionLibPath.toUri(), conf);
+ FileSystem fs;
+ // If the actionLibPath has a valid scheme and authority,
then use them to determine the filesystem that the
+ // sharelib resides on; otherwise, assume it resides on
the same filesystem as the appPath and use the appPath
+ // to determine the filesystem
+ if (actionLibPath.toUri().getScheme() != null &&
actionLibPath.toUri().getAuthority() != null) {
+ fs =
Services.get().get(HadoopAccessorService.class).createFileSystem(user,
actionLibPath.toUri(), conf);
+ }
+ else {
+ fs =
Services.get().get(HadoopAccessorService.class).createFileSystem(user,
appPath.toUri(), conf);
+ }
if (fs.exists(actionLibPath)) {
FileStatus[] files = fs.listStatus(actionLibPath);
for (FileStatus file : files) {
@@ -482,19 +490,20 @@ public class JavaActionExecutor extends
}
}
- addAllShareLibs(conf, context, actionXml);
+ addAllShareLibs(appPath, conf, context, actionXml);
}
// Adds action specific share libs and common share libs
- private void addAllShareLibs(Configuration conf, Context context, Element
actionXml)
+ private void addAllShareLibs(Path appPath, Configuration conf, Context
context, Element actionXml)
throws ActionExecutorException {
// Add action specific share libs
- addActionShareLib(conf, context, actionXml);
+ addActionShareLib(appPath, conf, context, actionXml);
// Add common sharelibs for Oozie
- addShareLib(conf, JavaActionExecutor.OOZIE_COMMON_LIBDIR);
+ addShareLib(appPath, conf, JavaActionExecutor.OOZIE_COMMON_LIBDIR);
}
- private void addActionShareLib(Configuration conf, Context context,
Element actionXml) throws ActionExecutorException {
+ private void addActionShareLib(Path appPath, Configuration conf, Context
context, Element actionXml)
+ throws ActionExecutorException {
XConfiguration wfJobConf = null;
try {
wfJobConf = new XConfiguration(new
StringReader(context.getWorkflow().getConf()));
@@ -506,7 +515,7 @@ public class JavaActionExecutor extends
// Action sharelibs are only added if user has specified to use system
libpath
if (wfJobConf.getBoolean(OozieClient.USE_SYSTEM_LIBPATH, false)) {
// add action specific sharelibs
- addShareLib(conf, getShareLibName(context, actionXml, conf));
+ addShareLib(appPath, conf, getShareLibName(context, actionXml,
conf));
}
}
Modified:
oozie/trunk/core/src/test/java/org/apache/oozie/action/hadoop/TestJavaActionExecutor.java
URL:
http://svn.apache.org/viewvc/oozie/trunk/core/src/test/java/org/apache/oozie/action/hadoop/TestJavaActionExecutor.java?rev=1425376&r1=1425375&r2=1425376&view=diff
==============================================================================
---
oozie/trunk/core/src/test/java/org/apache/oozie/action/hadoop/TestJavaActionExecutor.java
(original)
+++
oozie/trunk/core/src/test/java/org/apache/oozie/action/hadoop/TestJavaActionExecutor.java
Sat Dec 22 23:53:37 2012
@@ -1019,6 +1019,52 @@ public class TestJavaActionExecutor exte
assertTrue(cacheFilesStr.contains(jar3Path.toString()));
}
+ public void testAddShareLibSchemeAndAuthority() throws Exception {
+ JavaActionExecutor ae = new JavaActionExecutor() {
+ @Override
+ protected String getDefaultShareLibName(Element actionXml) {
+ return "java-action-executor";
+ }
+ };
+ String actionXml = "<java>" + "<job-tracker>" + getJobTrackerUri() +
"</job-tracker>" + "<name-node>"
+ + getNameNodeUri() + "</name-node>" + "<main-class>" +
LauncherMainTester.class.getName()
+ + "</main-class>" + "</java>";
+ Element eActionXml = XmlUtils.parseXml(actionXml);
+ Context context = createContext(actionXml, null);
+
+ // Set sharelib to a relative path (i.e. no scheme nor authority)
+ Services.get().destroy();
+ setSystemProperty(WorkflowAppService.SYSTEM_LIB_PATH, "/user/" +
getOozieUser() + "/share/");
+ new Services().init();
+ Path appPath = getAppPath();
+ JobConf conf = ae.createBaseHadoopConf(context, eActionXml);
+ // The next line should not throw an Exception because it will get the
scheme and authority from the appPath, and not the
+ // sharelib path because it doesn't have a scheme or authority
+ ae.addShareLib(appPath, conf, "java-action-executor");
+
+ appPath = new Path("foo://bar:1234/blah");
+ conf = ae.createBaseHadoopConf(context, eActionXml);
+ // The next line should throw an Exception because it will get the
scheme and authority from the appPath, which is obviously
+ // invalid, and not the sharelib path because it doesn't have a scheme
or authority
+ try {
+ ae.addShareLib(appPath, conf, "java-action-executor");
+ }
+ catch (ActionExecutorException aee) {
+ assertEquals("E0902", aee.getErrorCode());
+ assertTrue(aee.getMessage().contains("[No FileSystem for scheme:
foo]"));
+ }
+
+ // Set sharelib to a full path (i.e. include scheme and authority)
+ Services.get().destroy();
+ setSystemProperty(WorkflowAppService.SYSTEM_LIB_PATH, getNameNodeUri()
+ "/user/" + getOozieUser() + "/share/");
+ new Services().init();
+ appPath = new Path("foo://bar:1234/blah");
+ conf = ae.createBaseHadoopConf(context, eActionXml);
+ // The next line should not throw an Exception because it will get the
scheme and authority from the sharelib path (and not
+ // from the obviously invalid appPath)
+ ae.addShareLib(appPath, conf, "java-action-executor");
+ }
+
public void testFilesystemScheme() throws Exception {
try {
String actionXml = "<java>" + "<job-tracker>" + getJobTrackerUri()
+ "</job-tracker>" + "<name-node>"
Modified: oozie/trunk/release-log.txt
URL:
http://svn.apache.org/viewvc/oozie/trunk/release-log.txt?rev=1425376&r1=1425375&r2=1425376&view=diff
==============================================================================
--- oozie/trunk/release-log.txt (original)
+++ oozie/trunk/release-log.txt Sat Dec 22 23:53:37 2012
@@ -1,5 +1,6 @@
-- Oozie 3.4.0 release (trunk - unreleased)
+OOZIE-1144 OOZIE-1137 breaks the sharelib (rkanter)
OOZIE-1035 Improve forkjoin validation to allow same errorTo transitions
(rkanter)
OOZIE-1137 In light of federation use actionLibPath instead of appPath (vaidya
via rkanter)
OOZIE-1126 see if checkstyle works for oozie development. (jaoki via rkanter)