This is an automated email from the ASF dual-hosted git repository.
kturner pushed a commit to branch main
in repository https://gitbox.apache.org/repos/asf/accumulo.git
The following commit(s) were added to refs/heads/main by this push:
new b31886a9e9 test transitioning tablets from hosted to ondemand (#5929)
b31886a9e9 is described below
commit b31886a9e96d1f5f9fb4d121746343780a0d9f15
Author: Keith Turner <[email protected]>
AuthorDate: Wed Sep 24 16:06:07 2025 -0400
test transitioning tablets from hosted to ondemand (#5929)
Co-authored-by: Christopher Tubbs <[email protected]>
---
.../test/functional/OnDemandTabletUnloadingIT.java | 45 ++++++++++++++++++++++
1 file changed, 45 insertions(+)
diff --git
a/test/src/main/java/org/apache/accumulo/test/functional/OnDemandTabletUnloadingIT.java
b/test/src/main/java/org/apache/accumulo/test/functional/OnDemandTabletUnloadingIT.java
index 1c03cf9948..a8e3db0460 100644
---
a/test/src/main/java/org/apache/accumulo/test/functional/OnDemandTabletUnloadingIT.java
+++
b/test/src/main/java/org/apache/accumulo/test/functional/OnDemandTabletUnloadingIT.java
@@ -20,6 +20,7 @@ package org.apache.accumulo.test.functional;
import static
org.apache.accumulo.core.metrics.Metric.TSERVER_TABLETS_ONLINE_ONDEMAND;
import static org.junit.jupiter.api.Assertions.assertEquals;
+import static org.junit.jupiter.api.Assertions.assertFalse;
import static org.junit.jupiter.api.Assertions.assertTrue;
import java.util.HashSet;
@@ -41,6 +42,7 @@ import org.apache.accumulo.core.client.Scanner;
import org.apache.accumulo.core.client.ScannerBase;
import org.apache.accumulo.core.client.TableNotFoundException;
import org.apache.accumulo.core.client.admin.NewTableConfiguration;
+import org.apache.accumulo.core.client.admin.TabletAvailability;
import org.apache.accumulo.core.clientImpl.ClientContext;
import org.apache.accumulo.core.conf.Property;
import org.apache.accumulo.core.data.Mutation;
@@ -169,6 +171,49 @@ public class OnDemandTabletUnloadingIT extends
SharedMiniClusterBase {
}
}
+ /**
+ * Test the behavior of transitioning tablets from having a tablet
availability of HOSTED to
+ * ONDEMAND. This transition should cause all tablets to unload because
tablets are hosted but do
+ * not have a hosting requested column set.
+ */
+ @Test
+ public void testTransitionFromHostedToOndemand() throws Exception {
+ try (AccumuloClient c =
Accumulo.newClient().from(getClientProps()).build()) {
+
+ String tableName = super.getUniqueNames(1)[0];
+
+ var splits = new TreeSet<>(Set.of(new Text("f"), new Text("m"), new
Text("t")));
+ var ntc = new NewTableConfiguration().withSplits(splits);
+ // set this really high because the manager should unassign tablets
because of a lack of a
+ // hosting requested column
+ ntc.setProperties(
+ Map.of(LastAccessTimeOnDemandTabletUnloader.INACTIVITY_THRESHOLD,
"1000000"));
+ ntc.withInitialTabletAvailability(TabletAvailability.HOSTED);
+ c.tableOperations().create(tableName, ntc);
+ String tableId = c.tableOperations().tableIdMap().get(tableName);
+
+ // wait for all tablets in table to be hosted
+ Wait.waitFor(() -> ManagerAssignmentIT.countTabletsWithLocation(c,
TableId.of(tableId)) == 4);
+
+ // transition all tablets to ondemand. Since no tablets have a hosting
requested column set
+ // the manager should unassign all tablets.
+ c.tableOperations().setTabletAvailability(tableName, new Range(),
+ TabletAvailability.ONDEMAND);
+
+ Wait.waitFor(() -> ManagerAssignmentIT.countTabletsWithLocation(c,
TableId.of(tableId)) == 0);
+
+ // scan tablet.
+ try (var scanner = c.createScanner(tableName)) {
+ scanner.setRange(new Range("h"));
+ assertFalse(scanner.iterator().hasNext());
+ }
+
+ // ensure only one tablet is hosted now since we transitioned all
tablets to ONDEMAND
+ Wait.waitFor(() -> ManagerAssignmentIT.countTabletsWithLocation(c,
TableId.of(tableId)) == 1);
+ Wait.waitFor(() -> ONDEMAND_ONLINE_COUNT == 1);
+ }
+ }
+
private static void verifyDataForScan(AccumuloClient c, String tableName)
throws TableNotFoundException, AccumuloSecurityException,
AccumuloException {