You are viewing a plain text version of this content. The canonical link for it is here.
Posted to notifications@accumulo.apache.org by "dlmarion (via GitHub)" <gi...@apache.org> on 2023/05/09 14:57:39 UTC

[GitHub] [accumulo] dlmarion opened a new pull request, #3388: Added ScanServer tests for different tablet hosting goals

dlmarion opened a new pull request, #3388:
URL: https://github.com/apache/accumulo/pull/3388

   (no 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.

To unsubscribe, e-mail: notifications-unsubscribe@accumulo.apache.org

For queries about this service, please contact Infrastructure at:
users@infra.apache.org


[GitHub] [accumulo] keith-turner commented on a diff in pull request #3388: Added ScanServer tests for different tablet hosting goals

Posted by "keith-turner (via GitHub)" <gi...@apache.org>.
keith-turner commented on code in PR #3388:
URL: https://github.com/apache/accumulo/pull/3388#discussion_r1192743173


##########
test/src/main/java/org/apache/accumulo/test/ScanServerIT.java:
##########
@@ -224,6 +234,110 @@ public void testBatchScannerTimeout() throws Exception {
     }
   }
 
+  @Test
+  public void testScanWithTabletHostingMix() throws Exception {
+    try (AccumuloClient client = Accumulo.newClient().from(getClientProps()).build()) {
+      String tableName = getUniqueNames(1)[0];
+
+      SortedSet<Text> splits = new TreeSet<>();
+      splits.add(new Text("row_0000000001"));
+      splits.add(new Text("row_0000000002"));
+      splits.add(new Text("row_0000000003"));
+      splits.add(new Text("row_0000000004"));
+      splits.add(new Text("row_0000000005"));
+      splits.add(new Text("row_0000000006"));
+      splits.add(new Text("row_0000000007"));
+      splits.add(new Text("row_0000000008"));
+      splits.add(new Text("row_0000000009"));
+      NewTableConfiguration ntc = new NewTableConfiguration();
+      ntc.withSplits(splits);
+      ntc.withInitialHostingGoal(TabletHostingGoal.ALWAYS); // speed up ingest
+      final int ingestedEntryCount = createTableAndIngest(client, tableName, ntc, 10, 10, "colf");
+
+      String tableId = client.tableOperations().tableIdMap().get(tableName);
+
+      // row 1 -> 3 are always
+      client.tableOperations().setTabletHostingGoal(tableName,
+          new Range(null, true, "row_0000000003", true), TabletHostingGoal.ALWAYS);
+      // row 4 -> 7 are never
+      client.tableOperations().setTabletHostingGoal(tableName,
+          new Range("row_0000000004", true, "row_0000000007", true), TabletHostingGoal.NEVER);
+      // row 8 and 9 are ondemand
+      client.tableOperations().setTabletHostingGoal(tableName,
+          new Range("row_0000000008", true, null, true), TabletHostingGoal.ONDEMAND);
+
+      // Wait for the NEVER and ONDEMAND tablets to be unloaded
+      int hosted = getNumHostedTablets(client, tableId);
+      // Waiting for tablets to be unloaded due to inactivity
+      while (hosted != 3) {
+        Thread.sleep(1000);
+        hosted = getNumHostedTablets(client, tableId);
+      }
+
+      try (Scanner scanner = client.createScanner(tableName, Authorizations.EMPTY)) {
+        scanner.setRange(new Range());
+        scanner.setConsistencyLevel(ConsistencyLevel.EVENTUAL);
+        assertEquals(ingestedEntryCount, Iterables.size(scanner),
+            "The scan server scanner should have seen all ingested and flushed entries");
+        // Throws an exception because of the tablets with the NEVER hosting goal
+        scanner.setConsistencyLevel(ConsistencyLevel.IMMEDIATE);
+        assertThrows(RuntimeException.class, () -> Iterables.size(scanner));
+      } // when the scanner is closed, all open sessions should be closed
+    }
+  }
+
+  @Test
+  public void testBatchScanWithTabletHostingMix() throws Exception {
+    try (AccumuloClient client = Accumulo.newClient().from(getClientProps()).build()) {
+      String tableName = getUniqueNames(1)[0];
+
+      SortedSet<Text> splits = new TreeSet<>();
+      splits.add(new Text("row_0000000001"));
+      splits.add(new Text("row_0000000002"));
+      splits.add(new Text("row_0000000003"));
+      splits.add(new Text("row_0000000004"));
+      splits.add(new Text("row_0000000005"));
+      splits.add(new Text("row_0000000006"));
+      splits.add(new Text("row_0000000007"));
+      splits.add(new Text("row_0000000008"));
+      splits.add(new Text("row_0000000009"));
+      NewTableConfiguration ntc = new NewTableConfiguration();
+      ntc.withSplits(splits);
+      ntc.withInitialHostingGoal(TabletHostingGoal.ALWAYS); // speed up ingest
+      final int ingestedEntryCount = createTableAndIngest(client, tableName, ntc, 10, 10, "colf");
+
+      String tableId = client.tableOperations().tableIdMap().get(tableName);
+
+      // row 1 -> 3 are always
+      client.tableOperations().setTabletHostingGoal(tableName,
+          new Range(null, true, "row_0000000003", true), TabletHostingGoal.ALWAYS);
+      // row 4 -> 7 are never
+      client.tableOperations().setTabletHostingGoal(tableName,
+          new Range("row_0000000004", true, "row_0000000007", true), TabletHostingGoal.NEVER);
+      // row 8 and 9 are ondemand
+      client.tableOperations().setTabletHostingGoal(tableName,
+          new Range("row_0000000008", true, null, true), TabletHostingGoal.ONDEMAND);
+
+      // Wait for the NEVER and ONDEMAND tablets to be unloaded
+      int hosted = getNumHostedTablets(client, tableId);
+      // Waiting for tablets to be unloaded due to inactivity
+      while (hosted != 3) {
+        Thread.sleep(1000);
+        hosted = getNumHostedTablets(client, tableId);
+      }
+
+      try (BatchScanner scanner = client.createBatchScanner(tableName, Authorizations.EMPTY)) {
+        scanner.setRanges(Collections.singleton(new Range()));
+        scanner.setConsistencyLevel(ConsistencyLevel.EVENTUAL);
+        assertEquals(ingestedEntryCount, Iterables.size(scanner),
+            "The scan server scanner should have seen all ingested and flushed entries");
+        // Throws an exception because of the tablets with the NEVER hosting goal
+        scanner.setConsistencyLevel(ConsistencyLevel.IMMEDIATE);
+        assertThrows(RuntimeException.class, () -> Iterables.size(scanner));

Review Comment:
   Could also try scanning the ranges of the table that should work.
   
   ```suggestion
           assertThrows(RuntimeException.class, () -> Iterables.size(scanner));
           
           scanner.setRange(new Range(null,"row_0000000003"));
           assertEquals(???, Iterables.size(scanner));
           
            scanner.setRange(new Range("row_0000000008",null));
            assertEquals(???, Iterables.size(scanner));
   ```



##########
test/src/main/java/org/apache/accumulo/test/ScanServerIT.java:
##########
@@ -224,6 +234,110 @@ public void testBatchScannerTimeout() throws Exception {
     }
   }
 
+  @Test
+  public void testScanWithTabletHostingMix() throws Exception {
+    try (AccumuloClient client = Accumulo.newClient().from(getClientProps()).build()) {
+      String tableName = getUniqueNames(1)[0];
+
+      SortedSet<Text> splits = new TreeSet<>();
+      splits.add(new Text("row_0000000001"));
+      splits.add(new Text("row_0000000002"));
+      splits.add(new Text("row_0000000003"));
+      splits.add(new Text("row_0000000004"));
+      splits.add(new Text("row_0000000005"));
+      splits.add(new Text("row_0000000006"));
+      splits.add(new Text("row_0000000007"));
+      splits.add(new Text("row_0000000008"));
+      splits.add(new Text("row_0000000009"));
+      NewTableConfiguration ntc = new NewTableConfiguration();
+      ntc.withSplits(splits);
+      ntc.withInitialHostingGoal(TabletHostingGoal.ALWAYS); // speed up ingest
+      final int ingestedEntryCount = createTableAndIngest(client, tableName, ntc, 10, 10, "colf");
+
+      String tableId = client.tableOperations().tableIdMap().get(tableName);
+
+      // row 1 -> 3 are always
+      client.tableOperations().setTabletHostingGoal(tableName,
+          new Range(null, true, "row_0000000003", true), TabletHostingGoal.ALWAYS);
+      // row 4 -> 7 are never
+      client.tableOperations().setTabletHostingGoal(tableName,
+          new Range("row_0000000004", true, "row_0000000007", true), TabletHostingGoal.NEVER);
+      // row 8 and 9 are ondemand
+      client.tableOperations().setTabletHostingGoal(tableName,
+          new Range("row_0000000008", true, null, true), TabletHostingGoal.ONDEMAND);
+
+      // Wait for the NEVER and ONDEMAND tablets to be unloaded
+      int hosted = getNumHostedTablets(client, tableId);
+      // Waiting for tablets to be unloaded due to inactivity
+      while (hosted != 3) {
+        Thread.sleep(1000);
+        hosted = getNumHostedTablets(client, tableId);
+      }
+
+      try (Scanner scanner = client.createScanner(tableName, Authorizations.EMPTY)) {
+        scanner.setRange(new Range());
+        scanner.setConsistencyLevel(ConsistencyLevel.EVENTUAL);
+        assertEquals(ingestedEntryCount, Iterables.size(scanner),
+            "The scan server scanner should have seen all ingested and flushed entries");
+        // Throws an exception because of the tablets with the NEVER hosting goal
+        scanner.setConsistencyLevel(ConsistencyLevel.IMMEDIATE);
+        assertThrows(RuntimeException.class, () -> Iterables.size(scanner));
+      } // when the scanner is closed, all open sessions should be closed

Review Comment:
   can also add immediates scans of the ranges that should work here



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

To unsubscribe, e-mail: notifications-unsubscribe@accumulo.apache.org

For queries about this service, please contact Infrastructure at:
users@infra.apache.org


[GitHub] [accumulo] keith-turner commented on a diff in pull request #3388: Added ScanServer tests for different tablet hosting goals

Posted by "keith-turner (via GitHub)" <gi...@apache.org>.
keith-turner commented on code in PR #3388:
URL: https://github.com/apache/accumulo/pull/3388#discussion_r1193874618


##########
test/src/main/java/org/apache/accumulo/test/ScanServerIT.java:
##########
@@ -205,6 +217,124 @@ public void testBatchScannerTimeout() throws Exception {
     }
   }
 
+  @Test
+  public void testScanWithTabletHostingMix() throws Exception {
+    try (AccumuloClient client = Accumulo.newClient().from(getClientProps()).build()) {
+      String tableName = getUniqueNames(1)[0];
+
+      SortedSet<Text> splits = new TreeSet<>();
+      splits.add(new Text("row_0000000001"));
+      splits.add(new Text("row_0000000002"));
+      splits.add(new Text("row_0000000003"));
+      splits.add(new Text("row_0000000004"));
+      splits.add(new Text("row_0000000005"));
+      splits.add(new Text("row_0000000006"));
+      splits.add(new Text("row_0000000007"));
+      splits.add(new Text("row_0000000008"));
+      splits.add(new Text("row_0000000009"));
+      NewTableConfiguration ntc = new NewTableConfiguration();
+      ntc.withSplits(splits);
+      ntc.withInitialHostingGoal(TabletHostingGoal.ALWAYS); // speed up ingest
+      final int ingestedEntryCount = createTableAndIngest(client, tableName, ntc, 10, 10, "colf");
+
+      String tableId = client.tableOperations().tableIdMap().get(tableName);
+
+      // row 1 -> 3 are always
+      client.tableOperations().setTabletHostingGoal(tableName,
+          new Range(null, true, "row_0000000003", true), TabletHostingGoal.ALWAYS);
+      // row 4 -> 7 are never
+      client.tableOperations().setTabletHostingGoal(tableName,
+          new Range("row_0000000004", true, "row_0000000007", true), TabletHostingGoal.NEVER);
+      // row 8 and 9 are ondemand
+      client.tableOperations().setTabletHostingGoal(tableName,
+          new Range("row_0000000008", true, null, true), TabletHostingGoal.ONDEMAND);
+
+      // Wait for the NEVER and ONDEMAND tablets to be unloaded
+      int hosted = getNumHostedTablets(client, tableId);
+      // Waiting for tablets to be unloaded due to inactivity
+      while (hosted != 3) {
+        Thread.sleep(1000);
+        hosted = getNumHostedTablets(client, tableId);
+      }
+
+      try (Scanner scanner = client.createScanner(tableName, Authorizations.EMPTY)) {
+        scanner.setRange(new Range());
+        scanner.setConsistencyLevel(ConsistencyLevel.EVENTUAL);
+        assertEquals(ingestedEntryCount, Iterables.size(scanner),
+            "The scan server scanner should have seen all ingested and flushed entries");
+        // Throws an exception because of the tablets with the NEVER hosting goal
+        scanner.setConsistencyLevel(ConsistencyLevel.IMMEDIATE);
+        assertThrows(RuntimeException.class, () -> Iterables.size(scanner));
+
+        // Test that hosted ranges work
+        scanner.setRange(new Range(null, "row_0000000003"));
+        assertEquals(40, Iterables.size(scanner));
+
+        scanner.setRange(new Range("row_0000000008", null));
+        assertEquals(20, Iterables.size(scanner));
+      } // when the scanner is closed, all open sessions should be closed
+    }
+  }
+
+  @Test
+  public void testBatchScanWithTabletHostingMix() throws Exception {
+    try (AccumuloClient client = Accumulo.newClient().from(getClientProps()).build()) {
+      String tableName = getUniqueNames(1)[0];
+
+      SortedSet<Text> splits = new TreeSet<>();
+      splits.add(new Text("row_0000000001"));
+      splits.add(new Text("row_0000000002"));
+      splits.add(new Text("row_0000000003"));
+      splits.add(new Text("row_0000000004"));
+      splits.add(new Text("row_0000000005"));
+      splits.add(new Text("row_0000000006"));
+      splits.add(new Text("row_0000000007"));
+      splits.add(new Text("row_0000000008"));
+      splits.add(new Text("row_0000000009"));
+      NewTableConfiguration ntc = new NewTableConfiguration();
+      ntc.withSplits(splits);
+      ntc.withInitialHostingGoal(TabletHostingGoal.ALWAYS); // speed up ingest
+      final int ingestedEntryCount = createTableAndIngest(client, tableName, ntc, 10, 10, "colf");
+
+      String tableId = client.tableOperations().tableIdMap().get(tableName);
+
+      // row 1 -> 3 are always
+      client.tableOperations().setTabletHostingGoal(tableName,
+          new Range(null, true, "row_0000000003", true), TabletHostingGoal.ALWAYS);
+      // row 4 -> 7 are never
+      client.tableOperations().setTabletHostingGoal(tableName,
+          new Range("row_0000000004", true, "row_0000000007", true), TabletHostingGoal.NEVER);
+      // row 8 and 9 are ondemand
+      client.tableOperations().setTabletHostingGoal(tableName,
+          new Range("row_0000000008", true, null, true), TabletHostingGoal.ONDEMAND);
+
+      // Wait for the NEVER and ONDEMAND tablets to be unloaded
+      int hosted = getNumHostedTablets(client, tableId);
+      // Waiting for tablets to be unloaded due to inactivity
+      while (hosted != 3) {
+        Thread.sleep(1000);
+        hosted = getNumHostedTablets(client, tableId);
+      }
+
+      try (BatchScanner scanner = client.createBatchScanner(tableName, Authorizations.EMPTY)) {
+        scanner.setRanges(Collections.singleton(new Range()));
+        scanner.setConsistencyLevel(ConsistencyLevel.EVENTUAL);
+        assertEquals(ingestedEntryCount, Iterables.size(scanner),
+            "The scan server scanner should have seen all ingested and flushed entries");
+        // Throws an exception because of the tablets with the NEVER hosting goal
+        scanner.setConsistencyLevel(ConsistencyLevel.IMMEDIATE);
+        assertThrows(RuntimeException.class, () -> Iterables.size(scanner));
+
+        // Test that hosted ranges work
+        Collection<Range> ranges = new ArrayList<>();
+        ranges.add(new Range(null, "row_0000000003"));
+        ranges.add(new Range("row_0000000008", null));
+        scanner.setRanges(ranges);
+        assertEquals(60, Iterables.size(scanner));

Review Comment:
   This is neat, a single batch scan against ranges with diff hosting goals.



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

To unsubscribe, e-mail: notifications-unsubscribe@accumulo.apache.org

For queries about this service, please contact Infrastructure at:
users@infra.apache.org


[GitHub] [accumulo] keith-turner commented on a diff in pull request #3388: Added ScanServer tests for different tablet hosting goals

Posted by "keith-turner (via GitHub)" <gi...@apache.org>.
keith-turner commented on code in PR #3388:
URL: https://github.com/apache/accumulo/pull/3388#discussion_r1192745057


##########
test/src/main/java/org/apache/accumulo/test/ScanServerIT.java:
##########
@@ -224,6 +234,110 @@ public void testBatchScannerTimeout() throws Exception {
     }
   }
 
+  @Test
+  public void testScanWithTabletHostingMix() throws Exception {
+    try (AccumuloClient client = Accumulo.newClient().from(getClientProps()).build()) {
+      String tableName = getUniqueNames(1)[0];
+
+      SortedSet<Text> splits = new TreeSet<>();
+      splits.add(new Text("row_0000000001"));
+      splits.add(new Text("row_0000000002"));
+      splits.add(new Text("row_0000000003"));
+      splits.add(new Text("row_0000000004"));
+      splits.add(new Text("row_0000000005"));
+      splits.add(new Text("row_0000000006"));
+      splits.add(new Text("row_0000000007"));
+      splits.add(new Text("row_0000000008"));
+      splits.add(new Text("row_0000000009"));
+      NewTableConfiguration ntc = new NewTableConfiguration();
+      ntc.withSplits(splits);
+      ntc.withInitialHostingGoal(TabletHostingGoal.ALWAYS); // speed up ingest
+      final int ingestedEntryCount = createTableAndIngest(client, tableName, ntc, 10, 10, "colf");
+
+      String tableId = client.tableOperations().tableIdMap().get(tableName);
+
+      // row 1 -> 3 are always
+      client.tableOperations().setTabletHostingGoal(tableName,
+          new Range(null, true, "row_0000000003", true), TabletHostingGoal.ALWAYS);
+      // row 4 -> 7 are never
+      client.tableOperations().setTabletHostingGoal(tableName,
+          new Range("row_0000000004", true, "row_0000000007", true), TabletHostingGoal.NEVER);
+      // row 8 and 9 are ondemand
+      client.tableOperations().setTabletHostingGoal(tableName,
+          new Range("row_0000000008", true, null, true), TabletHostingGoal.ONDEMAND);
+
+      // Wait for the NEVER and ONDEMAND tablets to be unloaded
+      int hosted = getNumHostedTablets(client, tableId);
+      // Waiting for tablets to be unloaded due to inactivity
+      while (hosted != 3) {
+        Thread.sleep(1000);
+        hosted = getNumHostedTablets(client, tableId);
+      }
+
+      try (Scanner scanner = client.createScanner(tableName, Authorizations.EMPTY)) {
+        scanner.setRange(new Range());
+        scanner.setConsistencyLevel(ConsistencyLevel.EVENTUAL);
+        assertEquals(ingestedEntryCount, Iterables.size(scanner),
+            "The scan server scanner should have seen all ingested and flushed entries");
+        // Throws an exception because of the tablets with the NEVER hosting goal
+        scanner.setConsistencyLevel(ConsistencyLevel.IMMEDIATE);
+        assertThrows(RuntimeException.class, () -> Iterables.size(scanner));
+      } // when the scanner is closed, all open sessions should be closed
+    }
+  }
+
+  @Test
+  public void testBatchScanWithTabletHostingMix() throws Exception {
+    try (AccumuloClient client = Accumulo.newClient().from(getClientProps()).build()) {
+      String tableName = getUniqueNames(1)[0];
+
+      SortedSet<Text> splits = new TreeSet<>();
+      splits.add(new Text("row_0000000001"));
+      splits.add(new Text("row_0000000002"));
+      splits.add(new Text("row_0000000003"));
+      splits.add(new Text("row_0000000004"));
+      splits.add(new Text("row_0000000005"));
+      splits.add(new Text("row_0000000006"));
+      splits.add(new Text("row_0000000007"));
+      splits.add(new Text("row_0000000008"));
+      splits.add(new Text("row_0000000009"));
+      NewTableConfiguration ntc = new NewTableConfiguration();
+      ntc.withSplits(splits);
+      ntc.withInitialHostingGoal(TabletHostingGoal.ALWAYS); // speed up ingest
+      final int ingestedEntryCount = createTableAndIngest(client, tableName, ntc, 10, 10, "colf");
+
+      String tableId = client.tableOperations().tableIdMap().get(tableName);
+
+      // row 1 -> 3 are always
+      client.tableOperations().setTabletHostingGoal(tableName,
+          new Range(null, true, "row_0000000003", true), TabletHostingGoal.ALWAYS);
+      // row 4 -> 7 are never
+      client.tableOperations().setTabletHostingGoal(tableName,
+          new Range("row_0000000004", true, "row_0000000007", true), TabletHostingGoal.NEVER);
+      // row 8 and 9 are ondemand
+      client.tableOperations().setTabletHostingGoal(tableName,
+          new Range("row_0000000008", true, null, true), TabletHostingGoal.ONDEMAND);
+
+      // Wait for the NEVER and ONDEMAND tablets to be unloaded
+      int hosted = getNumHostedTablets(client, tableId);
+      // Waiting for tablets to be unloaded due to inactivity
+      while (hosted != 3) {
+        Thread.sleep(1000);
+        hosted = getNumHostedTablets(client, tableId);
+      }
+
+      try (BatchScanner scanner = client.createBatchScanner(tableName, Authorizations.EMPTY)) {
+        scanner.setRanges(Collections.singleton(new Range()));
+        scanner.setConsistencyLevel(ConsistencyLevel.EVENTUAL);
+        assertEquals(ingestedEntryCount, Iterables.size(scanner),
+            "The scan server scanner should have seen all ingested and flushed entries");
+        // Throws an exception because of the tablets with the NEVER hosting goal
+        scanner.setConsistencyLevel(ConsistencyLevel.IMMEDIATE);
+        assertThrows(RuntimeException.class, () -> Iterables.size(scanner));

Review Comment:
   The above comment was meant for the scanner test, but I made it in the batch scanner test.  So the set range call is not correct.



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

To unsubscribe, e-mail: notifications-unsubscribe@accumulo.apache.org

For queries about this service, please contact Infrastructure at:
users@infra.apache.org


[GitHub] [accumulo] dlmarion merged pull request #3388: Added ScanServer tests for different tablet hosting goals

Posted by "dlmarion (via GitHub)" <gi...@apache.org>.
dlmarion merged PR #3388:
URL: https://github.com/apache/accumulo/pull/3388


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

To unsubscribe, e-mail: notifications-unsubscribe@accumulo.apache.org

For queries about this service, please contact Infrastructure at:
users@infra.apache.org


[GitHub] [accumulo] dlmarion commented on a diff in pull request #3388: Added ScanServer tests for different tablet hosting goals

Posted by "dlmarion (via GitHub)" <gi...@apache.org>.
dlmarion commented on code in PR #3388:
URL: https://github.com/apache/accumulo/pull/3388#discussion_r1193867832


##########
test/src/main/java/org/apache/accumulo/test/ScanServerIT.java:
##########
@@ -224,6 +234,110 @@ public void testBatchScannerTimeout() throws Exception {
     }
   }
 
+  @Test
+  public void testScanWithTabletHostingMix() throws Exception {
+    try (AccumuloClient client = Accumulo.newClient().from(getClientProps()).build()) {
+      String tableName = getUniqueNames(1)[0];
+
+      SortedSet<Text> splits = new TreeSet<>();
+      splits.add(new Text("row_0000000001"));
+      splits.add(new Text("row_0000000002"));
+      splits.add(new Text("row_0000000003"));
+      splits.add(new Text("row_0000000004"));
+      splits.add(new Text("row_0000000005"));
+      splits.add(new Text("row_0000000006"));
+      splits.add(new Text("row_0000000007"));
+      splits.add(new Text("row_0000000008"));
+      splits.add(new Text("row_0000000009"));
+      NewTableConfiguration ntc = new NewTableConfiguration();
+      ntc.withSplits(splits);
+      ntc.withInitialHostingGoal(TabletHostingGoal.ALWAYS); // speed up ingest
+      final int ingestedEntryCount = createTableAndIngest(client, tableName, ntc, 10, 10, "colf");
+
+      String tableId = client.tableOperations().tableIdMap().get(tableName);
+
+      // row 1 -> 3 are always
+      client.tableOperations().setTabletHostingGoal(tableName,
+          new Range(null, true, "row_0000000003", true), TabletHostingGoal.ALWAYS);
+      // row 4 -> 7 are never
+      client.tableOperations().setTabletHostingGoal(tableName,
+          new Range("row_0000000004", true, "row_0000000007", true), TabletHostingGoal.NEVER);
+      // row 8 and 9 are ondemand
+      client.tableOperations().setTabletHostingGoal(tableName,
+          new Range("row_0000000008", true, null, true), TabletHostingGoal.ONDEMAND);
+
+      // Wait for the NEVER and ONDEMAND tablets to be unloaded
+      int hosted = getNumHostedTablets(client, tableId);
+      // Waiting for tablets to be unloaded due to inactivity
+      while (hosted != 3) {
+        Thread.sleep(1000);
+        hosted = getNumHostedTablets(client, tableId);
+      }
+
+      try (Scanner scanner = client.createScanner(tableName, Authorizations.EMPTY)) {
+        scanner.setRange(new Range());
+        scanner.setConsistencyLevel(ConsistencyLevel.EVENTUAL);
+        assertEquals(ingestedEntryCount, Iterables.size(scanner),
+            "The scan server scanner should have seen all ingested and flushed entries");
+        // Throws an exception because of the tablets with the NEVER hosting goal
+        scanner.setConsistencyLevel(ConsistencyLevel.IMMEDIATE);
+        assertThrows(RuntimeException.class, () -> Iterables.size(scanner));
+      } // when the scanner is closed, all open sessions should be closed

Review Comment:
   Added in cabcf0b



##########
test/src/main/java/org/apache/accumulo/test/ScanServerIT.java:
##########
@@ -224,6 +234,110 @@ public void testBatchScannerTimeout() throws Exception {
     }
   }
 
+  @Test
+  public void testScanWithTabletHostingMix() throws Exception {
+    try (AccumuloClient client = Accumulo.newClient().from(getClientProps()).build()) {
+      String tableName = getUniqueNames(1)[0];
+
+      SortedSet<Text> splits = new TreeSet<>();
+      splits.add(new Text("row_0000000001"));
+      splits.add(new Text("row_0000000002"));
+      splits.add(new Text("row_0000000003"));
+      splits.add(new Text("row_0000000004"));
+      splits.add(new Text("row_0000000005"));
+      splits.add(new Text("row_0000000006"));
+      splits.add(new Text("row_0000000007"));
+      splits.add(new Text("row_0000000008"));
+      splits.add(new Text("row_0000000009"));
+      NewTableConfiguration ntc = new NewTableConfiguration();
+      ntc.withSplits(splits);
+      ntc.withInitialHostingGoal(TabletHostingGoal.ALWAYS); // speed up ingest
+      final int ingestedEntryCount = createTableAndIngest(client, tableName, ntc, 10, 10, "colf");
+
+      String tableId = client.tableOperations().tableIdMap().get(tableName);
+
+      // row 1 -> 3 are always
+      client.tableOperations().setTabletHostingGoal(tableName,
+          new Range(null, true, "row_0000000003", true), TabletHostingGoal.ALWAYS);
+      // row 4 -> 7 are never
+      client.tableOperations().setTabletHostingGoal(tableName,
+          new Range("row_0000000004", true, "row_0000000007", true), TabletHostingGoal.NEVER);
+      // row 8 and 9 are ondemand
+      client.tableOperations().setTabletHostingGoal(tableName,
+          new Range("row_0000000008", true, null, true), TabletHostingGoal.ONDEMAND);
+
+      // Wait for the NEVER and ONDEMAND tablets to be unloaded
+      int hosted = getNumHostedTablets(client, tableId);
+      // Waiting for tablets to be unloaded due to inactivity
+      while (hosted != 3) {
+        Thread.sleep(1000);
+        hosted = getNumHostedTablets(client, tableId);
+      }
+
+      try (Scanner scanner = client.createScanner(tableName, Authorizations.EMPTY)) {
+        scanner.setRange(new Range());
+        scanner.setConsistencyLevel(ConsistencyLevel.EVENTUAL);
+        assertEquals(ingestedEntryCount, Iterables.size(scanner),
+            "The scan server scanner should have seen all ingested and flushed entries");
+        // Throws an exception because of the tablets with the NEVER hosting goal
+        scanner.setConsistencyLevel(ConsistencyLevel.IMMEDIATE);
+        assertThrows(RuntimeException.class, () -> Iterables.size(scanner));
+      } // when the scanner is closed, all open sessions should be closed
+    }
+  }
+
+  @Test
+  public void testBatchScanWithTabletHostingMix() throws Exception {
+    try (AccumuloClient client = Accumulo.newClient().from(getClientProps()).build()) {
+      String tableName = getUniqueNames(1)[0];
+
+      SortedSet<Text> splits = new TreeSet<>();
+      splits.add(new Text("row_0000000001"));
+      splits.add(new Text("row_0000000002"));
+      splits.add(new Text("row_0000000003"));
+      splits.add(new Text("row_0000000004"));
+      splits.add(new Text("row_0000000005"));
+      splits.add(new Text("row_0000000006"));
+      splits.add(new Text("row_0000000007"));
+      splits.add(new Text("row_0000000008"));
+      splits.add(new Text("row_0000000009"));
+      NewTableConfiguration ntc = new NewTableConfiguration();
+      ntc.withSplits(splits);
+      ntc.withInitialHostingGoal(TabletHostingGoal.ALWAYS); // speed up ingest
+      final int ingestedEntryCount = createTableAndIngest(client, tableName, ntc, 10, 10, "colf");
+
+      String tableId = client.tableOperations().tableIdMap().get(tableName);
+
+      // row 1 -> 3 are always
+      client.tableOperations().setTabletHostingGoal(tableName,
+          new Range(null, true, "row_0000000003", true), TabletHostingGoal.ALWAYS);
+      // row 4 -> 7 are never
+      client.tableOperations().setTabletHostingGoal(tableName,
+          new Range("row_0000000004", true, "row_0000000007", true), TabletHostingGoal.NEVER);
+      // row 8 and 9 are ondemand
+      client.tableOperations().setTabletHostingGoal(tableName,
+          new Range("row_0000000008", true, null, true), TabletHostingGoal.ONDEMAND);
+
+      // Wait for the NEVER and ONDEMAND tablets to be unloaded
+      int hosted = getNumHostedTablets(client, tableId);
+      // Waiting for tablets to be unloaded due to inactivity
+      while (hosted != 3) {
+        Thread.sleep(1000);
+        hosted = getNumHostedTablets(client, tableId);
+      }
+
+      try (BatchScanner scanner = client.createBatchScanner(tableName, Authorizations.EMPTY)) {
+        scanner.setRanges(Collections.singleton(new Range()));
+        scanner.setConsistencyLevel(ConsistencyLevel.EVENTUAL);
+        assertEquals(ingestedEntryCount, Iterables.size(scanner),
+            "The scan server scanner should have seen all ingested and flushed entries");
+        // Throws an exception because of the tablets with the NEVER hosting goal
+        scanner.setConsistencyLevel(ConsistencyLevel.IMMEDIATE);
+        assertThrows(RuntimeException.class, () -> Iterables.size(scanner));

Review Comment:
   Added in cabcf0b



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

To unsubscribe, e-mail: notifications-unsubscribe@accumulo.apache.org

For queries about this service, please contact Infrastructure at:
users@infra.apache.org