Uploaded image for project: 'Sqoop'
  1. Sqoop
  2. SQOOP-453

Oozie does not work with Sqoop metastore

    Details

    • Type: Bug
    • Status: Resolved
    • Priority: Major
    • Resolution: Fixed
    • Affects Version/s: 1.3.0
    • Fix Version/s: 1.4.2
    • Component/s: None
    • Labels:
      None

      Description

      The sqoop metastore is handy for retaining lastvalue during incremental imports.
      Unfortunately, it does not work with Oozie. Here's the log from the launcher:

      java.lang.NullPointerException
      at com.cloudera.sqoop.SqoopOptions.securePasswordEntry(SqoopOptions.java:1069)
      at com.cloudera.sqoop.SqoopOptions.setPasswordFromConsole(SqoopOptions.java:1077)
      at com.cloudera.sqoop.SqoopOptions.loadProperties(SqoopOptions.java:562)
      at com.cloudera.sqoop.metastore.hsqldb.HsqldbJobStorage.read(HsqldbJobStorage.java:303)
      at com.cloudera.sqoop.tool.JobTool.execJob(JobTool.java:203)
      at com.cloudera.sqoop.tool.JobTool.run(JobTool.java:288)
      at com.cloudera.sqoop.Sqoop.run(Sqoop.java:146)
      at org.apache.hadoop.util.ToolRunner.run(ToolRunner.java:65)
      at com.cloudera.sqoop.Sqoop.runSqoop(Sqoop.java:182)
      at com.cloudera.sqoop.Sqoop.runTool(Sqoop.java:221)
      at com.cloudera.sqoop.Sqoop.runTool(Sqoop.java:230)
      at com.cloudera.sqoop.Sqoop.main(Sqoop.java:239)
      at org.apache.oozie.action.hadoop.SqoopMain.runSqoopJob(SqoopMain.java:198)
      at org.apache.oozie.action.hadoop.SqoopMain.run(SqoopMain.java:172)
      at org.apache.oozie.action.hadoop.LauncherMain.run(LauncherMain.java:26)
      at org.apache.oozie.action.hadoop.SqoopMain.main(SqoopMain.java:43)
      at sun.reflect.NativeMethodAccessorImpl.invoke0(Native Method)
      at sun.reflect.NativeMethodAccessorImpl.invoke(NativeMethodAccessorImpl.java:39)
      at sun.reflect.DelegatingMethodAccessorImpl.invoke(DelegatingMethodAccessorImpl.java:25)
      at java.lang.reflect.Method.invoke(Method.java:597)
      at org.apache.oozie.action.hadoop.LauncherMapper.map(LauncherMapper.java:391)
      at org.apache.hadoop.mapred.MapRunner.run(MapRunner.java:50)
      at org.apache.hadoop.mapred.MapTask.runOldMapper(MapTask.java:391)
      at org.apache.hadoop.mapred.MapTask.run(MapTask.java:325)
      at org.apache.hadoop.mapred.Child$4.run(Child.java:270)
      at java.security.AccessController.doPrivileged(Native Method)
      at javax.security.auth.Subject.doAs(Subject.java:396)
      at org.apache.hadoop.security.UserGroupInformation.doAs(UserGroupInformation.java:1157)
      at org.apache.hadoop.mapred.Child.main(Child.java:264)

      1. SQOOP-453.patch
        2 kB
        Cheolsoo Park

        Activity

        Hide
        hudson Hudson added a comment -

        Integrated in Sqoop-ant-jdk-1.6 #109 (See https://builds.apache.org/job/Sqoop-ant-jdk-1.6/109/)
        SQOOP-453. Oozie does not work with Sqoop metastore.

        (Cheolsoo Park via Jarek Jarcec Cecho) (Revision 1330263)

        Result = SUCCESS
        jarcec :
        Files :

        • /sqoop/trunk/src/docs/user/saved-jobs.txt
        • /sqoop/trunk/src/java/org/apache/sqoop/SqoopOptions.java
        Show
        hudson Hudson added a comment - Integrated in Sqoop-ant-jdk-1.6 #109 (See https://builds.apache.org/job/Sqoop-ant-jdk-1.6/109/ ) SQOOP-453 . Oozie does not work with Sqoop metastore. (Cheolsoo Park via Jarek Jarcec Cecho) (Revision 1330263) Result = SUCCESS jarcec : Files : /sqoop/trunk/src/docs/user/saved-jobs.txt /sqoop/trunk/src/java/org/apache/sqoop/SqoopOptions.java
        Hide
        jarcec Jarek Jarcec Cecho added a comment -

        Patch committed, thank you Cheolsoo for your time!

        Jarcec

        Show
        jarcec Jarek Jarcec Cecho added a comment - Patch committed, thank you Cheolsoo for your time! Jarcec
        Hide
        jiraposter@reviews.apache.org jiraposter@reviews.apache.org added a comment -

        -----------------------------------------------------------
        This is an automatically generated e-mail. To reply, visit:
        https://reviews.apache.org/r/4858/#review7212
        -----------------------------------------------------------

        Ship it!

        Hi Cheolsoo,
        change seems fine to me. I've noticed that you've already attached patch to the JIRA, so I'll commit it shortly.

        Jarcec

        • Jarek

        On 2012-04-24 20:26:31, Cheolsoo Park wrote:

        -----------------------------------------------------------

        This is an automatically generated e-mail. To reply, visit:

        https://reviews.apache.org/r/4858/

        -----------------------------------------------------------

        (Updated 2012-04-24 20:26:31)

        Review request for Sqoop, Jarek Cecho and Kathleen Ting.

        Summary

        -------

        Sqoop metastore jobs cannot be launched via Oozie when sqoop.metastore.client.record.password disabled.

        The changes include:

        1) Print out informative error message.

        2) Add a note to user doc.

        This addresses bug SQOOP-453.

        https://issues.apache.org/jira/browse/SQOOP-453

        Diffs

        -----

        /src/docs/user/saved-jobs.txt 1329854

        /src/java/org/apache/sqoop/SqoopOptions.java 1329854

        Diff: https://reviews.apache.org/r/4858/diff

        Testing

        -------

        Manually verified the following cases:

        1) sqoop.metastore.client.record.password = false && --password is NOT given in the command tag

        => Jobs fail with the error message in task logs.

        2) sqoop.metastore.client.record.password = false && --password is given in the command tag

        => Jobs succeed.

        3) sqoop.metastore.client.record.password = true

        => Jobs succeed.

        I also ran ant test and ant checkstyle.

        Thanks,

        Cheolsoo

        Show
        jiraposter@reviews.apache.org jiraposter@reviews.apache.org added a comment - ----------------------------------------------------------- This is an automatically generated e-mail. To reply, visit: https://reviews.apache.org/r/4858/#review7212 ----------------------------------------------------------- Ship it! Hi Cheolsoo, change seems fine to me. I've noticed that you've already attached patch to the JIRA, so I'll commit it shortly. Jarcec Jarek On 2012-04-24 20:26:31, Cheolsoo Park wrote: ----------------------------------------------------------- This is an automatically generated e-mail. To reply, visit: https://reviews.apache.org/r/4858/ ----------------------------------------------------------- (Updated 2012-04-24 20:26:31) Review request for Sqoop, Jarek Cecho and Kathleen Ting. Summary ------- Sqoop metastore jobs cannot be launched via Oozie when sqoop.metastore.client.record.password disabled. The changes include: 1) Print out informative error message. 2) Add a note to user doc. This addresses bug SQOOP-453 . https://issues.apache.org/jira/browse/SQOOP-453 Diffs ----- /src/docs/user/saved-jobs.txt 1329854 /src/java/org/apache/sqoop/SqoopOptions.java 1329854 Diff: https://reviews.apache.org/r/4858/diff Testing ------- Manually verified the following cases: 1) sqoop.metastore.client.record.password = false && --password is NOT given in the command tag => Jobs fail with the error message in task logs. 2) sqoop.metastore.client.record.password = false && --password is given in the command tag => Jobs succeed. 3) sqoop.metastore.client.record.password = true => Jobs succeed. I also ran ant test and ant checkstyle. Thanks, Cheolsoo
        Hide
        jiraposter@reviews.apache.org jiraposter@reviews.apache.org added a comment -

        -----------------------------------------------------------
        This is an automatically generated e-mail. To reply, visit:
        https://reviews.apache.org/r/4858/
        -----------------------------------------------------------

        Review request for Sqoop, Jarek Cecho and Kathleen Ting.

        Summary
        -------

        Sqoop metastore jobs cannot be launched via Oozie when sqoop.metastore.client.record.password disabled.

        The changes include:
        1) Print out informative error message.
        2) Add a note to user doc.

        This addresses bug SQOOP-453.
        https://issues.apache.org/jira/browse/SQOOP-453

        Diffs


        /src/docs/user/saved-jobs.txt 1329854
        /src/java/org/apache/sqoop/SqoopOptions.java 1329854

        Diff: https://reviews.apache.org/r/4858/diff

        Testing
        -------

        Manually verified the following cases:

        1) sqoop.metastore.client.record.password = false && --password is NOT given in the command tag
        => Jobs fail with the error message in task logs.

        2) sqoop.metastore.client.record.password = false && --password is given in the command tag
        => Jobs succeed.

        3) sqoop.metastore.client.record.password = true
        => Jobs succeed.

        I also ran ant test and ant checkstyle.

        Thanks,

        Cheolsoo

        Show
        jiraposter@reviews.apache.org jiraposter@reviews.apache.org added a comment - ----------------------------------------------------------- This is an automatically generated e-mail. To reply, visit: https://reviews.apache.org/r/4858/ ----------------------------------------------------------- Review request for Sqoop, Jarek Cecho and Kathleen Ting. Summary ------- Sqoop metastore jobs cannot be launched via Oozie when sqoop.metastore.client.record.password disabled. The changes include: 1) Print out informative error message. 2) Add a note to user doc. This addresses bug SQOOP-453 . https://issues.apache.org/jira/browse/SQOOP-453 Diffs /src/docs/user/saved-jobs.txt 1329854 /src/java/org/apache/sqoop/SqoopOptions.java 1329854 Diff: https://reviews.apache.org/r/4858/diff Testing ------- Manually verified the following cases: 1) sqoop.metastore.client.record.password = false && --password is NOT given in the command tag => Jobs fail with the error message in task logs. 2) sqoop.metastore.client.record.password = false && --password is given in the command tag => Jobs succeed. 3) sqoop.metastore.client.record.password = true => Jobs succeed. I also ran ant test and ant checkstyle. Thanks, Cheolsoo
        Hide
        jarcec Jarek Jarcec Cecho added a comment -

        Thank you Cheolso for your investigation. It was really very helpful.

        I would suggest to add try-catch block around that line with reading password so that we will avoid NullPointerException with reasonable error message and put a paragraph into documentation how to correctly use sqoop metastore with oozie.

        Also I believe that one additional workaround could be to to supply the password on the "command" line in Oozie workflow file (in the command tag, --password). However that would just move the problem from storing password in metastore to store password in workflow.xml (in HDFS file).

        Jarcec

        Show
        jarcec Jarek Jarcec Cecho added a comment - Thank you Cheolso for your investigation. It was really very helpful. I would suggest to add try-catch block around that line with reading password so that we will avoid NullPointerException with reasonable error message and put a paragraph into documentation how to correctly use sqoop metastore with oozie. Also I believe that one additional workaround could be to to supply the password on the "command" line in Oozie workflow file (in the command tag, --password). However that would just move the problem from storing password in metastore to store password in workflow.xml (in HDFS file). Jarcec
        Hide
        cheolsoo Cheolsoo Park added a comment -

        I did some digging on this, and I was able to reproduce the error as follows:

        1) Disable sqoop.metastore.client.record.password in sqoop-site.xml so that password is not saved in the metastore.

          <property>
            <name>sqoop.metastore.client.record.password</name>
            <value>false</value>
            <description>If true, allow saved passwords in the metastore.
            </description>
          </property>
        

        2) Save some job in the metastore. For example,

        sqoop job --meta-connect jdbc:hsqldb:hsql://localhost:16000/sqoop --create mysqlimport -- import --connect jdbc:mysql://localhost/sqooptestdb --username sqooptest --password ***** --table foo -m 1
        

        3) Run the saved job via Oozie, where my workflow.xml is something like this:

        <workflow-app xmlns="uri:oozie:workflow:0.2" name="sqoop-wf">
            ...
            <action name="sqoop-node">
                <sqoop xmlns="uri:oozie:sqoop-action:0.2">
                    ...
                    <command>job --meta-connect jdbc:hsqldb:hsql://localhost:16000/sqoop --exec mysqlimport</command>
                </sqoop>
                ...
            </action>
            ...
        </workflow-app>
        

        4) This job crashes with a NPE as shown in the description.

        The problem is, with sqoop.metastore.client.record.password = false, Sqoop prompts the user to enter the password when executing a saved job. However, it seems that Oozie task processes are not given stdin, resulting in a NPE at the following line in SqoopOptions.java:

        return new String(System.console().readPassword("Enter password: ")); // System.console() is null.
        

        A workaround for this problem would be setting sqoop.metastore.client.record.password to true. But apparently, this will make the metastore insecure.

        Does anyone have a better suggestion?

        Show
        cheolsoo Cheolsoo Park added a comment - I did some digging on this, and I was able to reproduce the error as follows: 1) Disable sqoop.metastore.client.record.password in sqoop-site.xml so that password is not saved in the metastore. <property> <name>sqoop.metastore.client.record.password</name> <value> false </value> <description>If true , allow saved passwords in the metastore. </description> </property> 2) Save some job in the metastore. For example, sqoop job --meta-connect jdbc:hsqldb:hsql: //localhost:16000/sqoop --create mysqlimport -- import --connect jdbc:mysql://localhost/sqooptestdb --username sqooptest --password ***** --table foo -m 1 3) Run the saved job via Oozie, where my workflow.xml is something like this: <workflow-app xmlns= "uri:oozie:workflow:0.2" name= "sqoop-wf" > ... <action name= "sqoop-node" > <sqoop xmlns= "uri:oozie:sqoop-action:0.2" > ... <command>job --meta-connect jdbc:hsqldb:hsql: //localhost:16000/sqoop --exec mysqlimport</command> </sqoop> ... </action> ... </workflow-app> 4) This job crashes with a NPE as shown in the description. The problem is, with sqoop.metastore.client.record.password = false, Sqoop prompts the user to enter the password when executing a saved job. However, it seems that Oozie task processes are not given stdin, resulting in a NPE at the following line in SqoopOptions.java: return new String ( System .console().readPassword( "Enter password: " )); // System .console() is null . A workaround for this problem would be setting sqoop.metastore.client.record.password to true. But apparently, this will make the metastore insecure. Does anyone have a better suggestion?
        Hide
        jarcec Jarek Jarcec Cecho added a comment -

        Hi Patrick,
        can you please share your oozie sqoop action configuration? (element <action> where are you calling sqoop)

        Jarcec

        Show
        jarcec Jarek Jarcec Cecho added a comment - Hi Patrick, can you please share your oozie sqoop action configuration? (element <action> where are you calling sqoop) Jarcec

          People

          • Assignee:
            cheolsoo Cheolsoo Park
            Reporter:
            patrickangeles Patrick Angeles
          • Votes:
            0 Vote for this issue
            Watchers:
            0 Start watching this issue

            Dates

            • Created:
              Updated:
              Resolved:

              Development