keith-turner commented on code in PR #3112:
URL: https://github.com/apache/accumulo/pull/3112#discussion_r1059499055


##########
test/src/main/java/org/apache/accumulo/test/functional/ConfigurableCompactionIT.java:
##########
@@ -1,183 +0,0 @@
-/*
- * 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.test.functional;
-
-import static java.util.Collections.singletonMap;
-import static org.junit.jupiter.api.Assertions.assertEquals;
-import static org.junit.jupiter.api.Assertions.assertTrue;
-
-import java.time.Duration;
-import java.util.Arrays;
-import java.util.HashMap;
-import java.util.Map;
-import java.util.TreeSet;
-
-import org.apache.accumulo.core.client.Accumulo;
-import org.apache.accumulo.core.client.AccumuloClient;
-import org.apache.accumulo.core.client.BatchWriter;
-import org.apache.accumulo.core.client.Scanner;
-import org.apache.accumulo.core.client.admin.NewTableConfiguration;
-import org.apache.accumulo.core.conf.Property;
-import org.apache.accumulo.core.data.Mutation;
-import org.apache.accumulo.core.metadata.MetadataTable;
-import 
org.apache.accumulo.core.metadata.schema.MetadataSchema.TabletsSection.DataFileColumnFamily;
-import org.apache.accumulo.core.security.Authorizations;
-import org.apache.accumulo.core.util.UtilWaitThread;
-import org.apache.accumulo.miniclusterImpl.MiniAccumuloConfigImpl;
-import org.apache.hadoop.conf.Configuration;
-import org.apache.hadoop.io.Text;
-import org.junit.jupiter.api.Test;
-
-import com.google.common.collect.Iterators;
-
-public class ConfigurableCompactionIT extends ConfigurableMacBase {
-
-  @Override
-  protected Duration defaultTimeout() {
-    return Duration.ofMinutes(2);
-  }
-
-  @Override
-  public void configure(MiniAccumuloConfigImpl cfg, Configuration 
hadoopCoreSite) {
-    cfg.setSiteConfig(singletonMap(Property.TSERV_MAJC_DELAY.getKey(), "1s"));
-  }
-
-  @SuppressWarnings("removal")
-  public static class SimpleCompactionStrategy
-      extends org.apache.accumulo.tserver.compaction.CompactionStrategy {
-
-    @Override
-    public void init(Map<String,String> options) {
-      String countString = options.get("count");
-      if (countString != null) {
-        count = Integer.parseInt(countString);
-      }
-    }
-
-    int count = 3;
-
-    @Override
-    public boolean
-        
shouldCompact(org.apache.accumulo.tserver.compaction.MajorCompactionRequest 
request) {
-      return request.getFiles().size() == count;
-
-    }
-
-    @Override
-    public org.apache.accumulo.tserver.compaction.CompactionPlan
-        
getCompactionPlan(org.apache.accumulo.tserver.compaction.MajorCompactionRequest 
request) {
-      var result = new org.apache.accumulo.tserver.compaction.CompactionPlan();
-      result.inputFiles.addAll(request.getFiles().keySet());
-      return result;
-    }
-
-  }
-
-  @SuppressWarnings("removal")
-  @Test
-  public void test() throws Exception {
-    try (AccumuloClient c = 
Accumulo.newClient().from(getClientProperties()).build()) {
-      final String tableName = getUniqueNames(1)[0];
-
-      c.tableOperations().create(tableName, new 
NewTableConfiguration().setProperties(singletonMap(
-          Property.TABLE_COMPACTION_STRATEGY.getKey(), 
SimpleCompactionStrategy.class.getName())));
-      runTest(c, tableName, 3);
-
-      c.tableOperations().setProperty(tableName,
-          Property.TABLE_COMPACTION_STRATEGY_PREFIX.getKey() + "count", "" + 
5);
-      runTest(c, tableName, 5);
-    }
-  }
-
-  @SuppressWarnings("removal")
-  @Test
-  public void testPerTableClasspath() throws Exception {
-    try (AccumuloClient c = 
Accumulo.newClient().from(getClientProperties()).build()) {
-      final String tableName = getUniqueNames(1)[0];
-      var destFile = 
initJar("/org/apache/accumulo/test/TestCompactionStrat.jar",

Review Comment:
   This file can be deleted.  Found it at the following location.
   
   ```
   $ find . -name "*Strat.jar"
   ./test/src/main/resources/org/apache/accumulo/test/TestCompactionStrat.jar
   ```



##########
server/tserver/src/main/java/org/apache/accumulo/tserver/tablet/CompactableUtils.java:
##########
@@ -383,50 +307,33 @@ public Optional<SortedKeyValueIterator<Key,Value>> 
getSample(CompactableFile fil
 
   private static final class TableCompactionHelper implements CompactionHelper 
{
     private final PluginConfig cselCfg2;
-    private final CompactionStrategyConfig stratCfg2;
     private final Tablet tablet;
-    private WriteParameters wp;
-    private Set<StoredTabletFile> filesToDrop;
 
-    private TableCompactionHelper(PluginConfig cselCfg2, 
CompactionStrategyConfig stratCfg2,
-        Tablet tablet) {
-      this.cselCfg2 = cselCfg2;
-      this.stratCfg2 = stratCfg2;
-      this.tablet = tablet;
+    private TableCompactionHelper(PluginConfig cselCfg2, Tablet tablet) {
+      this.cselCfg2 = Objects.requireNonNull(cselCfg2);
+      this.tablet = Objects.requireNonNull(tablet);
     }
 
     @Override
     public Set<StoredTabletFile> 
selectFiles(SortedMap<StoredTabletFile,DataFileValue> allFiles) {
-      if (cselCfg2 != null) {
-        filesToDrop = Set.of();
-        return CompactableUtils.selectFiles(tablet, allFiles, cselCfg2);
-      } else {
-        var plan =
-            CompactableUtils.selectFiles(CompactionKind.SELECTOR, tablet, 
allFiles, stratCfg2);
-        this.wp = plan.writeParameters;
-        filesToDrop = Set.copyOf(plan.deleteFiles);
-        return Set.copyOf(plan.inputFiles);
-      }
+      return CompactableUtils.selectFiles(tablet, allFiles, cselCfg2);
     }
 
     @Override
     public Map<String,String> getConfigOverrides(Set<CompactableFile> files) {
-      return computeOverrides(wp);
+      return null;
     }
 
     @Override
     public Set<StoredTabletFile> getFilesToDrop() {

Review Comment:
   This method should be completely removed from the code as this functionality 
of dropping files was unique to the compaction strategy and is not supported by 
the compaction selector.



##########
test/src/main/java/org/apache/accumulo/test/functional/SummaryIT.java:
##########
@@ -518,15 +476,6 @@ public void compactionSelectorTest() throws Exception {
     compactionTest(compactConfig);

Review Comment:
   Could inline this method now thats its only used once.



##########
test/src/main/java/org/apache/accumulo/test/compaction/UserCompactionStrategyIT.java:
##########
@@ -1,334 +0,0 @@
-/*
- * 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.test.compaction;
-
-import static org.junit.jupiter.api.Assertions.assertEquals;
-import static org.junit.jupiter.api.Assertions.assertTrue;
-import static org.junit.jupiter.api.Assertions.fail;
-import static org.junit.jupiter.api.Assumptions.assumeTrue;
-
-import java.io.File;
-import java.time.Duration;
-import java.util.Arrays;
-import java.util.HashMap;
-import java.util.HashSet;
-import java.util.Map;
-import java.util.Map.Entry;
-import java.util.Set;
-import java.util.SortedSet;
-import java.util.TreeSet;
-
-import org.apache.accumulo.core.client.Accumulo;
-import org.apache.accumulo.core.client.AccumuloClient;
-import org.apache.accumulo.core.client.AccumuloException;
-import org.apache.accumulo.core.client.BatchWriter;
-import org.apache.accumulo.core.client.IteratorSetting;
-import org.apache.accumulo.core.client.Scanner;
-import org.apache.accumulo.core.client.TableNotFoundException;
-import org.apache.accumulo.core.client.admin.CompactionConfig;
-import org.apache.accumulo.core.client.admin.CompactionStrategyConfig;
-import org.apache.accumulo.core.client.admin.NewTableConfiguration;
-import org.apache.accumulo.core.conf.Property;
-import org.apache.accumulo.core.data.Key;
-import org.apache.accumulo.core.data.Mutation;
-import org.apache.accumulo.core.data.Value;
-import org.apache.accumulo.core.iterators.user.RegExFilter;
-import org.apache.accumulo.core.security.Authorizations;
-import org.apache.accumulo.harness.AccumuloClusterHarness;
-import org.apache.accumulo.test.functional.FunctionalTestUtils;
-import org.apache.accumulo.test.functional.SlowIterator;
-import org.apache.hadoop.io.Text;
-import org.junit.jupiter.api.AfterEach;
-import org.junit.jupiter.api.Test;
-
-@SuppressWarnings("removal")
-public class UserCompactionStrategyIT extends AccumuloClusterHarness {
-
-  @Override
-  protected Duration defaultTimeout() {
-    return Duration.ofMinutes(3);
-  }
-
-  @AfterEach
-  public void checkForDanglingFateLocks() {
-    if (getClusterType() == ClusterType.MINI) {
-      FunctionalTestUtils.assertNoDanglingFateLocks(getCluster());
-    }
-  }
-
-  @Test
-  public void testDropA() throws Exception {
-    try (AccumuloClient c = 
Accumulo.newClient().from(getClientProps()).build()) {
-
-      String tableName = getUniqueNames(1)[0];
-      c.tableOperations().create(tableName);
-
-      writeFlush(c, tableName, "a");
-      writeFlush(c, tableName, "b");
-      // create a file that starts with A containing rows 'a' and 'b'
-      c.tableOperations().compact(tableName, new 
CompactionConfig().setWait(true));
-
-      writeFlush(c, tableName, "c");
-      writeFlush(c, tableName, "d");
-
-      // drop files that start with A
-      CompactionStrategyConfig csConfig =
-          new CompactionStrategyConfig(TestCompactionStrategy.class.getName());
-      csConfig.setOptions(Map.of("dropPrefix", "A", "inputPrefix", "F"));
-      c.tableOperations().compact(tableName,
-          new 
CompactionConfig().setWait(true).setCompactionStrategy(csConfig));
-
-      assertEquals(Set.of("c", "d"), getRows(c, tableName));
-
-      // this compaction should not drop files starting with A
-      c.tableOperations().compact(tableName, new 
CompactionConfig().setWait(true));
-      c.tableOperations().compact(tableName, new 
CompactionConfig().setWait(true));
-
-      assertEquals(Set.of("c", "d"), getRows(c, tableName));
-    }
-  }
-
-  private void testDropNone(Map<String,String> options) throws Exception {
-
-    try (AccumuloClient c = 
Accumulo.newClient().from(getClientProps()).build()) {
-
-      String tableName = getUniqueNames(1)[0];
-      c.tableOperations().create(tableName);
-
-      writeFlush(c, tableName, "a");
-      writeFlush(c, tableName, "b");
-
-      CompactionStrategyConfig csConfig =
-          new CompactionStrategyConfig(TestCompactionStrategy.class.getName());
-      csConfig.setOptions(options);
-      c.tableOperations().compact(tableName,
-          new 
CompactionConfig().setWait(true).setCompactionStrategy(csConfig));
-
-      assertEquals(Set.of("a", "b"), getRows(c, tableName));
-    }
-  }
-
-  @Test
-  public void testDropNone() throws Exception {
-    // test a compaction strategy that selects no files. In this case there is 
no work to do, want
-    // to ensure it does not hang.
-
-    testDropNone(Map.of("inputPrefix", "Z"));

Review Comment:
   Looked around to see if we had a test like this for compaction selectors, 
did not find anything but that does not mean it does not exists.  Would be nice 
to test this functionality for selectors if we are not doing it, ensure that 
when a selector selects nothing that things do not hang.



##########
test/src/main/java/org/apache/accumulo/test/compaction/UserCompactionStrategyIT.java:
##########
@@ -1,334 +0,0 @@
-/*
- * 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.test.compaction;
-
-import static org.junit.jupiter.api.Assertions.assertEquals;
-import static org.junit.jupiter.api.Assertions.assertTrue;
-import static org.junit.jupiter.api.Assertions.fail;
-import static org.junit.jupiter.api.Assumptions.assumeTrue;
-
-import java.io.File;
-import java.time.Duration;
-import java.util.Arrays;
-import java.util.HashMap;
-import java.util.HashSet;
-import java.util.Map;
-import java.util.Map.Entry;
-import java.util.Set;
-import java.util.SortedSet;
-import java.util.TreeSet;
-
-import org.apache.accumulo.core.client.Accumulo;
-import org.apache.accumulo.core.client.AccumuloClient;
-import org.apache.accumulo.core.client.AccumuloException;
-import org.apache.accumulo.core.client.BatchWriter;
-import org.apache.accumulo.core.client.IteratorSetting;
-import org.apache.accumulo.core.client.Scanner;
-import org.apache.accumulo.core.client.TableNotFoundException;
-import org.apache.accumulo.core.client.admin.CompactionConfig;
-import org.apache.accumulo.core.client.admin.CompactionStrategyConfig;
-import org.apache.accumulo.core.client.admin.NewTableConfiguration;
-import org.apache.accumulo.core.conf.Property;
-import org.apache.accumulo.core.data.Key;
-import org.apache.accumulo.core.data.Mutation;
-import org.apache.accumulo.core.data.Value;
-import org.apache.accumulo.core.iterators.user.RegExFilter;
-import org.apache.accumulo.core.security.Authorizations;
-import org.apache.accumulo.harness.AccumuloClusterHarness;
-import org.apache.accumulo.test.functional.FunctionalTestUtils;
-import org.apache.accumulo.test.functional.SlowIterator;
-import org.apache.hadoop.io.Text;
-import org.junit.jupiter.api.AfterEach;
-import org.junit.jupiter.api.Test;
-
-@SuppressWarnings("removal")
-public class UserCompactionStrategyIT extends AccumuloClusterHarness {
-
-  @Override
-  protected Duration defaultTimeout() {
-    return Duration.ofMinutes(3);
-  }
-
-  @AfterEach
-  public void checkForDanglingFateLocks() {
-    if (getClusterType() == ClusterType.MINI) {
-      FunctionalTestUtils.assertNoDanglingFateLocks(getCluster());
-    }
-  }
-
-  @Test
-  public void testDropA() throws Exception {
-    try (AccumuloClient c = 
Accumulo.newClient().from(getClientProps()).build()) {
-
-      String tableName = getUniqueNames(1)[0];
-      c.tableOperations().create(tableName);
-
-      writeFlush(c, tableName, "a");
-      writeFlush(c, tableName, "b");
-      // create a file that starts with A containing rows 'a' and 'b'
-      c.tableOperations().compact(tableName, new 
CompactionConfig().setWait(true));
-
-      writeFlush(c, tableName, "c");
-      writeFlush(c, tableName, "d");
-
-      // drop files that start with A
-      CompactionStrategyConfig csConfig =
-          new CompactionStrategyConfig(TestCompactionStrategy.class.getName());
-      csConfig.setOptions(Map.of("dropPrefix", "A", "inputPrefix", "F"));
-      c.tableOperations().compact(tableName,
-          new 
CompactionConfig().setWait(true).setCompactionStrategy(csConfig));
-
-      assertEquals(Set.of("c", "d"), getRows(c, tableName));
-
-      // this compaction should not drop files starting with A
-      c.tableOperations().compact(tableName, new 
CompactionConfig().setWait(true));
-      c.tableOperations().compact(tableName, new 
CompactionConfig().setWait(true));
-
-      assertEquals(Set.of("c", "d"), getRows(c, tableName));
-    }
-  }
-
-  private void testDropNone(Map<String,String> options) throws Exception {
-
-    try (AccumuloClient c = 
Accumulo.newClient().from(getClientProps()).build()) {
-
-      String tableName = getUniqueNames(1)[0];
-      c.tableOperations().create(tableName);
-
-      writeFlush(c, tableName, "a");
-      writeFlush(c, tableName, "b");
-
-      CompactionStrategyConfig csConfig =
-          new CompactionStrategyConfig(TestCompactionStrategy.class.getName());
-      csConfig.setOptions(options);
-      c.tableOperations().compact(tableName,
-          new 
CompactionConfig().setWait(true).setCompactionStrategy(csConfig));
-
-      assertEquals(Set.of("a", "b"), getRows(c, tableName));
-    }
-  }
-
-  @Test
-  public void testDropNone() throws Exception {
-    // test a compaction strategy that selects no files. In this case there is 
no work to do, want
-    // to ensure it does not hang.
-
-    testDropNone(Map.of("inputPrefix", "Z"));
-  }
-
-  @Test
-  public void testDropNone2() throws Exception {
-    // test a compaction strategy that selects no files. This differs 
testDropNone() in that
-    // shouldCompact() will return true and getCompactionPlan() will
-    // return no work to do.
-
-    testDropNone(Map.of("inputPrefix", "Z", "shouldCompact", "true"));
-  }
-
-  @Test
-  public void testPerTableClasspath() throws Exception {
-    // Can't assume that a test-resource will be on the server's classpath
-    assumeTrue(getClusterType() == ClusterType.MINI);
-
-    // test per-table classpath + user specified compaction strategy
-    try (AccumuloClient c = 
Accumulo.newClient().from(getClientProps()).build()) {
-      final String tableName = getUniqueNames(1)[0];
-      File target = new File(System.getProperty("user.dir"), "target");
-      assertTrue(target.mkdirs() || target.isDirectory());
-      var destFile = 
initJar("/org/apache/accumulo/test/TestCompactionStrat.jar",
-          "TestCompactionStrat", target.getAbsolutePath());
-      c.instanceOperations().setProperty(
-          Property.VFS_CONTEXT_CLASSPATH_PROPERTY.getKey() + "context1", 
destFile.toString());
-      HashMap<String,String> props = new HashMap<>();
-      props.put(Property.TABLE_CLASSLOADER_CONTEXT.getKey(), "context1");
-      SortedSet<Text> splits = new TreeSet<>(Arrays.asList(new Text("efg")));
-      var ntc = new 
NewTableConfiguration().setProperties(props).withSplits(splits);
-      c.tableOperations().create(tableName, ntc);
-
-      writeFlush(c, tableName, "a");
-      writeFlush(c, tableName, "b");
-
-      writeFlush(c, tableName, "h");
-      writeFlush(c, tableName, "i");
-
-      assertEquals(4, FunctionalTestUtils.countRFiles(c, tableName));
-
-      // EfgCompactionStrat will only compact a tablet w/ end row of 'efg'. No 
other tablets are
-      // compacted.
-      CompactionStrategyConfig csConfig =
-          new 
CompactionStrategyConfig("org.apache.accumulo.test.EfgCompactionStrat");
-      c.tableOperations().compact(tableName,
-          new 
CompactionConfig().setWait(true).setCompactionStrategy(csConfig));
-
-      assertEquals(3, FunctionalTestUtils.countRFiles(c, tableName));
-
-      c.tableOperations().compact(tableName, new 
CompactionConfig().setWait(true));
-
-      assertEquals(2, FunctionalTestUtils.countRFiles(c, tableName));
-    }
-  }
-
-  @Test
-  public void testIterators() throws Exception {
-    // test compaction strategy + iterators
-
-    try (AccumuloClient c = 
Accumulo.newClient().from(getClientProps()).build()) {
-
-      String tableName = getUniqueNames(1)[0];
-      c.tableOperations().create(tableName);
-
-      writeFlush(c, tableName, "a");
-      writeFlush(c, tableName, "b");
-      // create a file that starts with A containing rows 'a' and 'b'
-      c.tableOperations().compact(tableName, new 
CompactionConfig().setWait(true));
-
-      writeFlush(c, tableName, "c");
-      writeFlush(c, tableName, "d");
-
-      assertEquals(3, FunctionalTestUtils.countRFiles(c, tableName));
-
-      // drop files that start with A
-      CompactionStrategyConfig csConfig =
-          new CompactionStrategyConfig(TestCompactionStrategy.class.getName());
-      csConfig.setOptions(Map.of("inputPrefix", "F"));
-
-      IteratorSetting iterConf = new IteratorSetting(21, "myregex", 
RegExFilter.class);
-      RegExFilter.setRegexs(iterConf, "a|c", null, null, null, false);
-
-      c.tableOperations().compact(tableName, new 
CompactionConfig().setWait(true)

Review Comment:
   I was curious if there were test that exercised iterators+selectors in 
compaction.  I looked around and found CompactionIT.testPartialCompaction()



##########
test/src/main/java/org/apache/accumulo/test/functional/ConfigurableCompactionIT.java:
##########
@@ -1,183 +0,0 @@
-/*
- * 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.test.functional;
-
-import static java.util.Collections.singletonMap;
-import static org.junit.jupiter.api.Assertions.assertEquals;
-import static org.junit.jupiter.api.Assertions.assertTrue;
-
-import java.time.Duration;
-import java.util.Arrays;
-import java.util.HashMap;
-import java.util.Map;
-import java.util.TreeSet;
-
-import org.apache.accumulo.core.client.Accumulo;
-import org.apache.accumulo.core.client.AccumuloClient;
-import org.apache.accumulo.core.client.BatchWriter;
-import org.apache.accumulo.core.client.Scanner;
-import org.apache.accumulo.core.client.admin.NewTableConfiguration;
-import org.apache.accumulo.core.conf.Property;
-import org.apache.accumulo.core.data.Mutation;
-import org.apache.accumulo.core.metadata.MetadataTable;
-import 
org.apache.accumulo.core.metadata.schema.MetadataSchema.TabletsSection.DataFileColumnFamily;
-import org.apache.accumulo.core.security.Authorizations;
-import org.apache.accumulo.core.util.UtilWaitThread;
-import org.apache.accumulo.miniclusterImpl.MiniAccumuloConfigImpl;
-import org.apache.hadoop.conf.Configuration;
-import org.apache.hadoop.io.Text;
-import org.junit.jupiter.api.Test;
-
-import com.google.common.collect.Iterators;
-
-public class ConfigurableCompactionIT extends ConfigurableMacBase {
-
-  @Override
-  protected Duration defaultTimeout() {
-    return Duration.ofMinutes(2);
-  }
-
-  @Override
-  public void configure(MiniAccumuloConfigImpl cfg, Configuration 
hadoopCoreSite) {
-    cfg.setSiteConfig(singletonMap(Property.TSERV_MAJC_DELAY.getKey(), "1s"));
-  }
-
-  @SuppressWarnings("removal")
-  public static class SimpleCompactionStrategy
-      extends org.apache.accumulo.tserver.compaction.CompactionStrategy {
-
-    @Override
-    public void init(Map<String,String> options) {
-      String countString = options.get("count");
-      if (countString != null) {
-        count = Integer.parseInt(countString);
-      }
-    }
-
-    int count = 3;
-
-    @Override
-    public boolean
-        
shouldCompact(org.apache.accumulo.tserver.compaction.MajorCompactionRequest 
request) {
-      return request.getFiles().size() == count;
-
-    }
-
-    @Override
-    public org.apache.accumulo.tserver.compaction.CompactionPlan
-        
getCompactionPlan(org.apache.accumulo.tserver.compaction.MajorCompactionRequest 
request) {
-      var result = new org.apache.accumulo.tserver.compaction.CompactionPlan();
-      result.inputFiles.addAll(request.getFiles().keySet());
-      return result;
-    }
-
-  }
-
-  @SuppressWarnings("removal")
-  @Test
-  public void test() throws Exception {
-    try (AccumuloClient c = 
Accumulo.newClient().from(getClientProperties()).build()) {
-      final String tableName = getUniqueNames(1)[0];
-
-      c.tableOperations().create(tableName, new 
NewTableConfiguration().setProperties(singletonMap(
-          Property.TABLE_COMPACTION_STRATEGY.getKey(), 
SimpleCompactionStrategy.class.getName())));
-      runTest(c, tableName, 3);
-
-      c.tableOperations().setProperty(tableName,
-          Property.TABLE_COMPACTION_STRATEGY_PREFIX.getKey() + "count", "" + 
5);
-      runTest(c, tableName, 5);
-    }
-  }
-
-  @SuppressWarnings("removal")
-  @Test
-  public void testPerTableClasspath() throws Exception {
-    try (AccumuloClient c = 
Accumulo.newClient().from(getClientProperties()).build()) {
-      final String tableName = getUniqueNames(1)[0];
-      var destFile = 
initJar("/org/apache/accumulo/test/TestCompactionStrat.jar",
-          "TestCompactionStrat", 
getCluster().getConfig().getAccumuloDir().getAbsolutePath());
-      c.instanceOperations().setProperty(
-          Property.VFS_CONTEXT_CLASSPATH_PROPERTY.getKey() + "context1", 
destFile.toString());
-      Map<String,String> props = new HashMap<>();
-      props.put(Property.TABLE_MAJC_RATIO.getKey(), "10");
-      props.put(Property.TABLE_CLASSLOADER_CONTEXT.getKey(), "context1");

Review Comment:
   Looking at this made me wonder if the new plugins had test to ensure they 
worked properly w/ per table classpath.   I didn't find any test, in fact it 
seems few plugins have this type of test.  I think it may be good to open an 
issue exploring testing this for each plugin.  Below is how I did my search.
   
   ```
   $ find . -name "*.java" | xargs grep TABLE_CLASSLOADER_CONTEXT
   
./core/src/main/java/org/apache/accumulo/core/classloader/ClassLoaderUtil.java: 
   return conf.get(Property.TABLE_CLASSLOADER_CONTEXT);
   ./core/src/main/java/org/apache/accumulo/core/conf/Property.java:  
TABLE_CLASSLOADER_CONTEXT("table.class.loader.context", "", PropertyType.STRING,
   
./test/src/main/java/org/apache/accumulo/test/functional/ConfigurableCompactionIT.java:
      props.put(Property.TABLE_CLASSLOADER_CONTEXT.getKey(), "context1");
   
./test/src/main/java/org/apache/accumulo/test/functional/ScannerContextIT.java: 
     c.tableOperations().setProperty(tableName, 
Property.TABLE_CLASSLOADER_CONTEXT.getKey(),
   
./test/src/main/java/org/apache/accumulo/test/compaction/UserCompactionStrategyIT.java:
      props.put(Property.TABLE_CLASSLOADER_CONTEXT.getKey(), "context1");
   ./test/src/main/java/org/apache/accumulo/test/shell/ShellServerIT.java:    
ts.exec("config -t " + table + " -s " + 
Property.TABLE_CLASSLOADER_CONTEXT.getKey() + "=cx1",
   ./test/src/main/java/org/apache/accumulo/test/shell/ShellServerIT.java:    
result = ts.exec("config -t " + tableName + " -s " + 
Property.TABLE_CLASSLOADER_CONTEXT.getKey()
   ./test/src/main/java/org/apache/accumulo/test/shell/ShellServerIT.java:      
  + Property.TABLE_CLASSLOADER_CONTEXT.getKey() + "=" + FAKE_CONTEXT + "\n", 
result);
   
./minicluster/src/test/java/org/apache/accumulo/minicluster/MiniAccumuloClusterClasspathTest.java:
      ntc.setProperties(Map.of(Property.TABLE_CLASSLOADER_CONTEXT.getKey(), 
"cx1"));
   ./shell/src/main/java/org/apache/accumulo/shell/Shell.java:    String 
tableContext = tableProps.get(Property.TABLE_CLASSLOADER_CONTEXT.getKey());
   
   ```



##########
test/src/main/java/org/apache/accumulo/test/compaction/UserCompactionStrategyIT.java:
##########
@@ -1,334 +0,0 @@
-/*
- * 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.test.compaction;
-
-import static org.junit.jupiter.api.Assertions.assertEquals;
-import static org.junit.jupiter.api.Assertions.assertTrue;
-import static org.junit.jupiter.api.Assertions.fail;
-import static org.junit.jupiter.api.Assumptions.assumeTrue;
-
-import java.io.File;
-import java.time.Duration;
-import java.util.Arrays;
-import java.util.HashMap;
-import java.util.HashSet;
-import java.util.Map;
-import java.util.Map.Entry;
-import java.util.Set;
-import java.util.SortedSet;
-import java.util.TreeSet;
-
-import org.apache.accumulo.core.client.Accumulo;
-import org.apache.accumulo.core.client.AccumuloClient;
-import org.apache.accumulo.core.client.AccumuloException;
-import org.apache.accumulo.core.client.BatchWriter;
-import org.apache.accumulo.core.client.IteratorSetting;
-import org.apache.accumulo.core.client.Scanner;
-import org.apache.accumulo.core.client.TableNotFoundException;
-import org.apache.accumulo.core.client.admin.CompactionConfig;
-import org.apache.accumulo.core.client.admin.CompactionStrategyConfig;
-import org.apache.accumulo.core.client.admin.NewTableConfiguration;
-import org.apache.accumulo.core.conf.Property;
-import org.apache.accumulo.core.data.Key;
-import org.apache.accumulo.core.data.Mutation;
-import org.apache.accumulo.core.data.Value;
-import org.apache.accumulo.core.iterators.user.RegExFilter;
-import org.apache.accumulo.core.security.Authorizations;
-import org.apache.accumulo.harness.AccumuloClusterHarness;
-import org.apache.accumulo.test.functional.FunctionalTestUtils;
-import org.apache.accumulo.test.functional.SlowIterator;
-import org.apache.hadoop.io.Text;
-import org.junit.jupiter.api.AfterEach;
-import org.junit.jupiter.api.Test;
-
-@SuppressWarnings("removal")
-public class UserCompactionStrategyIT extends AccumuloClusterHarness {
-
-  @Override
-  protected Duration defaultTimeout() {
-    return Duration.ofMinutes(3);
-  }
-
-  @AfterEach
-  public void checkForDanglingFateLocks() {
-    if (getClusterType() == ClusterType.MINI) {
-      FunctionalTestUtils.assertNoDanglingFateLocks(getCluster());
-    }
-  }
-
-  @Test
-  public void testDropA() throws Exception {
-    try (AccumuloClient c = 
Accumulo.newClient().from(getClientProps()).build()) {
-
-      String tableName = getUniqueNames(1)[0];
-      c.tableOperations().create(tableName);
-
-      writeFlush(c, tableName, "a");
-      writeFlush(c, tableName, "b");
-      // create a file that starts with A containing rows 'a' and 'b'
-      c.tableOperations().compact(tableName, new 
CompactionConfig().setWait(true));
-
-      writeFlush(c, tableName, "c");
-      writeFlush(c, tableName, "d");
-
-      // drop files that start with A
-      CompactionStrategyConfig csConfig =
-          new CompactionStrategyConfig(TestCompactionStrategy.class.getName());
-      csConfig.setOptions(Map.of("dropPrefix", "A", "inputPrefix", "F"));
-      c.tableOperations().compact(tableName,
-          new 
CompactionConfig().setWait(true).setCompactionStrategy(csConfig));
-
-      assertEquals(Set.of("c", "d"), getRows(c, tableName));
-
-      // this compaction should not drop files starting with A
-      c.tableOperations().compact(tableName, new 
CompactionConfig().setWait(true));
-      c.tableOperations().compact(tableName, new 
CompactionConfig().setWait(true));
-
-      assertEquals(Set.of("c", "d"), getRows(c, tableName));
-    }
-  }
-
-  private void testDropNone(Map<String,String> options) throws Exception {
-
-    try (AccumuloClient c = 
Accumulo.newClient().from(getClientProps()).build()) {
-
-      String tableName = getUniqueNames(1)[0];
-      c.tableOperations().create(tableName);
-
-      writeFlush(c, tableName, "a");
-      writeFlush(c, tableName, "b");
-
-      CompactionStrategyConfig csConfig =
-          new CompactionStrategyConfig(TestCompactionStrategy.class.getName());
-      csConfig.setOptions(options);
-      c.tableOperations().compact(tableName,
-          new 
CompactionConfig().setWait(true).setCompactionStrategy(csConfig));
-
-      assertEquals(Set.of("a", "b"), getRows(c, tableName));
-    }
-  }
-
-  @Test
-  public void testDropNone() throws Exception {
-    // test a compaction strategy that selects no files. In this case there is 
no work to do, want
-    // to ensure it does not hang.
-
-    testDropNone(Map.of("inputPrefix", "Z"));
-  }
-
-  @Test
-  public void testDropNone2() throws Exception {
-    // test a compaction strategy that selects no files. This differs 
testDropNone() in that
-    // shouldCompact() will return true and getCompactionPlan() will
-    // return no work to do.
-
-    testDropNone(Map.of("inputPrefix", "Z", "shouldCompact", "true"));
-  }
-
-  @Test
-  public void testPerTableClasspath() throws Exception {
-    // Can't assume that a test-resource will be on the server's classpath
-    assumeTrue(getClusterType() == ClusterType.MINI);
-
-    // test per-table classpath + user specified compaction strategy
-    try (AccumuloClient c = 
Accumulo.newClient().from(getClientProps()).build()) {
-      final String tableName = getUniqueNames(1)[0];
-      File target = new File(System.getProperty("user.dir"), "target");
-      assertTrue(target.mkdirs() || target.isDirectory());
-      var destFile = 
initJar("/org/apache/accumulo/test/TestCompactionStrat.jar",
-          "TestCompactionStrat", target.getAbsolutePath());
-      c.instanceOperations().setProperty(
-          Property.VFS_CONTEXT_CLASSPATH_PROPERTY.getKey() + "context1", 
destFile.toString());
-      HashMap<String,String> props = new HashMap<>();
-      props.put(Property.TABLE_CLASSLOADER_CONTEXT.getKey(), "context1");
-      SortedSet<Text> splits = new TreeSet<>(Arrays.asList(new Text("efg")));
-      var ntc = new 
NewTableConfiguration().setProperties(props).withSplits(splits);
-      c.tableOperations().create(tableName, ntc);
-
-      writeFlush(c, tableName, "a");
-      writeFlush(c, tableName, "b");
-
-      writeFlush(c, tableName, "h");
-      writeFlush(c, tableName, "i");
-
-      assertEquals(4, FunctionalTestUtils.countRFiles(c, tableName));
-
-      // EfgCompactionStrat will only compact a tablet w/ end row of 'efg'. No 
other tablets are
-      // compacted.
-      CompactionStrategyConfig csConfig =
-          new 
CompactionStrategyConfig("org.apache.accumulo.test.EfgCompactionStrat");
-      c.tableOperations().compact(tableName,
-          new 
CompactionConfig().setWait(true).setCompactionStrategy(csConfig));
-
-      assertEquals(3, FunctionalTestUtils.countRFiles(c, tableName));
-
-      c.tableOperations().compact(tableName, new 
CompactionConfig().setWait(true));
-
-      assertEquals(2, FunctionalTestUtils.countRFiles(c, tableName));
-    }
-  }
-
-  @Test
-  public void testIterators() throws Exception {
-    // test compaction strategy + iterators
-
-    try (AccumuloClient c = 
Accumulo.newClient().from(getClientProps()).build()) {
-
-      String tableName = getUniqueNames(1)[0];
-      c.tableOperations().create(tableName);
-
-      writeFlush(c, tableName, "a");
-      writeFlush(c, tableName, "b");
-      // create a file that starts with A containing rows 'a' and 'b'
-      c.tableOperations().compact(tableName, new 
CompactionConfig().setWait(true));
-
-      writeFlush(c, tableName, "c");
-      writeFlush(c, tableName, "d");
-
-      assertEquals(3, FunctionalTestUtils.countRFiles(c, tableName));
-
-      // drop files that start with A
-      CompactionStrategyConfig csConfig =
-          new CompactionStrategyConfig(TestCompactionStrategy.class.getName());
-      csConfig.setOptions(Map.of("inputPrefix", "F"));
-
-      IteratorSetting iterConf = new IteratorSetting(21, "myregex", 
RegExFilter.class);
-      RegExFilter.setRegexs(iterConf, "a|c", null, null, null, false);
-
-      c.tableOperations().compact(tableName, new 
CompactionConfig().setWait(true)
-          
.setCompactionStrategy(csConfig).setIterators(Arrays.asList(iterConf)));
-
-      // compaction strategy should only be applied to one file. If its 
applied to both, then row
-      // 'b'
-      // would be dropped by filter.
-      assertEquals(Set.of("a", "b", "c"), getRows(c, tableName));
-
-      assertEquals(2, FunctionalTestUtils.countRFiles(c, tableName));
-
-      c.tableOperations().compact(tableName, new 
CompactionConfig().setWait(true));
-
-      // ensure that iterator is not applied
-      assertEquals(Set.of("a", "b", "c"), getRows(c, tableName));
-
-      assertEquals(1, FunctionalTestUtils.countRFiles(c, tableName));
-    }
-  }
-
-  @Test
-  public void testFileSize() throws Exception {
-    try (AccumuloClient c = 
Accumulo.newClient().from(getClientProps()).build()) {
-
-      String tableName = getUniqueNames(1)[0];
-      c.tableOperations().create(tableName);
-
-      // write random data because its very unlikely it will compress
-      writeRandomValue(c, tableName, 1 << 16);
-      writeRandomValue(c, tableName, 1 << 16);
-
-      writeRandomValue(c, tableName, 1 << 9);
-      writeRandomValue(c, tableName, 1 << 7);
-      writeRandomValue(c, tableName, 1 << 6);
-
-      assertEquals(5, FunctionalTestUtils.countRFiles(c, tableName));
-
-      CompactionStrategyConfig csConfig =
-          new CompactionStrategyConfig(SizeCompactionStrategy.class.getName());
-      csConfig.setOptions(Map.of("size", "" + (1 << 15)));
-      c.tableOperations().compact(tableName,
-          new 
CompactionConfig().setWait(true).setCompactionStrategy(csConfig));
-
-      assertEquals(3, FunctionalTestUtils.countRFiles(c, tableName));
-
-      csConfig = new 
CompactionStrategyConfig(SizeCompactionStrategy.class.getName());
-      csConfig.setOptions(Map.of("size", "" + (1 << 17)));
-      c.tableOperations().compact(tableName,
-          new 
CompactionConfig().setWait(true).setCompactionStrategy(csConfig));
-
-      assertEquals(1, FunctionalTestUtils.countRFiles(c, tableName));
-    }
-
-  }
-
-  @Test
-  public void testConcurrent() throws Exception {

Review Comment:
   We can keep this test, seems like it does not use compaction strats.  Maybe 
move it to another class w/ compaction test.



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