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 2020/05/17 09:48:15 UTC

[GitHub] [hbase] HorizonNet commented on a change in pull request #1724: HBASE-24386 TableSnapshotScanner support scan limit

HorizonNet commented on a change in pull request #1724:
URL: https://github.com/apache/hbase/pull/1724#discussion_r426240189



##########
File path: hbase-server/src/test/java/org/apache/hadoop/hbase/client/TestTableSnapshotScanner.java
##########
@@ -190,6 +190,36 @@ public void testNoDuplicateResultsWhenSplitting() throws Exception {
     }
   }
 
+
+  @Test
+  public void testScanLimit() throws Exception {
+    setupCluster();
+    TableName tableName = TableName.valueOf("testScanLimit");

Review comment:
       Please introduce a rule for the table name
   
   ```
   @Rule
   public TestName name = new TestName();
   ```
   
   And use it like this
   
   ```
   final TableName tableName = TableName.valueOf(name.getMethodName());
   ```

##########
File path: hbase-server/src/test/java/org/apache/hadoop/hbase/client/TestTableSnapshotScanner.java
##########
@@ -190,6 +190,36 @@ public void testNoDuplicateResultsWhenSplitting() throws Exception {
     }
   }
 
+
+  @Test
+  public void testScanLimit() throws Exception {
+    setupCluster();
+    TableName tableName = TableName.valueOf("testScanLimit");
+    String snapshotName = "testScanLimitSnapshot";
+    try {
+      createTableAndSnapshot(UTIL, tableName, snapshotName, 50);
+      Path restoreDir = UTIL.getDataTestDirOnTestFS(snapshotName);
+      Scan scan = new Scan().withStartRow(bbb).setLimit(100); // limit the scan
+
+      TableSnapshotScanner scanner =
+          new TableSnapshotScanner(UTIL.getConfiguration(), restoreDir, snapshotName, scan);
+      int count = 0;
+      while (true) {
+        Result result = scanner.next();
+        if (result == null) {
+          break;
+        }
+        count++;
+      }
+      assert (100 == count);

Review comment:
       I would prefer `assertEquals` in that case.




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