Ejemplo n.º 1
0
 @Test
 public void testDefaultBasePersistDirectory() {
   final RealtimeTuningConfig tuningConfig1 = RealtimeTuningConfig.makeDefaultTuningConfig(null);
   final RealtimeTuningConfig tuningConfig2 = RealtimeTuningConfig.makeDefaultTuningConfig(null);
   Assert.assertNotEquals(
       tuningConfig1.getBasePersistDirectory(), tuningConfig2.getBasePersistDirectory());
 }
Ejemplo n.º 2
0
 @Override
 public void close() throws Exception {
   appenderator.close();
   queryExecutor.shutdownNow();
   emitter.close();
   FileUtils.deleteDirectory(tuningConfig.getBasePersistDirectory());
 }
 @Override
 public Appenderator build(
     final DataSchema schema,
     final RealtimeTuningConfig config,
     final FireDepartmentMetrics metrics) {
   return Appenderators.createRealtime(
       schema,
       config.withBasePersistDirectory(
           makeBasePersistSubdirectory(
               config.getBasePersistDirectory(), schema.getDataSource(), config.getShardSpec())),
       metrics,
       dataSegmentPusher,
       objectMapper,
       indexIO,
       indexMerger,
       conglomerate,
       segmentAnnouncer,
       emitter,
       queryExecutorService,
       cache,
       cacheConfig);
 }
Ejemplo n.º 4
0
  @Test
  public void testSerdeWithNonDefaults() throws Exception {
    String jsonStr =
        "{\n"
            + "  \"type\": \"realtime\",\n"
            + "  \"maxRowsInMemory\": 100,\n"
            + "  \"intermediatePersistPeriod\": \"PT1H\",\n"
            + "  \"windowPeriod\": \"PT1H\",\n"
            + "  \"basePersistDirectory\": \"/tmp/xxx\",\n"
            + "  \"maxPendingPersists\": 100,\n"
            + "  \"buildV9Directly\": false,\n"
            + "  \"persistThreadPriority\": 100,\n"
            + "  \"mergeThreadPriority\": 100,\n"
            + "  \"reportParseExceptions\": true,\n"
            + "  \"handoffConditionTimeout\": 100\n"
            + "}";

    ObjectMapper mapper = TestHelper.getObjectMapper();
    RealtimeTuningConfig config =
        (RealtimeTuningConfig)
            mapper.readValue(
                mapper.writeValueAsString(mapper.readValue(jsonStr, TuningConfig.class)),
                TuningConfig.class);

    Assert.assertEquals("/tmp/xxx", config.getBasePersistDirectory().toString());
    Assert.assertEquals(false, config.getBuildV9Directly());
    Assert.assertEquals(100, config.getHandoffConditionTimeout());
    Assert.assertEquals(new IndexSpec(), config.getIndexSpec());
    Assert.assertEquals(new Period("PT1H"), config.getIntermediatePersistPeriod());
    Assert.assertEquals(NoneShardSpec.instance(), config.getShardSpec());
    Assert.assertEquals(100, config.getMaxPendingPersists());
    Assert.assertEquals(100, config.getMaxRowsInMemory());
    Assert.assertEquals(100, config.getMergeThreadPriority());
    Assert.assertEquals(100, config.getPersistThreadPriority());
    Assert.assertEquals(new Period("PT1H"), config.getWindowPeriod());
    Assert.assertEquals(true, config.isReportParseExceptions());
  }
Ejemplo n.º 5
0
  @Test
  public void testSerdeWithDefaults() throws Exception {
    String jsonStr = "{\"type\":\"realtime\"}";

    ObjectMapper mapper = TestHelper.getObjectMapper();
    RealtimeTuningConfig config =
        (RealtimeTuningConfig)
            mapper.readValue(
                mapper.writeValueAsString(mapper.readValue(jsonStr, TuningConfig.class)),
                TuningConfig.class);

    Assert.assertNotNull(config.getBasePersistDirectory());
    Assert.assertEquals(true, config.getBuildV9Directly());
    Assert.assertEquals(0, config.getHandoffConditionTimeout());
    Assert.assertEquals(new IndexSpec(), config.getIndexSpec());
    Assert.assertEquals(new Period("PT10M"), config.getIntermediatePersistPeriod());
    Assert.assertEquals(NoneShardSpec.instance(), config.getShardSpec());
    Assert.assertEquals(0, config.getMaxPendingPersists());
    Assert.assertEquals(75000, config.getMaxRowsInMemory());
    Assert.assertEquals(0, config.getMergeThreadPriority());
    Assert.assertEquals(0, config.getPersistThreadPriority());
    Assert.assertEquals(new Period("PT10M"), config.getWindowPeriod());
    Assert.assertEquals(false, config.isReportParseExceptions());
  }
Ejemplo n.º 6
0
 @After
 public void tearDown() throws Exception {
   EasyMock.verify(announcer, segmentPublisher, dataSegmentPusher, serverView, emitter);
   FileUtils.deleteDirectory(
       new File(tuningConfig.getBasePersistDirectory(), schema.getDataSource()));
 }
Ejemplo n.º 7
0
 @Test
 public void testSpecificBasePersistDirectory() {
   final RealtimeTuningConfig tuningConfig =
       RealtimeTuningConfig.makeDefaultTuningConfig(new File("/tmp/nonexistent"));
   Assert.assertEquals(new File("/tmp/nonexistent"), tuningConfig.getBasePersistDirectory());
 }