Esempio n. 1
0
 protected void unloadAndKillData(final String dataSource, String start, String end)
     throws Exception {
   Interval interval = new Interval(start + "/" + end);
   coordinator.unloadSegmentsForDataSource(dataSource, interval);
   RetryUtil.retryUntilFalse(
       new Callable<Boolean>() {
         @Override
         public Boolean call() throws Exception {
           return coordinator.areSegmentsLoaded(dataSource);
         }
       },
       "Segment Unloading");
   coordinator.deleteSegmentsDataSource(dataSource, interval);
   RetryUtil.retryUntilTrue(
       new Callable<Boolean>() {
         @Override
         public Boolean call() throws Exception {
           return (indexer.getPendingTasks().size()
                   + indexer.getRunningTasks().size()
                   + indexer.getWaitingTasks().size())
               == 0;
         }
       },
       "Waiting for Tasks Completion");
 }
Esempio n. 2
0
  protected void unloadAndKillData(final String dataSource) throws Exception {
    ArrayList<String> intervals = coordinator.getSegmentIntervals(dataSource);

    // each element in intervals has this form:
    //   2015-12-01T23:15:00.000Z/2015-12-01T23:16:00.000Z
    // we'll sort the list (ISO dates have lexicographic order)
    // then delete segments from the 1st date in the first string
    // to the 2nd date in the last string
    Collections.sort(intervals);
    String first = intervals.get(0).split("/")[0];
    String last = intervals.get(intervals.size() - 1).split("/")[1];
    unloadAndKillData(dataSource, first, last);
  }