use of org.apache.druid.client.DataSourcesSnapshot in project druid by apache.
the class LogUsedSegments method run.
@Override
public DruidCoordinatorRuntimeParams run(DruidCoordinatorRuntimeParams params) {
log.debug("Starting coordination. Getting used segments.");
// Log info about all used segments only if debug logging is enabled
if (log.isDebugEnabled()) {
DataSourcesSnapshot dataSourcesSnapshot = params.getDataSourcesSnapshot();
log.debug("Used Segments");
for (DataSegment dataSegment : dataSourcesSnapshot.iterateAllUsedSegmentsInSnapshot()) {
log.debug(" %s", dataSegment);
}
}
log.info("Found [%,d] used segments.", params.getUsedSegments().size());
return params;
}
use of org.apache.druid.client.DataSourcesSnapshot in project druid by apache.
the class DataSourcesSnapshotBenchmark method setUp.
@Setup
public void setUp() {
long start = System.currentTimeMillis();
Map<String, ImmutableDruidDataSource> dataSources = new HashMap<>();
for (int i = 0; i < numDataSources; i++) {
String dataSource = StringUtils.format("ds-%d", i);
List<DataSegment> segments = new ArrayList<>();
for (int j = 0; j < numSegmentPerDataSource; j++) {
segments.add(new DataSegment(dataSource, TEST_SEGMENT_INTERVAL, String.valueOf(j), Collections.emptyMap(), Collections.emptyList(), Collections.emptyList(), NoneShardSpec.instance(), 0, 10L));
}
dataSources.put(dataSource, new ImmutableDruidDataSource(dataSource, Collections.emptyMap(), segments));
}
snapshot = new DataSourcesSnapshot(dataSources);
System.out.println("Setup Time " + (System.currentTimeMillis() - start) + " ms");
}
Aggregations