dlmarion commented on code in PR #5648:
URL: https://github.com/apache/accumulo/pull/5648#discussion_r2150085965


##########
core/src/main/java/org/apache/accumulo/core/metadata/schema/TabletsMetadata.java:
##########
@@ -126,8 +131,19 @@ public TabletsMetadata build() {
           "scanTable() cannot be used in conjunction with forLevel(), 
forTable() or forTablet() %s %s",
           level, table);
       if (level == DataLevel.ROOT) {
-        ClientContext ctx = ((ClientContext) _client);
-        return new TabletsMetadata(getRootMetadata(ctx));
+        final ClientContext ctx = ((ClientContext) _client);
+        final RootTabletMetadata rtm = RootTabletMetadata.read(ctx);
+        final SortedMapIterator iter = new 
SortedMapIterator(rtm.toKeyValues());
+        if (!tabletMetadataFilters.isEmpty()) {
+          for (var filter : tabletMetadataFilters) {
+            if (!filter.acceptRow(iter)) {
+              LOG.trace("Not returning root metadata as it does not pass 
filter: {}",
+                  filter.getClass().getSimpleName());
+              return new TabletsMetadata((AutoCloseable) null, Set.of());
+            }
+          }
+        }
+        return new TabletsMetadata(rtm.toTabletMetadata());

Review Comment:
   I can look at adding tests. Regarding correctness, I think it's correct to 
not return tablet metadata when the filter returns `false`. I don't believe 
that the filtering mechanism filters out keys within tablet metadata.



-- 
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]

Reply via email to