Examples of ShardId


Examples of org.elasticsearch.index.shard.ShardId

        for (int i = 0; i < numberOfRelocations; i++) {
            String fromNode = (i % 2 == 0) ? node1 : node2;
            String toNode = node1.equals(fromNode) ? node2 : node1;
            logger.trace("--> START relocate the shard from {} to {}", fromNode, toNode);
            cluster().client(node1).admin().cluster().prepareReroute()
                    .add(new MoveAllocationCommand(new ShardId(BlobIndices.fullIndexName("test"), 0), fromNode, toNode))
                    .execute().actionGet();
            ClusterHealthResponse clusterHealthResponse = cluster().client(node1).admin().cluster()
                    .prepareHealth()
                    .setWaitForEvents(Priority.LANGUID)
                    .setWaitForRelocatingShards(0)
View Full Code Here

Examples of org.elasticsearch.index.shard.ShardId

        executeIfNeeded();
        return true;
    }

    private void partitionRequestByShard(String indexName, BytesReference source, String id, String routing) {
        ShardId shardId = clusterService.operationRouting().indexShards(
                clusterService.state(),
                indexName,
                Constants.DEFAULT_MAPPING_TYPE,
                id,
                routing
View Full Code Here

Examples of org.elasticsearch.index.shard.ShardId

        } catch (InterruptedException e) {
            Thread.interrupted();
        }
        for (Iterator<Map.Entry<ShardId, List<BulkItemRequest>>> it = requestsByShard.entrySet().iterator(); it.hasNext();) {
            Map.Entry<ShardId, List<BulkItemRequest>> entry = it.next();
            ShardId shardId= entry.getKey();
            List<BulkItemRequest> items = entry.getValue();
            BulkShardRequest bulkShardRequest = new BulkShardRequest(
                    shardId.index().name(),
                    shardId.id(),
                    false,
                    items.toArray(new BulkItemRequest[items.size()]));
            bulkShardRequest.timeout(requestTimeout);
            execute(bulkShardRequest);
            it.remove();
View Full Code Here

Examples of org.elasticsearch.index.shard.ShardId

            bind(ClusterName.class).toInstance(clusterName);

            Index index = new Index(SysShardsTableInfo.IDENT.name());
            bind(Index.class).toInstance(index);

            ShardId shardId = mock(ShardId.class);
            when(shardId.getId()).thenReturn(1);
            when(shardId.getIndex()).thenAnswer(new Answer<String>() {
                @Override
                public String answer(InvocationOnMock invocation) throws Throwable {
                    return indexName;
                }
            });
View Full Code Here

Examples of org.elasticsearch.index.shard.ShardId

            for (int i = 0; i < numberOfSnapshots; i++) {
                SnapshotId snapshotId = SnapshotId.readSnapshotId(in);
                ImmutableMap.Builder<ShardId, SnapshotIndexShardStatus> shardMapBuilder = ImmutableMap.builder();
                int numberOfShards = in.readVInt();
                for (int j = 0; j < numberOfShards; j++) {
                    ShardId shardId =  ShardId.readShardId(in);
                    SnapshotIndexShardStatus status = SnapshotIndexShardStatus.readShardSnapshotStatus(in);
                    shardMapBuilder.put(shardId, status);
                }
                snapshotMapBuilder.put(snapshotId, shardMapBuilder.build());
            }
View Full Code Here

Examples of org.elasticsearch.index.shard.ShardId

        }

        if (seed == -1) {
            seed = Longs.hashCode(parseContext.nowInMillis());
        }
        final ShardId shardId = SearchContext.current().indexShard().shardId();
        final int salt = (shardId.index().name().hashCode() << 10) | shardId.id();
        final IndexFieldData<?> uidFieldData = SearchContext.current().fieldData().getForField(mapper);

        return new RandomScoreFunction(seed, salt, uidFieldData);
    }
View Full Code Here

Examples of org.elasticsearch.index.shard.ShardId

        private EnumSet<ShardStatusChangeType> purgeDeletedAndClosedShards() {
            EnumSet<ShardStatusChangeType> changes = EnumSet.noneOf(ShardStatusChangeType.class);

            Iterator<ShardId> statusShardIdIterator = shardsIndicesStatus.keySet().iterator();
            while (statusShardIdIterator.hasNext()) {
                ShardId statusShardId = statusShardIdIterator.next();
                IndexService indexService = indicesService.indexService(statusShardId.getIndex());
                boolean remove = false;
                try {
                    if (indexService == null) {
                        remove = true;
                        continue;
                    }
                    IndexShard indexShard = indexService.shard(statusShardId.id());
                    if (indexShard == null) {
                        remove = true;
                        continue;
                    }
                    remove = !CAN_UPDATE_INDEX_BUFFER_STATES.contains(indexShard.state());
View Full Code Here

Examples of org.hibernate.shards.ShardId

  }

  public static Unary<Integer, ShardId> nodeIdToShardIdConverter() {
    return new Unary<Integer, ShardId>() {
      public ShardId f(Integer id) {
        return new ShardId(id);
      }
    };
  }
View Full Code Here

Examples of org.hibernate.shards.ShardId

    ConfigurationReader reader = new ConfigurationReader(Continent.class, WeatherReport.class);
    Hive hive = getHive();
    HiveShardSelector selector = new HiveShardSelector(reader.getHiveConfiguration(), hive);
    WeatherReport report = WeatherReportImpl.generate();

    ShardId id = selector.selectShardIdForNewObject(report);
    Assert.assertNotNull(id);

    Collection<Integer> nodeIds = Transform.map(new Unary<Node, Integer>() {
      public Integer f(Node n) {
        return n.getId();
      }
    }, hive.getNodes());

    assertTrue(Filter.grepItemAgainstList(new Integer(id.getId()), nodeIds));
  }
View Full Code Here

Examples of org.makersoft.shards.ShardId

   */
  private ShardId selectShardIdForNewObject(String statement, Object obj) {
    // if(lockedShardId != null) {
    // return lockedShardId;
    // }
    ShardId shardId = shardStrategy.getShardSelectionStrategy().selectShardIdForNewObject(
        statement, obj);
    // lock has been requested but shard has not yet been selected - lock it in
    // if(lockedShard) {
    // lockedShardId = shardId;
    // }
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.