Examples of shard()


Examples of org.elasticsearch.cluster.routing.IndexRoutingTable.shard()

                if (entry.state() == State.STARTED && !entry.waitingIndices().isEmpty()) {
                    for (String index : entry.waitingIndices().keySet()) {
                        if (event.indexRoutingTableChanged(index)) {
                            IndexRoutingTable indexShardRoutingTable = event.state().getRoutingTable().index(index);
                            for (ShardId shardId : entry.waitingIndices().get(index)) {
                                ShardRouting shardRouting = indexShardRoutingTable.shard(shardId.id()).primaryShard();
                                if (shardRouting != null && (shardRouting.started() || shardRouting.unassigned())) {
                                    return true;
                                }
                            }
                        }
View Full Code Here

Examples of org.elasticsearch.cluster.routing.IndexRoutingTable.shard()

            IndexMetaData indexMetaData = metaData.index(index);
            IndexRoutingTable indexRoutingTable = clusterState.getRoutingTable().index(index);
            for (int i = 0; i < indexMetaData.numberOfShards(); i++) {
                ShardId shardId = new ShardId(index, i);
                if (indexRoutingTable != null) {
                    ShardRouting primary = indexRoutingTable.shard(i).primaryShard();
                    if (primary == null || !primary.assignedToNode()) {
                        builder.put(shardId, new SnapshotMetaData.ShardSnapshotStatus(null, State.MISSING, "primary shard is not allocated"));
                    } else if (clusterState.getNodes().smallestVersion().onOrAfter(Version.V_1_2_0) && (primary.relocating() || primary.initializing())) {
                        // The WAITING state was introduced in V1.2.0 - don't use it if there are nodes with older version in the cluster
                        builder.put(shardId, new SnapshotMetaData.ShardSnapshotStatus(primary.currentNodeId(), State.WAITING));
View Full Code Here

Examples of org.elasticsearch.index.service.IndexService.shard()

                shardStateAction.shardFailed(shardRouting, "master " + nodes.masterNode() + " marked shard as started, but shard have not been created, mark shard as failed");
                continue;
            }

            if (indexService.hasShard(shardId)) {
                InternalIndexShard indexShard = (InternalIndexShard) indexService.shard(shardId);
                if (!shardRouting.equals(indexShard.routingEntry())) {
                    indexShard.routingEntry(shardRouting);
                    indexService.shardInjector(shardId).getInstance(IndexShardGatewayService.class).routingStateChanged();
                }
            }
View Full Code Here

Examples of org.elasticsearch.index.service.IndexService.shard()

    }

    private StoreFilesMetaData listStoreMetaData(ShardId shardId) throws IOException {
        IndexService indexService = indicesService.indexService(shardId.index().name());
        if (indexService != null) {
            InternalIndexShard indexShard = (InternalIndexShard) indexService.shard(shardId.id());
            if (indexShard != null) {
                return new StoreFilesMetaData(true, shardId, indexShard.store().list());
            }
        }
        // try and see if we an list unallocated
View Full Code Here

Examples of org.elasticsearch.index.service.IndexService.shard()

    private class FailedEngineHandler implements Engine.FailedEngineListener {
        @Override public void onFailedEngine(final ShardId shardId, final Throwable failure) {
            ShardRouting shardRouting = null;
            final IndexService indexService = indicesService.indexService(shardId.index().name());
            if (indexService != null) {
                IndexShard indexShard = indexService.shard(shardId.id());
                if (indexShard != null) {
                    shardRouting = indexShard.routingEntry();
                }
            }
            if (shardRouting == null) {
View Full Code Here

Examples of org.elasticsearch.index.service.IndexService.shard()

        return percolator.percolate(request);
    }

    private void loadQueries(String indexName) {
        IndexService indexService = percolatorIndexService();
        IndexShard shard = indexService.shard(0);
        shard.refresh(new Engine.Refresh(true));
        Engine.Searcher searcher = shard.searcher();
        try {
            // create a query to fetch all queries that are registered under the index name (which is the type
            // in the percolator).
View Full Code Here

Examples of org.elasticsearch.index.service.IndexService.shard()

                throw new PercolateIndexUnavailable(new Index(PercolatorService.INDEX_NAME));
            }
            if (percolatorIndex.numberOfShards() == 0) {
                throw new PercolateIndexUnavailable(new Index(PercolatorService.INDEX_NAME));
            }
            IndexShard percolatorShard = percolatorIndex.shard(0);
            Engine.Searcher percolatorSearcher = percolatorShard.searcher();
            try {
                percolatorSearcher.searcher().search(request.query(), new QueryCollector(logger, queries, searcher, percolatorIndex, matches));
            } catch (IOException e) {
                logger.warn("failed to execute", e);
View Full Code Here

Examples of org.elasticsearch.index.service.IndexService.shard()

        if (indexService == null) {
            removeAndCleanOnGoingRecovery(request.shardId());
            listener.onIgnoreRecovery(false, "index missing locally, stop recovery");
            return;
        }
        final InternalIndexShard shard = (InternalIndexShard) indexService.shard(request.shardId().id());
        if (shard == null) {
            removeAndCleanOnGoingRecovery(request.shardId());
            listener.onIgnoreRecovery(false, "shard missing locally, stop recovery");
            return;
        }
View Full Code Here

Examples of org.elasticsearch.index.service.IndexService.shard()

        }
        IndexService indexService = indicesService.indexService(context.shardId().index().name());
        if (indexService == null) {
            return;
        }
        final IndexShard indexShard = indexService.shard(context.shardId().id());
        if (indexShard == null) {
            return;
        }
        if (logger.isTraceEnabled()) {
            if (topReader) {
View Full Code Here

Examples of org.elasticsearch.index.service.IndexService.shard()

                    }
                }
                continue;
            }

            InternalIndexShard indexShard = (InternalIndexShard) indexService.shard(shardId);
            if (indexShard != null) {
                ShardRouting currentRoutingEntry = indexShard.routingEntry();
                // if the current and global routing are initializing, but are still not the same, its a different "shard" being allocated
                // for example: a shard that recovers from one node and now needs to recover to another node,
                //              or a replica allocated and then allocating a primary because the primary failed on another node
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.