[ 
https://issues.apache.org/jira/browse/HADOOP-4885?page=com.atlassian.jira.plugin.system.issuetabpanels:comment-tabpanel&focusedCommentId=12666032#action_12666032
 ] 

Boris Shkolnik commented on HADOOP-4885:
----------------------------------------

Another issue is testing. To test this feature we would need to simulate 
failure to write into edit logs. For manual testing I used mounting.
But that may be non-portable to all the systems, so I need another solution. 
My suggestions is to create a "mock" of the stream class. It will extend from 
EditLogFileOutputStream and override write() methods.
It will also introduce a boolean member flag to specify if it is in a "failure" 
mode. When the flag is set - the write methods will throw IOException, if not 
they will call corresponding functions from the super classes.  

Class will look something like this:
------------
  class EditLogFileErrorTestOutputStream extends EditLogFileOutputStream {
    private boolean throwException = false;
    public void setThrowException(boolean val){
      throwException = val;
    }
   
    public void write(int b) throws IOException {
      if(throwException)
        throw new IOException("Simulated IOException in write()");
      else 
        super.write(b);
    }
  }
--------------

configuration will have a setting "dfs.name.dir.simulateError" to specify that 
it needs editLog streams of the EditLogFileErrorTestOutputStream class.


> Try to restore failed replicas of Name Node storage (at checkpoint time)
> ------------------------------------------------------------------------
>
>                 Key: HADOOP-4885
>                 URL: https://issues.apache.org/jira/browse/HADOOP-4885
>             Project: Hadoop Core
>          Issue Type: Improvement
>          Components: dfs
>            Reporter: Boris Shkolnik
>            Assignee: Boris Shkolnik
>


-- 
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