keith-turner commented on code in PR #5335:
URL: https://github.com/apache/accumulo/pull/5335#discussion_r1956435764
##########
core/src/main/java/org/apache/accumulo/core/metadata/schema/TabletMetadata.java:
##########
@@ -202,7 +206,74 @@ public enum ColumnType {
COMPACTED,
USER_COMPACTION_REQUESTED,
UNSPLITTABLE,
- MERGEABILITY
+ MERGEABILITY;
+
+ public static Set<ByteSequence> resolveFamilies(Set<ColumnType> columns) {
Review Comment:
> The methods are a bit different so we may need to do something like have
some immutable maps that map between ColumnType and ColumnFQ or families.
That would be nice if instead of the switch stmt we had a static
`Map<ColumnType, List<Family>>` that was populated in a static code block.
Looked for a way to automatically construct this in a static code block and do
not see a way w/ the current code.
##########
core/src/test/java/org/apache/accumulo/core/metadata/schema/TabletMetadataCheckTest.java:
##########
@@ -0,0 +1,65 @@
+/*
+ * Licensed to the Apache Software Foundation (ASF) under one
+ * or more contributor license agreements. See the NOTICE file
+ * distributed with this work for additional information
+ * regarding copyright ownership. The ASF licenses this file
+ * to you under the Apache License, Version 2.0 (the
+ * "License"); you may not use this file except in compliance
+ * with the License. You may obtain a copy of the License at
+ *
+ * https://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing,
+ * software distributed under the License is distributed on an
+ * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
+ * KIND, either express or implied. See the License for the
+ * specific language governing permissions and limitations
+ * under the License.
+ */
+package org.apache.accumulo.core.metadata.schema;
+
+import static
org.apache.accumulo.core.metadata.schema.TabletMetadata.ColumnType.DIR;
+import static
org.apache.accumulo.core.metadata.schema.TabletMetadata.ColumnType.ECOMP;
+import static
org.apache.accumulo.core.metadata.schema.TabletMetadata.ColumnType.FILES;
+import static
org.apache.accumulo.core.metadata.schema.TabletMetadata.ColumnType.PREV_ROW;
+import static
org.apache.accumulo.core.metadata.schema.TabletMetadata.ColumnType.SCANS;
+import static
org.apache.accumulo.core.metadata.schema.TabletMetadata.ColumnType.SELECTED;
+import static org.junit.jupiter.api.Assertions.assertEquals;
+import static org.junit.jupiter.api.Assertions.assertTrue;
+
+import java.util.Set;
+import java.util.stream.Collectors;
+
+import org.apache.accumulo.core.data.ArrayByteSequence;
+import
org.apache.accumulo.core.metadata.schema.MetadataSchema.TabletsSection.DataFileColumnFamily;
+import
org.apache.accumulo.core.metadata.schema.MetadataSchema.TabletsSection.ExternalCompactionColumnFamily;
+import
org.apache.accumulo.core.metadata.schema.MetadataSchema.TabletsSection.ScanFileColumnFamily;
+import
org.apache.accumulo.core.metadata.schema.MetadataSchema.TabletsSection.ServerColumnFamily;
+import
org.apache.accumulo.core.metadata.schema.MetadataSchema.TabletsSection.TabletColumnFamily;
+import org.apache.accumulo.core.metadata.schema.TabletMetadata.ColumnType;
+import
org.apache.accumulo.core.metadata.schema.TabletMetadataCheck.ResolvedColumns;
+import org.junit.jupiter.api.Test;
+
+public class TabletMetadataCheckTest {
+
Review Comment:
Could add a test that loops over each column type and makes sure it resolves
to some family. Its tricky knowing if its the correct family, but could at
least know each column type is covered. This will help someone know they need
to make an update when adding a new column type.
##########
server/base/src/main/java/org/apache/accumulo/server/metadata/iterators/TabletMetadataCheckIterator.java:
##########
@@ -98,11 +97,11 @@ public void seek(Range range, Collection<ByteSequence>
columnFamilies, boolean i
var colsToRead = check.columnsToRead();
- source.seek(new Range(tabletRow), Set.of(), false);
+ source.seek(new Range(tabletRow), colsToRead.getFamilies(), true);
Review Comment:
When want to read everything for the empty set need to set inclusive to
false.
```suggestion
source.seek(new Range(tabletRow), colsToRead.getFamilies(),
!colsToRead.getFamilies().isEmpty());
```
##########
server/base/src/main/java/org/apache/accumulo/server/metadata/iterators/TabletMetadataCheckIterator.java:
##########
@@ -98,11 +97,11 @@ public void seek(Range range, Collection<ByteSequence>
columnFamilies, boolean i
var colsToRead = check.columnsToRead();
- source.seek(new Range(tabletRow), Set.of(), false);
+ source.seek(new Range(tabletRow), colsToRead.getFamilies(), true);
if (source.hasTop()) {
var tabletMetadata = TabletMetadata.convertRow(new
IteratorAdapter(source),
- EnumSet.copyOf(colsToRead), false, false);
+ EnumSet.copyOf(colsToRead.getColumns()), false, false);
Review Comment:
Could move this copy of the set into ResolvedColumns.getColumns() for
encapsulation. Then the real internal set never escapes.
--
This is an automated message from the Apache Git Service.
To respond to the message, please log on to GitHub and use the
URL above to go to the specific comment.
To unsubscribe, e-mail: [email protected]
For queries about this service, please contact Infrastructure at:
[email protected]