You are viewing a plain text version of this content. The canonical link for it is here.
Posted to issues@hbase.apache.org by GitBox <gi...@apache.org> on 2019/12/11 11:36:46 UTC

[GitHub] [hbase] JeongDaeKim commented on a change in pull request #749: HBASE-23205 Correctly update the position of WALs currently being replicated

JeongDaeKim commented on a change in pull request #749: HBASE-23205 Correctly update the position of WALs currently being replicated
URL: https://github.com/apache/hbase/pull/749#discussion_r356548457
 
 

 ##########
 File path: hbase-server/src/test/java/org/apache/hadoop/hbase/replication/regionserver/TestWALEntryStream.java
 ##########
 @@ -436,6 +439,56 @@ public void testWALKeySerialization() throws Exception {
     }
   }
 
+  @Test
+  public void testReplicationSourceWALReaderThreadWithFilter() throws Exception {
+    final byte[] notReplicatedCf = Bytes.toBytes("notReplicated");
+    final Map<TableName, List<String>> tableCfs = new HashMap<>();
+    tableCfs.put(tableName, Collections.singletonList(Bytes.toString(family)));
+    ReplicationPeer peer = mock(ReplicationPeer.class);
+    when(peer.getTableCFs()).thenReturn(tableCfs);
+    WALEntryFilter filter = new ChainWALEntryFilter(new TableCfWALEntryFilter(peer));
+
+    appendToLogPlus(3, notReplicatedCf);
+
+    Path firstWAL = walQueue.peek();
+    ReplicationSourceManager mockSourceManager = mock(ReplicationSourceManager.class);
+    when(mockSourceManager.getTotalBufferUsed()).thenReturn(new AtomicLong(0));
+    final ReplicationSourceWALReaderThread reader =
+            new ReplicationSourceWALReaderThread(mockSourceManager, getQueueInfo(), walQueue,
+                    0, fs, conf, filter, new MetricsSource("1"));
+    reader.start();
+
+    // reader won't put any batch, even if EOF reached.
+    ExecutorService executor = Executors.newSingleThreadExecutor();
+    Future<WALEntryBatch> future = executor.submit(new Callable<WALEntryBatch>() {
+      @Override
+      public WALEntryBatch call() throws Exception {
+        return reader.take();
+      }
+    });
+    Thread.sleep(2000);
+    assertFalse(future.isDone());
 
 Review comment:
   👍 

----------------------------------------------------------------
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:
users@infra.apache.org


With regards,
Apache Git Services