Skip to content

[BUG] LeafReader removes all SubReaderWrappers incase IndexWriter encounters a non aborting Exception #19851

@RS146BIJAY

Description

@RS146BIJAY

Describe the bug

In OpenSearch, during recovery flow, documents are queried using a DirectoryReader to be replayed as operations during translog replay. Now incase OpenSearch IndexWriter encounters any non aborted exception, underlying segments can contain both hard and soft deleted documents. In this case, OpenSearch unwraps a LeafReader and uses it for querying documents which are replayed as operation for Translog replay.

Since this unwrapping process will remove all wrappers from LeafReader, it becomes an issue for features like DerivedSource where we rely on a DerivedSourceDirectoryReader wrapper over LeafReader to extract source for a document. For Derived Source enabled index, with wrapper removed, a MissingHistoryOperationsException will be thrown during Translog replay as source field will be null for the documents, failing recovery.

Related component

Indexing, Search

Expected behavior

DirectoryReader should not unwrap LeafReader incase IndexWriter encounters a non aborting Exception

Additional Details

Metadata

Metadata

Assignees

No one assigned

    Labels

    IndexingIndexing, Bulk Indexing and anything related to indexingSearchSearch query, autocomplete ...etcbugSomething isn't working

    Type

    No type

    Projects

    Status

    🆕 New

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions