Review Board 1.6.3

Refactor "Corrupt Data" Tests in TestHLogSplit

Review Request #1115 - submitted 3 years, 5 months ago

Alex Newman Reviewers
hbase
hbase-2935 nspiegelberg
None hbase
So I took the approach taken with the instrumented sequence file rider. Not sure if exposing those methods in the WALReader is cool so I am down with other suggestions.

- Add a FaultySequenceFileLogReader
- Un-commented the 2935 tests
Running on our internal hudson as I type this. Also I ran the TestHLogSplit test locally. I'll update the review if hudson is green.
src/main/java/org/apache/hadoop/hbase/regionserver/wal/HLog.java
Revision c8a10af New Change
... 132 lines hidden [Expand]
public class HLog implements Syncable {
133

   
133

   
134

   
134

   
135
  private static Class<? extends Writer> logWriterClass;
135
  private static Class<? extends Writer> logWriterClass;
136
  private static Class<? extends Reader> logReaderClass;
136
  private static Class<? extends Reader> logReaderClass;
137

   
137

   

   
138
  static void resetLogReaderClass() {

   
139
    HLog.logReaderClass = null;

   
140
  }

   
141

   
138
  private OutputStream hdfs_out;     // OutputStream associated with the current SequenceFile.writer
142
  private OutputStream hdfs_out;     // OutputStream associated with the current SequenceFile.writer
139
  private int initialReplication;    // initial replication factor of SequenceFile.writer
143
  private int initialReplication;    // initial replication factor of SequenceFile.writer
140
  private Method getNumCurrentReplicas; // refers to DFSOutputStream.getNumCurrentReplicas
144
  private Method getNumCurrentReplicas; // refers to DFSOutputStream.getNumCurrentReplicas
141
  final static Object [] NO_ARGS = new Object []{};
145
  final static Object [] NO_ARGS = new Object []{};
142

   
146

   
... 412 lines hidden [Expand]
protected Writer createWriterInstance(final FileSystem fs, final Path path,
555
   */
559
   */
556
  public static Reader getReader(final FileSystem fs,
560
  public static Reader getReader(final FileSystem fs,
557
    final Path path, Configuration conf)
561
    final Path path, Configuration conf)
558
  throws IOException {
562
  throws IOException {
559
    try {
563
    try {

   
564

   
560
      if (logReaderClass == null) {
565
      if (logReaderClass == null) {

   
566

   
561
        logReaderClass = conf.getClass("hbase.regionserver.hlog.reader.impl",
567
        logReaderClass = conf.getClass("hbase.regionserver.hlog.reader.impl",
562
            SequenceFileLogReader.class, Reader.class);
568
            SequenceFileLogReader.class, Reader.class);
563
      }
569
      }
564

   
570

   

   
571

   
565
      HLog.Reader reader = logReaderClass.newInstance();
572
      HLog.Reader reader = logReaderClass.newInstance();
566
      reader.init(fs, path, conf);
573
      reader.init(fs, path, conf);
567
      return reader;
574
      return reader;
568
    } catch (IOException e) {
575
    } catch (IOException e) {
569
      throw e;
576
      throw e;
... 961 lines hidden [Expand]
src/main/java/org/apache/hadoop/hbase/regionserver/wal/SequenceFileLogReader.java
Revision 0b7dc78 New Change
 
src/test/java/org/apache/hadoop/hbase/regionserver/wal/FaultySequenceFileLogReader.java
New File
 
src/test/java/org/apache/hadoop/hbase/regionserver/wal/TestHLogSplit.java
Revision 473c359 New Change
 
  1. src/main/java/org/apache/hadoop/hbase/regionserver/wal/HLog.java: Loading...
  2. src/main/java/org/apache/hadoop/hbase/regionserver/wal/SequenceFileLogReader.java: Loading...
  3. src/test/java/org/apache/hadoop/hbase/regionserver/wal/FaultySequenceFileLogReader.java: Loading...
  4. src/test/java/org/apache/hadoop/hbase/regionserver/wal/TestHLogSplit.java: Loading...