Skip to content
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

Open
wants to merge 23 commits into
base: main
Choose a base branch
from

Conversation

drempapis
Copy link
Contributor

@drempapis drempapis commented Dec 12, 2024

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

@drempapis drempapis self-assigned this Dec 12, 2024
@drempapis drempapis added >test Issues or PRs that are addressing/adding tests Team:Search Foundations Meta label for the Search Foundations team in Elasticsearch :Search Foundations/Search Catch all for Search Foundations labels Dec 12, 2024
Copy link
Member

@javanna javanna left a 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!

@drempapis drempapis changed the title Archive-Index version compatibility Archive-Index upgrade compatibility Dec 16, 2024

import org.elasticsearch.test.cluster.util.Version;

public class RestoreFromVersion5IT extends ArchiveIndexTestCase {
Copy link
Contributor Author

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 {
Copy link
Contributor Author

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.

@drempapis drempapis marked this pull request as ready for review December 17, 2024 09:56
@elasticsearchmachine
Copy link
Collaborator

Pinging @elastic/es-search-foundations (Team:Search Foundations)

Copy link
Member

@javanna javanna left a 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 {
Copy link
Member

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?

Copy link
Contributor Author

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.
Copy link
Member

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

Copy link
Contributor Author

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 {
Copy link
Member

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.

Copy link
Contributor Author

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.

@javanna
Copy link
Member

javanna commented Dec 17, 2024

@cbuescher would you like to take a look as well?

&& indexMetadata.getCreationVersion().isLegacyIndexVersion()
&& indexMetadata.getCompatibilityVersion().onOrAfter(IndexVersions.MINIMUM_READONLY_COMPATIBLE)) {
return;
}
Copy link
Member

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.

Copy link
Member

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.

Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I'm about to merge #118744 that is a prerequisite of #118785 which contains similar logic than the one added here but for searchable snapshots.

Copy link
Member

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.

Copy link
Contributor Author

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.

Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

thanks for doing that!

Copy link
Member

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

IndexMetadata newMetadata = indexMetadataVerifier.verifyIndexMetadata(indexMetadata, IndexVersions.MINIMUM_COMPATIBLE);
led to other startup issues on full cluster restart, I haven't succeeded in exactly debugging those yet but will continue to investigate.

Copy link
Member

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.

Copy link
Member

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.

@drempapis drempapis requested review from cbuescher and tlrx December 17, 2024 11:16
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
:Search Foundations/Search Catch all for Search Foundations Team:Search Foundations Meta label for the Search Foundations team in Elasticsearch >test Issues or PRs that are addressing/adding tests v9.0.0
Projects
None yet
Development

Successfully merging this pull request may close these issues.

5 participants