-
Notifications
You must be signed in to change notification settings - Fork 25.6k
[Failure store] Add failure index retrieval to IndexAbstraction
#119413
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
[Failure store] Add failure index retrieval to IndexAbstraction
#119413
Conversation
… most common cases.
Pinging @elastic/es-data-management (Team:Data Management) |
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.
LGTM! Sorry, this fell off my radar for a bit there, but the code looks so much cleaner after all this, thanks!
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.
LGTM, please go ahead and merge this ASAP so I can merge this into #119915, which currently duplicates much of this in a less complete, less tested way. Nice work!
The
IndexAbstraction
interface provides the methodsgetWriteIndex()
andgetIndices()
to retrieve the backing indices and its subclasses implement them accordingly.For the failure store, we implemented equivalent ways to retrieve the failure indices but only in the
DataStream
subclass. Until now this was sufficient but looking at #118614, I think the code could be simplified and be more robust if we pulled them up toIndexAbstraction
; considering that a data stream alias can also be resolved to failure store indices.I believe that if we add these methods we could easily retrieve the failure store indices after we check
isDataStreamRelated()
without needing to know how to resolve them.With this PR I we add the equivalent failure indices retrieval methods, with a twist, we retrieve them lazily. Considering that the failure indices are not as often needed, we retrieve them lazily from the metadata and we do not burden all data stream aliases. So we propose the following:
Index getWriteIndex()
Index getWriteFailureIndex(Metadata metadata)
List<Index> getIndices()
List<Index> getFailureIndices(Metadata metadata)
Furthermore, we renamed the following
DataStream
methods to be more symmetrical:DataStreamIndices getBackingIndices()
->DataStreamIndices getDataComponent()
DataStreamIndices getFailureIndices()
->DataStreamIndices getFailureComponent()
List<Index> getFailureIndices()
->List<Index> getFailureIndices()
this is symmetrical with theList<Index> getIndices()
.Index getFailureStoreWriteIndex()
->Index getWriteFailureIndex()
so it can be an overloaded version ofIndex getWriteFailureIndex(Metadata metadata)
.Bonus, now the failure store retrieval can be tested easier.