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

cshannon 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 5ccb9195ac Add test to verify correctness of Accumulo fate table 
(#4328)
5ccb9195ac is described below

commit 5ccb9195ac39297bce23a1a8e941cf11ce0477d0
Author: Christopher L. Shannon <cshan...@apache.org>
AuthorDate: Fri Mar 1 11:15:28 2024 -0500

    Add test to verify correctness of Accumulo fate table (#4328)
    
    This test makes sure configuration that is relevant to the correctness
    of the Fate table, such as the versioning iterator, are set correctly.
    
    This closes #4322
---
 .../test/fate/accumulo/AccumuloStoreIT.java        | 51 ++++++++++++++++++++++
 1 file changed, 51 insertions(+)

diff --git 
a/test/src/main/java/org/apache/accumulo/test/fate/accumulo/AccumuloStoreIT.java
 
b/test/src/main/java/org/apache/accumulo/test/fate/accumulo/AccumuloStoreIT.java
index 785b52b290..4a5e0c18c7 100644
--- 
a/test/src/main/java/org/apache/accumulo/test/fate/accumulo/AccumuloStoreIT.java
+++ 
b/test/src/main/java/org/apache/accumulo/test/fate/accumulo/AccumuloStoreIT.java
@@ -21,6 +21,7 @@ package org.apache.accumulo.test.fate.accumulo;
 import static org.junit.jupiter.api.Assertions.assertDoesNotThrow;
 import static org.junit.jupiter.api.Assertions.assertEquals;
 import static org.junit.jupiter.api.Assertions.assertThrows;
+import static org.junit.jupiter.api.Assertions.assertTrue;
 
 import java.util.Iterator;
 import java.util.List;
@@ -32,7 +33,9 @@ import org.apache.accumulo.core.client.Accumulo;
 import org.apache.accumulo.core.client.BatchWriter;
 import org.apache.accumulo.core.client.MutationsRejectedException;
 import org.apache.accumulo.core.client.TableNotFoundException;
+import org.apache.accumulo.core.client.admin.TabletAvailability;
 import org.apache.accumulo.core.clientImpl.ClientContext;
+import org.apache.accumulo.core.conf.Property;
 import org.apache.accumulo.core.data.Mutation;
 import org.apache.accumulo.core.data.Value;
 import org.apache.accumulo.core.fate.FateId;
@@ -41,6 +44,8 @@ import org.apache.accumulo.core.fate.FateStore;
 import org.apache.accumulo.core.fate.ReadOnlyFateStore.TStatus;
 import org.apache.accumulo.core.fate.accumulo.AccumuloStore;
 import org.apache.accumulo.core.fate.accumulo.schema.FateSchema;
+import org.apache.accumulo.core.iterators.user.VersioningIterator;
+import org.apache.accumulo.core.metadata.AccumuloTable;
 import org.apache.accumulo.harness.SharedMiniClusterBase;
 import org.apache.accumulo.test.fate.FateIT;
 import org.apache.hadoop.io.Text;
@@ -92,6 +97,52 @@ public class AccumuloStoreIT extends SharedMiniClusterBase {
     }
   }
 
+  // Test that configs related to the correctness of the FATE instance user 
table
+  // are initialized correctly
+  @Test
+  public void testFateInitialConfigCorrectness() throws Exception {
+    try (ClientContext client =
+        (ClientContext) Accumulo.newClient().from(getClientProps()).build()) {
+
+      // It is important here to use getTableProperties() and not 
getConfiguration()
+      // because we want only the table properties and not a merged view
+      var fateTableProps =
+          
client.tableOperations().getTableProperties(AccumuloTable.FATE.tableName());
+
+      // Verify properties all have a table. prefix
+      assertTrue(fateTableProps.keySet().stream().allMatch(key -> 
key.startsWith("table.")));
+
+      // Verify properties are correctly set
+      assertEquals("5", 
fateTableProps.get(Property.TABLE_FILE_REPLICATION.getKey()));
+      assertEquals("sync", 
fateTableProps.get(Property.TABLE_DURABILITY.getKey()));
+      assertEquals("false", 
fateTableProps.get(Property.TABLE_FAILURES_IGNORE.getKey()));
+      assertEquals("", 
fateTableProps.get(Property.TABLE_DEFAULT_SCANTIME_VISIBILITY.getKey()));
+
+      // Verify VersioningIterator related properties are correct
+      var iterClass = "10," + VersioningIterator.class.getName();
+      var maxVersions = "1";
+      assertEquals(iterClass,
+          fateTableProps.get(Property.TABLE_ITERATOR_PREFIX.getKey() + 
"scan.vers"));
+      assertEquals(maxVersions, fateTableProps
+          .get(Property.TABLE_ITERATOR_PREFIX.getKey() + 
"scan.vers.opt.maxVersions"));
+      assertEquals(iterClass,
+          fateTableProps.get(Property.TABLE_ITERATOR_PREFIX.getKey() + 
"minc.vers"));
+      assertEquals(maxVersions, fateTableProps
+          .get(Property.TABLE_ITERATOR_PREFIX.getKey() + 
"minc.vers.opt.maxVersions"));
+      assertEquals(iterClass,
+          fateTableProps.get(Property.TABLE_ITERATOR_PREFIX.getKey() + 
"majc.vers"));
+      assertEquals(maxVersions, fateTableProps
+          .get(Property.TABLE_ITERATOR_PREFIX.getKey() + 
"majc.vers.opt.maxVersions"));
+
+      // Verify all tablets are HOSTED
+      try (var tablets =
+          
client.getAmple().readTablets().forTable(AccumuloTable.FATE.tableId()).build()) 
{
+        assertTrue(tablets.stream()
+            .allMatch(tm -> tm.getTabletAvailability() == 
TabletAvailability.HOSTED));
+      }
+    }
+  }
+
   @Test
   public void testCreateWithCollisionAndExceedRetryLimit() throws Exception {
     String table = getUniqueNames(1)[0];

Reply via email to