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
commit afe2857935b42067cbce86ad93e85c567df70f52 Merge: 8798fccd5c c976af383f Author: Christopher L. Shannon <cshan...@apache.org> AuthorDate: Fri Mar 1 17:26:38 2024 -0500 Merge branch 'main' into elasticity .../accumulo/test/functional/MetadataIT.java | 69 ++++++++++++++++++++++ 1 file changed, 69 insertions(+) diff --cc test/src/main/java/org/apache/accumulo/test/functional/MetadataIT.java index 63f1b30a7a,60ca6cb562..5a4dd306cc --- a/test/src/main/java/org/apache/accumulo/test/functional/MetadataIT.java +++ b/test/src/main/java/org/apache/accumulo/test/functional/MetadataIT.java @@@ -40,7 -41,8 +41,9 @@@ import org.apache.accumulo.core.client. import org.apache.accumulo.core.client.AccumuloClient; import org.apache.accumulo.core.client.BatchScanner; import org.apache.accumulo.core.client.Scanner; ++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.Key; import org.apache.accumulo.core.data.Range; import org.apache.accumulo.core.data.TableId; @@@ -221,4 -227,69 +226,68 @@@ 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(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")); ++ testCommonSystemTableConfig(client, AccumuloTable.ROOT.tableId(), rootTableProps); + + // Verify metadata table config - testCommonSystemTableConfig(metadataTableProps); - assertEquals("meta", - metadataTableProps.get(Property.TABLE_COMPACTION_DISPATCHER_OPTS.getKey() + "service")); ++ testCommonSystemTableConfig(client, AccumuloTable.METADATA.tableId(), metadataTableProps); + } + } + - private void testCommonSystemTableConfig(Map<String,String> tableProps) { ++ private void testCommonSystemTableConfig(ClientContext client, TableId tableId, ++ 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")); ++ ++ // Verify all tablets are HOSTED ++ try (var tablets = client.getAmple().readTablets().forTable(tableId).build()) { ++ assertTrue( ++ tablets.stream().allMatch(tm -> tm.getTabletAvailability() == TabletAvailability.HOSTED)); ++ } + } }