-
Notifications
You must be signed in to change notification settings - Fork 2k
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
Enhance searchable snapshots to enable a read-only view of older snapshots #5812
Conversation
Gradle Check (Jenkins) Run Completed with:
|
Gradle Check (Jenkins) Run Completed with:
|
…shots (opensearch-project#5429) * Enhance searchable snapshots to enable a read-only view of older snapshots This change removes the guardrails around N-1 backward compatibility and uses Lucene's "expert" APIs to read snapshots (Lucene segments) older than N-1 on a best-effort basis. The functionality is gated by an additional feature flag, separate from the searchable snapshots flag. Note that the Lucene integration is rather inefficient because the necessary "expert" Lucene APIs are still package-private. Signed-off-by: Kartik Ganesh <[email protected]> * Added some unit tests This change also includes a test index ZIP file for the unit tests. The change also introduces a bug fix in the readAnySegmentsInfo method to close the reader before returning the SegmentInfos object - this avoids dangling/open file handles. Signed-off-by: Kartik Ganesh <[email protected]> * Incorporating PR feedback Signed-off-by: Kartik Ganesh <[email protected]> * Incorporate PR comments from andrross Signed-off-by: Kartik Ganesh <[email protected]> * Remove use of IndexSetting for minimum version for snapshots backwards compatibility Signed-off-by: Kartik Ganesh <[email protected]> * Moved ES 6.3.0 test data to a subdirectory This change also includes an update to the file name to clarify that it is an ES index, and changing the associated markdown file name to just README.md. All tests that reference this ZIP file have corresponding changes to the path they reference. Signed-off-by: Kartik Ganesh <[email protected]> * Update unit tests to use try-with-resources Signed-off-by: Kartik Ganesh <[email protected]> * Added FeatureFlagSetter helper class Also refactored unit test classes to use the helper class. Signed-off-by: Kartik Ganesh <[email protected]> * Incorporating PR feedback from @mch2 Signed-off-by: Kartik Ganesh <[email protected]> * Fix IndexSettingsTests Updated the asserts in IndexSettingsTests to account for the new defaulting behavior. Signed-off-by: Kartik Ganesh <[email protected]> Signed-off-by: Kartik Ganesh <[email protected]>
Note that the unit tests are still failing at this commit since the Lucene 9 libraries no longer hold constants for Lucene 7 and below, so the fromId logic resolves the Lucene version to 8. Signed-off-by: Kartik Ganesh <[email protected]>
This change fixes resolution of the Lucene version for legacy versions since the Lucene 9 libraries no longer hold constants for Lucene 7 and below. The change also updates DECLARED_VERSIONS to derive from the Versions class rather than LegacyESVersions (thereby ignoring legacy versions). This in turn required a change to the minimumIndexCompatibleVersion logic for LegacyESVersion. Finally, the testMinimumIndexCompatibilityVersion unit test was updated to use accurate version identifiers. All unit tests pass and the code compiles, but actual functionality is still broken because some backwards compatibility logic was removed in the current branch that is retained in 2.x Signed-off-by: Kartik Ganesh <[email protected]>
This reverts changes made in opensearch-project#4728 and opensearch-project#4702. These were only made in main and not backported to 2.x This change also adds unit tests for IndexMetadataGenerations Signed-off-by: Kartik Ganesh <[email protected]>
This commit also includes a correction to documentation, and removes the unnecessary "afterWriteSnapBlob" runnable from BlobStoreRepository Signed-off-by: Kartik Ganesh <[email protected]>
Signed-off-by: Kartik Ganesh <[email protected]>
Gradle Check (Jenkins) Run Completed with:
|
assertEquals(LegacyESVersion.fromId(7000099), Version.fromId(2000099).minimumIndexCompatibilityVersion()); | ||
assertEquals(LegacyESVersion.fromId(7000099), Version.fromId(2010000).minimumIndexCompatibilityVersion()); | ||
assertEquals(LegacyESVersion.fromId(7000099), Version.fromId(2000001).minimumIndexCompatibilityVersion()); | ||
assertEquals(LegacyESVersion.fromId(7000099), Version.fromId(2000099 ^ MASK).minimumIndexCompatibilityVersion()); |
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.
Why is the mask now required?
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 simple answer is that MASK
is now required because the computeMinIndexCompatVersion
logic has diverged between LegacyESVersion
and Version
.
Previously, logic to handle both types of versions were intertwined within the same method. This test then (incorrectly) created LegacyESVersion
objects in the Version.fromId
invocations, but the asserts still passed since the logic was co-mingled.
Now that the two classes have different logic to compute the minimum index-compatible version, the test breaks because LegacyESVersion 2.0 is (correctly) not compatible with LegacyESVersion 7.0. Adding the MASK
ensures that a (OpenSearch) Version 2.0 object is created, which is compatible with LegacyESVersion 7.0
This feature was released in 2.5.0 so it no longer needs to be listed in the changelog. Signed-off-by: Kartik Ganesh <[email protected]>
Gradle Check (Jenkins) Run Completed with:
|
Signed-off-by: Kartik Ganesh <[email protected]>
Gradle Check (Jenkins) Run Completed with:
|
…roject#5812 Signed-off-by: Kartik Ganesh <[email protected]>
… from #5812 (#5922) * Backporting unit tests for IndexMetadataGenerations from #5812 Signed-off-by: Kartik Ganesh <[email protected]> * Fix javadoc for getExtendedCompatibilitySnapshotVersion Signed-off-by: Kartik Ganesh <[email protected]> Signed-off-by: Kartik Ganesh <[email protected]>
… from #5812 (#5922) * Backporting unit tests for IndexMetadataGenerations from #5812 Signed-off-by: Kartik Ganesh <[email protected]> * Fix javadoc for getExtendedCompatibilitySnapshotVersion Signed-off-by: Kartik Ganesh <[email protected]> Signed-off-by: Kartik Ganesh <[email protected]>
Description
This change is a forward-port of #5429 - the changes were made on
2.x
first becausemain
contains some backwards-incompatible changes that made development and testing of the feature difficult.The commits in this PR consist of cherry-picking the commit from
2.x
followed by incremental changes to make the code buildable and the functionality operational inmain
:2.x
. The second commit fixes some minor merge issues.DECLARED_VERSIONS
from the Version class rather than the LegacyESVersion class (to ignore legacy versions), which then required fixing theminimumIndexCompatibleVersion
logic for LegacyESVersion. Finally, the testMinimumIndexCompatibilityVersion unit test was updated to use accurate version identifiers. At this point, all unit tests pass.IndexMetadata
(removed in #4702) andIndexMetadataGenerations
(removed in #4728). It also adds a unit test for the latter class.LegacyESVersion
constants and includes some other minor fixes to documentation and code.Readability fixes and the unit tests for
IndexMetadataGenerations
will be backported to2.x
in a separate PR.Issues Resolved
closes #5451
Check List
By submitting this pull request, I confirm that my contribution is made under the terms of the Apache 2.0 license.
For more information on following Developer Certificate of Origin and signing off your commits, please check here.