Review Board 1.7.22


SQOOP-979 MySQL direct connector is not working correct after moving password to credential cache

Review Request #10322 - Created April 5, 2013 and submitted

Jarek Cecho
SQOOP-979
Reviewers
Sqoop
sqoop-trunk
I've changed the code to use DBConfiguration object to retrieve the password instead of directly using the old properties. I've also done two questionable changes that I would like to highlight:

1) I've removed MySQLUtils.PASSWORD_KEY. This is internal property of MySQL direct connector and should not be used in any dependent code. I would argue that by deleting it, any affected third party code will fail very quickly rather than causing random exceptions later as the property will be always empty.

2) I've change method DBConfiguration.getPassword() to public. I would argue that this method can be called only by Sqoop and connectors do have valid need to get the password so that it can be passed to third party applications like mysqldump.
Failing MySQLAuthTest and DirectMySQLExportTest test cases seems to be working after applying the patch.
src/java/com/cloudera/sqoop/manager/MySQLUtils.java
Revision 6611f8eaa7027b9fc2d384c41d55f9e77fdf8e0e New Change
[20] 46 lines
[+20]
47
      org.apache.sqoop.manager.MySQLUtils.TABLE_NAME_KEY;
47
      org.apache.sqoop.manager.MySQLUtils.TABLE_NAME_KEY;
48
  public static final String CONNECT_STRING_KEY =
48
  public static final String CONNECT_STRING_KEY =
49
      org.apache.sqoop.manager.MySQLUtils.CONNECT_STRING_KEY;
49
      org.apache.sqoop.manager.MySQLUtils.CONNECT_STRING_KEY;
50
  public static final String USERNAME_KEY =
50
  public static final String USERNAME_KEY =
51
      org.apache.sqoop.manager.MySQLUtils.USERNAME_KEY;
51
      org.apache.sqoop.manager.MySQLUtils.USERNAME_KEY;
52
  public static final String PASSWORD_KEY =

   
53
      org.apache.sqoop.manager.MySQLUtils.PASSWORD_KEY;

   
54
  public static final String WHERE_CLAUSE_KEY =
52
  public static final String WHERE_CLAUSE_KEY =
55
      org.apache.sqoop.manager.MySQLUtils.WHERE_CLAUSE_KEY;
53
      org.apache.sqoop.manager.MySQLUtils.WHERE_CLAUSE_KEY;
56
  public static final String EXTRA_ARGS_KEY =
54
  public static final String EXTRA_ARGS_KEY =
57
      org.apache.sqoop.manager.MySQLUtils.EXTRA_ARGS_KEY;
55
      org.apache.sqoop.manager.MySQLUtils.EXTRA_ARGS_KEY;
58
  public static final String MYSQL_DEFAULT_CHARSET =
56
  public static final String MYSQL_DEFAULT_CHARSET =
[+20] [20] 13 lines
src/java/org/apache/sqoop/manager/MySQLUtils.java
Revision c86cf1a6e25852764c8bb3d768441a9eb09142e3 New Change
 
src/java/org/apache/sqoop/mapreduce/MySQLDumpMapper.java
Revision 4daaaeb51654cc76a55636abb82c8f9d2ebb2f2e New Change
 
src/java/org/apache/sqoop/mapreduce/MySQLExportMapper.java
Revision dc1c1263e5d92bca3eda3dec5a52b6e0c92284f8 New Change
 
src/java/org/apache/sqoop/mapreduce/db/DBConfiguration.java
Revision 4bd066db40bd1d8f5eb04fdc541e5e1a1e300a09 New Change
 
  1. src/java/com/cloudera/sqoop/manager/MySQLUtils.java: Loading...
  2. src/java/org/apache/sqoop/manager/MySQLUtils.java: Loading...
  3. src/java/org/apache/sqoop/mapreduce/MySQLDumpMapper.java: Loading...
  4. src/java/org/apache/sqoop/mapreduce/MySQLExportMapper.java: Loading...
  5. src/java/org/apache/sqoop/mapreduce/db/DBConfiguration.java: Loading...