-
Notifications
You must be signed in to change notification settings - Fork 1.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
Enhance searchable snapshots to enable a read-only view of older snapshots #5429
Changes from all commits
5d4acf6
f4f1648
d85174f
e5d8880
a0eea5d
440b066
73a1429
2006683
4339244
99b81ae
File filter
Filter by extension
Conversations
Jump to
Diff view
Diff view
There are no files selected for viewing
Original file line number | Diff line number | Diff line change |
---|---|---|
|
@@ -37,6 +37,13 @@ public class FeatureFlags { | |
*/ | ||
public static final String SEARCHABLE_SNAPSHOT = "opensearch.experimental.feature.searchable_snapshot.enabled"; | ||
|
||
/** | ||
* Gates the ability for Searchable Snapshots to read snapshots that are older than the | ||
* guaranteed backward compatibility for OpenSearch (one prior major version) on a best effort basis. | ||
*/ | ||
public static final String SEARCHABLE_SNAPSHOT_EXTENDED_COMPATIBILITY = | ||
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. This might be a bad idea, but can we consider not adding another feature flag for this? If we need to promote searchable snapshots out of experimental without the extended compatibility support, we can put a new feature flag in at that time. There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. Happy to remove it if you feel strongly, but I'd prefer to keep it - Lucene compatibility guarantees that we can read an N-1 snapshot, but support for older versions is on a best-effort basis. Taking this more conservative route ensures that we don't inadvertently expose this and give users the impressions that extended backward compatibility is stable. Moreover, given that the underlying access relies on a workaround until Lucene makes the "expert" API public, I wouldn't be comfortable removing the feature flag until we can remove the workaround |
||
"opensearch.experimental.feature.searchable_snapshot.extended_compatibility.enabled"; | ||
|
||
/** | ||
* Gates the functionality of extensions. | ||
* Once the feature is ready for production release, this feature flag can be removed. | ||
|
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.
I have a couple questions that might be worth answering in this comment:
org.apache.lucene.index.SegmentInfos.readLatestCommit(Directory, int)
package private?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.
DirectoryReader.open
which is the workaround used in this method implementation.segments_N
file and reads theSegmentInfos
object from it. The implementation here does the following:DirectoryReader.listCommits
, It reads theSegmentInfos
object for the latestsegments_N
file as well as for all oldersegments_N
files. These are returned as a sorted list ofIndexCommit
objects which are created from the correspondingSegmentInfos
but do not hold a reference to them.IndexCommit
object is then used to open aDirectoryReader
. Underneath, theIndexCommit
is transformed to aSegmentInfos
object by the same method as the expert API. ThisSegmentInfos
object is the one that is finally returned from this method.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.
I should also note that the two code paths described in point 2 above have an associated test case in LuceneTests to check that they are equivalent -
testReadSegmentInfosExtendedCompatibilityBaseCase