You are viewing a plain text version of this content. The canonical link for it is here.
Posted to commits@accumulo.apache.org by jm...@apache.org on 2023/06/23 17:48:53 UTC
[accumulo] branch elasticity updated: Verify hostingGoals in table with mixed goals (#3532)
This is an automated email from the ASF dual-hosted git repository.
jmark99 pushed a commit to branch elasticity
in repository https://gitbox.apache.org/repos/asf/accumulo.git
The following commit(s) were added to refs/heads/elasticity by this push:
new de48b78544 Verify hostingGoals in table with mixed goals (#3532)
de48b78544 is described below
commit de48b785447be37622d1c9bd4cd32e89d6177c5f
Author: Mark Owens <jm...@apache.org>
AuthorDate: Fri Jun 23 13:48:48 2023 -0400
Verify hostingGoals in table with mixed goals (#3532)
* Verify hostingGoals in table with mixed goals
This PR adds a suggested additional test for the setting of `TabletHostingGoals` in `TableOperationsImpl.java`.
Specifically, the new tests verifies that when a table that already contains mixed `TabletHostingGoals` splits further, the new splits retain the hostingGoal of the tablet from which they were split. The new test, `testGetHostingGoals_StaggeredSplits`, does the following:
- creates table
- add two splits; leave first tablet to default ONDEMAND. Set second to NEVER and third to ALWAYS
- add an additional split point within each of the existing three tablets
- verify newly created tablets are set with the hostingGoal of the tablet from which they were split
---
.../apache/accumulo/test/TableOperationsIT.java | 63 ++++++++++++++++++++++
1 file changed, 63 insertions(+)
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 94d41f82b4..caef8145e7 100644
--- a/test/src/main/java/org/apache/accumulo/test/TableOperationsIT.java
+++ b/test/src/main/java/org/apache/accumulo/test/TableOperationsIT.java
@@ -617,6 +617,69 @@ public class TableOperationsIT extends AccumuloClusterHarness {
}
}
+ // This test checks that tablets are correct when staggered splits are added to a table, i.e.,
+ // a table is split and assigned differing goals. Later when the two existing tablets are
+ // split, verify that the new splits contain the appropriate hosting goal of the tablet from
+ // which they wre split. Steps are as follows:
+ // - create table
+ // - add two splits; leave first tablet to default ONDEMAND, seconds to NEVER, third to ALWAYS
+ // - add an additional split within each of the three existing tablets
+ // - verify the newly created tablets are set with the hostingGoals of the tablet from which they
+ // are split.
+ @Test
+ public void testGetHostingGoals_StaggeredSplits() throws AccumuloException, TableExistsException,
+ AccumuloSecurityException, TableNotFoundException {
+
+ String tableName = getUniqueNames(1)[0];
+
+ try {
+ accumuloClient.tableOperations().create(tableName);
+ String tableId = accumuloClient.tableOperations().tableIdMap().get(tableName);
+
+ // add split 'h' and 'q'. Leave first as ONDEMAND, set second to NEVER, and third to ALWAYS
+ SortedSet<Text> 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().setTabletHostingGoal(tableName, range,
+ TabletHostingGoal.NEVER);
+ range = new Range(new Text("q"), false, null, true);
+ accumuloClient.tableOperations().setTabletHostingGoal(tableName, range,
+ TabletHostingGoal.ALWAYS);
+
+ // verify
+ List<HostingGoalForTablet> expectedGoals = new ArrayList<>();
+ setExpectedGoal(expectedGoals, tableId, "h", null, TabletHostingGoal.ONDEMAND);
+ setExpectedGoal(expectedGoals, tableId, "q", "h", TabletHostingGoal.NEVER);
+ setExpectedGoal(expectedGoals, tableId, null, "q", TabletHostingGoal.ALWAYS);
+
+ List<HostingGoalForTablet> hostingInfo = accumuloClient.tableOperations()
+ .getTabletHostingGoal(tableName, new Range()).collect(Collectors.toList());
+
+ assertEquals(expectedGoals, hostingInfo);
+
+ // Add a split within each of the existing tablets. Adding 'd', 'm', and 'v'
+ splits = Sets.newTreeSet(Arrays.asList(new Text("d"), new Text("m"), new Text("v")));
+ accumuloClient.tableOperations().addSplits(tableName, splits);
+
+ // verify results
+ expectedGoals.clear();
+ hostingInfo.clear();
+ setExpectedGoal(expectedGoals, tableId, "d", null, TabletHostingGoal.ONDEMAND);
+ setExpectedGoal(expectedGoals, tableId, "h", "d", TabletHostingGoal.ONDEMAND);
+ setExpectedGoal(expectedGoals, tableId, "m", "h", TabletHostingGoal.NEVER);
+ setExpectedGoal(expectedGoals, tableId, "q", "m", TabletHostingGoal.NEVER);
+ setExpectedGoal(expectedGoals, tableId, "v", "q", TabletHostingGoal.ALWAYS);
+ setExpectedGoal(expectedGoals, tableId, null, "v", TabletHostingGoal.ALWAYS);
+
+ hostingInfo = accumuloClient.tableOperations().getTabletHostingGoal(tableName, new Range())
+ .collect(Collectors.toList());
+
+ assertEquals(expectedGoals, hostingInfo);
+ } finally {
+ accumuloClient.tableOperations().delete(tableName);
+ }
+ }
+
private void verifyTablesWithSplits(String tableName, Map<String,String> idMap,
SortedSet<Text> splits, TabletHostingGoal goal) throws TableNotFoundException {