Ted Yu created HBASE-7881:
-----------------------------
Summary: Add FSUtils method delete(Path f, boolean recursive)
Key: HBASE-7881
URL: https://issues.apache.org/jira/browse/HBASE-7881
Project: HBase
Issue Type: Sub-task
Reporter: Ted Yu
>From Matteo
>(https://reviews.apache.org/r/9416/diff/2/?file=258262#file258262line402):
looking at the source, it seems that checking the return value and throw an
exception seems a good way to shoot ourselves in the foot. I've added that
check in other places and not I'm regretting that...
because a return false doesn't really mean I'm not able to delete the file/dir.
maybe the file is already deleted by someone else, or renamed...
You want to throw an exception only if the file/dir is still there...
so if we don't trust that the API will provide an exception is case of failure
we should do something like
{code}
if (!fs.delete(workingDir, true)) {
// Make sure that the dir is still there
if (fs.exists(workingDir)) {
throw new IOException("Unable to delete " + workingDir);
}
}
{code}
We can add the following method to FSUtils:
void delete(Path f, boolean recursive) throws IOException;
--
This message is automatically generated by JIRA.
If you think it was sent incorrectly, please contact your JIRA administrators
For more information on JIRA, see: http://www.atlassian.com/software/jira