Skip to content

Allow archive and searchable snapshots indices in N-2 version #118941

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

Merged
merged 12 commits into from
Dec 19, 2024

Conversation

tlrx
Copy link
Member

@tlrx tlrx commented Dec 18, 2024

This change (along with the required change #118923 for 8.18) relaxes the index compatibility version checks to allow archive and searchable snapshot indices in version N-2 to exist on a 9.x cluster.

The change in the compatibility tests and NodeJoinExecutor and IndexMetadataVerifier are ready for review.

Relates ES-10274

@tlrx tlrx added >enhancement :Distributed Indexing/Recovery Anything around constructing a new shard, either from a local or a remote source. v9.0.0 labels Dec 18, 2024
@elasticsearchmachine
Copy link
Collaborator

Hi @tlrx, I've created a changelog YAML for you.

@elasticsearchmachine
Copy link
Collaborator

Pinging @elastic/es-distributed-indexing (Team:Distributed Indexing)

@@ -207,7 +208,20 @@ public SegmentInfos readLastCommittedSegmentsInfo() throws IOException {
failIfCorrupted();
try {
return readSegmentsInfo(null, directory());
} catch (CorruptIndexException | IndexFormatTooOldException | IndexFormatTooNewException ex) {
} catch (IndexFormatTooOldException e) {
// Temporary workaround
Copy link
Member

Choose a reason for hiding this comment

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

could you expand on why we need this workaround? I could see how we need special logic for the case where we read from a specific index commit, but given the argument here is null, I would suggest to just change Store#readSegmentsInfo to provide the major argument at all times and then we no longer need this special handling? We do need to handle the case for reading the from a specific index comment pending 10.1 though because the method is not yet public in Lucene

Copy link
Member

Choose a reason for hiding this comment

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

Same for all the special casing done in this class, I think that we should centralize the segment infos parsing in a single place, and always provide the min supported major argument, I don't see why not. Not doing so complicates things for no reason?

Copy link
Member Author

Choose a reason for hiding this comment

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

Yeah sorry, I've been a bit nuclear here to have the tests passed.

I reworked this in the latest commit so that all methods finally end using one of the Lucene#readSegmentInfos() methods. I implemented a workaround there for reading a specific commit in N-2 version, let me know what you think.

Copy link
Member Author

Choose a reason for hiding this comment

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

I messed up exception handling in one of my latest change so be sure to review 612cde2

Copy link
Contributor

@henningandersen henningandersen left a comment

Choose a reason for hiding this comment

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

Looks great. Not approving due to:

more changes to allow reading Lucene commit files in N-2 version but those can be disregarded for now

Copy link
Contributor

@henningandersen henningandersen left a comment

Choose a reason for hiding this comment

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

LGTM.

}

/**
* Reads the segments infos from the given segments file name, failing if it fails to load
*/
private static SegmentInfos readSegmentInfos(String segmentsFileName, Directory directory) throws IOException {
return SegmentInfos.readCommit(directory, segmentsFileName);
// TODO Use readCommit(Directory directory, String segmentFileName, int minSupportedMajorVersion) once Lucene 10.1 is available
// and remove the try-catch block for IndexFormatTooOldException
Copy link
Member

Choose a reason for hiding this comment

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

could you add an assert based on the lucene version here just to make 100% sure?

Copy link
Member Author

@tlrx tlrx Dec 19, 2024

Choose a reason for hiding this comment

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

Sure, I just pushed 69c0e06

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 a couple of nits, LGTM though!

tlrx added a commit that referenced this pull request Dec 19, 2024
…118923)

This is the backport of #118941 for 8.18.

This change relaxes the index compatibility version checks 
to allow archive and searchable snapshot indices in version 
N-2 to exist on a 9.x cluster. It uses the min. read-only index 
compatible version added in #118884 to accept join requests 
from 9.x nodes that can read indices created in version 7.x
 (N-2) as long as they have a write block and are either archive 
or searchable snapshot indices.

Relates ES-10274
@tlrx tlrx merged commit 84f233a into elastic:main Dec 19, 2024
15 checks passed
@tlrx tlrx deleted the 2024/12/18/ES-10274-main branch December 19, 2024 15:19
yetanothertw added a commit to elastic/docs-content that referenced this pull request Jun 6, 2025
Fixes #1200

Updates the [Index
compatibility](https://www.elastic.co/docs/deploy-manage/tools/snapshot-and-restore#index-compatibility)
table in the **Snapshot and restore** section of the deployment docs.

[Preview available
here](https://docs-v3-preview.elastic.dev/elastic/docs-content/pull/1617/deploy-manage/tools/snapshot-and-restore#index-compatibility)

These changes are [confirmed by
eng](#1200 (comment))
and also
[PR#118941](elastic/elasticsearch#118941)
provides additional context on the compatibility.
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
:Distributed Indexing/Recovery Anything around constructing a new shard, either from a local or a remote source. >enhancement Team:Distributed Indexing Meta label for Distributed Indexing team v9.0.0
Projects
None yet
Development

Successfully merging this pull request may close these issues.

4 participants