This is an automated email from the ASF dual-hosted git repository. cshannon pushed a commit to branch main in repository https://gitbox.apache.org/repos/asf/accumulo.git
commit c976af383f992bdefcdd579220c704235960a6c7 Merge: 9817474333 507a96380b Author: Christopher L. Shannon <cshan...@apache.org> AuthorDate: Fri Mar 1 17:21:36 2024 -0500 Merge branch '2.1' .../accumulo/test/functional/MetadataIT.java | 71 ++++++++++++++++++++++ 1 file changed, 71 insertions(+) diff --cc test/src/main/java/org/apache/accumulo/test/functional/MetadataIT.java index 0b3116c395,3c6514624e..60ca6cb562 --- a/test/src/main/java/org/apache/accumulo/test/functional/MetadataIT.java +++ b/test/src/main/java/org/apache/accumulo/test/functional/MetadataIT.java @@@ -45,7 -48,10 +47,9 @@@ import org.apache.accumulo.core.data.Ke import org.apache.accumulo.core.data.Range; import org.apache.accumulo.core.data.TableId; import org.apache.accumulo.core.data.Value; + import org.apache.accumulo.core.iterators.user.VersioningIterator; -import org.apache.accumulo.core.metadata.MetadataTable; -import org.apache.accumulo.core.metadata.RootTable; +import org.apache.accumulo.core.metadata.AccumuloTable; + import org.apache.accumulo.core.metadata.schema.MetadataSchema; import org.apache.accumulo.core.metadata.schema.MetadataSchema.DeletesSection; import org.apache.accumulo.core.metadata.schema.MetadataSchema.TabletsSection; import org.apache.accumulo.core.metadata.schema.MetadataSchema.TabletsSection.DataFileColumnFamily; @@@ -221,4 -224,67 +227,69 @@@ public class MetadataIT extends Accumul } } + + // Test that configs related to the correctness of the Root/Metadata tables + // are initialized correctly + @Test + public void testSystemTablesInitialConfigCorrectness() 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 rootTableProps = client.tableOperations().getTableProperties(RootTable.NAME); - var metadataTableProps = client.tableOperations().getTableProperties(MetadataTable.NAME); ++ var rootTableProps = ++ client.tableOperations().getTableProperties(AccumuloTable.ROOT.tableName()); ++ var metadataTableProps = ++ client.tableOperations().getTableProperties(AccumuloTable.METADATA.tableName()); + + // Verify root table config + testCommonSystemTableConfig(rootTableProps); + assertEquals("root", + rootTableProps.get(Property.TABLE_COMPACTION_DISPATCHER_OPTS.getKey() + "service")); + + // Verify metadata table config + testCommonSystemTableConfig(metadataTableProps); + assertEquals("meta", + metadataTableProps.get(Property.TABLE_COMPACTION_DISPATCHER_OPTS.getKey() + "service")); + } + } + + private void testCommonSystemTableConfig(Map<String,String> tableProps) { + // Verify properties all have a table. prefix + assertTrue(tableProps.keySet().stream().allMatch(key -> key.startsWith("table."))); + + // Verify properties are correctly set + assertEquals("5", tableProps.get(Property.TABLE_FILE_REPLICATION.getKey())); + assertEquals("sync", tableProps.get(Property.TABLE_DURABILITY.getKey())); + assertEquals("false", tableProps.get(Property.TABLE_FAILURES_IGNORE.getKey())); + assertEquals("", tableProps.get(Property.TABLE_DEFAULT_SCANTIME_VISIBILITY.getKey())); + assertEquals("tablet,server", tableProps.get(Property.TABLE_LOCALITY_GROUPS.getKey())); + assertEquals( + String.format("%s,%s", MetadataSchema.TabletsSection.TabletColumnFamily.NAME, + MetadataSchema.TabletsSection.CurrentLocationColumnFamily.NAME), + tableProps.get(Property.TABLE_LOCALITY_GROUP_PREFIX.getKey() + "tablet")); + assertEquals( + String.format("%s,%s,%s,%s", MetadataSchema.TabletsSection.DataFileColumnFamily.NAME, + MetadataSchema.TabletsSection.LogColumnFamily.NAME, + MetadataSchema.TabletsSection.ServerColumnFamily.NAME, + MetadataSchema.TabletsSection.FutureLocationColumnFamily.NAME), + tableProps.get(Property.TABLE_LOCALITY_GROUP_PREFIX.getKey() + "server")); + assertEquals("20," + MetadataBulkLoadFilter.class.getName(), + tableProps.get(Property.TABLE_ITERATOR_PREFIX.getKey() + "majc.bulkLoadFilter")); + assertEquals(SimpleCompactionDispatcher.class.getName(), + tableProps.get(Property.TABLE_COMPACTION_DISPATCHER.getKey())); + + // Verify VersioningIterator related properties are correct + var iterClass = "10," + VersioningIterator.class.getName(); + var maxVersions = "1"; + assertEquals(iterClass, tableProps.get(Property.TABLE_ITERATOR_PREFIX.getKey() + "scan.vers")); + assertEquals(maxVersions, + tableProps.get(Property.TABLE_ITERATOR_PREFIX.getKey() + "scan.vers.opt.maxVersions")); + assertEquals(iterClass, tableProps.get(Property.TABLE_ITERATOR_PREFIX.getKey() + "minc.vers")); + assertEquals(maxVersions, + tableProps.get(Property.TABLE_ITERATOR_PREFIX.getKey() + "minc.vers.opt.maxVersions")); + assertEquals(iterClass, tableProps.get(Property.TABLE_ITERATOR_PREFIX.getKey() + "majc.vers")); + assertEquals(maxVersions, + tableProps.get(Property.TABLE_ITERATOR_PREFIX.getKey() + "majc.vers.opt.maxVersions")); + } }