You are viewing a plain text version of this content. The canonical link for it is here.
Posted to commits@accumulo.apache.org by kt...@apache.org on 2023/11/18 21:38:48 UTC

(accumulo) branch elasticity updated: Restores column family validation in TabletMetadata (#3958)

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

kturner 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 665484b029 Restores column family validation in TabletMetadata (#3958)
665484b029 is described below

commit 665484b029cb0ec0f2481ef677796191f6776179
Author: Keith Turner <kt...@apache.org>
AuthorDate: Sat Nov 18 13:38:42 2023 -0800

    Restores column family validation in TabletMetadata (#3958)
    
    Validation for unknown column families in TabletMetadata was dropped.
    Restored the validation and added a test.
---
 .../apache/accumulo/core/metadata/schema/TabletMetadata.java  |  5 ++++-
 .../accumulo/core/metadata/schema/TabletMetadataTest.java     | 11 +++++++++++
 2 files changed, 15 insertions(+), 1 deletion(-)

diff --git a/core/src/main/java/org/apache/accumulo/core/metadata/schema/TabletMetadata.java b/core/src/main/java/org/apache/accumulo/core/metadata/schema/TabletMetadata.java
index 391f81ffed..febc43ee45 100644
--- a/core/src/main/java/org/apache/accumulo/core/metadata/schema/TabletMetadata.java
+++ b/core/src/main/java/org/apache/accumulo/core/metadata/schema/TabletMetadata.java
@@ -572,9 +572,12 @@ public class TabletMetadata {
               te.onDemandHostingRequested = true;
               break;
             default:
-              throw new IllegalStateException("Unexpected family " + fam);
+              throw new IllegalStateException("Unexpected qualifier " + fam);
           }
           break;
+        default:
+          throw new IllegalStateException("Unexpected family " + fam);
+
       }
     }
 
diff --git a/core/src/test/java/org/apache/accumulo/core/metadata/schema/TabletMetadataTest.java b/core/src/test/java/org/apache/accumulo/core/metadata/schema/TabletMetadataTest.java
index fd8c8a80b8..61c2dded74 100644
--- a/core/src/test/java/org/apache/accumulo/core/metadata/schema/TabletMetadataTest.java
+++ b/core/src/test/java/org/apache/accumulo/core/metadata/schema/TabletMetadataTest.java
@@ -303,6 +303,17 @@ public class TabletMetadataTest {
     assertThrows(IllegalStateException.class, tm::hasMerged);
   }
 
+  @Test
+  public void testUnkownColFamily() {
+    KeyExtent extent = new KeyExtent(TableId.of("5"), new Text("df"), new Text("da"));
+    Mutation mutation = TabletColumnFamily.createPrevRowMutation(extent);
+
+    mutation.put("1234567890abcdefg", "xyz", "v1");
+    assertThrows(IllegalStateException.class,
+        () -> TabletMetadata.convertRow(toRowMap(mutation).entrySet().iterator(),
+            EnumSet.of(ColumnType.MERGED), true, false));
+  }
+
   private SortedMap<Key,Value> toRowMap(Mutation mutation) {
     SortedMap<Key,Value> rowMap = new TreeMap<>();
     mutation.getUpdates().forEach(cu -> {