SQOOP-604 Easy throttling feature for MySQL exports
Review Request #7135 - Created Sept. 17, 2012 and submitted
Code review for SQOOP-604, see https://issues.apache.org/jira/browse/SQOOP-604 The solution in short: Using the already existing "checkpoint" feature of the direct (--direct) MySQL exports (the export process is restarted every X bytes written), extending it with a new config value that would simply make the thread sleep for X milliseconds at the checkbpoints. With low enough byte count limit this can be a simple yet powerful throttling mechanism.
Executing with different settings of sqoop.mysql.export.checkpoint.bytes and sqoop.mysql.export.sleep.ms: 33554432B / 0ms: Transferred 4.7579 MB in 8.7175 seconds (558.8826 KB/sec) 102400B / 500ms: Transferred 4.7579 MB in 35.7794 seconds (136.1698 KB/sec) 51200B / 500ms: Transferred 4.758 MB in 57.8675 seconds (84.1959 KB/sec) 51200B / 250ms: Transferred 4.7579 MB in 35.0293 seconds (139.0854 KB/sec) I did not add unit tests yet and as it involves calling to Thread.sleep, I find testing this difficult. Unfortunately there is no "machine" or "environment" object that could be injected to these classes as mocks that could take care of time-related fixtures.
Posted (Oct. 1, 2012, 11:13 a.m.)
Few Comments. After corrections, please upload the new patch on JIRA as well Review board. Thanks!
Review request changed
Updated (Oct. 2, 2012, 10:08 a.m.)
You are right, I was in a hurry and here is the result. Anyways, I attach the fixed patch. Compiled with no checkstyle warnings. Output of test: 2012-10-02 12:03:17,575 WARN com.cloudera.sqoop.mapreduce.MySQLExportMapper: Value for sqoop.mysql.export.sleep.ms has to be smaller than mapred.task.timeout
Posted (Oct. 2, 2012, 3:45 p.m.)
Posted (Oct. 31, 2012, 3:47 a.m.)
My aplogies for replying late on this, had been a lot busy. I think we will have to do a round more :). I see 5 checkstyle errors, out of which please resolve the 3 (in file MySQLExportMapper.java) which are due to the changes you made in the code. I will raise a JIRA for other two which are not a part of your change. How to 'checkstyle' steps: 1. run 'ant checkstyle' 2. Now above command may be successful, but it generates an HTML file(checkstyle-errors.html to be exact) in 'build' dir under $SQOOP_HOME. Opening that file gives the details of the checkstyle errrors. Thanks.
Review request changed
Updated (Nov. 3, 2012, 10:34 a.m.)
- changed from pending to submitted