Skip to content

Commit

Permalink
[BUG] /_nodes/stats throwing serialization error (opensearch-project#315
Browse files Browse the repository at this point in the history
)

Signed-off-by: Andriy Redko <[email protected]>

Signed-off-by: Andriy Redko <[email protected]>
  • Loading branch information
reta authored Jan 10, 2023
1 parent 5756641 commit f1fbe83
Show file tree
Hide file tree
Showing 27 changed files with 448 additions and 1,000 deletions.
1 change: 1 addition & 0 deletions CHANGELOG.md
Original file line number Diff line number Diff line change
Expand Up @@ -33,6 +33,7 @@ Inspired from [Keep a Changelog](https://keepachangelog.com/en/1.0.0/)

### Fixed
- Make ChildrenAggregate as a SingleBucketAggregate ([#306](https://github.com/opensearch-project/opensearch-java/pull/306))
- Fix /_nodes/stats, /_nodes/info throwing serialization error ([#315](https://github.com/opensearch-project/opensearch-java/pull/315))

### Security

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -69,10 +69,6 @@ public class PluginStats implements JsonpSerializable {

private final String version;

private final boolean licensed;

private final String type;

// ---------------------------------------------------------------------------------------------

private PluginStats(Builder builder) {
Expand All @@ -87,8 +83,6 @@ private PluginStats(Builder builder) {
this.javaVersion = ApiTypeHelper.requireNonNull(builder.javaVersion, this, "javaVersion");
this.name = ApiTypeHelper.requireNonNull(builder.name, this, "name");
this.version = ApiTypeHelper.requireNonNull(builder.version, this, "version");
this.licensed = ApiTypeHelper.requireNonNull(builder.licensed, this, "licensed");
this.type = ApiTypeHelper.requireNonNull(builder.type, this, "type");

}

Expand Down Expand Up @@ -152,20 +146,6 @@ public final String version() {
return this.version;
}

/**
* Required - API name: {@code licensed}
*/
public final boolean licensed() {
return this.licensed;
}

/**
* Required - API name: {@code type}
*/
public final String type() {
return this.type;
}

/**
* Serialize this object to JSON.
*/
Expand Down Expand Up @@ -207,13 +187,6 @@ protected void serializeInternal(JsonGenerator generator, JsonpMapper mapper) {

generator.writeKey("version");
generator.write(this.version);

generator.writeKey("licensed");
generator.write(this.licensed);

generator.writeKey("type");
generator.write(this.type);

}

// ---------------------------------------------------------------------------------------------
Expand All @@ -239,10 +212,6 @@ public static class Builder extends ObjectBuilderBase implements ObjectBuilder<P

private String version;

private Boolean licensed;

private String type;

/**
* Required - API name: {@code classname}
*/
Expand Down Expand Up @@ -319,22 +288,6 @@ public final Builder version(String value) {
return this;
}

/**
* Required - API name: {@code licensed}
*/
public final Builder licensed(boolean value) {
this.licensed = value;
return this;
}

/**
* Required - API name: {@code type}
*/
public final Builder type(String value) {
this.type = value;
return this;
}

/**
* Builds a {@link PluginStats}.
*
Expand Down Expand Up @@ -367,8 +320,6 @@ protected static void setupPluginStatsDeserializer(ObjectDeserializer<PluginStat
op.add(Builder::javaVersion, JsonpDeserializer.stringDeserializer(), "java_version");
op.add(Builder::name, JsonpDeserializer.stringDeserializer(), "name");
op.add(Builder::version, JsonpDeserializer.stringDeserializer(), "version");
op.add(Builder::licensed, JsonpDeserializer.booleanDeserializer(), "licensed");
op.add(Builder::type, JsonpDeserializer.stringDeserializer(), "type");

}

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -78,7 +78,7 @@ public class SegmentsStats implements JsonpSerializable {

private final int indexWriterMemoryInBytes;

private final int maxUnsafeAutoIdTimestamp;
private final long maxUnsafeAutoIdTimestamp;

@Nullable
private final String memory;
Expand Down Expand Up @@ -228,7 +228,7 @@ public final int indexWriterMemoryInBytes() {
/**
* Required - API name: {@code max_unsafe_auto_id_timestamp}
*/
public final int maxUnsafeAutoIdTimestamp() {
public final long maxUnsafeAutoIdTimestamp() {
return this.maxUnsafeAutoIdTimestamp;
}

Expand Down Expand Up @@ -481,7 +481,7 @@ public static class Builder extends ObjectBuilderBase implements ObjectBuilder<S

private Integer indexWriterMemoryInBytes;

private Integer maxUnsafeAutoIdTimestamp;
private Long maxUnsafeAutoIdTimestamp;

@Nullable
private String memory;
Expand Down Expand Up @@ -615,7 +615,7 @@ public final Builder indexWriterMemoryInBytes(int value) {
/**
* Required - API name: {@code max_unsafe_auto_id_timestamp}
*/
public final Builder maxUnsafeAutoIdTimestamp(int value) {
public final Builder maxUnsafeAutoIdTimestamp(long value) {
this.maxUnsafeAutoIdTimestamp = value;
return this;
}
Expand Down Expand Up @@ -768,7 +768,7 @@ protected static void setupSegmentsStatsDeserializer(ObjectDeserializer<Segments
"index_writer_max_memory_in_bytes");
op.add(Builder::indexWriterMemoryInBytes, JsonpDeserializer.integerDeserializer(),
"index_writer_memory_in_bytes");
op.add(Builder::maxUnsafeAutoIdTimestamp, JsonpDeserializer.integerDeserializer(),
op.add(Builder::maxUnsafeAutoIdTimestamp, JsonpDeserializer.longDeserializer(),
"max_unsafe_auto_id_timestamp");
op.add(Builder::memory, JsonpDeserializer.stringDeserializer(), "memory");
op.add(Builder::memoryInBytes, JsonpDeserializer.integerDeserializer(), "memory_in_bytes");
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -55,12 +55,8 @@
public class AdaptiveSelection implements JsonpSerializable {
private final long avgQueueSize;

private final long avgResponseTime;

private final long avgResponseTimeNs;

private final String avgServiceTime;

private final long avgServiceTimeNs;

private final long outgoingSearches;
Expand All @@ -72,9 +68,7 @@ public class AdaptiveSelection implements JsonpSerializable {
private AdaptiveSelection(Builder builder) {

this.avgQueueSize = ApiTypeHelper.requireNonNull(builder.avgQueueSize, this, "avgQueueSize");
this.avgResponseTime = ApiTypeHelper.requireNonNull(builder.avgResponseTime, this, "avgResponseTime");
this.avgResponseTimeNs = ApiTypeHelper.requireNonNull(builder.avgResponseTimeNs, this, "avgResponseTimeNs");
this.avgServiceTime = ApiTypeHelper.requireNonNull(builder.avgServiceTime, this, "avgServiceTime");
this.avgServiceTimeNs = ApiTypeHelper.requireNonNull(builder.avgServiceTimeNs, this, "avgServiceTimeNs");
this.outgoingSearches = ApiTypeHelper.requireNonNull(builder.outgoingSearches, this, "outgoingSearches");
this.rank = ApiTypeHelper.requireNonNull(builder.rank, this, "rank");
Expand All @@ -92,27 +86,13 @@ public final long avgQueueSize() {
return this.avgQueueSize;
}

/**
* Required - API name: {@code avg_response_time}
*/
public final long avgResponseTime() {
return this.avgResponseTime;
}

/**
* Required - API name: {@code avg_response_time_ns}
*/
public final long avgResponseTimeNs() {
return this.avgResponseTimeNs;
}

/**
* Required - API name: {@code avg_service_time}
*/
public final String avgServiceTime() {
return this.avgServiceTime;
}

/**
* Required - API name: {@code avg_service_time_ns}
*/
Expand Down Expand Up @@ -148,15 +128,9 @@ protected void serializeInternal(JsonGenerator generator, JsonpMapper mapper) {
generator.writeKey("avg_queue_size");
generator.write(this.avgQueueSize);

generator.writeKey("avg_response_time");
generator.write(this.avgResponseTime);

generator.writeKey("avg_response_time_ns");
generator.write(this.avgResponseTimeNs);

generator.writeKey("avg_service_time");
generator.write(this.avgServiceTime);

generator.writeKey("avg_service_time_ns");
generator.write(this.avgServiceTimeNs);

Expand All @@ -177,12 +151,8 @@ protected void serializeInternal(JsonGenerator generator, JsonpMapper mapper) {
public static class Builder extends ObjectBuilderBase implements ObjectBuilder<AdaptiveSelection> {
private Long avgQueueSize;

private Long avgResponseTime;

private Long avgResponseTimeNs;

private String avgServiceTime;

private Long avgServiceTimeNs;

private Long outgoingSearches;
Expand All @@ -197,14 +167,6 @@ public final Builder avgQueueSize(long value) {
return this;
}

/**
* Required - API name: {@code avg_response_time}
*/
public final Builder avgResponseTime(long value) {
this.avgResponseTime = value;
return this;
}

/**
* Required - API name: {@code avg_response_time_ns}
*/
Expand All @@ -213,14 +175,6 @@ public final Builder avgResponseTimeNs(long value) {
return this;
}

/**
* Required - API name: {@code avg_service_time}
*/
public final Builder avgServiceTime(String value) {
this.avgServiceTime = value;
return this;
}

/**
* Required - API name: {@code avg_service_time_ns}
*/
Expand Down Expand Up @@ -269,9 +223,7 @@ public AdaptiveSelection build() {
protected static void setupAdaptiveSelectionDeserializer(ObjectDeserializer<AdaptiveSelection.Builder> op) {

op.add(Builder::avgQueueSize, JsonpDeserializer.longDeserializer(), "avg_queue_size");
op.add(Builder::avgResponseTime, JsonpDeserializer.longDeserializer(), "avg_response_time");
op.add(Builder::avgResponseTimeNs, JsonpDeserializer.longDeserializer(), "avg_response_time_ns");
op.add(Builder::avgServiceTime, JsonpDeserializer.stringDeserializer(), "avg_service_time");
op.add(Builder::avgServiceTimeNs, JsonpDeserializer.longDeserializer(), "avg_service_time_ns");
op.add(Builder::outgoingSearches, JsonpDeserializer.longDeserializer(), "outgoing_searches");
op.add(Builder::rank, JsonpDeserializer.stringDeserializer(), "rank");
Expand Down
Loading

0 comments on commit f1fbe83

Please sign in to comment.