keith-turner commented on code in PR #5353:
URL: https://github.com/apache/accumulo/pull/5353#discussion_r1986115952
##########
test/src/main/java/org/apache/accumulo/test/functional/TabletMergeabilityIT.java:
##########
@@ -183,6 +184,48 @@ public void testSplitAndMergeAll() throws Exception {
}
}
+ @Test
+ public void testMergeabilityThreshold() throws Exception {
+ String tableName = getUniqueNames(1)[0];
+ try (AccumuloClient c =
Accumulo.newClient().from(getClientProps()).build()) {
+ Map<String,String> props = new HashMap<>();
+ props.put(Property.TABLE_SPLIT_THRESHOLD.getKey(), "16K");
+ props.put(Property.TABLE_FILE_COMPRESSED_BLOCK_SIZE.getKey(), "1K");
+ // Set a low threshold to 1% of the split threshold
+ props.put(Property.TABLE_MAX_MERGEABILITY_THRESHOLD.getKey(), ".01");
+ c.tableOperations().create(tableName, new
NewTableConfiguration().setProperties(props)
+ .withInitialTabletAvailability(TabletAvailability.HOSTED));
+ var tableId =
TableId.of(c.tableOperations().tableIdMap().get(tableName));
+
+ // Ingest data so tablet will split
+ VerifyParams params = new VerifyParams(getClientProps(), tableName,
5_000);
+ TestIngest.ingest(c, params);
+ c.tableOperations().flush(tableName);
+ VerifyIngest.verifyIngest(c, params);
+
+ // Wait for table to split, should be more than 10 tablets
+ Wait.waitFor(() -> c.tableOperations().listSplits(tableName).size() >
10, 10000, 200);
+
+ // Set the split threshold back to the default of 5 MB. There's not a
lot of data so normally
+ // we could merge back to 1 tablet, but the threshold is too low at 1%
so it should not merge
+ // yet.
+ c.tableOperations().setProperty(tableName,
Property.TABLE_SPLIT_THRESHOLD.getKey(), "5m");
+
+ // Should not merge so make sure it throws IllegalStateException
+ assertThrows(IllegalStateException.class,
+ () -> Wait.waitFor(() ->
hasExactTablets(getCluster().getServerContext(), tableId,
+ Set.of(new KeyExtent(tableId, null, null))), 5000, 500));
+
Review Comment:
Could call hasExactTablets again after the waitFor, this helps confirm the
IllegalStateException was thrown for the expected reason. Assuming the test
expects the IllegalSE to be thrown on timeout?
--
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: [email protected]
For queries about this service, please contact Infrastructure at:
[email protected]