diff --git a/core/src/main/java/org/apache/accumulo/core/client/admin/TableOperations.java b/core/src/main/java/org/apache/accumulo/core/client/admin/TableOperations.java index 5ab6a89e7c2..8d0c3d5107e 100644 --- a/core/src/main/java/org/apache/accumulo/core/client/admin/TableOperations.java +++ b/core/src/main/java/org/apache/accumulo/core/client/admin/TableOperations.java @@ -1063,16 +1063,15 @@ default TimeType getTimeType(String tableName) throws TableNotFoundException { /** * Sets the tablet availability for a range of Tablets in the specified table, but does not wait - * for the tablets to reach this availability state. For the Range parameter, note that the Row - * portion of the start and end Keys and the inclusivity parameters are used when determining the - * range of affected tablets. The other portions of the start and end Keys are not used. + * for the tablets to reach this availability state. The supplied row range is compared against + * the tablets' start/end rows using its lower/upper bounds and inclusivity flags. * * @param tableName table name - * @param range tablet range + * @param rowRange tablet row range * @param tabletAvailability tablet availability * @since 4.0.0 */ - default void setTabletAvailability(String tableName, Range range, + default void setTabletAvailability(String tableName, RowRange rowRange, TabletAvailability tabletAvailability) throws AccumuloSecurityException, AccumuloException, TableNotFoundException { throw new UnsupportedOperationException(); diff --git a/core/src/main/java/org/apache/accumulo/core/client/admin/TabletAvailability.java b/core/src/main/java/org/apache/accumulo/core/client/admin/TabletAvailability.java index 34f0ae2a253..512cba250e7 100644 --- a/core/src/main/java/org/apache/accumulo/core/client/admin/TabletAvailability.java +++ b/core/src/main/java/org/apache/accumulo/core/client/admin/TabletAvailability.java @@ -18,9 +18,10 @@ */ package org.apache.accumulo.core.client.admin; +import org.apache.accumulo.core.data.RowRange; + /** - * @see TableOperations#setTabletAvailability(String, org.apache.accumulo.core.data.Range, - * TabletAvailability) + * @see TableOperations#setTabletAvailability(String, RowRange, TabletAvailability) * @since 4.0.0 */ public enum TabletAvailability { diff --git a/core/src/main/java/org/apache/accumulo/core/clientImpl/TableOperationsImpl.java b/core/src/main/java/org/apache/accumulo/core/clientImpl/TableOperationsImpl.java index 11a07f02d76..e59736a70ce 100644 --- a/core/src/main/java/org/apache/accumulo/core/clientImpl/TableOperationsImpl.java +++ b/core/src/main/java/org/apache/accumulo/core/clientImpl/TableOperationsImpl.java @@ -2210,16 +2210,18 @@ private void validatePropertiesToSet(Map opts, Map } @Override - public void setTabletAvailability(String tableName, Range range, TabletAvailability availability) - throws AccumuloSecurityException, AccumuloException { + public void setTabletAvailability(String tableName, RowRange rowRange, + TabletAvailability availability) throws AccumuloSecurityException, AccumuloException { EXISTING_TABLE_NAME.validate(tableName); if (SystemTables.containsTableName(tableName)) { throw new AccumuloException("Cannot set set tablet availability for table " + tableName); } - checkArgument(range != null, "range is null"); + checkArgument(rowRange != null, "rowRange is null"); checkArgument(availability != null, "tabletAvailability is null"); + Range range = rowRange.asRange(); + byte[] bRange; try { bRange = new TSerializer().serialize(range.toThrift()); diff --git a/core/src/test/java/org/apache/accumulo/core/clientImpl/TableOperationsHelperTest.java b/core/src/test/java/org/apache/accumulo/core/clientImpl/TableOperationsHelperTest.java index 040d21fd0ae..90329f497d7 100644 --- a/core/src/test/java/org/apache/accumulo/core/clientImpl/TableOperationsHelperTest.java +++ b/core/src/test/java/org/apache/accumulo/core/clientImpl/TableOperationsHelperTest.java @@ -212,7 +212,7 @@ public void offline(String tableName, boolean wait) {} public void online(String tableName, boolean wait) {} @Override - public void setTabletAvailability(String tableName, Range range, + public void setTabletAvailability(String tableName, RowRange rowRange, TabletAvailability tabletAvailability) throws AccumuloSecurityException, AccumuloException, TableNotFoundException {} diff --git a/shell/src/main/java/org/apache/accumulo/shell/commands/SetAvailabilityCommand.java b/shell/src/main/java/org/apache/accumulo/shell/commands/SetAvailabilityCommand.java index e47d79cceab..36ecc192967 100644 --- a/shell/src/main/java/org/apache/accumulo/shell/commands/SetAvailabilityCommand.java +++ b/shell/src/main/java/org/apache/accumulo/shell/commands/SetAvailabilityCommand.java @@ -24,7 +24,7 @@ import org.apache.accumulo.core.client.AccumuloSecurityException; import org.apache.accumulo.core.client.TableNotFoundException; import org.apache.accumulo.core.client.admin.TabletAvailability; -import org.apache.accumulo.core.data.Range; +import org.apache.accumulo.core.data.RowRange; import org.apache.accumulo.shell.Shell; import org.apache.commons.cli.CommandLine; import org.apache.commons.cli.Option; @@ -38,7 +38,7 @@ public class SetAvailabilityCommand extends TableOperation { private Option optEndRowExclusive; private Option availabilityOpt; - private Range range; + private RowRange rowRange; private TabletAvailability tabletAvailability; @Override @@ -54,10 +54,10 @@ public String description() { @Override protected void doTableOp(final Shell shellState, final String tableName) throws AccumuloException, AccumuloSecurityException, TableNotFoundException, IOException { - shellState.getAccumuloClient().tableOperations().setTabletAvailability(tableName, range, + shellState.getAccumuloClient().tableOperations().setTabletAvailability(tableName, rowRange, tabletAvailability); Shell.log.debug("Set tablet availability: {} on table: {}, range: {}", tabletAvailability, - tableName, range); + tableName, rowRange); } @Override @@ -73,13 +73,14 @@ public int execute(final String fullCommand, final CommandLine cl, final Shell s } if (cl.hasOption(optRow.getOpt())) { - this.range = new Range(new Text(cl.getOptionValue(optRow.getOpt()).getBytes(Shell.CHARSET))); + this.rowRange = + RowRange.closed(new Text(cl.getOptionValue(optRow.getOpt()).getBytes(Shell.CHARSET))); } else { Text startRow = OptUtil.getStartRow(cl); Text endRow = OptUtil.getEndRow(cl); final boolean startInclusive = !cl.hasOption(optStartRowExclusive.getOpt()); final boolean endInclusive = !cl.hasOption(optEndRowExclusive.getOpt()); - this.range = new Range(startRow, startInclusive, endRow, endInclusive); + this.rowRange = RowRange.range(startRow, startInclusive, endRow, endInclusive); } this.tabletAvailability = diff --git a/test/src/main/java/org/apache/accumulo/test/ComprehensiveITBase.java b/test/src/main/java/org/apache/accumulo/test/ComprehensiveITBase.java index 798e33252c6..a863b664fca 100644 --- a/test/src/main/java/org/apache/accumulo/test/ComprehensiveITBase.java +++ b/test/src/main/java/org/apache/accumulo/test/ComprehensiveITBase.java @@ -850,7 +850,7 @@ public void testCreateTableWithManyOptions() throws Exception { // set last tablet in table to always be HOSTED, setting a tablet availability here will test // export and cloning tables with tablet availabilities client.tableOperations().setTabletAvailability(everythingTable, - new Range(everythingSplits.last(), false, null, true), TabletAvailability.HOSTED); + RowRange.greaterThan(everythingSplits.last()), TabletAvailability.HOSTED); write(client, everythingTable, generateMutations(0, 100, tr -> true)); diff --git a/test/src/main/java/org/apache/accumulo/test/ComprehensiveTableOperationsIT.java b/test/src/main/java/org/apache/accumulo/test/ComprehensiveTableOperationsIT.java index 100168f9157..b3fdcbc463d 100644 --- a/test/src/main/java/org/apache/accumulo/test/ComprehensiveTableOperationsIT.java +++ b/test/src/main/java/org/apache/accumulo/test/ComprehensiveTableOperationsIT.java @@ -801,7 +801,7 @@ public void test_setTabletAvailability_getTabletInformation() throws Exception { for (var sysTable : SystemTables.tableNames()) { // should not be able to unhost any system table assertThrows(AccumuloException.class, - () -> ops.setTabletAvailability(sysTable, new Range(), TabletAvailability.UNHOSTED)); + () -> ops.setTabletAvailability(sysTable, RowRange.all(), TabletAvailability.UNHOSTED)); assertTrue(ops.getTabletInformation(sysTable, List.of(RowRange.all())).findAny().isPresent()); ops.getTabletInformation(sysTable, List.of(RowRange.all())) .forEach(ti -> assertEquals(TabletAvailability.HOSTED, ti.getTabletAvailability())); diff --git a/test/src/main/java/org/apache/accumulo/test/ImportExportIT.java b/test/src/main/java/org/apache/accumulo/test/ImportExportIT.java index a0172897944..23fa026d125 100644 --- a/test/src/main/java/org/apache/accumulo/test/ImportExportIT.java +++ b/test/src/main/java/org/apache/accumulo/test/ImportExportIT.java @@ -367,9 +367,9 @@ public void testImportedTableIsOnDemand() throws Exception { // add split 'h' and 'q'. Leave first as ONDEMAND, set second to UNHOSTED, and third to HOSTED SortedSet splits = Sets.newTreeSet(Arrays.asList(new Text("h"), new Text("q"))); client.tableOperations().addSplits(srcTable, splits); - Range range = new Range(new Text("h"), false, new Text("q"), true); + RowRange range = RowRange.openClosed(new Text("h"), new Text("q")); client.tableOperations().setTabletAvailability(srcTable, range, TabletAvailability.UNHOSTED); - range = new Range(new Text("q"), false, null, true); + range = RowRange.greaterThan(new Text("q")); client.tableOperations().setTabletAvailability(srcTable, range, TabletAvailability.HOSTED); // verify diff --git a/test/src/main/java/org/apache/accumulo/test/LocatorIT.java b/test/src/main/java/org/apache/accumulo/test/LocatorIT.java index ff89e81b922..eea4ee57332 100644 --- a/test/src/main/java/org/apache/accumulo/test/LocatorIT.java +++ b/test/src/main/java/org/apache/accumulo/test/LocatorIT.java @@ -44,6 +44,7 @@ import org.apache.accumulo.core.client.admin.TabletAvailability; import org.apache.accumulo.core.client.admin.servers.ServerId; import org.apache.accumulo.core.data.Range; +import org.apache.accumulo.core.data.RowRange; import org.apache.accumulo.core.data.TableId; import org.apache.accumulo.core.data.TabletId; import org.apache.accumulo.core.dataImpl.KeyExtent; @@ -129,7 +130,7 @@ public void testBasic() throws Exception { ranges.clear(); - tableOps.setTabletAvailability(tableName, new Range(), TabletAvailability.HOSTED); + tableOps.setTabletAvailability(tableName, RowRange.all(), TabletAvailability.HOSTED); Wait.waitFor(() -> hostedAndCurrentNotNull .test(ManagerAssignmentIT.getTabletMetadata(client, tableId, null)), 60000, 250); diff --git a/test/src/main/java/org/apache/accumulo/test/ScanServerIT.java b/test/src/main/java/org/apache/accumulo/test/ScanServerIT.java index b4155d506af..9507dbe3fb8 100644 --- a/test/src/main/java/org/apache/accumulo/test/ScanServerIT.java +++ b/test/src/main/java/org/apache/accumulo/test/ScanServerIT.java @@ -56,6 +56,7 @@ import org.apache.accumulo.core.conf.ClientProperty; import org.apache.accumulo.core.conf.Property; import org.apache.accumulo.core.data.Range; +import org.apache.accumulo.core.data.RowRange; import org.apache.accumulo.core.data.TableId; import org.apache.accumulo.core.fate.FateId; import org.apache.accumulo.core.fate.FateInstanceType; @@ -254,7 +255,7 @@ public void testScanTabletsWithOperationIds() throws Exception { // Unload all tablets TableId tid = TableId.of(client.tableOperations().tableIdMap().get(tableName)); - client.tableOperations().setTabletAvailability(tableName, new Range((Text) null, (Text) null), + client.tableOperations().setTabletAvailability(tableName, RowRange.all(), TabletAvailability.ONDEMAND); // Wait for the tablets to be unloaded @@ -373,14 +374,14 @@ protected static int setupTableWithTabletAvailabilityMix(AccumuloClient client, String tableId = client.tableOperations().tableIdMap().get(tableName); // row 1 -> 3 are HOSTED - client.tableOperations().setTabletAvailability(tableName, - new Range(null, true, "row_0000000003", true), TabletAvailability.HOSTED); + client.tableOperations().setTabletAvailability(tableName, RowRange.atMost("row_0000000003"), + TabletAvailability.HOSTED); // row 4 -> 7 are UNHOSTED client.tableOperations().setTabletAvailability(tableName, - new Range("row_0000000004", true, "row_0000000007", true), TabletAvailability.UNHOSTED); + RowRange.closed("row_0000000004", "row_0000000007"), TabletAvailability.UNHOSTED); // row 8 and 9 are ondemand - client.tableOperations().setTabletAvailability(tableName, - new Range("row_0000000008", true, null, true), TabletAvailability.ONDEMAND); + client.tableOperations().setTabletAvailability(tableName, RowRange.atLeast("row_0000000008"), + TabletAvailability.ONDEMAND); // Wait for the UNHOSTED and ONDEMAND tablets to be unloaded due to inactivity Wait.waitFor(() -> ScanServerIT.getNumHostedTablets(client, tableId) == 3, 30_000, 1_000); diff --git a/test/src/main/java/org/apache/accumulo/test/TableOperationsIT.java b/test/src/main/java/org/apache/accumulo/test/TableOperationsIT.java index 7414e0a7cb6..cfb633f088d 100644 --- a/test/src/main/java/org/apache/accumulo/test/TableOperationsIT.java +++ b/test/src/main/java/org/apache/accumulo/test/TableOperationsIT.java @@ -67,7 +67,6 @@ import org.apache.accumulo.core.data.Key; import org.apache.accumulo.core.data.Mutation; import org.apache.accumulo.core.data.PartialKey; -import org.apache.accumulo.core.data.Range; import org.apache.accumulo.core.data.RowRange; import org.apache.accumulo.core.data.TableId; import org.apache.accumulo.core.data.TabletId; @@ -614,14 +613,14 @@ public void testGetTabletAvailability_MixedAvailabilities() throws AccumuloExcep accumuloClient.tableOperations().create(tableName, ntc); // set each tablet with a different availability and query to see if they are set accordingly - Range range = new Range(null, false, new Text("d"), true); - accumuloClient.tableOperations().setTabletAvailability(tableName, range, + RowRange rowRange = RowRange.atMost(new Text("d")); + accumuloClient.tableOperations().setTabletAvailability(tableName, rowRange, TabletAvailability.UNHOSTED); - range = new Range(new Text("m"), false, new Text("s"), true); - accumuloClient.tableOperations().setTabletAvailability(tableName, range, + rowRange = RowRange.openClosed(new Text("m"), new Text("s")); + accumuloClient.tableOperations().setTabletAvailability(tableName, rowRange, TabletAvailability.HOSTED); - range = new Range(new Text("s"), false, null, true); - accumuloClient.tableOperations().setTabletAvailability(tableName, range, + rowRange = RowRange.greaterThan(new Text("s")); + accumuloClient.tableOperations().setTabletAvailability(tableName, rowRange, TabletAvailability.UNHOSTED); Map idMap = accumuloClient.tableOperations().tableIdMap(); @@ -663,12 +662,12 @@ public void testGetTabletAvailability_NonSplitBoundaries() throws AccumuloExcept // set each different availability for each tablet and query to see if they are set // accordingly - accumuloClient.tableOperations().setTabletAvailability(tableName, new Range(new Text("d")), - TabletAvailability.HOSTED); - accumuloClient.tableOperations().setTabletAvailability(tableName, new Range(new Text("m")), - TabletAvailability.UNHOSTED); - accumuloClient.tableOperations().setTabletAvailability(tableName, new Range(new Text("s")), - TabletAvailability.HOSTED); + accumuloClient.tableOperations().setTabletAvailability(tableName, + RowRange.closed(new Text("d")), TabletAvailability.HOSTED); + accumuloClient.tableOperations().setTabletAvailability(tableName, + RowRange.closed(new Text("m")), TabletAvailability.UNHOSTED); + accumuloClient.tableOperations().setTabletAvailability(tableName, + RowRange.closed(new Text("s")), TabletAvailability.HOSTED); idMap = accumuloClient.tableOperations().tableIdMap(); tableId = idMap.get(tableName); @@ -679,8 +678,8 @@ public void testGetTabletAvailability_NonSplitBoundaries() throws AccumuloExcept verifyTabletAvailabilities(tableName, RowRange.closed("a"), expectedTabletAvailability); // test using startRowInclusive set to true - RowRange range = RowRange.closed(new Text("c")); - verifyTabletAvailabilities(tableName, range, expectedTabletAvailability); + RowRange rowRange = RowRange.closed(new Text("c")); + verifyTabletAvailabilities(tableName, rowRange, expectedTabletAvailability); expectedTabletAvailability.clear(); setExpectedTabletAvailability(expectedTabletAvailability, tableId, "m", "d", @@ -688,8 +687,8 @@ public void testGetTabletAvailability_NonSplitBoundaries() throws AccumuloExcept setExpectedTabletAvailability(expectedTabletAvailability, tableId, "s", "m", TabletAvailability.HOSTED); - range = RowRange.closed(new Text("m"), new Text("p")); - verifyTabletAvailabilities(tableName, range, expectedTabletAvailability); + rowRange = RowRange.closed(new Text("m"), new Text("p")); + verifyTabletAvailabilities(tableName, rowRange, expectedTabletAvailability); expectedTabletAvailability.clear(); setExpectedTabletAvailability(expectedTabletAvailability, tableId, "d", null, @@ -701,8 +700,8 @@ public void testGetTabletAvailability_NonSplitBoundaries() throws AccumuloExcept setExpectedTabletAvailability(expectedTabletAvailability, tableId, null, "s", TabletAvailability.ONDEMAND); - range = RowRange.openClosed("b", "t"); - verifyTabletAvailabilities(tableName, range, expectedTabletAvailability); + rowRange = RowRange.openClosed("b", "t"); + verifyTabletAvailabilities(tableName, rowRange, expectedTabletAvailability); } finally { accumuloClient.tableOperations().delete(tableName); @@ -722,7 +721,7 @@ public void testGetTabletAvailability_DelayedSplits() throws AccumuloException, Map idMap = accumuloClient.tableOperations().tableIdMap(); // set goals to HOSTED - accumuloClient.tableOperations().setTabletAvailability(tableName, new Range(), + accumuloClient.tableOperations().setTabletAvailability(tableName, RowRange.all(), TabletAvailability.HOSTED); Map expectedTabletAvailability = new HashMap<>(); @@ -773,11 +772,11 @@ public void testGetTabletAvailability_StaggeredSplits() throws AccumuloException // add split 'h' and 'q'. Leave first as ONDEMAND, set second to UNHOSTED, and third to HOSTED SortedSet splits = Sets.newTreeSet(Arrays.asList(new Text("h"), new Text("q"))); accumuloClient.tableOperations().addSplits(tableName, splits); - Range range = new Range(new Text("h"), false, new Text("q"), true); - accumuloClient.tableOperations().setTabletAvailability(tableName, range, + RowRange rowRange = RowRange.openClosed(new Text("h"), new Text("q")); + accumuloClient.tableOperations().setTabletAvailability(tableName, rowRange, TabletAvailability.UNHOSTED); - range = new Range(new Text("q"), false, null, true); - accumuloClient.tableOperations().setTabletAvailability(tableName, range, + rowRange = RowRange.greaterThan(new Text("q")); + accumuloClient.tableOperations().setTabletAvailability(tableName, rowRange, TabletAvailability.HOSTED); // verify @@ -869,17 +868,18 @@ private void verifyTablesWithSplits(String tableName, Map idMap, expectedTabletAvailability); } - public static void verifyTabletAvailabilities(String tableName, RowRange range, + public static void verifyTabletAvailabilities(String tableName, RowRange rowRange, Map expectedAvailability) throws TableNotFoundException { - verifyTabletAvailabilities(accumuloClient, tableName, range, expectedAvailability); + verifyTabletAvailabilities(accumuloClient, tableName, rowRange, expectedAvailability); } public static void verifyTabletAvailabilities(AccumuloClient client, String tableName, - RowRange range, Map expectedAvailability) + RowRange rowRange, Map expectedAvailability) throws TableNotFoundException { - Map seenAvailability = - client.tableOperations().getTabletInformation(tableName, List.of(range)).collect(Collectors - .toMap(TabletInformation::getTabletId, TabletInformation::getTabletAvailability)); + Map seenAvailability = client.tableOperations() + .getTabletInformation(tableName, List.of(rowRange)).collect(Collectors + .toMap(TabletInformation::getTabletId, TabletInformation::getTabletAvailability)); assertEquals(expectedAvailability, seenAvailability); } diff --git a/test/src/main/java/org/apache/accumulo/test/TestDualAssignment.java b/test/src/main/java/org/apache/accumulo/test/TestDualAssignment.java index d04ff0d68f0..3c3525e7a6f 100644 --- a/test/src/main/java/org/apache/accumulo/test/TestDualAssignment.java +++ b/test/src/main/java/org/apache/accumulo/test/TestDualAssignment.java @@ -31,7 +31,7 @@ import org.apache.accumulo.core.client.admin.NewTableConfiguration; import org.apache.accumulo.core.client.admin.TabletAvailability; import org.apache.accumulo.core.conf.Property; -import org.apache.accumulo.core.data.Range; +import org.apache.accumulo.core.data.RowRange; import org.apache.accumulo.core.dataImpl.KeyExtent; import org.apache.accumulo.core.metadata.schema.TabletMetadata; import org.apache.accumulo.miniclusterImpl.MiniAccumuloConfigImpl; @@ -83,7 +83,7 @@ public void test() throws Exception { // This operation will fail when there are two locations set on a tablet assertThrows(AccumuloException.class, () -> c.tableOperations().setTabletAvailability(table, - new Range(), TabletAvailability.HOSTED)); + RowRange.all(), TabletAvailability.HOSTED)); try (var scanner = c.createScanner(table)) { // should not be able to scan the table when a tablet has multiple locations @@ -116,7 +116,7 @@ public void test() throws Exception { } // this should no longer fail - c.tableOperations().setTabletAvailability(table, new Range(), TabletAvailability.HOSTED); + c.tableOperations().setTabletAvailability(table, RowRange.all(), TabletAvailability.HOSTED); } } } diff --git a/test/src/main/java/org/apache/accumulo/test/functional/BulkNewIT.java b/test/src/main/java/org/apache/accumulo/test/functional/BulkNewIT.java index 271a410246f..bab8086c87b 100644 --- a/test/src/main/java/org/apache/accumulo/test/functional/BulkNewIT.java +++ b/test/src/main/java/org/apache/accumulo/test/functional/BulkNewIT.java @@ -1130,11 +1130,11 @@ public void testAvailability() throws Exception { addSplits(c, tableName, "0100 0200 0300 0400 0500"); - c.tableOperations().setTabletAvailability(tableName, new Range("0100", false, "0200", true), + c.tableOperations().setTabletAvailability(tableName, RowRange.openClosed("0100", "0200"), TabletAvailability.HOSTED); - c.tableOperations().setTabletAvailability(tableName, new Range("0300", false, "0400", true), + c.tableOperations().setTabletAvailability(tableName, RowRange.openClosed("0300", "0400"), TabletAvailability.HOSTED); - c.tableOperations().setTabletAvailability(tableName, new Range("0400", false, null, true), + c.tableOperations().setTabletAvailability(tableName, RowRange.greaterThan("0400"), TabletAvailability.UNHOSTED); // verify tablet availabilities are as expected diff --git a/test/src/main/java/org/apache/accumulo/test/functional/FlushNoFileIT.java b/test/src/main/java/org/apache/accumulo/test/functional/FlushNoFileIT.java index e6d0943a2d7..b70cb831a8c 100644 --- a/test/src/main/java/org/apache/accumulo/test/functional/FlushNoFileIT.java +++ b/test/src/main/java/org/apache/accumulo/test/functional/FlushNoFileIT.java @@ -42,6 +42,7 @@ import org.apache.accumulo.core.data.Key; import org.apache.accumulo.core.data.Mutation; import org.apache.accumulo.core.data.Range; +import org.apache.accumulo.core.data.RowRange; import org.apache.accumulo.core.data.TableId; import org.apache.accumulo.core.data.Value; import org.apache.accumulo.core.dataImpl.KeyExtent; @@ -126,7 +127,8 @@ public void test() throws Exception { }); // Host all tablets - c.tableOperations().setTabletAvailability(tableName, new Range(), TabletAvailability.HOSTED); + c.tableOperations().setTabletAvailability(tableName, RowRange.all(), + TabletAvailability.HOSTED); // Wait for all tablets to be hosted Wait.waitFor(() -> ManagerAssignmentIT.countTabletsWithLocation(c, tableId) == 3); diff --git a/test/src/main/java/org/apache/accumulo/test/functional/ManagerAssignmentIT.java b/test/src/main/java/org/apache/accumulo/test/functional/ManagerAssignmentIT.java index d4b5d9655a2..aec39e56f7e 100644 --- a/test/src/main/java/org/apache/accumulo/test/functional/ManagerAssignmentIT.java +++ b/test/src/main/java/org/apache/accumulo/test/functional/ManagerAssignmentIT.java @@ -61,6 +61,7 @@ import org.apache.accumulo.core.data.Mutation; import org.apache.accumulo.core.data.Range; import org.apache.accumulo.core.data.ResourceGroupId; +import org.apache.accumulo.core.data.RowRange; import org.apache.accumulo.core.data.TableId; import org.apache.accumulo.core.dataImpl.KeyExtent; import org.apache.accumulo.core.fate.FateId; @@ -180,7 +181,7 @@ public void test() throws Exception { assertEquals(TabletAvailability.ONDEMAND, online.getTabletAvailability()); // set the tablet availability to HOSTED - client.tableOperations().setTabletAvailability(tableName, new Range(), + client.tableOperations().setTabletAvailability(tableName, RowRange.all(), TabletAvailability.HOSTED); Predicate hostedOrCurrentNotNull = @@ -196,7 +197,7 @@ public void test() throws Exception { assertEquals(TabletAvailability.HOSTED, always.getTabletAvailability()); // set the hosting availability to never - client.tableOperations().setTabletAvailability(tableName, new Range(), + client.tableOperations().setTabletAvailability(tableName, RowRange.all(), TabletAvailability.UNHOSTED); Predicate unhostedOrCurrentNull = t -> (t.getTabletAvailability() == TabletAvailability.UNHOSTED && !t.hasCurrent()); @@ -210,7 +211,7 @@ public void test() throws Exception { assertEquals(TabletAvailability.UNHOSTED, unhosted.getTabletAvailability()); // set the tablet availability to ONDEMAND - client.tableOperations().setTabletAvailability(tableName, new Range(), + client.tableOperations().setTabletAvailability(tableName, RowRange.all(), TabletAvailability.ONDEMAND); Predicate ondemandHosted = t -> t.getTabletAvailability() == TabletAvailability.ONDEMAND; diff --git a/test/src/main/java/org/apache/accumulo/test/functional/MergeTabletsITBase.java b/test/src/main/java/org/apache/accumulo/test/functional/MergeTabletsITBase.java index 80870f43bca..5a43744bd95 100644 --- a/test/src/main/java/org/apache/accumulo/test/functional/MergeTabletsITBase.java +++ b/test/src/main/java/org/apache/accumulo/test/functional/MergeTabletsITBase.java @@ -57,6 +57,7 @@ import org.apache.accumulo.core.data.Mutation; import org.apache.accumulo.core.data.Range; import org.apache.accumulo.core.data.ResourceGroupId; +import org.apache.accumulo.core.data.RowRange; import org.apache.accumulo.core.data.TableId; import org.apache.accumulo.core.data.Value; import org.apache.accumulo.core.dataImpl.KeyExtent; @@ -176,9 +177,9 @@ public void merge() throws Exception { bw.addMutation(m); } } - c.tableOperations().setTabletAvailability(tableName, new Range("d", "e"), + c.tableOperations().setTabletAvailability(tableName, RowRange.closed("d", "e"), TabletAvailability.HOSTED); - c.tableOperations().setTabletAvailability(tableName, new Range("e", "f"), + c.tableOperations().setTabletAvailability(tableName, RowRange.closed("e", "f"), TabletAvailability.UNHOSTED); c.tableOperations().flush(tableName, null, null, true); c.tableOperations().merge(tableName, new Text("c1"), new Text("f1")); 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 a8e3db04603..560583ab35e 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 @@ -47,6 +47,7 @@ import org.apache.accumulo.core.conf.Property; import org.apache.accumulo.core.data.Mutation; import org.apache.accumulo.core.data.Range; +import org.apache.accumulo.core.data.RowRange; import org.apache.accumulo.core.data.TableId; import org.apache.accumulo.core.metadata.schema.TabletMetadata; import org.apache.accumulo.core.spi.ondemand.LastAccessTimeOnDemandTabletUnloader; @@ -197,7 +198,7 @@ public void testTransitionFromHostedToOndemand() throws Exception { // 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(), + c.tableOperations().setTabletAvailability(tableName, RowRange.all(), TabletAvailability.ONDEMAND); Wait.waitFor(() -> ManagerAssignmentIT.countTabletsWithLocation(c, TableId.of(tableId)) == 0); diff --git a/test/src/main/java/org/apache/accumulo/test/functional/SplitMillionIT.java b/test/src/main/java/org/apache/accumulo/test/functional/SplitMillionIT.java index 4bf4a3d4511..57eeb684157 100644 --- a/test/src/main/java/org/apache/accumulo/test/functional/SplitMillionIT.java +++ b/test/src/main/java/org/apache/accumulo/test/functional/SplitMillionIT.java @@ -176,7 +176,7 @@ public void testOneMillionTablets() throws Exception { // of the tablets for the clone table will be hosted. The subsequent merge operation // is a metadata-only operation unless the tablet is hosted. If the tablet is hosted // then the tablet has to be closed making the merge operation take longer. - c.tableOperations().setTabletAvailability(tableName, new Range(), + c.tableOperations().setTabletAvailability(tableName, RowRange.all(), TabletAvailability.UNHOSTED); // clone the table to test cloning with lots of tablets and also to give merge its own table diff --git a/test/src/main/java/org/apache/accumulo/test/functional/TabletAvailabilityIT.java b/test/src/main/java/org/apache/accumulo/test/functional/TabletAvailabilityIT.java index 6dbb58f21ae..7d1ac7d1ebc 100644 --- a/test/src/main/java/org/apache/accumulo/test/functional/TabletAvailabilityIT.java +++ b/test/src/main/java/org/apache/accumulo/test/functional/TabletAvailabilityIT.java @@ -57,7 +57,7 @@ public void testSystemFails() throws Exception { try (AccumuloClient client = Accumulo.newClient().from(getClientProps()).build()) { for (SystemTables t : SystemTables.values()) { assertThrows(AccumuloException.class, () -> client.tableOperations() - .setTabletAvailability(t.tableName(), new Range(), UNHOSTED)); + .setTabletAvailability(t.tableName(), RowRange.all(), UNHOSTED)); } } } @@ -69,7 +69,7 @@ public void testOffline() throws Exception { client.tableOperations().create(table, new NewTableConfiguration().createOffline()); assertThrows(TableOfflineException.class, - () -> client.tableOperations().setTabletAvailability(table, new Range(), HOSTED)); + () -> client.tableOperations().setTabletAvailability(table, RowRange.all(), HOSTED)); } } @@ -95,9 +95,9 @@ public void testBoundries() throws Exception { for (var a1 : TabletAvailability.values()) { for (var a2 : TabletAvailability.values()) { availabilites.put(row(r), a1); - client.tableOperations().setTabletAvailability(table, new Range(row(r++)), a1); + client.tableOperations().setTabletAvailability(table, RowRange.closed(row(r++)), a1); availabilites.put(row(r), a2); - client.tableOperations().setTabletAvailability(table, new Range(row(r++)), a2); + client.tableOperations().setTabletAvailability(table, RowRange.closed(row(r++)), a2); } } @@ -150,7 +150,7 @@ public void testBoundries() throws Exception { } // verify nothing was actually written to the unhosted tablets - client.tableOperations().setTabletAvailability(table, new Range(), HOSTED); + client.tableOperations().setTabletAvailability(table, RowRange.all(), HOSTED); for (var entry : availabilites.entrySet()) { if (entry.getValue() == UNHOSTED) { var row = entry.getKey();