Package org.elasticsearch.cluster

Examples of org.elasticsearch.cluster.ClusterState$Custom


                            blocks.addIndexBlock(indexMetaData.index(), MetaDataStateIndexService.INDEX_CLOSED_BLOCK);
                        }
                    }

                    // update the state to reflect the new metadata and routing
                    ClusterState updatedState = newClusterStateBuilder().state(currentState)
                            .version(recoveredState.version())
                            .blocks(blocks)
                            .metaData(metaDataBuilder)
                            .build();

                    // initialize all index routing tables as empty
                    RoutingTable.Builder routingTableBuilder = RoutingTable.builder().routingTable(updatedState.routingTable());
                    for (IndexMetaData indexMetaData : updatedState.metaData().indices().values()) {
                        if (indexMetaData.state() == IndexMetaData.State.OPEN) {
                            IndexRoutingTable.Builder indexRoutingBuilder = new IndexRoutingTable.Builder(indexMetaData.index())
                                    .initializeEmpty(updatedState.metaData().index(indexMetaData.index()), false /*not from API*/);
                            routingTableBuilder.add(indexRoutingBuilder);
                        }
                    }
                    routingTableBuilder.version(recoveredState.version());

View Full Code Here


                            blocks.addIndexBlock(indexMetaData.index(), MetaDataStateIndexService.INDEX_CLOSED_BLOCK);
                        }
                    }

                    // update the state to reflect the new metadata and routing
                    ClusterState updatedState = newClusterStateBuilder().state(currentState)
                            .version(recoveredState.version())
                            .blocks(blocks)
                            .metaData(metaDataBuilder)
                            .build();

                    // initialize all index routing tables as empty
                    RoutingTable.Builder routingTableBuilder = RoutingTable.builder().routingTable(updatedState.routingTable());
                    for (IndexMetaData indexMetaData : updatedState.metaData().indices().values()) {
                        if (indexMetaData.state() == IndexMetaData.State.OPEN) {
                            IndexRoutingTable.Builder indexRoutingBuilder = new IndexRoutingTable.Builder(indexMetaData.index())
                                    .initializeEmpty(updatedState.metaData().index(indexMetaData.index()), false /*not from API*/);
                            routingTableBuilder.add(indexRoutingBuilder);
                        }
                    }
                    routingTableBuilder.version(recoveredState.version());

View Full Code Here

                        if (mappingMd != null) {
                            builder.put(newIndexMetaDataBuilder(indexMetaData).putMapping(mappingMd));
                        }
                    }

                    ClusterState updatedState = newClusterStateBuilder().state(currentState).metaData(builder).build();

                    // wait for responses from other nodes if needed
                    int counter = 0;
                    for (String index : request.indices) {
                        IndexRoutingTable indexRoutingTable = updatedState.routingTable().index(index);
                        if (indexRoutingTable != null) {
                            counter += indexRoutingTable.numberOfNodesShardsAreAllocatedOn(updatedState.nodes().masterNodeId());
                        }
                    }

                    if (counter == 0) {
                        listener.onResponse(new Response(true));
View Full Code Here

                        if (mappingMd != null) {
                            builder.put(newIndexMetaDataBuilder(indexMetaData).putMapping(mappingMd));
                        }
                    }

                    ClusterState updatedState = newClusterStateBuilder().state(currentState).metaData(builder).build();

                    // wait for responses from other nodes if needed
                    int counter = 0;
                    for (String index : request.indices) {
                        IndexRoutingTable indexRoutingTable = updatedState.routingTable().index(index);
                        if (indexRoutingTable != null) {
                            counter += indexRoutingTable.numberOfNodesShardsAreAllocatedOn(updatedState.nodes().masterNodeId());
                        }
                    }

                    if (counter == 0) {
                        listener.onResponse(new Response(true));
View Full Code Here

                        String[] indices = closeIndices.toArray(new String[closeIndices.size()]);
                        metaDataBuilder.updateSettings(closeSettings, indices);
                    }


                    ClusterState updatedState = ClusterState.builder().state(currentState).metaData(metaDataBuilder).routingTable(routingTableBuilder).build();

                    // now, reroute in case things change that require it (like number of replicas)
                    RoutingAllocation.Result routingResult = shardsAllocation.reroute(updatedState);
                    updatedState = newClusterStateBuilder().state(updatedState).routingResult(routingResult).build();
View Full Code Here

                        String[] indices = closeIndices.toArray(new String[closeIndices.size()]);
                        metaDataBuilder.updateSettings(closeSettings, indices);
                    }


                    ClusterState updatedState = ClusterState.builder().state(currentState).metaData(metaDataBuilder).routingTable(routingTableBuilder).build();

                    // now, reroute in case things change that require it (like number of replicas)
                    RoutingAllocation.Result routingResult = shardsAllocation.reroute(updatedState);
                    updatedState = newClusterStateBuilder().state(updatedState).routingResult(routingResult).build();
View Full Code Here

                        changed = true;
                        builder.put(indexMetaDataBuilder);
                    }

                    if (changed) {
                        ClusterState updatedState = newClusterStateBuilder().state(currentState).metaData(builder).build();
                        // wait for responses from other nodes if needed
                        int responseCount = updatedState.getNodes().size();
                        long version = updatedState.version() + 1;
                        logger.trace("Waiting for [{}] notifications with version [{}]", responseCount, version);
                        aliasOperationPerformedAction.add(new CountDownListener(responseCount, listener, version), request.timeout);

                        return updatedState;
                    } else {
View Full Code Here

                        changed = true;
                        builder.put(indexMetaDataBuilder);
                    }

                    if (changed) {
                        ClusterState updatedState = newClusterStateBuilder().state(currentState).metaData(builder).build();
                        // wait for responses from other nodes if needed
                        int responseCount = updatedState.getNodes().size();
                        long version = updatedState.version() + 1;
                        logger.trace("Waiting for [{}] notifications with version [{}]", responseCount, version);
                        aliasOperationPerformedAction.add(new CountDownListener(responseCount, listener, version), request.timeout);

                        return updatedState;
                    } else {
View Full Code Here

                        .put(IndexMetaData.newIndexMetaDataBuilder(currentState.metaData().index(request.index)).state(IndexMetaData.State.CLOSE));

                ClusterBlocks.Builder blocks = ClusterBlocks.builder().blocks(currentState.blocks())
                        .addIndexBlock(request.index, INDEX_CLOSED_BLOCK);

                ClusterState updatedState = ClusterState.builder().state(currentState).metaData(mdBuilder).blocks(blocks).build();

                RoutingTable.Builder rtBuilder = RoutingTable.builder()
                        .routingTable(currentState.routingTable())
                        .remove(request.index);
View Full Code Here

                        .put(IndexMetaData.newIndexMetaDataBuilder(currentState.metaData().index(request.index)).state(IndexMetaData.State.OPEN));

                ClusterBlocks.Builder blocks = ClusterBlocks.builder().blocks(currentState.blocks())
                        .removeIndexBlock(request.index, INDEX_CLOSED_BLOCK);

                ClusterState updatedState = ClusterState.builder().state(currentState).metaData(mdBuilder).blocks(blocks).build();

                RoutingTable.Builder rtBuilder = RoutingTable.builder().routingTable(updatedState.routingTable());
                IndexRoutingTable.Builder indexRoutingBuilder = new IndexRoutingTable.Builder(request.index)
                        .initializeEmpty(updatedState.metaData().index(request.index), false);
                rtBuilder.add(indexRoutingBuilder);

                RoutingAllocation.Result routingResult = shardsAllocation.reroute(newClusterStateBuilder().state(updatedState).routingTable(rtBuilder).build());

                return ClusterState.builder().state(updatedState).routingResult(routingResult).build();
View Full Code Here

TOP

Related Classes of org.elasticsearch.cluster.ClusterState$Custom

Copyright © 2018 www.massapicom. 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.