This is an automated email from the ASF dual-hosted git repository.

keith-turner 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 4e2d30c555 Warns when can not split because of single row (#6673)
4e2d30c555 is described below

commit 4e2d30c555acd59da70e87b862d0a3287f17fa6a
Author: Keith Turner <[email protected]>
AuthorDate: Mon Nov 30 18:36:21 2026 -0500

    Warns when can not split because of single row (#6673)
---
 .../manager/tableOps/split/FindSplits.java         | 11 ++++--
 .../org/apache/accumulo/test/LargeSplitRowIT.java  | 42 ++++++++++++++++++++++
 2 files changed, 50 insertions(+), 3 deletions(-)

diff --git 
a/server/manager/src/main/java/org/apache/accumulo/manager/tableOps/split/FindSplits.java
 
b/server/manager/src/main/java/org/apache/accumulo/manager/tableOps/split/FindSplits.java
index 2e55d4905c..7f483cc164 100644
--- 
a/server/manager/src/main/java/org/apache/accumulo/manager/tableOps/split/FindSplits.java
+++ 
b/server/manager/src/main/java/org/apache/accumulo/manager/tableOps/split/FindSplits.java
@@ -100,7 +100,12 @@ public class FindSplits extends AbstractFateOperation {
     SortedSet<Text> splits = SplitUtils.findSplits(env.getContext(), 
tabletMetadata);
 
     if (extent.endRow() != null) {
-      splits.remove(extent.endRow());
+      if (splits.remove(extent.endRow()) && splits.isEmpty()) {
+        log.warn(
+            "Tablet {} needs to split but the only split found equals the 
tablets end row, so can "
+                + "not split. The tablet probably has a single row with many 
columns.",
+            extent);
+      }
     }
 
     if (splits.isEmpty()) {
@@ -120,7 +125,7 @@ public class FindSplits extends AbstractFateOperation {
         // split metadata is changed
         final var context = env.getContext();
         if (SplitUtils.needsSplit(context, tabletMetadata)) {
-          log.info("Tablet {} needs to split, but no split points could be 
found.",
+          log.debug("Tablet {} needs to split, but no split points could be 
found.",
               tabletMetadata.getExtent());
           var unSplittableMeta = computedUnsplittable
               .orElseGet(() -> SplitUtils.toUnSplittable(context, 
tabletMetadata));
@@ -142,7 +147,7 @@ public class FindSplits extends AbstractFateOperation {
           // or if the threshold has been raised higher because the tablet 
management iterator
           // will try and split any time the computed metadata changes.
         } else if (tabletMetadata.getUnSplittable() != null) {
-          log.info("Tablet {} no longer needs to split, deleting unsplittable 
marker.",
+          log.debug("Tablet {} no longer needs to split, deleting unsplittable 
marker.",
               tabletMetadata.getExtent());
           var mutator = 
tabletsMutator.mutateTablet(extent).requireAbsentOperation()
               .requireSame(tabletMetadata, FILES, 
UNSPLITTABLE).deleteUnSplittable();
diff --git a/test/src/main/java/org/apache/accumulo/test/LargeSplitRowIT.java 
b/test/src/main/java/org/apache/accumulo/test/LargeSplitRowIT.java
index 2d7fa77685..1c1133928d 100644
--- a/test/src/main/java/org/apache/accumulo/test/LargeSplitRowIT.java
+++ b/test/src/main/java/org/apache/accumulo/test/LargeSplitRowIT.java
@@ -20,13 +20,16 @@ package org.apache.accumulo.test;
 
 import static java.nio.charset.StandardCharsets.UTF_8;
 import static java.util.concurrent.TimeUnit.SECONDS;
+import static org.apache.accumulo.core.util.LazySingletons.RANDOM;
 import static org.junit.jupiter.api.Assertions.assertEquals;
+import static org.junit.jupiter.api.Assertions.assertNotNull;
 import static org.junit.jupiter.api.Assertions.assertThrows;
 import static org.junit.jupiter.api.Assertions.assertTrue;
 import static org.junit.jupiter.api.Assertions.fail;
 
 import java.time.Duration;
 import java.util.Arrays;
+import java.util.List;
 import java.util.Map;
 import java.util.Map.Entry;
 import java.util.SortedSet;
@@ -39,6 +42,7 @@ import org.apache.accumulo.core.client.AccumuloException;
 import org.apache.accumulo.core.client.BatchWriter;
 import org.apache.accumulo.core.client.Scanner;
 import org.apache.accumulo.core.client.admin.NewTableConfiguration;
+import org.apache.accumulo.core.clientImpl.ClientContext;
 import org.apache.accumulo.core.clientImpl.Namespace;
 import org.apache.accumulo.core.conf.ConfigurationTypeHelper;
 import org.apache.accumulo.core.conf.Property;
@@ -81,6 +85,44 @@ public class LargeSplitRowIT extends SharedMiniClusterBase {
     return Duration.ofMinutes(1);
   }
 
+  // Test a tablet with a single row that has many columns, should not be able 
to split this because
+  // there is only one row.
+  @Test
+  public void testManyColumns() throws Exception {
+    final String tableName = getUniqueNames(1)[0];
+    try (AccumuloClient client = 
Accumulo.newClient().from(getClientProps()).build()) {
+      Map<String,String> props = 
Map.of(Property.TABLE_SPLIT_THRESHOLD.getKey(), "256K");
+      final String split = "manyCols";
+      TreeSet<Text> splits = new TreeSet<>(List.of(new Text(split)));
+      client.tableOperations().create(tableName,
+          new NewTableConfiguration().setProperties(props).withSplits(splits));
+
+      byte[] data = new byte[1000];
+      // Write 1K columns to a single row with 1K of data in each column. This 
should create 1M of
+      // data which exceeds the 256K split threshold.
+      try (BatchWriter batchWriter = client.createBatchWriter(tableName)) {
+        for (int f = 0; f < 100; f++) {
+          Mutation m = new Mutation(split);
+          for (int q = 0; q < 10; q++) {
+            RANDOM.get().nextBytes(data);
+            m.at().family(String.format("%03d", 
f)).qualifier(String.format("%03d", q)).put(data);
+          }
+          batchWriter.addMutation(m);
+        }
+      }
+
+      client.tableOperations().flush(tableName, null, null, true);
+
+      var ctx = (ClientContext) client;
+      var tableId = ctx.getTableId(tableName);
+      var extent = new KeyExtent(tableId, new Text(split), null);
+      Wait.waitFor(() -> ctx.getAmple().readTablet(extent).getUnSplittable() 
!= null);
+      assertNotNull(ctx.getAmple().readTablet(extent).getUnSplittable());
+
+      assertEquals(splits, new 
TreeSet<>(client.tableOperations().listSplits(tableName)));
+    }
+  }
+
   // User added split
   @Test
   public void userAddedSplit() throws Exception {

Reply via email to