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


##########
core/src/test/java/org/apache/accumulo/core/spi/compaction/DefaultCompactionPlannerTest.java:
##########
@@ -239,6 +243,38 @@ public void testMaxSize() {
     assertEquals(CompactionExecutorIdImpl.externalId("large"), 
job.getExecutor());
   }
 
+  /**
+   * Tests max.open can be overridden with maxOpen.
+   */
+  @Test
+  @SuppressWarnings("removal")
+  public void testOverrideMaxOpen() {
+    DefaultCompactionPlanner planner = new DefaultCompactionPlanner();
+    ConfigurationCopy aconf = new 
ConfigurationCopy(DefaultConfiguration.getInstance());
+    aconf.set(Property.TSERV_MAJC_THREAD_MAXOPEN.getKey(), "5");
+
+    ConfigurationImpl config = new ConfigurationImpl(aconf);
+
+    ServiceEnvironment senv = EasyMock.createMock(ServiceEnvironment.class);
+    EasyMock.expect(senv.getConfiguration()).andReturn(config).anyTimes();
+    EasyMock.replay(senv);
+
+    String executors = getExecutors("'type': 
'internal','maxSize':'32M','numThreads':1",
+        "'type': 'internal','maxSize':'128M','numThreads':2", "'type': 
'external','queue':'q1'");
+
+    // Test with max.open property
+    planner.init(getInitParams(senv, executors, "15"));
+    assertEquals(5, planner.getMaxFilesToCompact());

Review Comment:
   If this works it would test a bit more and would not need to add the 
getMaxFilesToCompact() method
   
   ```suggestion
       var all = createCFs("F1", "1M", "F2", "1M", "F3", "1M", "F4", "1M", 
"F5", "11M","F6","1M","F7","1M");
       var params = createPlanningParams(all, all, Set.of(), 2, 
CompactionKind.SYSTEM);
       var plan = planner.makePlan(params);
       // TODO verify job has 5 files
   ```



##########
core/src/test/java/org/apache/accumulo/core/spi/compaction/DefaultCompactionPlannerTest.java:
##########
@@ -239,6 +243,38 @@ public void testMaxSize() {
     assertEquals(CompactionExecutorIdImpl.externalId("large"), 
job.getExecutor());
   }
 
+  /**
+   * Tests max.open can be overridden with maxOpen.
+   */
+  @Test
+  @SuppressWarnings("removal")
+  public void testOverrideMaxOpen() {
+    DefaultCompactionPlanner planner = new DefaultCompactionPlanner();
+    ConfigurationCopy aconf = new 
ConfigurationCopy(DefaultConfiguration.getInstance());
+    aconf.set(Property.TSERV_MAJC_THREAD_MAXOPEN.getKey(), "5");
+
+    ConfigurationImpl config = new ConfigurationImpl(aconf);
+
+    ServiceEnvironment senv = EasyMock.createMock(ServiceEnvironment.class);
+    EasyMock.expect(senv.getConfiguration()).andReturn(config).anyTimes();
+    EasyMock.replay(senv);
+
+    String executors = getExecutors("'type': 
'internal','maxSize':'32M','numThreads':1",
+        "'type': 'internal','maxSize':'128M','numThreads':2", "'type': 
'external','queue':'q1'");
+
+    // Test with max.open property
+    planner.init(getInitParams(senv, executors, "15"));
+    assertEquals(5, planner.getMaxFilesToCompact());
+
+    // Test again by overriding maxOpen
+    Integer maxOpen = 30;
+    aconf.set(Property.TSERV_COMPACTION_SERVICE_PREFIX.getKey() + 
"cs1.planner.opts.maxOpen",
+        maxOpen.toString());
+    planner = new DefaultCompactionPlanner();
+    planner.init(getInitParams(senv, executors, maxOpen.toString()));
+    assertEquals(maxOpen, planner.getMaxFilesToCompact());

Review Comment:
   Could set max open to 10 and pass in 11 files of all the same size  like the 
prev comment and verify it creates a job of size 10.



-- 
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-unsubscr...@accumulo.apache.org

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

Reply via email to