-
Notifications
You must be signed in to change notification settings - Fork 25k
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
Archive-Index upgrade compatibility #118599
base: main
Are you sure you want to change the base?
Archive-Index upgrade compatibility #118599
Conversation
…:drempapis/elasticsearch into test/archive-index-version-compatibility
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.
Thanks @drempapis , I left some comments!
server/src/main/java/org/elasticsearch/cluster/coordination/NodeJoinExecutor.java
Outdated
Show resolved
Hide resolved
server/src/main/java/org/elasticsearch/cluster/metadata/IndexMetadataVerifier.java
Outdated
Show resolved
Hide resolved
...rc/javaRestTest/java/org/elasticsearch/lucene/AbstractArchiveIndexCompatibilityTestCase.java
Outdated
Show resolved
Hide resolved
...rc/javaRestTest/java/org/elasticsearch/lucene/AbstractArchiveIndexCompatibilityTestCase.java
Outdated
Show resolved
Hide resolved
...ompatibility/src/javaRestTest/java/org/elasticsearch/lucene/ArchiveIndexCompatibilityIT.java
Outdated
Show resolved
Hide resolved
...ompatibility/src/javaRestTest/java/org/elasticsearch/lucene/ArchiveIndexCompatibilityIT.java
Outdated
Show resolved
Hide resolved
|
||
import org.elasticsearch.test.cluster.util.Version; | ||
|
||
public class RestoreFromVersion5IT extends ArchiveIndexTestCase { |
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.
Because the Gradle setup is not flexible, I needed to divide the different base versions into separate classes. For each case, we need a fresh cluster with version Current-1.
} | ||
} | ||
|
||
public final void verifyArchiveIndexCompatibility(String version) throws Exception { |
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.
The Searchable snapshot
test will also use this template and implement the abstract recovery
method to mount
a snapshot.
Pinging @elastic/es-search-foundations (Team:Search Foundations) |
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.
Left some small comments, LGTM otherwise
* Restores snapshots from old-clusters (version 5/6) and upgrades it to the current version. | ||
* Test methods are executed after each upgrade. | ||
*/ | ||
public class ArchiveIndexTestCase extends AbstractUpgradeCompatibilityTestCase { |
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.
I think I could use some upgrade mention in this class name as well given it's what it tests? You probably wanted to make a distinction between archive indices restored from snapshot and those mounted as searchable snapshots?
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.
Correct, that was my intention. I considered that the Upgrade
functionality was implicitly implied by the parent class, where this one denotes that the test is for ArchiveIndex
. The same logic has been implemented for SearchableSnapshot
in this pr
* Test suite for Archive indices backward compatibility with N-2 versions. | ||
* The test suite creates a cluster in the N-1 version, where N is the current version. | ||
* Restores snapshots from old-clusters (version 5/6) and upgrades it to the current version. | ||
* Test methods are executed after each upgrade. |
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.
I think it would help to provide an example with concrete versions as well., for clarity
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.
I'll do so, ty!
* Overrides the snapshot-restore operation for archive-indices scenario. | ||
*/ | ||
@Override | ||
public void recover(RestClient client, String repository, String snapshot, String index) throws Exception { |
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.
I would call this method importArchiveIndex or something along those lines.
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.
Using the template
pattern, this template placeholder will be used for the archive-index
and searchable-snapshots
tests. This method implements a restore
operation for archive-index tests and a mount
operation for searchable snapshots. Yes, by changing the name to importIndex
fits better.
@cbuescher would you like to take a look as well? |
&& indexMetadata.getCreationVersion().isLegacyIndexVersion() | ||
&& indexMetadata.getCompatibilityVersion().onOrAfter(IndexVersions.MINIMUM_READONLY_COMPATIBLE)) { | ||
return; | ||
} |
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.
@tlrx are you good with this special case here and the one above that targets archive indices? We are addressing the need to upgrade the compatibility version for archive indices imported first in 8.x, that don't allow to upgrade to 9.x otherwise.
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.
I don't think this is going to work during rolling upgrades, because the master may still be a 8.x node and therefore will reject join requests from 9.x, because a 8.x master will still think that 9.x nodes cannot support indices with a 7.x compatibility version.
I think it does work in the case of a full cluster restart though, since the node will be directly be 9.x with the new logic here.
We have to change that logic to also support searchable snapshot N-2 indices, maybe I can do it for both types of indices at once.
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.
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.
good point Tanguy, thanks for raising this. I guess we are better off waiting for your changes then.
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.
I replicated the same test under the qa/rolling-upgrade
project to verify the behavior. It fails in the line,
NodeJoinExecutor.ensureIndexCompatibility(NodeJoinExecutor.java:386)
when upgrading any of the nodes.
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.
thanks for doing that!
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.
I also got stuck in this area (IndexMetadataVerifier#checkSupportedVersion) when trying to revert one of the deleted FullClusterRestartIT tests. My quick fix of changing IndexVersions.MINIMUM_COMPATIBLE to IndexVersions.MINIMUM_READ_ONLY_COMPATIBLE in
elasticsearch/server/src/main/java/org/elasticsearch/gateway/GatewayMetaState.java
Line 298 in 5ec0a84
IndexMetadata newMetadata = indexMetadataVerifier.verifyIndexMetadata(indexMetadata, IndexVersions.MINIMUM_COMPATIBLE); |
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.
Sounds like we may need distrib help with some of these issues @cbuescher , or at least some of the changes they are working on.
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.
I opened #118941 (with #118923 for 8.18
) that should allow archive indices in 7.x to exist on a 9.x cluster. I will try to test the change for archive too but in the case you're interested here is the change for IndexMetadataVerifier.
In this pr, archive-indices upgrade compatibility is tested.
The test suite creates a cluster in the N-1 version, where N is the current version. Restores snapshots from old clusters (version 5/6) and upgrades it to the current version. Test methods are executed after each upgrade.
This is based on #118363 and closes ES-10200