Enhance searchable snapshots to enable a read-only view of older snapshots#5812
Merged
kartg merged 8 commits intoopensearch-project:mainfrom Jan 13, 2023
Merged
Enhance searchable snapshots to enable a read-only view of older snapshots#5812kartg merged 8 commits intoopensearch-project:mainfrom
kartg merged 8 commits intoopensearch-project:mainfrom
Conversation
Contributor
Gradle Check (Jenkins) Run Completed with:
|
Contributor
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 <gkart@amazon.com> * 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 <gkart@amazon.com> * Incorporating PR feedback Signed-off-by: Kartik Ganesh <gkart@amazon.com> * Incorporate PR comments from andrross Signed-off-by: Kartik Ganesh <gkart@amazon.com> * Remove use of IndexSetting for minimum version for snapshots backwards compatibility Signed-off-by: Kartik Ganesh <gkart@amazon.com> * 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 <gkart@amazon.com> * Update unit tests to use try-with-resources Signed-off-by: Kartik Ganesh <gkart@amazon.com> * Added FeatureFlagSetter helper class Also refactored unit test classes to use the helper class. Signed-off-by: Kartik Ganesh <gkart@amazon.com> * Incorporating PR feedback from @mch2 Signed-off-by: Kartik Ganesh <gkart@amazon.com> * Fix IndexSettingsTests Updated the asserts in IndexSettingsTests to account for the new defaulting behavior. Signed-off-by: Kartik Ganesh <gkart@amazon.com> Signed-off-by: Kartik Ganesh <gkart@amazon.com>
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 <gkart@amazon.com>
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 <gkart@amazon.com>
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 <gkart@amazon.com>
This commit also includes a correction to documentation, and removes the unnecessary "afterWriteSnapBlob" runnable from BlobStoreRepository Signed-off-by: Kartik Ganesh <gkart@amazon.com>
Signed-off-by: Kartik Ganesh <gkart@amazon.com>
Contributor
Gradle Check (Jenkins) Run Completed with:
|
mch2
reviewed
Jan 12, 2023
| 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()); |
Member
Author
There was a problem hiding this comment.
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
mch2
approved these changes
Jan 12, 2023
andrross
reviewed
Jan 13, 2023
This feature was released in 2.5.0 so it no longer needs to be listed in the changelog. Signed-off-by: Kartik Ganesh <gkart@amazon.com>
Contributor
Gradle Check (Jenkins) Run Completed with:
|
andrross
approved these changes
Jan 13, 2023
reta
reviewed
Jan 13, 2023
Signed-off-by: Kartik Ganesh <gkart@amazon.com>
Contributor
Gradle Check (Jenkins) Run Completed with:
|
kartg
added a commit
to kartg/OpenSearch
that referenced
this pull request
Jan 17, 2023
…roject#5812 Signed-off-by: Kartik Ganesh <gkart@amazon.com>
6 tasks
3 tasks
This file contains hidden or 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
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
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.
Description
This change is a forward-port of #5429 - the changes were made on
2.xfirst becausemaincontains 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.xfollowed by incremental changes to make the code buildable and the functionality operational inmain:2.x. The second commit fixes some minor merge issues.DECLARED_VERSIONSfrom the Version class rather than the LegacyESVersion class (to ignore legacy versions), which then required fixing theminimumIndexCompatibleVersionlogic 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.LegacyESVersionconstants and includes some other minor fixes to documentation and code.Readability fixes and the unit tests for
IndexMetadataGenerationswill be backported to2.xin 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.