cshannon commented on code in PR #4317: URL: https://github.com/apache/accumulo/pull/4317#discussion_r1518324765
########## test/src/main/java/org/apache/accumulo/test/LargeSplitRowIT.java: ########## @@ -242,6 +257,148 @@ public void automaticSplitLater() throws Exception { } } + @Test + @Timeout(60) + public void testUnsplittableColumn() throws Exception { + log.info("Unsplittable Column Test"); + try (AccumuloClient client = Accumulo.newClient().from(getClientProperties()).build()) { + // make a table and lower the configuration properties + // @formatter:off + var maxEndRow = 100; + Map<String,String> props = Map.of( + Property.TABLE_SPLIT_THRESHOLD.getKey(), "1K", + Property.TABLE_FILE_COMPRESSION_TYPE.getKey(), "none", + Property.TABLE_FILE_COMPRESSED_BLOCK_SIZE.getKey(), "64", + Property.TABLE_MAX_END_ROW_SIZE.getKey(), "" + maxEndRow, + Property.TABLE_MAJC_RATIO.getKey(), "9999" + ); + // @formatter:on + + final String tableName = getUniqueNames(1)[0]; + client.tableOperations().create(tableName, new NewTableConfiguration().setProperties(props)); + + // Create a key for a table entry that is longer than the allowed size for an + // end row and fill this key with all m's except the last spot + byte[] data = new byte[maxEndRow + 1]; + Arrays.fill(data, 0, data.length - 2, (byte) 'm'); + + final int numOfMutations = 20; + try (BatchWriter batchWriter = client.createBatchWriter(tableName)) { + // Make the last place in the key different for every entry added to the table + for (int i = 0; i < numOfMutations; i++) { + data[data.length - 1] = (byte) i; + Mutation m = new Mutation(data); + m.put("cf", "cq", "value"); + batchWriter.addMutation(m); + } + } + // Flush the BatchWriter and table + client.tableOperations().flush(tableName, null, null, true); + + // Wait for the tablets to be marked as unsplittable due to the system split running + TableId tableId = TableId.of(client.tableOperations().tableIdMap().get(tableName)); + Wait.waitFor(() -> getServerContext().getAmple() + .readTablet(new KeyExtent(tableId, null, null)).getUnSplittable() != null, + Wait.MAX_WAIT_MILLIS, 100); + + // Verify that the unsplittable column is read correctly + TabletMetadata tm = + getServerContext().getAmple().readTablet(new KeyExtent(tableId, null, null)); + assertEquals(tm.getUnSplittable(), SplitUtils.toUnSplittable(getServerContext(), tm)); + + // Make sure no splits occurred in the table + assertTrue(client.tableOperations().listSplits(tableName).isEmpty()); + Review Comment: That's a good idea to test that, i will add that. -- 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-unsubscr...@accumulo.apache.org For queries about this service, please contact Infrastructure at: us...@infra.apache.org