Package org.elasticsearch.index.shard.service

Examples of org.elasticsearch.index.shard.service.InternalIndexShard.engine()


                if (logger.isDebugEnabled()) {
                    logger.debug("[{}][{}] creating shard", shardRouting.index(), shardId);
                }
                InternalIndexShard indexShard = (InternalIndexShard) indexService.createShard(shardId);
                indexShard.routingEntry(shardRouting);
                indexShard.engine().addFailedEngineListener(failedEngineHandler);
            } catch (IndexShardAlreadyExistsException e) {
                // ignore this, the method call can happen several times
            } catch (Exception e) {
                logger.warn("[{}][{}] failed to create shard", e, shardRouting.index(), shardRouting.id());
                try {
View Full Code Here


    }

    @Override protected ShardSegments shardOperation(IndexShardSegmentRequest request) throws ElasticSearchException {
        InternalIndexService indexService = (InternalIndexService) indicesService.indexServiceSafe(request.index());
        InternalIndexShard indexShard = (InternalIndexShard) indexService.shardSafe(request.shardId());
        return new ShardSegments(indexShard.routingEntry(), indexShard.engine().segments());
    }

    public static class IndexShardSegmentRequest extends BroadcastShardOperationRequest {

        IndexShardSegmentRequest() {
View Full Code Here

    }

    @Override
    protected ShardTermlistResponse shardOperation(ShardTermlistRequest request) throws ElasticsearchException {
        InternalIndexShard indexShard = (InternalIndexShard) indicesService.indexServiceSafe(request.index()).shardSafe(request.shardId());
        Engine.Searcher searcher = indexShard.engine().acquireSearcher("termlist");
        try {
            Map<String, TermInfo> map = new CompactHashMap<String, TermInfo>();
            IndexReader reader = searcher.reader();
            Fields fields = MultiFields.getFields(reader);
            if (fields != null) {
View Full Code Here

    @Override
    protected ShardSegments shardOperation(IndexShardSegmentRequest request) throws ElasticsearchException {
        InternalIndexService indexService = (InternalIndexService) indicesService.indexServiceSafe(request.shardId().getIndex());
        InternalIndexShard indexShard = (InternalIndexShard) indexService.shardSafe(request.shardId().id());
        return new ShardSegments(indexShard.routingEntry(), indexShard.engine().segments());
    }

    static class IndexShardSegmentRequest extends BroadcastShardOperationRequest {

        IndexShardSegmentRequest() {
View Full Code Here

                if (logger.isDebugEnabled()) {
                    logger.debug("[{}][{}] creating shard", shardRouting.index(), shardId);
                }
                InternalIndexShard indexShard = (InternalIndexShard) indexService.createShard(shardId);
                indexShard.routingEntry(shardRouting);
                indexShard.engine().addFailedEngineListener(failedEngineHandler);
            } catch (IndexShardAlreadyExistsException e) {
                // ignore this, the method call can happen several times
            } catch (Throwable e) {
                logger.warn("[{}][{}] failed to create shard", e, shardRouting.index(), shardRouting.id());
                try {
View Full Code Here

                //    the edge case where its mark as relocated, and we might need to roll it back...
                // For replicas: we are recovering a backup from a primary
                RecoveryState.Type type = shardRouting.primary() ? RecoveryState.Type.RELOCATION : RecoveryState.Type.REPLICA;
                recoveryTarget.startRecovery(indexShard, type, sourceNode, new PeerRecoveryListener(shardRouting, indexService, indexMetaData));
            } catch (Throwable e) {
                indexShard.engine().failEngine("corrupted preexisting index", e);
                handleRecoveryFailure(indexService, indexMetaData, shardRouting, true, e);
            }
        } else {
            // we are the first primary, recover from the gateway
            // if its post api allocation, the index should exists
View Full Code Here

    @Override
    protected ShardReconstructIndexResponse shardOperation(ShardReconstructIndexRequest request) throws ElasticsearchException {
        IndexService indexService = indicesService.indexService(request.index());
        InternalIndexShard indexShard = (InternalIndexShard) indexService.shardSafe(request.shardId());
        Engine.Searcher searcher = indexShard.engine().acquireSearcher("transport_reconstruct");
        IndexReader reader = searcher.reader();
        DocumentReconstructor dr = new DocumentReconstructor(reader);
        try {
            return new ShardReconstructIndexResponse(true, dr.reconstruct(request.shardId()));
        } catch (IOException e) {
View Full Code Here

                indexFormatInfo.put("genericName", details.getGenericName());
                indexFormatInfo.put("capabilities", details.getCapabilities());
                response.put("indexFormat", indexFormatInfo);

                List commits = new ArrayList();
                Iterator<Segment> it = indexShard.engine().segments().iterator();
                while (it.hasNext()) {
                    Segment segment = it.next();
                    Map m = new HashMap();
                    m.put("segment", segment.getName());
                    m.put("count", segment.getNumDocs());
View Full Code Here

TOP
Copyright © 2018 www.massapi.com. All rights reserved.
All source code are property of their respective owners. Java is a trademark of Sun Microsystems, Inc and owned by ORACLE Inc. Contact coftware#gmail.com.