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

Hari Sankar Sivarama Subramaniyan commented on HIVE-10768:
----------------------------------------------------------

Hi [~xuefuz] Locking is more common in Windows OS where a user cannot delete 
file in use. In Linux, there is a round about way where the user can set the 
log files to read-only after the first run to avoid deletion (which is a 
somewhat uncommon case).  Here is a scenario where locking can happen/deleting 
the old log files is not possible.

 - mvn clean install -DskipTests -Phadoop-2(from Hive Root directory) which 
creates the *gen.log files in hive/itests/qtest/target/
- Set the *gen.log in to read-only (in Linux), If running in windows, just open 
one of the *gen.log files.
- cd itests
- mvn install -DskipTests -Phadoop-2

My point is that although this issue is very unlikely to happen with the way we 
run precommit tests and the way unit tests are supposed to be run in Linux, we 
should still avoid skipping the entire test suite if a similar issue happens in 
the future. i.e. the test framework should provide better resistance to such 
unexpected scenarios.

2. You are right, File.createTempFile actually will be a better option here 
than my own function. I will make the required changes in a new patch.

Thanks
Hari

> In QTestGenTask.execute() we should not throw an exception right away if we 
> are unable to clean any old files
> -------------------------------------------------------------------------------------------------------------
>
>                 Key: HIVE-10768
>                 URL: https://issues.apache.org/jira/browse/HIVE-10768
>             Project: Hive
>          Issue Type: Bug
>          Components: Testing Infrastructure
>            Reporter: Hari Sankar Sivarama Subramaniyan
>            Assignee: Hari Sankar Sivarama Subramaniyan
>         Attachments: HIVE-10768.1.patch
>
>
> Currently in QTestGenTask.execute(), we have code like :
> {code}
>        if (logFile != null) {
>          File lf = new File(logFile);
>          if (lf.exists()) {
>            if (!lf.delete()) {
>              throw new Exception("Could not delete log file " + 
> lf.getCanonicalPath());
>          }
> {code}
> If the log file gets locked due to some other process, it throws the above 
> exception and short circuits the entire test suite. We should provide a 
> mechanism to generate alternative new log files/temporary files whenever 
> possible to avoid unit test failures.



--
This message was sent by Atlassian JIRA
(v6.3.4#6332)

Reply via email to