-
Notifications
You must be signed in to change notification settings - Fork 1.8k
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Refresh OpenSearch nodes version in cluster state after upgrade #865
Changes from all commits
File filter
Filter by extension
Conversations
Jump to
Diff view
Diff view
There are no files selected for viewing
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,39 @@ | ||
/* | ||
* SPDX-License-Identifier: Apache-2.0 | ||
* | ||
* The OpenSearch Contributors require contributions made to | ||
* this file be licensed under the Apache-2.0 license or a | ||
* compatible open source license. | ||
*/ | ||
|
||
package org.opensearch.upgrades; | ||
|
||
import org.opensearch.Version; | ||
import org.opensearch.client.Request; | ||
import org.opensearch.client.Response; | ||
import org.opensearch.common.io.Streams; | ||
|
||
import java.io.IOException; | ||
|
||
public class RefreshVersionInClusterStateIT extends AbstractRollingTestCase { | ||
|
||
/* | ||
This test ensures that after the upgrade from ElasticSearch/ OpenSearch all nodes report the version on and after 1.0.0 | ||
*/ | ||
public void testRefresh() throws IOException { | ||
switch (CLUSTER_TYPE) { | ||
case OLD: | ||
case MIXED: | ||
break; | ||
case UPGRADED: | ||
Response response = client().performRequest(new Request("GET", "/_cat/nodes?h=id,version")); | ||
for (String nodeLine : Streams.readAllLines(response.getEntity().getContent())) { | ||
String[] elements = nodeLine.split(" +"); | ||
assertEquals(Version.fromString(elements[1]), Version.CURRENT); | ||
} | ||
break; | ||
default: | ||
throw new UnsupportedOperationException("Unknown cluster type [" + CLUSTER_TYPE + "]"); | ||
} | ||
} | ||
} |
Original file line number | Diff line number | Diff line change |
---|---|---|
|
@@ -367,7 +367,7 @@ public void writeTo(StreamOutput out) throws IOException { | |
} | ||
} | ||
} | ||
if (out.getVersion().before(Version.V_1_0_0)) { | ||
if (out.getVersion().before(Version.V_1_0_0) && version.onOrAfter(Version.V_1_0_0)) { | ||
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. can you please help me understand why we're adding this? There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. so, DiscoveryNode writeTo serialization method can be triggered from multiple places e.g. when cluster state is being sent from one node to another and BWC version should be set for only OpenSearch nodes. Without this check, it will mess with the version for Elasticsearch nodes in the cluster as well which ideally should be untouched. |
||
Version.writeVersion(LegacyESVersion.V_7_10_2, out); | ||
} else { | ||
Version.writeVersion(version, out); | ||
|
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Can it not be any other legacy version e.g. 6.8.x or 7.10.x which we are upgrading from?
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
We're only concerned about the OpenSearch nodes in BWC mode, any other ES node that is not yet upgraded should run in mixed cluster - is that correct understanding?
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
For other ES versions, the version in cluster state and channel version would always be same. So, there is no need for special handling. Its only for OpenSearch nodes which spoof to be 7.10.2 and we don't know if it is real 7.10.2 or OpenSearch node spoofing its version.