[ https://issues.apache.org/jira/browse/HDFS-2136?page=com.atlassian.jira.plugin.system.issuetabpanels:comment-tabpanel&focusedCommentId=13061432#comment-13061432 ]
Todd Lipcon commented on HDFS-2136: ----------------------------------- Yea, that would be great. I think there are three possibilities: 1) use the AOP-based fault injection framework 2) use some static methods (see use of ErrorSimulator in the SecondaryNameNode and TransferFsImage classes) 3) refactor the code so that a mock could be injected Personally, my preference is #2. I've found the AOP-based fault injection tests (#1) very difficult to develop and understand, as someone who only looks at aspectj code once every few months. They're also easy to forget about since they're in a different tree, they're slow to run, etc. #3 is probably ideal but I can't think of any refactors that wouldn't be really contrived. Thoughts? > 1073: Fault injection for StorageDirectory failures during read/write of > FSImage/Edits files > -------------------------------------------------------------------------------------------- > > Key: HDFS-2136 > URL: https://issues.apache.org/jira/browse/HDFS-2136 > Project: Hadoop HDFS > Issue Type: Sub-task > Reporter: Matt Foley > > Both HDFS-1955 and HDFS-2135 have observed that it is difficult to unit test > such failures. As a result, regression of HDFS-1955 was only found by > careful manual review (thanks, atm!). Since 1073 is making broad changes to > the way these files are read and written, and appropriately putting effort > into correct error handling, I propose we make also make it possible to > auto-test that error handling. -- This message is automatically generated by JIRA. For more information on JIRA, see: http://www.atlassian.com/software/jira