Skip to content

[Writable Warm] Need for Composite Directory Factory #17982

@rayshrey

Description

@rayshrey

Is your feature request related to a problem? Please describe

As a part of the Writable Warm feature, we introduced Composite Directory to abstract out the data locality (whether it was present locally or in remote) using FileCache.

While we initialize the local and the remote directories in IndexService.java using directory factories, we initialize the Composite Directory directly without any directory factory as follows:

directory = new CompositeDirectory(localDirectory, remoteDirectory, fileCache);

The above way restricts users to always use the same default implementation of Composite Directory provided unlike the local directory where users have the flexibility of having their custom implementations by extending IndexStorePlugin.DirectoryFactory in their own plugins.

Initialization of Composite directory should also follow the same pattern as other directories (i.e, using directory factory). But since Composite Directory requires some additional parameters we would require a new Directory Factory which takes in the additional required parameters (namely the Remote directory and File Cache). Also to give users an extra flexibility to have their own implementation of Composite Directory, we need to make the Composite Directory factory pluggable as well.

Describe the solution you'd like

We will need to create a new CompositeDirectoryFactory as mentioned above. Something similar to below.

interface CompositeDirectoryFactory {
        Directory newDirectory(IndexSettings indexSettings, ShardPath shardPath, DirectoryFactory localDirectoryFactory, Directory remoteDirectory, FileCache fileCache) throws IOException;
}

Also to make this pluggable we will need to add it to IndexStorePlugin and create a new method similar to getDirectoryFactories

default Map<String, CompositeDirectoryFactory> getCompositeDirectoryFactories() {
        return Collections.emptyMap();
}

We will need to create a DefaultCompositeDirectoryFactory which would use the existing CompositeDirectory implementation as the default choice for creating composite directories. In order to differentiate between which composite directory factory to choose, we will need to introduce a new index setting similar to index.store.type

"index" : {
    "composite_store": {
        "type": "default"
    }
}

Related component

Storage:Remote

Describe alternatives you've considered

N/A

Additional context

N/A

Metadata

Metadata

Assignees

No one assigned

    Labels

    Storage:RemoteenhancementEnhancement or improvement to existing feature or request

    Type

    No type

    Projects

    Status

    ✅ Done

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions