virajjasani commented on a change in pull request #2908:
URL: https://github.com/apache/hbase/pull/2908#discussion_r566614222
##########
File path:
hbase-server/src/test/java/org/apache/hadoop/hbase/replication/regionserver/TestWALEntryStream.java
##########
@@ -652,4 +653,33 @@ public void testReadBeyondCommittedLength() throws
IOException, InterruptedExcep
assertFalse(entryStream.hasNext());
}
}
+
+ /*
+ Test removal of 0 length log from logQueue if the source is a recovered
source and
+ size of logQueue is only 1.
+ */
+ @Test
+ public void testEOFExceptionForRecoveredQueue() throws Exception {
+ PriorityBlockingQueue<Path> queue = new PriorityBlockingQueue<>();
+ // Create a 0 length log.
+ Path emptyLog = new Path("emptyLog");
+ FSDataOutputStream fsdos = fs.create(emptyLog);
+ fsdos.close();
+ assertEquals(0, fs.getFileStatus(emptyLog).getLen());
+ queue.add(emptyLog);
+
+ Configuration conf = new Configuration(CONF);
+ // Override the max retries multiplier to fail fast.
+ conf.setInt("replication.source.maxretriesmultiplier", 1);
+ conf.setBoolean("replication.source.eof.autorecovery", true);
+ // Create a reader thread with source as recovered source.
+ ReplicationSource source = mockReplicationSource(true, conf);
+ when(source.isPeerEnabled()).thenReturn(true);
+ ReplicationSourceWALReader reader =
+ new ReplicationSourceWALReader(fs, conf, queue, 0, getDummyFilter(),
source);
+ reader.run();
Review comment:
nit: `reader.start()`?
----------------------------------------------------------------
This is an automated message from the Apache Git Service.
To respond to the message, please log on to GitHub and use the
URL above to go to the specific comment.
For queries about this service, please contact Infrastructure at:
[email protected]