Пример #1
0
 @Override
 public void readFrom(StreamInput in) throws IOException {
   pid = in.readLong();
   version = in.readString();
   vmName = in.readString();
   vmVersion = in.readString();
   vmVendor = in.readString();
   startTime = in.readLong();
   inputArguments = new String[in.readInt()];
   for (int i = 0; i < inputArguments.length; i++) {
     inputArguments[i] = in.readString();
   }
   bootClassPath = in.readString();
   classPath = in.readString();
   systemProperties = new HashMap<>();
   int size = in.readInt();
   for (int i = 0; i < size; i++) {
     systemProperties.put(in.readString(), in.readString());
   }
   mem = new Mem();
   mem.readFrom(in);
   gcCollectors = in.readStringArray();
   memoryPools = in.readStringArray();
   useCompressedOops = in.readString();
 }
Пример #2
0
 @Override
 public void readFrom(StreamInput in) throws IOException {
   this.name = in.readString();
   if (in.getVersion().onOrAfter(Version.V_1_4_0_Beta)) {
     this.docCountError = in.readLong();
   } else {
     this.docCountError = -1;
   }
   this.order = InternalOrder.Streams.readOrder(in);
   this.formatter = ValueFormatterStreams.readOptional(in);
   this.requiredSize = readSize(in);
   if (in.getVersion().onOrAfter(Version.V_1_4_0_Beta)) {
     this.shardSize = readSize(in);
     this.showTermDocCountError = in.readBoolean();
   } else {
     this.shardSize = requiredSize;
     this.showTermDocCountError = false;
   }
   this.minDocCount = in.readVLong();
   int size = in.readVInt();
   List<InternalTerms.Bucket> buckets = new ArrayList<>(size);
   for (int i = 0; i < size; i++) {
     long term = in.readLong();
     long docCount = in.readVLong();
     long bucketDocCountError = -1;
     if (in.getVersion().onOrAfter(Version.V_1_4_0_Beta) && showTermDocCountError) {
       bucketDocCountError = in.readLong();
     }
     InternalAggregations aggregations = InternalAggregations.readAggregations(in);
     buckets.add(
         new Bucket(term, docCount, aggregations, showTermDocCountError, bucketDocCountError));
   }
   this.buckets = buckets;
   this.bucketMap = null;
 }
 @Override
 public void readFrom(StreamInput in) throws IOException {
   super.readFrom(in);
   tookInMillis = in.readLong();
   ingestId = in.readLong();
   shardId = ShardId.readShardId(in);
   successCount = in.readVInt();
   quorumShards = in.readVInt();
   actionRequests = newLinkedList();
   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 = newLinkedList();
   size = in.readVInt();
   for (int i = 0; i < size; i++) {
     failures.add(IngestActionFailure.from(in));
   }
 }
Пример #4
0
 Cgroup(final StreamInput in) throws IOException {
   cpuAcctControlGroup = in.readString();
   cpuAcctUsageNanos = in.readLong();
   cpuControlGroup = in.readString();
   cpuCfsPeriodMicros = in.readLong();
   cpuCfsQuotaMicros = in.readLong();
   cpuStat = new CpuStat(in);
 }
Пример #5
0
 @Override
 public void readFrom(StreamInput in) throws IOException {
   super.readFrom(in);
   sourceNodeId = in.readString();
   transferId = new UUID(in.readLong(), in.readLong());
   currentPos = in.readVInt();
   content = in.readBytesReference();
   isLast = in.readBoolean();
 }
Пример #6
0
 @Override
 public void readFrom(StreamInput in) throws IOException {
   term = in.readLong();
   docCount = in.readVLong();
   docCountError = -1;
   if (in.getVersion().onOrAfter(Version.V_1_4_0_Beta1) && showDocCountError) {
     docCountError = in.readLong();
   }
   aggregations = InternalAggregations.readAggregations(in);
 }
 @Override
 public void readFrom(StreamInput in) throws IOException {
   name = in.readOptionalString();
   type = in.readOptionalString();
   started = new Date(in.readLong());
   timestamp = new Date(in.readLong());
   enabled = in.readBoolean();
   active = in.readBoolean();
   counter = in.readLong();
   custom = in.readMap();
 }
Пример #8
0
 @Override
 protected void doReadFrom(StreamInput in) throws IOException {
   if (in.getVersion().onOrAfter(Version.V_1_4_0_Beta1)) {
     this.docCountError = in.readLong();
   } else {
     this.docCountError = -1;
   }
   this.order = InternalOrder.Streams.readOrder(in);
   this.formatter = ValueFormatterStreams.readOptional(in);
   this.requiredSize = readSize(in);
   if (in.getVersion().onOrAfter(Version.V_1_4_0_Beta1)) {
     this.shardSize = readSize(in);
     this.showTermDocCountError = in.readBoolean();
   } else {
     this.shardSize = requiredSize;
     this.showTermDocCountError = false;
   }
   this.minDocCount = in.readVLong();
   if (in.getVersion().onOrAfter(Version.V_1_4_0)) {
     this.otherDocCount = in.readVLong();
   }
   int size = in.readVInt();
   List<InternalTerms.Bucket> buckets = new ArrayList<>(size);
   for (int i = 0; i < size; i++) {
     Bucket bucket = new Bucket(formatter, showTermDocCountError);
     bucket.readFrom(in);
     buckets.add(bucket);
   }
   this.buckets = buckets;
   this.bucketMap = null;
 }
Пример #9
0
    public MetaDataDiff(StreamInput in) throws IOException {
      clusterUUID = in.readString();
      version = in.readLong();
      transientSettings = Settings.readSettingsFromStream(in);
      persistentSettings = Settings.readSettingsFromStream(in);
      indices =
          DiffableUtils.readImmutableOpenMapDiff(
              in, DiffableUtils.getStringKeySerializer(), IndexMetaData.PROTO);
      templates =
          DiffableUtils.readImmutableOpenMapDiff(
              in, DiffableUtils.getStringKeySerializer(), IndexTemplateMetaData.PROTO);
      customs =
          DiffableUtils.readImmutableOpenMapDiff(
              in,
              DiffableUtils.getStringKeySerializer(),
              new DiffableUtils.DiffableValueSerializer<String, Custom>() {
                @Override
                public Custom read(StreamInput in, String key) throws IOException {
                  return lookupPrototypeSafe(key).readFrom(in);
                }

                @Override
                public Diff<Custom> readDiff(StreamInput in, String key) throws IOException {
                  return lookupPrototypeSafe(key).readDiffFrom(in);
                }
              });
    }
Пример #10
0
 @Override
 public IndexMetaData readFrom(StreamInput in) throws IOException {
   Builder builder = new Builder(in.readString());
   builder.version(in.readLong());
   builder.state(State.fromId(in.readByte()));
   builder.settings(readSettingsFromStream(in));
   int mappingsSize = in.readVInt();
   for (int i = 0; i < mappingsSize; i++) {
     MappingMetaData mappingMd = MappingMetaData.PROTO.readFrom(in);
     builder.putMapping(mappingMd);
   }
   int aliasesSize = in.readVInt();
   for (int i = 0; i < aliasesSize; i++) {
     AliasMetaData aliasMd = AliasMetaData.Builder.readFrom(in);
     builder.putAlias(aliasMd);
   }
   int customSize = in.readVInt();
   for (int i = 0; i < customSize; i++) {
     String type = in.readString();
     Custom customIndexMetaData = lookupPrototypeSafe(type).readFrom(in);
     builder.putCustom(type, customIndexMetaData);
   }
   int activeAllocationIdsSize = in.readVInt();
   for (int i = 0; i < activeAllocationIdsSize; i++) {
     int key = in.readVInt();
     Set<String> allocationIds =
         DiffableUtils.StringSetValueSerializer.getInstance().read(in, key);
     builder.putActiveAllocationIds(key, allocationIds);
   }
   return builder.build();
 }
Пример #11
0
    public IndexMetaDataDiff(StreamInput in) throws IOException {
      index = in.readString();
      version = in.readLong();
      state = State.fromId(in.readByte());
      settings = Settings.readSettingsFromStream(in);
      mappings =
          DiffableUtils.readImmutableOpenMapDiff(
              in, DiffableUtils.getStringKeySerializer(), MappingMetaData.PROTO);
      aliases =
          DiffableUtils.readImmutableOpenMapDiff(
              in, DiffableUtils.getStringKeySerializer(), AliasMetaData.PROTO);
      customs =
          DiffableUtils.readImmutableOpenMapDiff(
              in,
              DiffableUtils.getStringKeySerializer(),
              new DiffableUtils.DiffableValueSerializer<String, Custom>() {
                @Override
                public Custom read(StreamInput in, String key) throws IOException {
                  return lookupPrototypeSafe(key).readFrom(in);
                }

                @Override
                public Diff<Custom> readDiff(StreamInput in, String key) throws IOException {
                  return lookupPrototypeSafe(key).readDiffFrom(in);
                }
              });
      activeAllocationIds =
          DiffableUtils.readImmutableOpenIntMapDiff(
              in,
              DiffableUtils.getVIntKeySerializer(),
              DiffableUtils.StringSetValueSerializer.getInstance());
    }
Пример #12
0
  public static TopDocs readTopDocs(StreamInput in) throws IOException {
    if (!in.readBoolean()) {
      // no docs
      return null;
    }
    if (in.readBoolean()) {
      int totalHits = in.readVInt();
      float maxScore = in.readFloat();

      SortField[] fields = new SortField[in.readVInt()];
      for (int i = 0; i < fields.length; i++) {
        String field = null;
        if (in.readBoolean()) {
          field = in.readUTF();
        }
        fields[i] = new SortField(field, in.readVInt(), in.readBoolean());
      }

      FieldDoc[] fieldDocs = new FieldDoc[in.readVInt()];
      for (int i = 0; i < fieldDocs.length; i++) {
        Comparable[] cFields = new Comparable[in.readVInt()];
        for (int j = 0; j < cFields.length; j++) {
          byte type = in.readByte();
          if (type == 0) {
            cFields[j] = null;
          } else if (type == 1) {
            cFields[j] = in.readUTF();
          } else if (type == 2) {
            cFields[j] = in.readInt();
          } else if (type == 3) {
            cFields[j] = in.readLong();
          } else if (type == 4) {
            cFields[j] = in.readFloat();
          } else if (type == 5) {
            cFields[j] = in.readDouble();
          } else if (type == 6) {
            cFields[j] = in.readByte();
          } else if (type == 7) {
            cFields[j] = in.readShort();
          } else if (type == 8) {
            cFields[j] = in.readBoolean();
          } else {
            throw new IOException("Can't match type [" + type + "]");
          }
        }
        fieldDocs[i] = new FieldDoc(in.readVInt(), in.readFloat(), cFields);
      }
      return new TopFieldDocs(totalHits, fieldDocs, fields, maxScore);
    } else {
      int totalHits = in.readVInt();
      float maxScore = in.readFloat();

      ScoreDoc[] scoreDocs = new ScoreDoc[in.readVInt()];
      for (int i = 0; i < scoreDocs.length; i++) {
        scoreDocs[i] = new ScoreDoc(in.readVInt(), in.readFloat());
      }
      return new TopDocs(totalHits, scoreDocs, maxScore);
    }
  }
Пример #13
0
 @Override
 public void readFrom(StreamInput in) throws IOException {
   int version = in.readVInt(); // version
   uid = new Term(in.readUTF(), in.readUTF());
   if (version >= 1) {
     this.version = in.readLong();
   }
 }
Пример #14
0
 @Override
 public void readFrom(StreamInput in) throws IOException {
   count = in.readVInt();
   cpuPercent = in.readVInt();
   totalOpenFileDescriptors = in.readVLong();
   minOpenFileDescriptors = in.readLong();
   maxOpenFileDescriptors = in.readLong();
 }
Пример #15
0
  @Override
  public void readFrom(StreamInput in) throws IOException {
    super.readFrom(in);
    type = in.readSharedString();
    id = in.readOptionalString();
    routing = in.readOptionalString();
    parent = in.readOptionalString();
    timestamp = in.readOptionalString();
    ttl = in.readLong();
    source = in.readBytesReference();
    sourceUnsafe = false;

    opType = OpType.fromId(in.readByte());
    refresh = in.readBoolean();
    version = in.readLong();
    versionType = VersionType.fromValue(in.readByte());
  }
Пример #16
0
 public OsInfo(StreamInput in) throws IOException {
   this.refreshInterval = in.readLong();
   this.availableProcessors = in.readInt();
   this.allocatedProcessors = in.readInt();
   this.name = in.readOptionalString();
   this.arch = in.readOptionalString();
   this.version = in.readOptionalString();
 }
Пример #17
0
 @Override
 public void readFrom(StreamInput in) throws IOException {
   availableProcessors = in.readVInt();
   availableMemory = in.readLong();
   int size = in.readVInt();
   cpus = new ObjectIntOpenHashMap<OsInfo.Cpu>(size);
   for (; size > 0; size--) {
     cpus.addTo(OsInfo.Cpu.readCpu(in), in.readVInt());
   }
 }
Пример #18
0
 @Override
 public void readFrom(StreamInput in) throws IOException {
   availableProcessors = in.readVInt();
   availableMemory = in.readLong();
   int size = in.readVInt();
   names.clear();
   for (int i = 0; i < size; i++) {
     names.addTo(in.readString(), in.readVInt());
   }
 }
Пример #19
0
 @Override
 public void readFrom(StreamInput in) throws IOException {
   super.readFrom(in);
   type = in.readOptionalString();
   id = in.readOptionalString();
   routing = in.readOptionalString();
   parent = in.readOptionalString();
   if (in.getVersion().before(Version.V_6_0_0_alpha1_UNRELEASED)) {
     in.readOptionalString(); // timestamp
     in.readOptionalWriteable(TimeValue::new); // ttl
   }
   source = in.readBytesReference();
   opType = OpType.fromId(in.readByte());
   version = in.readLong();
   versionType = VersionType.fromValue(in.readByte());
   pipeline = in.readOptionalString();
   isRetry = in.readBoolean();
   autoGeneratedTimestamp = in.readLong();
 }
Пример #20
0
 @Override
 public void readFrom(StreamInput in) throws IOException {
   termBytes = in.readBytesRef();
   docCount = in.readVLong();
   docCountError = -1;
   if (showDocCountError) {
     docCountError = in.readLong();
   }
   aggregations = InternalAggregations.readAggregations(in);
 }
Пример #21
0
 @Override
 public void readFrom(StreamInput in) throws IOException {
   MapBuilder<String, String> builder = MapBuilder.newMapBuilder();
   for (int i = in.readVInt(); i > 0; i--) {
     builder.put(in.readString(), in.readString());
   }
   userData = builder.immutableMap();
   generation = in.readLong();
   id = in.readOptionalString();
   numDocs = in.readInt();
 }
Пример #22
0
 public static ClusterState readFrom(
     StreamInput in, @Nullable Settings globalSettings, @Nullable DiscoveryNode localNode)
     throws IOException {
   Builder builder = new Builder();
   builder.version = in.readLong();
   builder.metaData = MetaData.Builder.readFrom(in, globalSettings);
   builder.routingTable = RoutingTable.Builder.readFrom(in);
   builder.nodes = DiscoveryNodes.Builder.readFrom(in, localNode);
   builder.blocks = ClusterBlocks.Builder.readClusterBlocks(in);
   builder.allocationExplanation = AllocationExplanation.readAllocationExplanation(in);
   return builder.build();
 }
Пример #23
0
  protected void messageReceived(
      byte[] data,
      String action,
      LocalTransport sourceTransport,
      Version version,
      @Nullable final Long sendRequestId) {
    Transports.assertTransportThread();
    try {
      transportServiceAdapter.received(data.length);
      StreamInput stream = StreamInput.wrap(data);
      stream.setVersion(version);

      long requestId = stream.readLong();
      byte status = stream.readByte();
      boolean isRequest = TransportStatus.isRequest(status);
      if (isRequest) {
        ThreadContext threadContext = threadPool.getThreadContext();
        threadContext.readHeaders(stream);
        handleRequest(stream, requestId, data.length, sourceTransport, version);
      } else {
        final TransportResponseHandler handler =
            transportServiceAdapter.onResponseReceived(requestId);
        // ignore if its null, the adapter logs it
        if (handler != null) {
          if (TransportStatus.isError(status)) {
            handleResponseError(stream, handler);
          } else {
            handleResponse(stream, sourceTransport, handler);
          }
        }
      }
    } catch (Throwable e) {
      if (sendRequestId != null) {
        TransportResponseHandler handler =
            sourceTransport.transportServiceAdapter.onResponseReceived(sendRequestId);
        if (handler != null) {
          RemoteTransportException error =
              new RemoteTransportException(nodeName(), localAddress, action, e);
          sourceTransport
              .workers()
              .execute(
                  () -> {
                    ThreadContext threadContext = sourceTransport.threadPool.getThreadContext();
                    try (ThreadContext.StoredContext ignore = threadContext.stashContext()) {
                      sourceTransport.handleException(handler, error);
                    }
                  });
        }
      } else {
        logger.warn("Failed to receive message for action [{}]", e, action);
      }
    }
  }
Пример #24
0
 @Override
 public void readFrom(StreamInput in) throws IOException {
   super.readFrom(in);
   type = in.readUTF();
   id = in.readUTF();
   if (in.readBoolean()) {
     routing = in.readUTF();
   }
   refresh = in.readBoolean();
   version = in.readLong();
   versionType = VersionType.fromValue(in.readByte());
 }
Пример #25
0
    @Override
    public void readFrom(StreamInput in) throws IOException {
      index = in.readString();
      type = in.readOptionalString();
      id = in.readString();
      routing = in.readOptionalString();
      parent = in.readOptionalString();
      storedFields = in.readOptionalStringArray();
      version = in.readLong();
      versionType = VersionType.fromValue(in.readByte());

      fetchSourceContext = in.readOptionalWriteable(FetchSourceContext::new);
    }
  @Override
  public void readFrom(StreamInput in) throws IOException {
    super.readFrom(in);
    comparatorType = ComparatorType.fromId(in.readByte());
    requiredSize = in.readVInt();
    missing = in.readVLong();
    total = in.readVLong();

    int size = in.readVInt();
    entries = new ArrayList<LongEntry>(size);
    for (int i = 0; i < size; i++) {
      entries.add(new LongEntry(in.readLong(), in.readVInt()));
    }
  }
Пример #27
0
 @Override
 public void readFrom(StreamInput in) throws IOException {
   this.name = in.readString();
   this.order = InternalOrder.Streams.readOrder(in);
   this.valueFormatter = ValueFormatterStreams.readOptional(in);
   this.requiredSize = in.readVInt();
   int size = in.readVInt();
   List<InternalTerms.Bucket> buckets = new ArrayList<InternalTerms.Bucket>(size);
   for (int i = 0; i < size; i++) {
     buckets.add(
         new Bucket(in.readLong(), in.readVLong(), InternalAggregations.readAggregations(in)));
   }
   this.buckets = buckets;
   this.bucketMap = null;
 }
 @Override
 public void readFrom(StreamInput in) throws IOException {
   super.readFrom(in);
   recoveryId = in.readLong();
   shardId = ShardId.readShardId(in);
   if (in.getVersion().onOrAfter(Version.V_1_5_0)) {
     snapshotFiles = Store.MetadataSnapshot.read(in);
   } else {
     int size = in.readVInt();
     legacySnapshotFiles = Sets.newHashSetWithExpectedSize(size);
     for (int i = 0; i < size; i++) {
       legacySnapshotFiles.add(in.readString());
     }
   }
 }
 @Override
 public void readFrom(StreamInput in) throws IOException {
   super.readFrom(in);
   recoveryId = in.readLong();
   shardId = ShardId.readShardId(in);
   String name = in.readString();
   position = in.readVLong();
   long length = in.readVLong();
   String checksum = in.readOptionalString();
   content = in.readBytesReference();
   Version writtenBy = null;
   if (in.getVersion().onOrAfter(org.elasticsearch.Version.V_1_3_0)) {
     String versionString = in.readOptionalString();
     writtenBy = versionString == null ? null : Version.parseLeniently(versionString);
   }
   metaData = new StoreFileMetaData(name, length, checksum, writtenBy);
 }
Пример #30
0
    @Override
    public void readFrom(StreamInput in) throws IOException {
      index = in.readString();
      type = in.readOptionalString();
      id = in.readString();
      routing = in.readOptionalString();
      int size = in.readVInt();
      if (size > 0) {
        fields = new String[size];
        for (int i = 0; i < size; i++) {
          fields[i] = in.readString();
        }
      }
      version = in.readLong();
      versionType = VersionType.fromValue(in.readByte());

      fetchSourceContext = FetchSourceContext.optionalReadFromStream(in);
    }