org.elasticsearch.common.util.BigArrays Java Examples

The following examples show how to use org.elasticsearch.common.util.BigArrays. You can vote up the ones you like or vote down the ones you don't like, and go to the original project or source file by following the links above each example. You may check out the related API usage on the sidebar.
Example #1
Source File: DefaultSearchContext.java    From Elasticsearch with Apache License 2.0 6 votes vote down vote up
public DefaultSearchContext(long id, ShardSearchRequest request, SearchShardTarget shardTarget,
                            Engine.Searcher engineSearcher, IndexService indexService, IndexShard indexShard,
                            ScriptService scriptService, PageCacheRecycler pageCacheRecycler,
                            BigArrays bigArrays, Counter timeEstimateCounter, ParseFieldMatcher parseFieldMatcher,
                            TimeValue timeout
) {
    super(parseFieldMatcher, request);
    this.id = id;
    this.request = request;
    this.searchType = request.searchType();
    this.shardTarget = shardTarget;
    this.engineSearcher = engineSearcher;
    this.scriptService = scriptService;
    this.pageCacheRecycler = pageCacheRecycler;
    // SearchContexts use a BigArrays that can circuit break
    this.bigArrays = bigArrays.withCircuitBreaking();
    this.dfsResult = new DfsSearchResult(id, shardTarget);
    this.queryResult = new QuerySearchResult(id, shardTarget);
    this.fetchResult = new FetchSearchResult(id, shardTarget);
    this.indexShard = indexShard;
    this.indexService = indexService;
    this.searcher = new ContextIndexSearcher(engineSearcher, indexService.cache().query(), indexShard.getQueryCachingPolicy());
    this.timeEstimateCounter = timeEstimateCounter;
    this.timeoutInMillis = timeout.millis();
}
 
Example #2
Source File: Translog.java    From crate with Apache License 2.0 6 votes vote down vote up
/**
 * Writes all operations in the given iterable to the given output stream including the size of the array
 * use {@link #readOperations(StreamInput, String)} to read it back.
 */
public static void writeOperations(StreamOutput outStream, List<Operation> toWrite) throws IOException {
    final ReleasableBytesStreamOutput out = new ReleasableBytesStreamOutput(BigArrays.NON_RECYCLING_INSTANCE);
    try {
        outStream.writeInt(toWrite.size());
        final BufferedChecksumStreamOutput checksumStreamOutput = new BufferedChecksumStreamOutput(out);
        for (Operation op : toWrite) {
            out.reset();
            final long start = out.position();
            out.skip(Integer.BYTES);
            writeOperationNoSize(checksumStreamOutput, op);
            long end = out.position();
            int operationSize = (int) (out.position() - Integer.BYTES - start);
            out.seek(start);
            out.writeInt(operationSize);
            out.seek(end);
            ReleasablePagedBytesReference bytes = out.bytes();
            bytes.writeTo(outStream);
        }
    } finally {
        Releasables.close(out);
    }

}
 
Example #3
Source File: CrateSearchContext.java    From Elasticsearch with Apache License 2.0 6 votes vote down vote up
public CrateSearchContext(long id,
                          final long nowInMillis,
                          SearchShardTarget shardTarget,
                          Engine.Searcher engineSearcher,
                          IndexService indexService,
                          final IndexShard indexShard,
                          ScriptService scriptService,
                          PageCacheRecycler pageCacheRecycler,
                          BigArrays bigArrays,
                          Counter timeEstimateCounter,
                          Optional<Scroll> scroll) {
    super(id, new CrateSearchShardRequest(nowInMillis, scroll, indexShard),
            shardTarget, engineSearcher, indexService,
            indexShard, scriptService, pageCacheRecycler,
            bigArrays, timeEstimateCounter, ParseFieldMatcher.STRICT, SearchService.NO_TIMEOUT);
    this.engineSearcher = engineSearcher;
}
 
Example #4
Source File: GeoBoundsAggregator.java    From Elasticsearch with Apache License 2.0 6 votes vote down vote up
protected GeoBoundsAggregator(String name, AggregationContext aggregationContext, Aggregator parent,
        ValuesSource.GeoPoint valuesSource, boolean wrapLongitude, List<PipelineAggregator> pipelineAggregators,
        Map<String, Object> metaData) throws IOException {
    super(name, aggregationContext, parent, pipelineAggregators, metaData);
    this.valuesSource = valuesSource;
    this.wrapLongitude = wrapLongitude;
    if (valuesSource != null) {
        final BigArrays bigArrays = context.bigArrays();
        tops = bigArrays.newDoubleArray(1, false);
        tops.fill(0, tops.size(), Double.NEGATIVE_INFINITY);
        bottoms = bigArrays.newDoubleArray(1, false);
        bottoms.fill(0, bottoms.size(), Double.POSITIVE_INFINITY);
        posLefts = bigArrays.newDoubleArray(1, false);
        posLefts.fill(0, posLefts.size(), Double.POSITIVE_INFINITY);
        posRights = bigArrays.newDoubleArray(1, false);
        posRights.fill(0, posRights.size(), Double.NEGATIVE_INFINITY);
        negLefts = bigArrays.newDoubleArray(1, false);
        negLefts.fill(0, negLefts.size(), Double.POSITIVE_INFINITY);
        negRights = bigArrays.newDoubleArray(1, false);
        negRights.fill(0, negRights.size(), Double.NEGATIVE_INFINITY);
    }
}
 
Example #5
Source File: Netty4Plugin.java    From crate with Apache License 2.0 6 votes vote down vote up
@Override
public Map<String, Supplier<Transport>> getTransports(Settings settings,
                                                      ThreadPool threadPool,
                                                      BigArrays bigArrays,
                                                      PageCacheRecycler pageCacheRecycler,
                                                      CircuitBreakerService circuitBreakerService,
                                                      NamedWriteableRegistry namedWriteableRegistry,
                                                      NetworkService networkService) {
    return Collections.singletonMap(
        NETTY_TRANSPORT_NAME,
        () -> new Netty4Transport(
            settings,
            threadPool,
            networkService,
            bigArrays,
            namedWriteableRegistry,
            circuitBreakerService
        )
    );
}
 
Example #6
Source File: TransportTermsByQueryAction.java    From siren-join with GNU Affero General Public License v3.0 6 votes vote down vote up
/**
 * Constructor
 */
@Inject
public TransportTermsByQueryAction(Settings settings, ThreadPool threadPool, ClusterService clusterService,
                                   TransportService transportService, IndicesService indicesService,
                                   CircuitBreakerService breakerService,
                                   ScriptService scriptService, PageCacheRecycler pageCacheRecycler,
                                   BigArrays bigArrays, ActionFilters actionFilters,
                                   IndexNameExpressionResolver indexNameExpressionResolver, Client client) {
  super(settings, TermsByQueryAction.NAME, threadPool, clusterService, transportService, actionFilters,
          indexNameExpressionResolver, TermsByQueryRequest.class, TermsByQueryShardRequest.class,
          // Use the generic threadpool which is cached, as we can end up with deadlock with the SEARCH threadpool
          ThreadPool.Names.GENERIC);
  this.indicesService = indicesService;
  this.scriptService = scriptService;
  this.pageCacheRecycler = pageCacheRecycler;
  this.bigArrays = bigArrays;
  this.breakerService = breakerService;
  this.client = client;
}
 
Example #7
Source File: Netty4Plugin.java    From crate with Apache License 2.0 6 votes vote down vote up
@Override
public Map<String, Supplier<HttpServerTransport>> getHttpTransports(Settings settings, ThreadPool threadPool, BigArrays bigArrays,
                                                                    CircuitBreakerService circuitBreakerService,
                                                                    NamedWriteableRegistry namedWriteableRegistry,
                                                                    NamedXContentRegistry xContentRegistry,
                                                                    NetworkService networkService,
                                                                    NodeClient nodeClient) {
    return Collections.singletonMap(
        NETTY_HTTP_TRANSPORT_NAME,
        () -> new Netty4HttpServerTransport(
            settings,
            networkService,
            bigArrays,
            threadPool,
            xContentRegistry,
            pipelineRegistry,
            nodeClient
        )
    );
}
 
Example #8
Source File: ShardCollectorProviderFactory.java    From crate with Apache License 2.0 6 votes vote down vote up
ShardCollectorProviderFactory(ClusterService clusterService,
                              Settings settings,
                              Schemas schemas,
                              ThreadPool threadPool,
                              TransportActionProvider transportActionProvider,
                              BlobIndicesService blobIndicesService,
                              Functions functions,
                              LuceneQueryBuilder luceneQueryBuilder,
                              NodeJobsCounter nodeJobsCounter,
                              BigArrays bigArrays) {
    this.settings = settings;
    this.schemas = schemas;
    this.clusterService = clusterService;
    this.threadPool = threadPool;
    this.transportActionProvider = transportActionProvider;
    this.blobIndicesService = blobIndicesService;
    this.functions = functions;
    this.luceneQueryBuilder = luceneQueryBuilder;
    this.nodeJobsCounter = nodeJobsCounter;
    this.bigArrays = bigArrays;
}
 
Example #9
Source File: InternalCardinality.java    From Elasticsearch with Apache License 2.0 6 votes vote down vote up
@Override
public InternalAggregation doReduce(List<InternalAggregation> aggregations, ReduceContext reduceContext) {
    InternalCardinality reduced = null;
    for (InternalAggregation aggregation : aggregations) {
        final InternalCardinality cardinality = (InternalCardinality) aggregation;
        if (cardinality.counts != null) {
            if (reduced == null) {
                reduced = new InternalCardinality(name, new HyperLogLogPlusPlus(cardinality.counts.precision(),
                        BigArrays.NON_RECYCLING_INSTANCE, 1), this.valueFormatter, pipelineAggregators(), getMetaData());
            }
            reduced.merge(cardinality);
        }
    }

    if (reduced == null) { // all empty
        return aggregations.get(0);
    } else {
        return reduced;
    }
}
 
Example #10
Source File: HyperLogLogPlusPlus.java    From Elasticsearch with Apache License 2.0 6 votes vote down vote up
public static HyperLogLogPlusPlus readFrom(StreamInput in, BigArrays bigArrays) throws IOException {
    final int precision = in.readVInt();
    HyperLogLogPlusPlus counts = new HyperLogLogPlusPlus(precision, bigArrays, 1);
    final boolean algorithm = in.readBoolean();
    if (algorithm == LINEAR_COUNTING) {
        counts.algorithm.clear(0);
        final long size = in.readVLong();
        for (long i = 0; i < size; ++i) {
            final int encoded = in.readInt();
            counts.hashSet.add(0, encoded);
        }
    } else {
        counts.algorithm.set(0);
        for (int i = 0; i < counts.m; ++i) {
            counts.runLens.set(i, in.readByte());
        }
    }
    return counts;
}
 
Example #11
Source File: AvgAggregator.java    From Elasticsearch with Apache License 2.0 6 votes vote down vote up
@Override
public LeafBucketCollector getLeafCollector(LeafReaderContext ctx,
        final LeafBucketCollector sub) throws IOException {
    if (valuesSource == null) {
        return LeafBucketCollector.NO_OP_COLLECTOR;
    }
    final BigArrays bigArrays = context.bigArrays();
    final SortedNumericDoubleValues values = valuesSource.doubleValues(ctx);
    return new LeafBucketCollectorBase(sub, values) {
        @Override
        public void collect(int doc, long bucket) throws IOException {
            counts = bigArrays.grow(counts, bucket + 1);
            sums = bigArrays.grow(sums, bucket + 1);

            values.setDocument(doc);
            final int valueCount = values.count();
            counts.increment(bucket, valueCount);
            double sum = 0;
            for (int i = 0; i < valueCount; i++) {
                sum += values.valueAt(i);
            }
            sums.increment(bucket, sum);
        }
    };
}
 
Example #12
Source File: NodeModule.java    From Elasticsearch with Apache License 2.0 6 votes vote down vote up
@Override
protected void configure() {
    if (pageCacheRecyclerImpl == PageCacheRecycler.class) {
        bind(PageCacheRecycler.class).asEagerSingleton();
    } else {
        bind(PageCacheRecycler.class).to(pageCacheRecyclerImpl).asEagerSingleton();
    }
    if (bigArraysImpl == BigArrays.class) {
        bind(BigArrays.class).asEagerSingleton();
    } else {
        bind(BigArrays.class).to(bigArraysImpl).asEagerSingleton();
    }

    bind(Node.class).toInstance(node);
    bind(NodeSettingsService.class).asEagerSingleton();
    bind(NodeService.class).asEagerSingleton();
}
 
Example #13
Source File: OpenDistroSecuritySSLPlugin.java    From deprecated-security-ssl with Apache License 2.0 6 votes vote down vote up
@Override
public Map<String, Supplier<HttpServerTransport>> getHttpTransports(Settings settings, ThreadPool threadPool, BigArrays bigArrays,
        CircuitBreakerService circuitBreakerService, NamedWriteableRegistry namedWriteableRegistry,
        NamedXContentRegistry xContentRegistry, NetworkService networkService, Dispatcher dispatcher) {
    
    final Map<String, Supplier<HttpServerTransport>> httpTransports = new HashMap<String, Supplier<HttpServerTransport>>(1);
    if (!client && httpSSLEnabled) {
        
        final ValidatingDispatcher validatingDispatcher = new ValidatingDispatcher(threadPool.getThreadContext(), dispatcher, settings, configPath, NOOP_SSL_EXCEPTION_HANDLER);
        final OpenDistroSecuritySSLNettyHttpServerTransport sgsnht = new OpenDistroSecuritySSLNettyHttpServerTransport(settings, networkService, bigArrays, threadPool, odsks, xContentRegistry, validatingDispatcher, NOOP_SSL_EXCEPTION_HANDLER);
        
        httpTransports.put("com.amazon.opendistroforelasticsearch.security.ssl.http.netty.OpenDistroSecuritySSLNettyHttpServerTransport", () -> sgsnht);
        
    }
    return httpTransports;
}
 
Example #14
Source File: ShadowIndexShard.java    From Elasticsearch with Apache License 2.0 6 votes vote down vote up
@Inject
public ShadowIndexShard(ShardId shardId, IndexSettingsService indexSettingsService,
                        IndicesLifecycle indicesLifecycle, Store store, StoreRecoveryService storeRecoveryService,
                        ThreadPool threadPool, MapperService mapperService,
                        IndexQueryParserService queryParserService, IndexCache indexCache,
                        IndexAliasesService indexAliasesService, IndicesQueryCache indicesQueryCache,
                        ShardPercolateService shardPercolateService, CodecService codecService,
                        ShardTermVectorsService termVectorsService, IndexFieldDataService indexFieldDataService,
                        IndexService indexService, @Nullable IndicesWarmer warmer,
                        SnapshotDeletionPolicy deletionPolicy, SimilarityService similarityService,
                        EngineFactory factory, ClusterService clusterService,
                        ShardPath path, BigArrays bigArrays, IndexSearcherWrappingService wrappingService,
                        IndexingMemoryController indexingMemoryController, SearchService shardSearchService) throws IOException {
    super(shardId, indexSettingsService, indicesLifecycle, store, storeRecoveryService,
          threadPool, mapperService, queryParserService, indexCache, indexAliasesService,
          indicesQueryCache, shardPercolateService, codecService,
          termVectorsService, indexFieldDataService, indexService,
          warmer, deletionPolicy, similarityService,
          factory, clusterService, path, bigArrays, wrappingService, indexingMemoryController, shardSearchService);
}
 
Example #15
Source File: TranslogConfig.java    From Elasticsearch with Apache License 2.0 6 votes vote down vote up
/**
 * Creates a new TranslogConfig instance
 * @param shardId the shard ID this translog belongs to
 * @param translogPath the path to use for the transaction log files
 * @param indexSettings the index settings used to set internal variables
 * @param durabilty the default durability setting for the translog
 * @param bigArrays a bigArrays instance used for temporarily allocating write operations
 * @param threadPool a {@link ThreadPool} to schedule async sync durability
 */
public TranslogConfig(ShardId shardId, Path translogPath, Settings indexSettings, Translog.Durabilty durabilty, BigArrays bigArrays, @Nullable ThreadPool threadPool) {
    this.indexSettings = indexSettings;
    this.shardId = shardId;
    this.translogPath = translogPath;
    this.durabilty = durabilty;
    this.threadPool = threadPool;
    this.bigArrays = bigArrays;
    this.type = TranslogWriter.Type.fromString(indexSettings.get(INDEX_TRANSLOG_FS_TYPE, TranslogWriter.Type.BUFFERED.name()));
    this.bufferSize = (int) indexSettings.getAsBytesSize(INDEX_TRANSLOG_BUFFER_SIZE, IndexingMemoryController.INACTIVE_SHARD_TRANSLOG_BUFFER).bytes(); // Not really interesting, updated by IndexingMemoryController...

    syncInterval = indexSettings.getAsTime(INDEX_TRANSLOG_SYNC_INTERVAL, TimeValue.timeValueSeconds(5));
    if (syncInterval.millis() > 0 && threadPool != null) {
        syncOnEachOperation = false;
    } else if (syncInterval.millis() == 0) {
        syncOnEachOperation = true;
    } else {
        syncOnEachOperation = false;
    }
}
 
Example #16
Source File: Translog.java    From Elasticsearch with Apache License 2.0 6 votes vote down vote up
/**
 * Writes all operations in the given iterable to the given output stream including the size of the array
 * use {@link #readOperations(StreamInput)} to read it back.
 */
public static void writeOperations(StreamOutput outStream, List<Operation> toWrite) throws IOException {
    final ReleasableBytesStreamOutput out = new ReleasableBytesStreamOutput(BigArrays.NON_RECYCLING_INSTANCE);
    try {
        outStream.writeInt(toWrite.size());
        final BufferedChecksumStreamOutput checksumStreamOutput = new BufferedChecksumStreamOutput(out);
        for (Operation op : toWrite) {
            out.reset();
            final long start = out.position();
            out.skip(RamUsageEstimator.NUM_BYTES_INT);
            writeOperationNoSize(checksumStreamOutput, op);
            long end = out.position();
            int operationSize = (int) (out.position() - RamUsageEstimator.NUM_BYTES_INT - start);
            out.seek(start);
            out.writeInt(operationSize);
            out.seek(end);
            ReleasablePagedBytesReference bytes = out.bytes();
            bytes.writeTo(outStream);
        }
    } finally {
        Releasables.close(out.bytes());
    }

}
 
Example #17
Source File: MinAggregator.java    From Elasticsearch with Apache License 2.0 6 votes vote down vote up
@Override
public LeafBucketCollector getLeafCollector(LeafReaderContext ctx,
        final LeafBucketCollector sub) throws IOException {
    if (valuesSource == null) {
        return LeafBucketCollector.NO_OP_COLLECTOR;
    }
    final BigArrays bigArrays = context.bigArrays();
    final SortedNumericDoubleValues allValues = valuesSource.doubleValues(ctx);
    final NumericDoubleValues values = MultiValueMode.MIN.select(allValues, Double.POSITIVE_INFINITY);
    return new LeafBucketCollectorBase(sub, allValues) {

        @Override
        public void collect(int doc, long bucket) throws IOException {
            if (bucket >= mins.size()) {
                long from = mins.size();
                mins = bigArrays.grow(mins, bucket + 1);
                mins.fill(from, mins.size(), Double.POSITIVE_INFINITY);
            }
            final double value = values.get(doc);
            double min = mins.get(bucket);
            min = Math.min(min, value);
            mins.set(bucket, min);
        }

    };
}
 
Example #18
Source File: MockTcpTransport.java    From crate with Apache License 2.0 6 votes vote down vote up
public MockTcpTransport(Settings settings, ThreadPool threadPool, BigArrays bigArrays,
                        CircuitBreakerService circuitBreakerService, NamedWriteableRegistry namedWriteableRegistry,
                        NetworkService networkService, Version mockVersion) {
    super("mock-tcp-transport",
          settings,
          threadPool,
          bigArrays,
          circuitBreakerService,
          namedWriteableRegistry,
          networkService);
    // we have our own crazy cached threadpool this one is not bounded at all...
    // using the ES thread factory here is crucial for tests otherwise disruption tests won't block that thread
    executor = Executors.newCachedThreadPool(EsExecutors.daemonThreadFactory(settings,
                                                                             Transports.TEST_MOCK_TRANSPORT_THREAD_PREFIX));
    this.mockVersion = mockVersion;
}
 
Example #19
Source File: MaxAggregator.java    From Elasticsearch with Apache License 2.0 6 votes vote down vote up
@Override
public LeafBucketCollector getLeafCollector(LeafReaderContext ctx,
        final LeafBucketCollector sub) throws IOException {
    if (valuesSource == null) {
        return LeafBucketCollector.NO_OP_COLLECTOR;
}
    final BigArrays bigArrays = context.bigArrays();
    final SortedNumericDoubleValues allValues = valuesSource.doubleValues(ctx);
    final NumericDoubleValues values = MultiValueMode.MAX.select(allValues, Double.NEGATIVE_INFINITY);
    return new LeafBucketCollectorBase(sub, allValues) {

        @Override
        public void collect(int doc, long bucket) throws IOException {
            if (bucket >= maxes.size()) {
                long from = maxes.size();
                maxes = bigArrays.grow(maxes, bucket + 1);
                maxes.fill(from, maxes.size(), Double.NEGATIVE_INFINITY);
            }
            final double value = values.get(doc);
            double max = maxes.get(bucket);
            max = Math.max(max, value);
            maxes.set(bucket, max);
        }

    };
}
 
Example #20
Source File: SumAggregator.java    From Elasticsearch with Apache License 2.0 6 votes vote down vote up
@Override
public LeafBucketCollector getLeafCollector(LeafReaderContext ctx,
        final LeafBucketCollector sub) throws IOException {
    if (valuesSource == null) {
        return LeafBucketCollector.NO_OP_COLLECTOR;
    }
    final BigArrays bigArrays = context.bigArrays();
    final SortedNumericDoubleValues values = valuesSource.doubleValues(ctx);
    return new LeafBucketCollectorBase(sub, values) {
        @Override
        public void collect(int doc, long bucket) throws IOException {
            sums = bigArrays.grow(sums, bucket + 1);
            values.setDocument(doc);
            final int valuesCount = values.count();
            double sum = 0;
            for (int i = 0; i < valuesCount; i++) {
                sum += values.valueAt(i);
            }
            sums.increment(bucket, sum);
        }
    };
}
 
Example #21
Source File: ExtendedStatsAggregator.java    From Elasticsearch with Apache License 2.0 6 votes vote down vote up
public ExtendedStatsAggregator(String name, ValuesSource.Numeric valuesSource, ValueFormatter formatter,
        AggregationContext context, Aggregator parent, double sigma, List<PipelineAggregator> pipelineAggregators,
        Map<String, Object> metaData)
        throws IOException {
    super(name, context, parent, pipelineAggregators, metaData);
    this.valuesSource = valuesSource;
    this.formatter = formatter;
    this.sigma = sigma;
    if (valuesSource != null) {
        final BigArrays bigArrays = context.bigArrays();
        counts = bigArrays.newLongArray(1, true);
        sums = bigArrays.newDoubleArray(1, true);
        mins = bigArrays.newDoubleArray(1, false);
        mins.fill(0, mins.size(), Double.POSITIVE_INFINITY);
        maxes = bigArrays.newDoubleArray(1, false);
        maxes.fill(0, maxes.size(), Double.NEGATIVE_INFINITY);
        sumOfSqrs = bigArrays.newDoubleArray(1, true);
    }
}
 
Example #22
Source File: StatsAggregator.java    From Elasticsearch with Apache License 2.0 6 votes vote down vote up
public StatsAggregator(String name, ValuesSource.Numeric valuesSource, ValueFormatter formatter,
                       AggregationContext context,
                       Aggregator parent, List<PipelineAggregator> pipelineAggregators,
                       Map<String, Object> metaData) throws IOException {
    super(name, context, parent, pipelineAggregators, metaData);
    this.valuesSource = valuesSource;
    if (valuesSource != null) {
        final BigArrays bigArrays = context.bigArrays();
        counts = bigArrays.newLongArray(1, true);
        sums = bigArrays.newDoubleArray(1, true);
        mins = bigArrays.newDoubleArray(1, false);
        mins.fill(0, mins.size(), Double.POSITIVE_INFINITY);
        maxes = bigArrays.newDoubleArray(1, false);
        maxes.fill(0, maxes.size(), Double.NEGATIVE_INFINITY);
    }
    this.formatter = formatter;
}
 
Example #23
Source File: GroupByOptimizedIteratorTest.java    From crate with Apache License 2.0 5 votes vote down vote up
private BatchIterator<Row> createBatchIterator(Runnable onNextReader) {
    return GroupByOptimizedIterator.getIterator(
        BigArrays.NON_RECYCLING_INSTANCE,
        indexSearcher,
        columnName,
        aggregationContexts,
        List.of(new LuceneCollectorExpression<Object>() {

            @Override
            public void setNextReader(LeafReaderContext context) throws IOException {
                onNextReader.run();
            }

            @Override
            public Object value() {
                return null;
            }
        }),
        Collections.singletonList(inExpr),
        RamAccounting.NO_ACCOUNTING,
        new OnHeapMemoryManager(usedBytes -> {}),
        Version.CURRENT,
        new InputRow(Collections.singletonList(inExpr)),
        new MatchAllDocsQuery(),
        new CollectorContext(),
        AggregateMode.ITER_FINAL
    );
}
 
Example #24
Source File: EngineTestCase.java    From crate with Apache License 2.0 5 votes vote down vote up
protected Translog createTranslog(Path translogPath, LongSupplier primaryTermSupplier) throws IOException {
    TranslogConfig translogConfig = new TranslogConfig(shardId, translogPath, INDEX_SETTINGS, BigArrays.NON_RECYCLING_INSTANCE);
    String translogUUID = Translog.createEmptyTranslog(translogPath, SequenceNumbers.NO_OPS_PERFORMED, shardId,
        primaryTermSupplier.getAsLong());
    return new Translog(translogConfig, translogUUID, createTranslogDeletionPolicy(INDEX_SETTINGS),
        () -> SequenceNumbers.NO_OPS_PERFORMED, primaryTermSupplier, seqNo -> {});
}
 
Example #25
Source File: OpenDistroSecuritySSLNettyHttpServerTransport.java    From deprecated-security-ssl with Apache License 2.0 5 votes vote down vote up
public OpenDistroSecuritySSLNettyHttpServerTransport(final Settings settings, final NetworkService networkService, final BigArrays bigArrays,
        final ThreadPool threadPool, final OpenDistroSecurityKeyStore odks, final NamedXContentRegistry namedXContentRegistry, final ValidatingDispatcher dispatcher,
        final SslExceptionHandler errorHandler) {
    super(settings, networkService, bigArrays, threadPool, namedXContentRegistry, dispatcher);
    this.odks = odks;
    this.threadContext = threadPool.getThreadContext();
    this.errorHandler = errorHandler;
}
 
Example #26
Source File: NetworkPlugin.java    From crate with Apache License 2.0 5 votes vote down vote up
/**
 * Returns a map of {@link Transport} suppliers.
 * See {@link org.elasticsearch.common.network.NetworkModule#TRANSPORT_TYPE_KEY} to configure a specific implementation.
 */
default Map<String, Supplier<Transport>> getTransports(Settings settings, ThreadPool threadPool, BigArrays bigArrays,
                                                       PageCacheRecycler pageCacheRecycler,
                                                       CircuitBreakerService circuitBreakerService,
                                                       NamedWriteableRegistry namedWriteableRegistry,
                                                       NetworkService networkService) {
    return Collections.emptyMap();
}
 
Example #27
Source File: BytesStreamOutput.java    From Elasticsearch with Apache License 2.0 5 votes vote down vote up
@Override
public void reset() {
    // shrink list of pages
    if (bytes.size() > BigArrays.PAGE_SIZE_IN_BYTES) {
        bytes = bigarrays.resize(bytes, BigArrays.PAGE_SIZE_IN_BYTES);
    }

    // go back to start
    count = 0;
}
 
Example #28
Source File: OpenShiftElasticSearchPlugin.java    From openshift-elasticsearch-plugin with Apache License 2.0 5 votes vote down vote up
@Override
public Map<String, Supplier<HttpServerTransport>> getHttpTransports(Settings settings, ThreadPool threadPool,
        BigArrays bigArrays, CircuitBreakerService circuitBreakerService,
        NamedWriteableRegistry namedWriteableRegistry, NamedXContentRegistry namedXContentRegistry,
        NetworkService networkService, Dispatcher dispatcher) {
    Map<String, Supplier<HttpServerTransport>> transports = sgPlugin.getHttpTransports(settings, threadPool, bigArrays, circuitBreakerService,
            namedWriteableRegistry, namedXContentRegistry, networkService, dispatcher);
    return transports;
}
 
Example #29
Source File: TransportValidateQueryAction.java    From Elasticsearch with Apache License 2.0 5 votes vote down vote up
@Inject
public TransportValidateQueryAction(Settings settings, ThreadPool threadPool, ClusterService clusterService,
                                    TransportService transportService, IndicesService indicesService,
                                    ScriptService scriptService, PageCacheRecycler pageCacheRecycler,
                                    BigArrays bigArrays, ActionFilters actionFilters, IndexNameExpressionResolver indexNameExpressionResolver) {
    super(settings, ValidateQueryAction.NAME, threadPool, clusterService, transportService, actionFilters,
            indexNameExpressionResolver, ValidateQueryRequest.class, ShardValidateQueryRequest.class, ThreadPool.Names.SEARCH);
    this.indicesService = indicesService;
    this.scriptService = scriptService;
    this.pageCacheRecycler = pageCacheRecycler;
    this.bigArrays = bigArrays;
}
 
Example #30
Source File: TransportExplainAction.java    From Elasticsearch with Apache License 2.0 5 votes vote down vote up
@Inject
public TransportExplainAction(Settings settings, ThreadPool threadPool, ClusterService clusterService,
                              TransportService transportService, IndicesService indicesService,
                              ScriptService scriptService, PageCacheRecycler pageCacheRecycler,
                              BigArrays bigArrays, ActionFilters actionFilters, IndexNameExpressionResolver indexNameExpressionResolver) {
    super(settings, ExplainAction.NAME, threadPool, clusterService, transportService, actionFilters, indexNameExpressionResolver,
            ExplainRequest.class, ThreadPool.Names.GET);
    this.indicesService = indicesService;
    this.scriptService = scriptService;
    this.pageCacheRecycler = pageCacheRecycler;
    this.bigArrays = bigArrays;
}