-
Notifications
You must be signed in to change notification settings - Fork 24.9k
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
Update archival indices logic to support ES 7 indices #116565
Open
cbuescher
wants to merge
31
commits into
elastic:main
Choose a base branch
from
cbuescher:add-bwcLucene87Codec
base: main
Could not load branches
Branch not found: {{ refName }}
Loading
Could not load tags
Nothing to show
Loading
Are you sure you want to change the base?
Some commits from the old base branch may be removed from the timeline,
and old review comments may become outdated.
Open
Changes from 15 commits
Commits
Show all changes
31 commits
Select commit
Hold shift + click to select a range
95ba9c4
WIP
cbuescher d2817fa
Trying to add new qa test project for 7x archival indices
cbuescher 1bd696d
iter
cbuescher 85b61cd
Add basic search test
cbuescher 93b95fb
Rework OldMappingIT
cbuescher 6b8177c
iter
cbuescher b27ab02
Merge branch 'main' into add-bwcLucene87Codec
cbuescher 33f3f36
Use system property for version
cbuescher dce64b2
Add BWCLucene86Codec
cbuescher 8aae226
Merge branch 'main' into add-bwcLucene87Codec
cbuescher 2f3b6d0
Fix codec name
cbuescher feaee28
Change version to 7.9.0
cbuescher becea6b
Merge branch 'main' into add-bwcLucene87Codec
cbuescher 41d69c7
Add modified version of OldRepositoryAccessIT
cbuescher 8b3acb8
Adding back test for source_only repo
cbuescher 55ed6d0
Add looping over versions
cbuescher 1351e2e
Change looping over version
cbuescher 4d35161
Fix cluster version checks
cbuescher d4be0ac
No snapshot cache for old cluster
cbuescher 9919159
Add DocValueOnlyFieldsIT yaml rest test
cbuescher 2406751
Fix wiring of yaml specs to test tasks
breskeby 85d01c2
Make DocValueOnlyFieldsIT work for V7x
cbuescher f17527f
Using 7.9.0 instead of 7.16
cbuescher 6cabe33
Merge branch 'main' into add-bwcLucene87Codec
cbuescher da3db30
Cleanups
cbuescher 4a46d80
Merge branch 'main' into add-bwcLucene87Codec
cbuescher 01ba741
Add _field_names disabling to new tests
cbuescher 3d257dd
Merge branch 'main' into add-bwcLucene87Codec
cbuescher c7693b3
Add restart cluster test
cbuescher 3bf231d
Merge branch 'main' into add-bwcLucene87Codec
cbuescher 050d195
Pulling in test changes from 117649
cbuescher File filter
Filter by extension
Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
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
153 changes: 153 additions & 0 deletions
153
...ns/src/main/java/org/elasticsearch/xpack/lucene/bwc/codecs/lucene86/BWCLucene86Codec.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,153 @@ | ||
/* | ||
* 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.lucene.bwc.codecs.lucene86; | ||
|
||
import org.apache.lucene.backward_codecs.lucene50.Lucene50CompoundFormat; | ||
import org.apache.lucene.backward_codecs.lucene50.Lucene50LiveDocsFormat; | ||
import org.apache.lucene.backward_codecs.lucene50.Lucene50StoredFieldsFormat; | ||
import org.apache.lucene.backward_codecs.lucene50.Lucene50TermVectorsFormat; | ||
import org.apache.lucene.backward_codecs.lucene60.Lucene60FieldInfosFormat; | ||
import org.apache.lucene.backward_codecs.lucene80.Lucene80NormsFormat; | ||
import org.apache.lucene.backward_codecs.lucene84.Lucene84PostingsFormat; | ||
import org.apache.lucene.backward_codecs.lucene86.Lucene86PointsFormat; | ||
import org.apache.lucene.backward_codecs.lucene86.Lucene86SegmentInfoFormat; | ||
import org.apache.lucene.codecs.CompoundFormat; | ||
import org.apache.lucene.codecs.DocValuesFormat; | ||
import org.apache.lucene.codecs.FieldInfosFormat; | ||
import org.apache.lucene.codecs.KnnVectorsFormat; | ||
import org.apache.lucene.codecs.LiveDocsFormat; | ||
import org.apache.lucene.codecs.NormsFormat; | ||
import org.apache.lucene.codecs.PointsFormat; | ||
import org.apache.lucene.codecs.PostingsFormat; | ||
import org.apache.lucene.codecs.SegmentInfoFormat; | ||
import org.apache.lucene.codecs.StoredFieldsFormat; | ||
import org.apache.lucene.codecs.TermVectorsFormat; | ||
import org.apache.lucene.codecs.perfield.PerFieldDocValuesFormat; | ||
import org.apache.lucene.codecs.perfield.PerFieldPostingsFormat; | ||
import org.elasticsearch.xpack.lucene.bwc.codecs.BWCCodec; | ||
|
||
import java.util.Objects; | ||
|
||
public class BWCLucene86Codec extends BWCCodec { | ||
|
||
private final TermVectorsFormat vectorsFormat = new Lucene50TermVectorsFormat(); | ||
private final FieldInfosFormat fieldInfosFormat = wrap(new Lucene60FieldInfosFormat()); | ||
private final SegmentInfoFormat segmentInfosFormat = wrap(new Lucene86SegmentInfoFormat()); | ||
private final LiveDocsFormat liveDocsFormat = new Lucene50LiveDocsFormat(); | ||
private final CompoundFormat compoundFormat = new Lucene50CompoundFormat(); | ||
private final PointsFormat pointsFormat = new Lucene86PointsFormat(); | ||
private final PostingsFormat defaultFormat; | ||
|
||
private final PostingsFormat postingsFormat = new PerFieldPostingsFormat() { | ||
@Override | ||
public PostingsFormat getPostingsFormatForField(String field) { | ||
return BWCLucene86Codec.this.getPostingsFormatForField(field); | ||
} | ||
}; | ||
|
||
private final DocValuesFormat docValuesFormat = new PerFieldDocValuesFormat() { | ||
@Override | ||
public DocValuesFormat getDocValuesFormatForField(String field) { | ||
return BWCLucene86Codec.this.getDocValuesFormatForField(field); | ||
} | ||
}; | ||
|
||
private final StoredFieldsFormat storedFieldsFormat; | ||
|
||
/** Instantiates a new codec. */ | ||
public BWCLucene86Codec() { | ||
super("BWCLucene86Codec"); | ||
this.storedFieldsFormat = new Lucene50StoredFieldsFormat(Objects.requireNonNull(Lucene50StoredFieldsFormat.Mode.BEST_SPEED)); | ||
this.defaultFormat = new Lucene84PostingsFormat(); | ||
} | ||
|
||
@Override | ||
public StoredFieldsFormat storedFieldsFormat() { | ||
return storedFieldsFormat; | ||
} | ||
|
||
@Override | ||
public TermVectorsFormat termVectorsFormat() { | ||
return vectorsFormat; | ||
} | ||
|
||
@Override | ||
public PostingsFormat postingsFormat() { | ||
return postingsFormat; | ||
} | ||
|
||
@Override | ||
public final FieldInfosFormat fieldInfosFormat() { | ||
return fieldInfosFormat; | ||
} | ||
|
||
@Override | ||
public SegmentInfoFormat segmentInfoFormat() { | ||
return segmentInfosFormat; | ||
} | ||
|
||
@Override | ||
public final LiveDocsFormat liveDocsFormat() { | ||
return liveDocsFormat; | ||
} | ||
|
||
@Override | ||
public CompoundFormat compoundFormat() { | ||
return compoundFormat; | ||
} | ||
|
||
@Override | ||
public PointsFormat pointsFormat() { | ||
return pointsFormat; | ||
} | ||
|
||
@Override | ||
public final KnnVectorsFormat knnVectorsFormat() { | ||
return KnnVectorsFormat.EMPTY; | ||
} | ||
|
||
/** | ||
* Returns the postings format that should be used for writing new segments of <code>field</code>. | ||
* | ||
* <p>The default implementation always returns "Lucene84". | ||
* | ||
* <p><b>WARNING:</b> if you subclass, you are responsible for index backwards compatibility: | ||
* future version of Lucene are only guaranteed to be able to read the default implementation. | ||
*/ | ||
public PostingsFormat getPostingsFormatForField(String field) { | ||
return defaultFormat; | ||
} | ||
|
||
/** | ||
* Returns the docvalues format that should be used for writing new segments of <code>field</code> | ||
* . | ||
* | ||
* <p>The default implementation always returns "Lucene80". | ||
* | ||
* <p><b>WARNING:</b> if you subclass, you are responsible for index backwards compatibility: | ||
* future version of Lucene are only guaranteed to be able to read the default implementation. | ||
*/ | ||
public DocValuesFormat getDocValuesFormatForField(String field) { | ||
return defaultDVFormat; | ||
} | ||
|
||
@Override | ||
public final DocValuesFormat docValuesFormat() { | ||
return docValuesFormat; | ||
} | ||
|
||
private final DocValuesFormat defaultDVFormat = DocValuesFormat.forName("Lucene80"); | ||
|
||
private final NormsFormat normsFormat = new Lucene80NormsFormat(); | ||
|
||
@Override | ||
public NormsFormat normsFormat() { | ||
return normsFormat; | ||
} | ||
|
||
} |
153 changes: 153 additions & 0 deletions
153
...ns/src/main/java/org/elasticsearch/xpack/lucene/bwc/codecs/lucene87/BWCLucene87Codec.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,153 @@ | ||
/* | ||
* 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.lucene.bwc.codecs.lucene87; | ||
|
||
import org.apache.lucene.backward_codecs.lucene50.Lucene50CompoundFormat; | ||
import org.apache.lucene.backward_codecs.lucene50.Lucene50LiveDocsFormat; | ||
import org.apache.lucene.backward_codecs.lucene50.Lucene50TermVectorsFormat; | ||
import org.apache.lucene.backward_codecs.lucene60.Lucene60FieldInfosFormat; | ||
import org.apache.lucene.backward_codecs.lucene80.Lucene80DocValuesFormat; | ||
import org.apache.lucene.backward_codecs.lucene80.Lucene80NormsFormat; | ||
import org.apache.lucene.backward_codecs.lucene84.Lucene84PostingsFormat; | ||
import org.apache.lucene.backward_codecs.lucene86.Lucene86PointsFormat; | ||
import org.apache.lucene.backward_codecs.lucene86.Lucene86SegmentInfoFormat; | ||
import org.apache.lucene.backward_codecs.lucene87.Lucene87StoredFieldsFormat; | ||
import org.apache.lucene.codecs.CompoundFormat; | ||
import org.apache.lucene.codecs.DocValuesFormat; | ||
import org.apache.lucene.codecs.FieldInfosFormat; | ||
import org.apache.lucene.codecs.KnnVectorsFormat; | ||
import org.apache.lucene.codecs.LiveDocsFormat; | ||
import org.apache.lucene.codecs.NormsFormat; | ||
import org.apache.lucene.codecs.PointsFormat; | ||
import org.apache.lucene.codecs.PostingsFormat; | ||
import org.apache.lucene.codecs.SegmentInfoFormat; | ||
import org.apache.lucene.codecs.StoredFieldsFormat; | ||
import org.apache.lucene.codecs.TermVectorsFormat; | ||
import org.apache.lucene.codecs.perfield.PerFieldDocValuesFormat; | ||
import org.apache.lucene.codecs.perfield.PerFieldPostingsFormat; | ||
import org.elasticsearch.xpack.lucene.bwc.codecs.BWCCodec; | ||
|
||
public class BWCLucene87Codec extends BWCCodec { | ||
|
||
private final TermVectorsFormat vectorsFormat = new Lucene50TermVectorsFormat(); | ||
private final FieldInfosFormat fieldInfosFormat = wrap(new Lucene60FieldInfosFormat()); | ||
private final SegmentInfoFormat segmentInfosFormat = wrap(new Lucene86SegmentInfoFormat()); | ||
private final LiveDocsFormat liveDocsFormat = new Lucene50LiveDocsFormat(); | ||
private final CompoundFormat compoundFormat = new Lucene50CompoundFormat(); | ||
private final PointsFormat pointsFormat = new Lucene86PointsFormat(); | ||
private final PostingsFormat defaultFormat; | ||
|
||
private final PostingsFormat postingsFormat = new PerFieldPostingsFormat() { | ||
@Override | ||
public PostingsFormat getPostingsFormatForField(String field) { | ||
return BWCLucene87Codec.this.getPostingsFormatForField(field); | ||
} | ||
}; | ||
|
||
private final DocValuesFormat docValuesFormat = new PerFieldDocValuesFormat() { | ||
@Override | ||
public DocValuesFormat getDocValuesFormatForField(String field) { | ||
return BWCLucene87Codec.this.getDocValuesFormatForField(field); | ||
} | ||
}; | ||
|
||
private final StoredFieldsFormat storedFieldsFormat; | ||
|
||
/** Instantiates a new codec. */ | ||
public BWCLucene87Codec() { | ||
super("BWCLucene87Codec"); | ||
this.storedFieldsFormat = new Lucene87StoredFieldsFormat(Lucene87StoredFieldsFormat.Mode.BEST_COMPRESSION); | ||
this.defaultFormat = new Lucene84PostingsFormat(); | ||
this.defaultDVFormat = new Lucene80DocValuesFormat(Lucene80DocValuesFormat.Mode.BEST_COMPRESSION); | ||
} | ||
|
||
@Override | ||
public StoredFieldsFormat storedFieldsFormat() { | ||
return storedFieldsFormat; | ||
} | ||
|
||
@Override | ||
public TermVectorsFormat termVectorsFormat() { | ||
return vectorsFormat; | ||
} | ||
|
||
@Override | ||
public PostingsFormat postingsFormat() { | ||
return postingsFormat; | ||
} | ||
|
||
@Override | ||
public final FieldInfosFormat fieldInfosFormat() { | ||
return fieldInfosFormat; | ||
} | ||
|
||
@Override | ||
public SegmentInfoFormat segmentInfoFormat() { | ||
return segmentInfosFormat; | ||
} | ||
|
||
@Override | ||
public final LiveDocsFormat liveDocsFormat() { | ||
return liveDocsFormat; | ||
} | ||
|
||
@Override | ||
public CompoundFormat compoundFormat() { | ||
return compoundFormat; | ||
} | ||
|
||
@Override | ||
public PointsFormat pointsFormat() { | ||
return pointsFormat; | ||
} | ||
|
||
@Override | ||
public final KnnVectorsFormat knnVectorsFormat() { | ||
return KnnVectorsFormat.EMPTY; | ||
} | ||
|
||
/** | ||
* Returns the postings format that should be used for writing new segments of <code>field</code>. | ||
* | ||
* <p>The default implementation always returns "Lucene84". | ||
* | ||
* <p><b>WARNING:</b> if you subclass, you are responsible for index backwards compatibility: | ||
* future version of Lucene are only guaranteed to be able to read the default implementation. | ||
*/ | ||
public PostingsFormat getPostingsFormatForField(String field) { | ||
return defaultFormat; | ||
} | ||
|
||
/** | ||
* Returns the docvalues format that should be used for writing new segments of <code>field</code> | ||
* . | ||
* | ||
* <p>The default implementation always returns "Lucene80". | ||
* | ||
* <p><b>WARNING:</b> if you subclass, you are responsible for index backwards compatibility: | ||
* future version of Lucene are only guaranteed to be able to read the default implementation. | ||
*/ | ||
public DocValuesFormat getDocValuesFormatForField(String field) { | ||
return defaultDVFormat; | ||
} | ||
|
||
@Override | ||
public final DocValuesFormat docValuesFormat() { | ||
return docValuesFormat; | ||
} | ||
|
||
private final DocValuesFormat defaultDVFormat; | ||
|
||
private final NormsFormat normsFormat = new Lucene80NormsFormat(); | ||
|
||
@Override | ||
public NormsFormat normsFormat() { | ||
return normsFormat; | ||
} | ||
|
||
} |
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
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,12 @@ | ||
import org.elasticsearch.gradle.internal.test.RestIntegTestTask | ||
import org.elasticsearch.gradle.Version | ||
|
||
apply plugin: 'elasticsearch.internal-java-rest-test' | ||
|
||
tasks.named("javaRestTest").configure { | ||
def versionString = "7.17.25" | ||
// def versionString = "7.9.0" | ||
systemProperty 'tests.old_cluster_version', versionString | ||
usesDefaultDistribution() | ||
usesBwcDistribution(Version.fromString(versionString)) | ||
} |
Oops, something went wrong.
Add this suggestion to a batch that can be applied as a single commit.
This suggestion is invalid because no changes were made to the code.
Suggestions cannot be applied while the pull request is closed.
Suggestions cannot be applied while viewing a subset of changes.
Only one suggestion per line can be applied in a batch.
Add this suggestion to a batch that can be applied as a single commit.
Applying suggestions on deleted lines is not supported.
You must change the existing code in this line in order to create a valid suggestion.
Outdated suggestions cannot be applied.
This suggestion has been applied or marked resolved.
Suggestions cannot be applied from pending reviews.
Suggestions cannot be applied on multi-line comments.
Suggestions cannot be applied while the pull request is queued to merge.
Suggestion cannot be applied right now. Please check back later.
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.
@breskeby I have ported two existing tests extending ESRestTestCase from the old qa project now. I cannot get the loop over versions to work though. I tried something like this:
But for some ran into trouble finding the test classes directory, so something is still off:
https://gradle-enterprise.elastic.co/s/c2iiwoowzbhlg
Any pointers?
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.
in your task registration you need to set the class path and the test classes folder in order to get this working with custom tasks:
Yeah my original suggestion was to have one test suite containing all tests for all versions. you might be right breaking those up is a more convenient way. though I think we usually would not trigger them individually by version. I could be wrong here and haven't thought too much about that yet. Lets go ahead with your approach for now and have one test task per version.