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 2013/02/04 19:03:18 UTC
svn commit: r1442261 - in /oozie/branches/branch-3.3:
core/src/main/java/org/apache/oozie/action/hadoop/JavaActionExecutor.java
core/src/test/java/org/apache/oozie/action/hadoop/TestJavaActionExecutor.java
release-log.txt
Author: rkanter
Date: Mon Feb 4 18:03:18 2013
New Revision: 1442261
URL: http://svn.apache.org/viewvc?rev=1442261&view=rev
Log:
OOZIE-1144 OOZIE-1137 breaks the sharelib (rkanter)
Modified:
oozie/branches/branch-3.3/core/src/main/java/org/apache/oozie/action/hadoop/JavaActionExecutor.java
oozie/branches/branch-3.3/core/src/test/java/org/apache/oozie/action/hadoop/TestJavaActionExecutor.java
oozie/branches/branch-3.3/release-log.txt
Modified: oozie/branches/branch-3.3/core/src/main/java/org/apache/oozie/action/hadoop/JavaActionExecutor.java
URL: http://svn.apache.org/viewvc/oozie/branches/branch-3.3/core/src/main/java/org/apache/oozie/action/hadoop/JavaActionExecutor.java?rev=1442261&r1=1442260&r2=1442261&view=diff
==============================================================================
--- oozie/branches/branch-3.3/core/src/main/java/org/apache/oozie/action/hadoop/JavaActionExecutor.java (original)
+++ oozie/branches/branch-3.3/core/src/main/java/org/apache/oozie/action/hadoop/JavaActionExecutor.java Mon Feb 4 18:03:18 2013
@@ -388,7 +388,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 {
@@ -396,8 +396,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) {
@@ -481,19 +489,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()));
@@ -505,7 +514,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/branches/branch-3.3/core/src/test/java/org/apache/oozie/action/hadoop/TestJavaActionExecutor.java
URL: http://svn.apache.org/viewvc/oozie/branches/branch-3.3/core/src/test/java/org/apache/oozie/action/hadoop/TestJavaActionExecutor.java?rev=1442261&r1=1442260&r2=1442261&view=diff
==============================================================================
--- oozie/branches/branch-3.3/core/src/test/java/org/apache/oozie/action/hadoop/TestJavaActionExecutor.java (original)
+++ oozie/branches/branch-3.3/core/src/test/java/org/apache/oozie/action/hadoop/TestJavaActionExecutor.java Mon Feb 4 18:03:18 2013
@@ -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/branches/branch-3.3/release-log.txt
URL: http://svn.apache.org/viewvc/oozie/branches/branch-3.3/release-log.txt?rev=1442261&r1=1442260&r2=1442261&view=diff
==============================================================================
--- oozie/branches/branch-3.3/release-log.txt (original)
+++ oozie/branches/branch-3.3/release-log.txt Mon Feb 4 18:03:18 2013
@@ -1,5 +1,6 @@
-- Oozie 3.3.2 (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)