sandeepvinayak commented on a change in pull request #2975:
URL: https://github.com/apache/hbase/pull/2975#discussion_r580691179
##########
File path:
hbase-server/src/test/java/org/apache/hadoop/hbase/replication/regionserver/TestWALEntryStream.java
##########
@@ -726,8 +727,62 @@ public void testEOFExceptionForRecoveredQueue() throws
Exception {
queue, 0, fs, conf, getDummyFilter(),
new MetricsSource("1"), (ReplicationSource) source);
reader.run();
+ assertEquals(0, queue.size());
+ }
+
+ @Test
+ public void testEOFExceptionForRecoveredQueueWithMultipleLogs() throws
Exception {
+ PriorityBlockingQueue<Path> queue =
+ new PriorityBlockingQueue<>(5, new ReplicationSource.LogsComparator());
+
+ // Create a 0 length log.
+ Path emptyLog = new Path("log.2");
+ FSDataOutputStream fsdos = fs.create(emptyLog);
+ fsdos.close();
+ assertEquals(0, fs.getFileStatus(emptyLog).getLen());
+ queue.add(emptyLog);
+
+ final Path log1 = new Path("log.1");
+ WALProvider.Writer writer1 = WALFactory.createWALWriter(fs, log1,
TEST_UTIL.getConfiguration());
+ appendEntries(writer1, 3);
+ queue.add(log1);
+
+ ReplicationSource source = Mockito.mock(ReplicationSource.class);
+ ReplicationSourceManager mockSourceManager =
mock(ReplicationSourceManager.class);
+ // Make it look like the source is from recovered source.
+ when(mockSourceManager.getOldSources())
+ .thenReturn(new
ArrayList<>(Arrays.asList((ReplicationSourceInterface)source)));
+ when(source.isPeerEnabled()).thenReturn(true);
+ when(mockSourceManager.getTotalBufferUsed()).thenReturn(new AtomicLong(0));
+ // 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.
+ ReplicationSourceWALReaderThread reader =
+ new ReplicationSourceWALReaderThread(mockSourceManager,
getRecoveredQueueInfo(),
+ queue, 0, fs, conf, getDummyFilter(),
+ new MetricsSource("1"), (ReplicationSource) source);
+ reader.run();
+
Review comment:
@xcangCRM i think you are confusing it with `.start()` method which is
async call. We are executing `.run()` which is sync call.
----------------------------------------------------------------
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]