|
[
Permlink
| « Hide
]
Doug Cutting added a comment - 11/Apr/08 07:31 PM
I think the namenode should return null for getFileInfo(), without having to catch an exception. And the client should throw an exception for null in getFileStatus() but not in exists().
I don't think RPC should dictate what exception NameNode should throw. I think it should still throw FileNotFound. There is probably a way not to log selected exceptions at the RPC server. In fact the server should not log the exceptions that it is sending the client actually! may be except RuntimeExceptions.
I agree with Doug:
getFileInfo() used to return null. This was changed couple of months back during fixes to various shell commands and APIs. I am not sure the actual reason behind it, may be consistency. Returning null for non-existent files is good.
Is it enough if RPC does not log these?
> Is it enough if RPC does not log these?
That sounds like a hack. If some consumers of getFileInfo() don't consider FileNotFound exceptional, then returning null is the right contract for that protocol method. As I've said before, using exception handling for normal control flow is a bad design. The exists() method should be able to return false via normal control flow. > Is it enough if RPC does not log these?
That would be enough if RPC could distinguish between exceptions that need to be logged and those that don't. But this is impossible in general. E.g. the FileNotFoundException being thrown in case of open() needs to be logged while thrown in exists() should not be. > should go in 0.17?
Formally, it is not a regression in terms of performance or functionality. Yes, I would prefer returning null from getFileInfo() as well. But I don't remember the reason why it was changed couple of months back.
The main issue in this jira I think is about logging in RPC server at the NameNode. What I meant earlier was that returning null or throwing FileNotFound should be independent of RPC logging. > E.g. the FileNotFoundException being thrown in case of open() needs to be logged while thrown in exists() should not be.
I don't think FNF during open() should be logged either. It is not any more severe than FNF during existss(). In fact, many place we discouraged code that first invoked exists() and threw a FNF or opened the file depending on the result. Last comment
This issue is about log messages generated by calls to exists() that didn't used to be generated by calls to exists(). It is a regression. It is not about namenode exception logging more generally. (About that, however, I think folks have found it convenient that whenever an exception is received from RPC that it is also logged on the server side.)
> getFileInfo() used to return null. That's not true. It has always thrown an exception for this case, since that was always before the contract of its corresponding FileSystem methods. Now that it is overloaded to support exists() too, it should no longer throw the exception at this level. You are right. What was changed recently was to throw FileNotFoundException rather than IOException. The extra logging is because of DFSClient.exists() using getFileInfo().
I still think eventually it would be nice to be able to tell RPC not to log user exceptions or be able to tell which ones to log. Attached patch does these
+1 overall. Here are the results of testing the latest attachment
http://issues.apache.org/jira/secure/attachment/12379975/HADOOP-3239-1.patch against trunk revision 645773. @author +1. The patch does not contain any @author tags. tests included +1. The patch appears to include 3 new or modified tests. javadoc +1. The javadoc tool did not generate any warning messages. javac +1. The applied patch does not generate any new javac compiler warnings. release audit +1. The applied patch does not generate any new release audit warnings. findbugs +1. The patch does not introduce any new Findbugs warnings. core tests +1. The patch passed core unit tests. contrib tests +1. The patch passed contrib unit tests. Test results: http://hudson.zones.apache.org/hudson/job/Hadoop-Patch/2217/testReport/ This message is automatically generated. +1
In JavaDoc the following * @return object containing information regarding the file * null if file not found will look like Returns: object containing information regarding the file null if file not found I'd say "or null if..." or use a comma. Thanks Doug and Konstantin. Attached patch modifies javadoc as suggested by Konstantin
I just committed this. Thank you Lohit.
Integrated in Hadoop-trunk #461 (See http://hudson.zones.apache.org/hudson/job/Hadoop-trunk/461/
|
||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||