[ 
https://issues.apache.org/jira/browse/HBASE-21342?page=com.atlassian.jira.plugin.system.issuetabpanels:comment-tabpanel&focusedCommentId=16656904#comment-16656904
 ] 

Ted Yu commented on HBASE-21342:
--------------------------------

{code}
+  interface InternalObserverForTest {
{code}
Since the interface has VisibleForTesting annotation, the interface name 
doesn't have to include ForTest.
How about naming the interface InternalObserverForFSOperation or something 
similar ?
{code}
+      decrementUgiReference(ugi);
{code}
Should the above be enclosed in finally block ?
{code}
+  public void testForRaceCondition() throws Exception {
{code}
There may be more test added to this class in the future. If including the race 
condition in test name makes the method name too long, can you add a comment 
describing the race ?
{code}
+  class MyExceptionToAvoidRetry extends DoNotRetryIOException {};
{code}
Put the right curly on separate line.
{code}
+      e.printStackTrace();
{code}
Please replace with a rethrow of the exception.
{code}
+        Thread.sleep(3000); /// sleep 3s so the fs will be closed by the time 
we wakeup
{code}
Is it possible to use some other condition so that the wait is not hardcoded ?
Sometime down the road, what if 3 second is not long enough ?
{code}
+      } catch (InterruptedException e) {}
{code}
Please log and rethrow InterruptedIOException.

thanks for the great work.

> FileSystem in use may get closed by other bulk load call  in secure bulkLoad
> ----------------------------------------------------------------------------
>
>                 Key: HBASE-21342
>                 URL: https://issues.apache.org/jira/browse/HBASE-21342
>             Project: HBase
>          Issue Type: Bug
>    Affects Versions: 3.0.0, 2.1.0, 1.5.0, 1.3.3, 1.4.4, 2.0.1, 1.2.7
>            Reporter: mazhenlin
>            Assignee: mazhenlin
>            Priority: Major
>         Attachments: 21342.v1.txt, HBASE-21342.002.patch, 
> HBASE-21342.003.patch, race.patch
>
>
> As mentioned in [HBASE-15291|#HBASE-15291], there is a race condition.   If 
> Two secure bulkload calls  from the same UGI into two different regions and 
> one region finishes earlier, it will close the bulk load fs, and the other 
> region will fail.
>  
> Another case would be more serious. The FileSystem.close() function needs two 
> synchronized variables : CACHE and deleteOnExit. If one region calls 
> FileSystem.closeAllForUGI ( in SecureBulkLoadManager.cleanupBulkLoad) while 
> another region is trying to close srcFS ( in  
> SecureBulkLoadListener.closeSrcFs)   , can cause deadlock here.
>  
> I have wrote a UT for this and fixed it using reference counter.
>  



--
This message was sent by Atlassian JIRA
(v7.6.3#76005)

Reply via email to