SQOOP-674 Sqoop2: Exceptions in special map reduce threads can cause mapreduce job to freeze
Review Request #8622 - Created Dec. 16, 2012 and submitted
I've changed unconditional free.acquire() to do-while loop that will periodically check reader status.
Unit tests are passing and I've tested it on real cluster.
Posted (Dec. 16, 2012, 10:12 p.m.)
Jarcec, Excellent catch! Running tryAcquire in a loop is generally an expensive CPU consuming operation. You could do something like this: * Release the free semaphore after setting readerFinished to true, just before throwing the exception in the consumer whenever exceptions are thrown (2 places I think). * Exchange the order of calls to free.acquire and checkIfConsumerThrew (acquire the free sema before checking if the consumer threw). This would make sure that we don't try to acquire the semaphore in a loop, but yet ensure that we will release the semaphore when an exception is thrown so we can continue and throw the exception out
Review request changed
Updated (Jan. 25, 2013, 2:28 a.m.)
- changed from pending to submitted