use of org.joda.time.Duration in project druid by druid-io.
the class DruidCoordinatorConfigTest method testDeserialization.
@Test
public void testDeserialization() {
ConfigurationObjectFactory factory = Config.createFactory(new Properties());
// with defaults
DruidCoordinatorConfig config = factory.build(DruidCoordinatorConfig.class);
Assert.assertEquals(new Duration("PT300s"), config.getCoordinatorStartDelay());
Assert.assertEquals(new Duration("PT60s"), config.getCoordinatorPeriod());
Assert.assertEquals(new Duration("PT1800s"), config.getCoordinatorIndexingPeriod());
Assert.assertEquals(86400000, config.getCoordinatorKillPeriod().getMillis());
Assert.assertEquals(7776000000L, config.getCoordinatorKillDurationToRetain().getMillis());
Assert.assertEquals(100, config.getCoordinatorKillMaxSegments());
Assert.assertEquals(new Duration(15 * 60 * 1000), config.getLoadTimeoutDelay());
Assert.assertEquals(Duration.millis(50), config.getLoadQueuePeonRepeatDelay());
Assert.assertTrue(config.getCompactionSkipLockedIntervals());
// with non-defaults
Properties props = new Properties();
props.setProperty("druid.coordinator.startDelay", "PT1s");
props.setProperty("druid.coordinator.period", "PT1s");
props.setProperty("druid.coordinator.period.indexingPeriod", "PT1s");
props.setProperty("druid.coordinator.kill.on", "true");
props.setProperty("druid.coordinator.kill.period", "PT1s");
props.setProperty("druid.coordinator.kill.durationToRetain", "PT1s");
props.setProperty("druid.coordinator.kill.maxSegments", "10000");
props.setProperty("druid.coordinator.kill.pendingSegments.on", "true");
props.setProperty("druid.coordinator.load.timeout", "PT1s");
props.setProperty("druid.coordinator.loadqueuepeon.repeatDelay", "PT0.100s");
props.setProperty("druid.coordinator.compaction.skipLockedIntervals", "false");
factory = Config.createFactory(props);
config = factory.build(DruidCoordinatorConfig.class);
Assert.assertEquals(new Duration("PT1s"), config.getCoordinatorStartDelay());
Assert.assertEquals(new Duration("PT1s"), config.getCoordinatorPeriod());
Assert.assertEquals(new Duration("PT1s"), config.getCoordinatorIndexingPeriod());
Assert.assertEquals(new Duration("PT1s"), config.getCoordinatorKillPeriod());
Assert.assertEquals(new Duration("PT1s"), config.getCoordinatorKillDurationToRetain());
Assert.assertEquals(10000, config.getCoordinatorKillMaxSegments());
Assert.assertEquals(new Duration("PT1s"), config.getLoadTimeoutDelay());
Assert.assertEquals(Duration.millis(100), config.getLoadQueuePeonRepeatDelay());
Assert.assertFalse(config.getCompactionSkipLockedIntervals());
}
use of org.joda.time.Duration in project druid by druid-io.
the class KillAuditLogTest method testConstructorFailIfInvalidPeriod.
@Test
public void testConstructorFailIfInvalidPeriod() {
TestDruidCoordinatorConfig druidCoordinatorConfig = new TestDruidCoordinatorConfig(null, null, null, new Duration("PT5S"), null, null, null, null, null, new Duration("PT3S"), new Duration("PT1S"), null, null, null, null, null, 10, null);
exception.expect(IllegalArgumentException.class);
exception.expectMessage("coordinator audit kill period must be >= druid.coordinator.period.metadataStoreManagementPeriod");
killAuditLog = new KillAuditLog(mockAuditManager, druidCoordinatorConfig);
}
use of org.joda.time.Duration in project druid by druid-io.
the class KillAuditLogTest method testRunSkipIfLastRunLessThanPeriod.
@Test
public void testRunSkipIfLastRunLessThanPeriod() {
TestDruidCoordinatorConfig druidCoordinatorConfig = new TestDruidCoordinatorConfig(null, null, null, new Duration("PT5S"), null, null, null, null, null, new Duration(Long.MAX_VALUE), new Duration("PT1S"), null, null, null, null, null, 10, null);
killAuditLog = new KillAuditLog(mockAuditManager, druidCoordinatorConfig);
killAuditLog.run(mockDruidCoordinatorRuntimeParams);
Mockito.verifyNoInteractions(mockAuditManager);
}
use of org.joda.time.Duration in project druid by druid-io.
the class KillDatasourceMetadataTest method testRunSkipIfLastRunLessThanPeriod.
@Test
public void testRunSkipIfLastRunLessThanPeriod() {
TestDruidCoordinatorConfig druidCoordinatorConfig = new TestDruidCoordinatorConfig(null, null, null, new Duration("PT5S"), null, null, null, null, null, null, null, null, null, null, new Duration(Long.MAX_VALUE), new Duration("PT1S"), 10, null);
killDatasourceMetadata = new KillDatasourceMetadata(druidCoordinatorConfig, mockIndexerMetadataStorageCoordinator, mockMetadataSupervisorManager);
killDatasourceMetadata.run(mockDruidCoordinatorRuntimeParams);
Mockito.verifyNoInteractions(mockIndexerMetadataStorageCoordinator);
Mockito.verifyNoInteractions(mockMetadataSupervisorManager);
}
use of org.joda.time.Duration in project druid by druid-io.
the class KillDatasourceMetadataTest method testConstructorFailIfInvalidRetainDuration.
@Test
public void testConstructorFailIfInvalidRetainDuration() {
TestDruidCoordinatorConfig druidCoordinatorConfig = new TestDruidCoordinatorConfig(null, null, null, new Duration("PT5S"), null, null, null, null, null, null, null, null, null, null, new Duration("PT6S"), new Duration("PT-1S"), 10, null);
exception.expect(IllegalArgumentException.class);
exception.expectMessage("Coordinator datasource metadata kill retainDuration must be >= 0");
killDatasourceMetadata = new KillDatasourceMetadata(druidCoordinatorConfig, mockIndexerMetadataStorageCoordinator, mockMetadataSupervisorManager);
}
Aggregations