use of org.apache.druid.segment.QueryableIndex in project druid by druid-io.
the class DruidSchemaConcurrencyTest method addSegmentsToCluster.
private void addSegmentsToCluster(int partitionIdStart, int numServers, int numSegments) {
for (int i = 0; i < numSegments; i++) {
DataSegment segment = newSegment(i + partitionIdStart);
QueryableIndex index = newQueryableIndex(i + partitionIdStart);
walker.add(segment, index);
int serverIndex = i % numServers;
inventoryView.addServerSegment(newServer("server_" + serverIndex), segment);
}
}
use of org.apache.druid.segment.QueryableIndex in project druid by druid-io.
the class FireHydrantTest method testGetSegmentForQueryButNotAbleToAcquireReferences.
@Test
public void testGetSegmentForQueryButNotAbleToAcquireReferences() {
ReferenceCountingSegment incrementalSegmentReference = hydrant.getHydrantSegment();
Assert.assertEquals(0, incrementalSegmentReference.getNumReferences());
Optional<Pair<SegmentReference, Closeable>> maybeSegmentAndCloseable = hydrant.getSegmentForQuery(segmentReference -> new SegmentReference() {
@Override
public Optional<Closeable> acquireReferences() {
return Optional.empty();
}
@Override
public SegmentId getId() {
return incrementalIndexSegment.getId();
}
@Override
public Interval getDataInterval() {
return incrementalIndexSegment.getDataInterval();
}
@Nullable
@Override
public QueryableIndex asQueryableIndex() {
return incrementalIndexSegment.asQueryableIndex();
}
@Override
public StorageAdapter asStorageAdapter() {
return incrementalIndexSegment.asStorageAdapter();
}
@Override
public void close() {
incrementalIndexSegment.close();
}
});
Assert.assertFalse(maybeSegmentAndCloseable.isPresent());
Assert.assertEquals(0, incrementalSegmentReference.getNumReferences());
}
Aggregations