[ 
https://issues.apache.org/jira/browse/PIG-1391?page=com.atlassian.jira.plugin.system.issuetabpanels:all-tabpanel
 ]

Thejas M Nair updated PIG-1391:
-------------------------------

    Attachment: minicluster.patch

This is a path for review before I go ahead and change around 70+ test files. 

It adds a shutdown() function in MiniCluster, which can be called from test 
cases to free the resources and delete the temp files.

In the patch, I have also made corresponding changes in one of the tests - 
TestPigContext to demonstrate the kind of changes that will be needed in other 
tests that use MiniCluster . The required changes are -
1. Add function annotated by @AfterClass which will call 
Minicluster.shutdown(). This will be called after all the unit test cases in 
the class have been run.
2. Annotate the class with @RunWith(JUnit4.class) so that junit4 is used . 
Without that it will run in junit3.x mode, which ignores @AfterClass 
annotation. 


> pig unit tests leave behind files in temp directory because MiniCluster files 
> don't get deleted
> -----------------------------------------------------------------------------------------------
>
>                 Key: PIG-1391
>                 URL: https://issues.apache.org/jira/browse/PIG-1391
>             Project: Pig
>          Issue Type: Bug
>    Affects Versions: 0.7.0
>            Reporter: Thejas M Nair
>            Assignee: Thejas M Nair
>             Fix For: 0.7.0
>
>         Attachments: minicluster.patch
>
>
> Pig unit test runs leave behind files in temp dir (/tmp) and there are too 
> many files in the directory over time.
> Most of the files are left behind by MiniCluster . It closes/shutsdown 
> MiniDFSCluster, MiniMRCluster and the FileSystem that it has created when the 
> constructor is called, only in finalize(). And java does not guarantee that 
> finalize() will be called. 

-- 
This message is automatically generated by JIRA.
-
You can reply to this email to add a comment to the issue online.

Reply via email to