You are viewing a plain text version of this content. The canonical link for it is here.
Posted to notifications@accumulo.apache.org by GitBox <gi...@apache.org> on 2022/05/24 08:21:55 UTC

[GitHub] [accumulo] ctubbsii opened a new pull request, #2727: Simplify config handling for compaction tests

ctubbsii opened a new pull request, #2727:
URL: https://github.com/apache/accumulo/pull/2727

   In pom.xml files:
   * ensure unit tests configured to run without reusing forks explicitly
     override any other includes
   
   In compaction tests:
   * avoid use of mock object for AccumuloConfiguration when
     DefaultConfiguration or ConfigurationCopy will suffice
   * use static import for EasyMock
   * Remove unnecessary parameter in test class for AccumuloConfiguration
     (retrieve from mocked context object instead)
   * use `var` in a few places where it made sense
   
   Avoid UnsupportedOperationException in AccumuloConfiguration:
   * Make AccumuloConfiguration.isPropertySet abstract and add missing
     implementation
   * Remove unnecessary anonymous inner class subclass instances of
     AccumuloConfiguration when ConfigurationCopy initialized with
     DefaultConfiguration would suffice
   
   Small Compaction constructor improvements:
   * Remove redundant constructor code in Compactor and
     CompactionCoordinator and ensure code uses the provided
     AccumuloConfiguration from tests for all tasks


-- 
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: notifications-unsubscribe@accumulo.apache.org

For queries about this service, please contact Infrastructure at:
users@infra.apache.org


[GitHub] [accumulo] ctubbsii merged pull request #2727: Simplify config handling for compaction tests

Posted by GitBox <gi...@apache.org>.
ctubbsii merged PR #2727:
URL: https://github.com/apache/accumulo/pull/2727


-- 
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: notifications-unsubscribe@accumulo.apache.org

For queries about this service, please contact Infrastructure at:
users@infra.apache.org


[GitHub] [accumulo] ctubbsii commented on a diff in pull request #2727: Simplify config handling for compaction tests

Posted by GitBox <gi...@apache.org>.
ctubbsii commented on code in PR #2727:
URL: https://github.com/apache/accumulo/pull/2727#discussion_r880768908


##########
server/compaction-coordinator/src/main/java/org/apache/accumulo/coordinator/CompactionCoordinator.java:
##########
@@ -123,20 +123,12 @@ public class CompactionCoordinator extends AbstractServer
   private ScheduledThreadPoolExecutor schedExecutor;
 
   protected CompactionCoordinator(ServerOpts opts, String[] args) {
-    super("compaction-coordinator", opts, args);
-    aconf = getConfiguration();
-    schedExecutor = ThreadPools.getServerThreadPools().createGeneralScheduledExecutorService(aconf);
-    compactionFinalizer = createCompactionFinalizer(schedExecutor);
-    tserverSet = createLiveTServerSet();
-    setupSecurity();
-    startGCLogger(schedExecutor);
-    printStartupMsg();
-    startCompactionCleaner(schedExecutor);
+    this(opts, args, null);
   }
 
   protected CompactionCoordinator(ServerOpts opts, String[] args, AccumuloConfiguration conf) {
     super("compaction-coordinator", opts, args);
-    aconf = conf;
+    aconf = conf == null ? super.getConfiguration() : conf;

Review Comment:
   It's used in a getter I added, to ensure that it overrides super.getConfiguration() if it is passed in explicitly.
   I would like to remove it entirely, so it's not passed into the constructor at all, instead relying on overriding it in getter in a test subclass, but it is needed in the constructor, so it needs to be passed in. The places we use it in the constructor could call `this.getConfiguration()`, but they'd have to be lazily-loaded with a Supplier, like we've done in ServerContext and elsewhere, so that the these objects that read the configuration are instantiated after the server itself is fully constructed. Then, we can get rid of the second constructor. But, that seemed like a lot of effort for now.



-- 
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: notifications-unsubscribe@accumulo.apache.org

For queries about this service, please contact Infrastructure at:
users@infra.apache.org


[GitHub] [accumulo] dlmarion commented on a diff in pull request #2727: Simplify config handling for compaction tests

Posted by GitBox <gi...@apache.org>.
dlmarion commented on code in PR #2727:
URL: https://github.com/apache/accumulo/pull/2727#discussion_r880641098


##########
server/compaction-coordinator/src/main/java/org/apache/accumulo/coordinator/CompactionCoordinator.java:
##########
@@ -123,20 +123,12 @@ public class CompactionCoordinator extends AbstractServer
   private ScheduledThreadPoolExecutor schedExecutor;
 
   protected CompactionCoordinator(ServerOpts opts, String[] args) {
-    super("compaction-coordinator", opts, args);
-    aconf = getConfiguration();
-    schedExecutor = ThreadPools.getServerThreadPools().createGeneralScheduledExecutorService(aconf);
-    compactionFinalizer = createCompactionFinalizer(schedExecutor);
-    tserverSet = createLiveTServerSet();
-    setupSecurity();
-    startGCLogger(schedExecutor);
-    printStartupMsg();
-    startCompactionCleaner(schedExecutor);
+    this(opts, args, null);
   }
 
   protected CompactionCoordinator(ServerOpts opts, String[] args, AccumuloConfiguration conf) {
     super("compaction-coordinator", opts, args);
-    aconf = conf;
+    aconf = conf == null ? super.getConfiguration() : conf;

Review Comment:
   if `aconf` is no longer referenced outside of the constructor, then could remove the class variable and only use it locally. I'm not sure if this is the case.



##########
server/compactor/src/main/java/org/apache/accumulo/compactor/Compactor.java:
##########
@@ -156,22 +156,13 @@ public String getQueueName() {
   private final AtomicBoolean compactionRunning = new AtomicBoolean(false);
 
   protected Compactor(CompactorServerOpts opts, String[] args) {
-    super("compactor", opts, args);
-    queueName = opts.getQueueName();
-    aconf = getConfiguration();
-    setupSecurity();
-    watcher = new CompactionWatcher(aconf);
-    var schedExecutor =
-        ThreadPools.getServerThreadPools().createGeneralScheduledExecutorService(aconf);
-    startGCLogger(schedExecutor);
-    startCancelChecker(schedExecutor, TIME_BETWEEN_CANCEL_CHECKS);
-    printStartupMsg();
+    this(opts, args, null);
   }
 
   protected Compactor(CompactorServerOpts opts, String[] args, AccumuloConfiguration conf) {
     super("compactor", opts, args);
     queueName = opts.getQueueName();
-    aconf = conf;
+    aconf = conf == null ? super.getConfiguration() : conf;

Review Comment:
   same comment about `aconf` variable applies here



-- 
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: notifications-unsubscribe@accumulo.apache.org

For queries about this service, please contact Infrastructure at:
users@infra.apache.org


[GitHub] [accumulo] ctubbsii commented on a diff in pull request #2727: Simplify config handling for compaction tests

Posted by GitBox <gi...@apache.org>.
ctubbsii commented on code in PR #2727:
URL: https://github.com/apache/accumulo/pull/2727#discussion_r880769238


##########
server/compactor/src/main/java/org/apache/accumulo/compactor/Compactor.java:
##########
@@ -156,22 +156,13 @@ public String getQueueName() {
   private final AtomicBoolean compactionRunning = new AtomicBoolean(false);
 
   protected Compactor(CompactorServerOpts opts, String[] args) {
-    super("compactor", opts, args);
-    queueName = opts.getQueueName();
-    aconf = getConfiguration();
-    setupSecurity();
-    watcher = new CompactionWatcher(aconf);
-    var schedExecutor =
-        ThreadPools.getServerThreadPools().createGeneralScheduledExecutorService(aconf);
-    startGCLogger(schedExecutor);
-    startCancelChecker(schedExecutor, TIME_BETWEEN_CANCEL_CHECKS);
-    printStartupMsg();
+    this(opts, args, null);
   }
 
   protected Compactor(CompactorServerOpts opts, String[] args, AccumuloConfiguration conf) {
     super("compactor", opts, args);
     queueName = opts.getQueueName();
-    aconf = conf;
+    aconf = conf == null ? super.getConfiguration() : conf;

Review Comment:
   For completeness, same reply :smiley_cat: 



-- 
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: notifications-unsubscribe@accumulo.apache.org

For queries about this service, please contact Infrastructure at:
users@infra.apache.org