Java Code Examples for org.elasticsearch.index.shard.ShardId#readShardId()

The following examples show how to use org.elasticsearch.index.shard.ShardId#readShardId() . 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: AllocationExplanation.java    From Elasticsearch with Apache License 2.0 6 votes vote down vote up
@Override
public void readFrom(StreamInput in) throws IOException {
    int size = in.readVInt();
    for (int i = 0; i < size; i++) {
        ShardId shardId = ShardId.readShardId(in);
        int size2 = in.readVInt();
        List<NodeExplanation> ne = new ArrayList<>(size2);
        for (int j = 0; j < size2; j++) {
            DiscoveryNode node = null;
            if (in.readBoolean()) {
                node = DiscoveryNode.readNode(in);
            }
            ne.add(new NodeExplanation(node, in.readString()));
        }
        explanations.put(shardId, ne);
    }
}
 
Example 2
Source File: SnapshotsInProgress.java    From Elasticsearch with Apache License 2.0 6 votes vote down vote up
@Override
public SnapshotsInProgress readFrom(StreamInput in) throws IOException {
    Entry[] entries = new Entry[in.readVInt()];
    for (int i = 0; i < entries.length; i++) {
        SnapshotId snapshotId = SnapshotId.readSnapshotId(in);
        boolean includeGlobalState = in.readBoolean();
        State state = State.fromValue(in.readByte());
        int indices = in.readVInt();
        List<String> indexBuilder = new ArrayList<>();
        for (int j = 0; j < indices; j++) {
            indexBuilder.add(in.readString());
        }
        long startTime = in.readLong();
        ImmutableMap.Builder<ShardId, ShardSnapshotStatus> builder = ImmutableMap.builder();
        int shards = in.readVInt();
        for (int j = 0; j < shards; j++) {
            ShardId shardId = ShardId.readShardId(in);
            String nodeId = in.readOptionalString();
            State shardState = State.fromValue(in.readByte());
            builder.put(shardId, new ShardSnapshotStatus(nodeId, shardState));
        }
        entries[i] = new Entry(snapshotId, includeGlobalState, state, Collections.unmodifiableList(indexBuilder), startTime, builder.build());
    }
    return new SnapshotsInProgress(entries);
}
 
Example 3
Source File: RestoreInProgress.java    From Elasticsearch with Apache License 2.0 6 votes vote down vote up
/**
 * {@inheritDoc}
 */
@Override
public RestoreInProgress readFrom(StreamInput in) throws IOException {
    Entry[] entries = new Entry[in.readVInt()];
    for (int i = 0; i < entries.length; i++) {
        SnapshotId snapshotId = SnapshotId.readSnapshotId(in);
        State state = State.fromValue(in.readByte());
        int indices = in.readVInt();
        List<String> indexBuilder = new ArrayList<>();
        for (int j = 0; j < indices; j++) {
            indexBuilder.add(in.readString());
        }
        ImmutableMap.Builder<ShardId, ShardRestoreStatus> builder = ImmutableMap.<ShardId, ShardRestoreStatus>builder();
        int shards = in.readVInt();
        for (int j = 0; j < shards; j++) {
            ShardId shardId = ShardId.readShardId(in);
            ShardRestoreStatus shardState = ShardRestoreStatus.readShardRestoreStatus(in);
            builder.put(shardId, shardState);
        }
        entries[i] = new Entry(snapshotId, state, Collections.unmodifiableList(indexBuilder), builder.build());
    }
    return new RestoreInProgress(entries);
}
 
Example 4
Source File: RecoveryCheckTranslogOffsetRequest.java    From Elasticsearch with Apache License 2.0 5 votes vote down vote up
@Override
public void readFrom(StreamInput in) throws IOException {
    super.readFrom(in);
    recoveryId = in.readLong();
    shardId = ShardId.readShardId(in);
    currentOffset = in.readLong();
}
 
Example 5
Source File: IngestLeaderShardResponse.java    From elasticsearch-helper with Apache License 2.0 5 votes vote down vote up
@Override
public void readFrom(StreamInput in) throws IOException {
    super.readFrom(in);
    tookInMillis = in.readLong();
    ingestId = in.readLong();
    if (in.readBoolean()) {
        shardId = ShardId.readShardId(in);
    }
    successCount = in.readVInt();
    quorumShards = in.readVInt();
    actionRequests = new LinkedList<>();
    int size = in.readVInt();
    for (int i = 0; i < size; i++) {
        boolean exists = in.readBoolean();
        if (exists) {
            boolean b = in.readBoolean();
            if (b) {
                IndexRequest indexRequest = new IndexRequest();
                indexRequest.readFrom(in);
                actionRequests.add(indexRequest);
            } else {
                DeleteRequest deleteRequest = new DeleteRequest();
                deleteRequest.readFrom(in);
                actionRequests.add(deleteRequest);
            }
        } else {
            actionRequests.add(null);
        }
    }
    failures = new LinkedList<>();
    size = in.readVInt();
    for (int i = 0; i < size; i++) {
        failures.add(IngestActionFailure.from(in));
    }
}
 
Example 6
Source File: ShardsSyncedFlushResult.java    From Elasticsearch with Apache License 2.0 5 votes vote down vote up
@Override
public void readFrom(StreamInput in) throws IOException {
    failureReason = in.readOptionalString();
    int numResponses = in.readInt();
    shardResponses = new HashMap<>();
    for (int i = 0; i < numResponses; i++) {
        ShardRouting shardRouting = ShardRouting.readShardRoutingEntry(in);
        SyncedFlushService.ShardSyncedFlushResponse response = SyncedFlushService.ShardSyncedFlushResponse.readSyncedFlushResponse(in);
        shardResponses.put(shardRouting, response);
    }
    syncId = in.readOptionalString();
    shardId = ShardId.readShardId(in);
    totalShards = in.readInt();
}
 
Example 7
Source File: IndicesStore.java    From Elasticsearch with Apache License 2.0 5 votes vote down vote up
@Override
public void readFrom(StreamInput in) throws IOException {
    super.readFrom(in);
    clusterName = ClusterName.readClusterName(in);
    indexUUID = in.readString();
    shardId = ShardId.readShardId(in);
    timeout = new TimeValue(in.readLong(), TimeUnit.MILLISECONDS);
}
 
Example 8
Source File: IngestReplicaShardRequest.java    From elasticsearch-helper with Apache License 2.0 5 votes vote down vote up
@Override
public void readFrom(StreamInput in) throws IOException {
    super.readFrom(in);
    index = in.readString();
    timeout = TimeValue.readTimeValue(in);
    ingestId = in.readLong();
    shardId = ShardId.readShardId(in);
    int size = in.readVInt();
    actionRequests = new LinkedList<>();
    for (int i = 0; i < size; i++) {
        boolean exists = in.readBoolean();
        if (exists) {
            boolean b = in.readBoolean();
            if (b) {
                IndexRequest indexRequest = new IndexRequest();
                indexRequest.readFrom(in);
                actionRequests.add(indexRequest);
            } else {
                DeleteRequest deleteRequest = new DeleteRequest();
                deleteRequest.readFrom(in);
                actionRequests.add(deleteRequest);
            }
        } else {
            actionRequests.add(null);
        }
    }
}
 
Example 9
Source File: RecoveryTranslogOperationsRequest.java    From Elasticsearch with Apache License 2.0 5 votes vote down vote up
@Override
public void readFrom(StreamInput in) throws IOException {
    super.readFrom(in);
    recoveryId = in.readLong();
    shardId = ShardId.readShardId(in);
    operations = Translog.readOperations(in);
    totalTranslogOps = in.readVInt();
}
 
Example 10
Source File: SingleShardRequest.java    From Elasticsearch with Apache License 2.0 5 votes vote down vote up
@Override
public void readFrom(StreamInput in) throws IOException {
    super.readFrom(in);
    if (in.readBoolean()) {
        internalShardId = ShardId.readShardId(in);
    }
    index = in.readOptionalString();
    // no need to pass threading over the network, they are always false when coming throw a thread pool
}
 
Example 11
Source File: StartRecoveryRequest.java    From Elasticsearch with Apache License 2.0 5 votes vote down vote up
@Override
public void readFrom(StreamInput in) throws IOException {
    super.readFrom(in);
    recoveryId = in.readLong();
    shardId = ShardId.readShardId(in);
    sourceNode = DiscoveryNode.readNode(in);
    targetNode = DiscoveryNode.readNode(in);
    markAsRelocated = in.readBoolean();
    metadataSnapshot = new Store.MetadataSnapshot(in);
    recoveryType = RecoveryState.Type.fromId(in.readByte());

}
 
Example 12
Source File: RecoveryCleanFilesRequest.java    From Elasticsearch with Apache License 2.0 5 votes vote down vote up
@Override
public void readFrom(StreamInput in) throws IOException {
    super.readFrom(in);
    recoveryId = in.readLong();
    shardId = ShardId.readShardId(in);
    snapshotFiles = new Store.MetadataSnapshot(in);
    totalTranslogOps = in.readVInt();
}
 
Example 13
Source File: SnapshotShardsService.java    From Elasticsearch with Apache License 2.0 5 votes vote down vote up
@Override
public void readFrom(StreamInput in) throws IOException {
    super.readFrom(in);
    snapshotId = SnapshotId.readSnapshotId(in);
    shardId = ShardId.readShardId(in);
    status = SnapshotsInProgress.ShardSnapshotStatus.readShardSnapshotStatus(in);
}
 
Example 14
Source File: CancelAllocationCommand.java    From Elasticsearch with Apache License 2.0 4 votes vote down vote up
@Override
public CancelAllocationCommand readFrom(StreamInput in) throws IOException {
    return new CancelAllocationCommand(ShardId.readShardId(in), in.readString(), in.readBoolean());
}
 
Example 15
Source File: TransportNodesListShardStoreMetaData.java    From Elasticsearch with Apache License 2.0 4 votes vote down vote up
@Override
public void readFrom(StreamInput in) throws IOException {
    allocated = in.readBoolean();
    shardId = ShardId.readShardId(in);
    this.metadataSnapshot = new Store.MetadataSnapshot(in);
}
 
Example 16
Source File: BroadcastShardRequest.java    From Elasticsearch with Apache License 2.0 4 votes vote down vote up
@Override
public void readFrom(StreamInput in) throws IOException {
    super.readFrom(in);
    shardId = ShardId.readShardId(in);
    originalIndices = OriginalIndices.readOriginalIndices(in);
}
 
Example 17
Source File: SyncedFlushService.java    From Elasticsearch with Apache License 2.0 4 votes vote down vote up
@Override
public void readFrom(StreamInput in) throws IOException {
    super.readFrom(in);
    shardId = ShardId.readShardId(in);
}
 
Example 18
Source File: SyncedFlushService.java    From Elasticsearch with Apache License 2.0 4 votes vote down vote up
@Override
public void readFrom(StreamInput in) throws IOException {
    super.readFrom(in);
    this.shardId = ShardId.readShardId(in);
}
 
Example 19
Source File: BlobStartRecoveryRequest.java    From Elasticsearch with Apache License 2.0 4 votes vote down vote up
@Override
public void readFrom(StreamInput in) throws IOException {
    super.readFrom(in);
    shardId = ShardId.readShardId(in);
}
 
Example 20
Source File: MoveAllocationCommand.java    From Elasticsearch with Apache License 2.0 4 votes vote down vote up
@Override
public MoveAllocationCommand readFrom(StreamInput in) throws IOException {
    return new MoveAllocationCommand(ShardId.readShardId(in), in.readString(), in.readString());
}