You are viewing a plain text version of this content. The canonical link for it is here.
Posted to commits@oozie.apache.org by vi...@apache.org on 2012/09/13 19:55:25 UTC
svn commit: r1384434 - in /oozie/trunk:
core/src/main/java/org/apache/oozie/command/coord/CoordActionInputCheckXCommand.java
core/src/test/java/org/apache/oozie/command/coord/TestCoordActionInputCheckXCommand.java
release-log.txt
Author: virag
Date: Thu Sep 13 17:55:24 2012
New Revision: 1384434
URL: http://svn.apache.org/viewvc?rev=1384434&view=rev
Log:
OOZIE-739 a coord action fails because the uri points to a namenode that is not in whitelist. the E0901 error shows in the oozie.log, but not written to the database (mona,mbattisha via virag)
Modified:
oozie/trunk/core/src/main/java/org/apache/oozie/command/coord/CoordActionInputCheckXCommand.java
oozie/trunk/core/src/test/java/org/apache/oozie/command/coord/TestCoordActionInputCheckXCommand.java
oozie/trunk/release-log.txt
Modified: oozie/trunk/core/src/main/java/org/apache/oozie/command/coord/CoordActionInputCheckXCommand.java
URL: http://svn.apache.org/viewvc/oozie/trunk/core/src/main/java/org/apache/oozie/command/coord/CoordActionInputCheckXCommand.java?rev=1384434&r1=1384433&r2=1384434&view=diff
==============================================================================
--- oozie/trunk/core/src/main/java/org/apache/oozie/command/coord/CoordActionInputCheckXCommand.java (original)
+++ oozie/trunk/core/src/main/java/org/apache/oozie/command/coord/CoordActionInputCheckXCommand.java Thu Sep 13 17:55:24 2012
@@ -152,14 +152,22 @@ public class CoordActionInputCheckXComma
queue(new CoordActionInputCheckXCommand(coordAction.getId(), coordAction.getJobId()), getCoordInputCheckRequeueInterval());
}
}
- coordAction.setLastModifiedTime(new Date());
- jpaService.execute(new org.apache.oozie.executor.jpa.CoordActionUpdateForInputCheckJPAExecutor(coordAction));
}
catch (Exception e) {
throw new CommandException(ErrorCode.E1021, e.getMessage(), e);
}
- cron.stop();
-
+ finally {
+ coordAction.setLastModifiedTime(new Date());
+ cron.stop();
+ if(jpaService != null) {
+ try {
+ jpaService.execute(new org.apache.oozie.executor.jpa.CoordActionUpdateForInputCheckJPAExecutor(coordAction));
+ }
+ catch(JPAExecutorException jex) {
+ throw new CommandException(ErrorCode.E1021, jex.getMessage(), jex);
+ }
+ }
+ }
return null;
}
@@ -412,7 +420,7 @@ public class CoordActionInputCheckXComma
* @return true if path exists
* @throws IOException thrown if unable to access the path
*/
- private boolean pathExists(String sPath, Configuration actionConf) throws IOException {
+ protected boolean pathExists(String sPath, Configuration actionConf) throws IOException {
LOG.debug("checking for the file " + sPath);
Path path = new Path(sPath);
String user = ParamChecker.notEmpty(actionConf.get(OozieClient.USER_NAME), OozieClient.USER_NAME);
@@ -422,6 +430,8 @@ public class CoordActionInputCheckXComma
return has.createFileSystem(user, path.toUri(), fsConf).exists(path);
}
catch (HadoopAccessorException e) {
+ coordAction.setErrorCode(e.getErrorCode().toString());
+ coordAction.setErrorMessage(e.getMessage());
throw new IOException(e);
}
}
@@ -462,6 +472,26 @@ public class CoordActionInputCheckXComma
return uris.toString();
}
+ /**
+ * getting the error code of the coord action. (used mainly for unit testing)
+ */
+ protected String getCoordActionErrorCode() {
+ if (coordAction != null) {
+ return coordAction.getErrorCode();
+ }
+ return null;
+ }
+
+ /**
+ * getting the error message of the coord action. (used mainly for unit testing)
+ */
+ protected String getCoordActionErrorMsg() {
+ if (coordAction != null) {
+ return coordAction.getErrorMessage();
+ }
+ return null;
+ }
+
/* (non-Javadoc)
* @see org.apache.oozie.command.XCommand#getEntityKey()
*/
Modified: oozie/trunk/core/src/test/java/org/apache/oozie/command/coord/TestCoordActionInputCheckXCommand.java
URL: http://svn.apache.org/viewvc/oozie/trunk/core/src/test/java/org/apache/oozie/command/coord/TestCoordActionInputCheckXCommand.java?rev=1384434&r1=1384433&r2=1384434&view=diff
==============================================================================
--- oozie/trunk/core/src/test/java/org/apache/oozie/command/coord/TestCoordActionInputCheckXCommand.java (original)
+++ oozie/trunk/core/src/test/java/org/apache/oozie/command/coord/TestCoordActionInputCheckXCommand.java Thu Sep 13 17:55:24 2012
@@ -22,6 +22,8 @@ import java.io.Reader;
import java.util.Arrays;
import java.util.Date;
import java.util.List;
+
+import org.apache.hadoop.fs.Path;
import org.apache.oozie.CoordinatorActionBean;
import org.apache.oozie.CoordinatorJobBean;
import org.apache.oozie.client.CoordinatorAction;
@@ -35,6 +37,7 @@ import org.apache.oozie.executor.jpa.Coo
import org.apache.oozie.executor.jpa.CoordJobInsertJPAExecutor;
import org.apache.oozie.executor.jpa.JPAExecutorException;
import org.apache.oozie.service.CallableQueueService;
+import org.apache.oozie.service.HadoopAccessorService;
import org.apache.oozie.service.JPAService;
import org.apache.oozie.service.Services;
import org.apache.oozie.service.XLogService;
@@ -195,6 +198,44 @@ public class TestCoordActionInputCheckXC
}
/**
+ * Testing a non existing namenode path
+ *
+ * @throws Exception
+ */
+ public void testNonExistingNameNode() throws Exception {
+ String jobId = "0000000-" + new Date().getTime() + "-TestCoordActionInputCheckXCommand-C";
+ Date startTime = DateUtils.parseDateUTC("2009-02-01T23:59Z");
+ Date endTime = DateUtils.parseDateUTC("2009-02-02T23:59Z");
+ CoordinatorJobBean job = addRecordToCoordJobTable(jobId, startTime, endTime);
+ new CoordMaterializeTransitionXCommand(job.getId(), 3600).call();
+ CoordActionInputCheckXCommand caicc = new CoordActionInputCheckXCommand(job.getId() + "@1", job.getId());
+ caicc.loadState();
+
+ // Override the name node while list for testing purpose only.
+ String[] whiteList = new String[1];
+ whiteList[0] = "localhost:5330";
+ setSystemProperty(HadoopAccessorService.NAME_NODE_WHITELIST, whiteList[0]);
+ new Services().init();
+
+ // setting the configuration
+ XConfiguration jobConf = new XConfiguration();
+ jobConf.set(OozieClient.USER_NAME, getTestUser());
+
+ // setting the test path with nonExistDir
+ Path appPath = new Path(getFsTestCaseDir(), "coord");
+ String inputDir = appPath.toString() + "/coord-input/2010/07/09/01/00";
+ String nonExistDir = inputDir.replaceFirst("localhost", "nonExist");
+ try {
+ caicc.pathExists(nonExistDir, jobConf);
+ fail("Should throw exception due to non-existent NN path. Therefore fail");
+ }
+ catch (IOException ioe) {
+ assertEquals(caicc.getCoordActionErrorCode(), "E0901");
+ assertTrue(caicc.getCoordActionErrorMsg().contains("not in Oozies whitelist"));
+ }
+ }
+
+ /**
* This test case verifies if getCoordInputCheckRequeueInterval picks up the
* overridden value. In reality, the value could be overridden in
* oozie-site.xml.
Modified: oozie/trunk/release-log.txt
URL: http://svn.apache.org/viewvc/oozie/trunk/release-log.txt?rev=1384434&r1=1384433&r2=1384434&view=diff
==============================================================================
--- oozie/trunk/release-log.txt (original)
+++ oozie/trunk/release-log.txt Thu Sep 13 17:55:24 2012
@@ -1,5 +1,6 @@
-- Oozie 3.4.0 release (trunk - unreleased)
+OOZIE-739 a coord action fails because the uri points to a namenode that is not in whitelist. the E0901 error shows in the oozie.log, but not written to the database (mona,mbattisha via virag)
OOZIE-989 Testcases failing intermittently where coordinator jobs are in catchup mode (virag)
OOZIE-990 TestLogStreamer.testStreamLog fails in very rare cases (rkanter via tucu)
OOZIE-987 Fix minor bug in one of the uber jar tests (rkanter via tucu)