forked from elastic/elasticsearch
-
Notifications
You must be signed in to change notification settings - Fork 3
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Register TopN status in plugin's writables (elastic#100874)
``` "node_failures": [ { "type": "failed_node_exception", "reason": "Failed node [qpdSPb3yQkuDlsI9TH7a2g]", "node_id": "qpdSPb3yQkuDlsI9TH7a2g", "caused_by": { "type": "transport_serialization_exception", "reason": "Failed to deserialize response from handler", "caused_by": { "type": "illegal_argument_exception", "reason": "Unknown NamedWriteable [org.elasticsearch.compute.operator.Operator$Status][topn]" } } } ] ``` I hit this error when trying to retrieve ESQL tasks. The issue is that we forget to register NamedWritable for the status of TopN.
- Loading branch information
Showing
2 changed files
with
33 additions
and
2 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
29 changes: 29 additions & 0 deletions
29
...k/plugin/esql/src/test/java/org/elasticsearch/xpack/esql/action/NamedWriteablesTests.java
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,29 @@ | ||
/* | ||
* Copyright Elasticsearch B.V. and/or licensed to Elasticsearch B.V. under one | ||
* or more contributor license agreements. Licensed under the Elastic License | ||
* 2.0; you may not use this file except in compliance with the Elastic License | ||
* 2.0. | ||
*/ | ||
|
||
package org.elasticsearch.xpack.esql.action; | ||
|
||
import org.elasticsearch.common.io.stream.NamedWriteableRegistry; | ||
import org.elasticsearch.compute.operator.Operator; | ||
import org.elasticsearch.compute.operator.topn.TopNOperatorStatus; | ||
import org.elasticsearch.test.ESTestCase; | ||
import org.elasticsearch.xpack.esql.plugin.EsqlPlugin; | ||
|
||
import static org.hamcrest.Matchers.equalTo; | ||
|
||
public class NamedWriteablesTests extends ESTestCase { | ||
|
||
public void testTopNStatus() throws Exception { | ||
try (EsqlPlugin plugin = new EsqlPlugin()) { | ||
NamedWriteableRegistry registry = new NamedWriteableRegistry(plugin.getNamedWriteables()); | ||
TopNOperatorStatus origin = new TopNOperatorStatus(randomNonNegativeInt(), randomNonNegativeLong()); | ||
TopNOperatorStatus copy = (TopNOperatorStatus) copyNamedWriteable(origin, registry, Operator.Status.class); | ||
assertThat(copy.occupiedRows(), equalTo(origin.occupiedRows())); | ||
assertThat(copy.ramBytesUsed(), equalTo(origin.ramBytesUsed())); | ||
} | ||
} | ||
} |