[ https://issues.apache.org/jira/browse/IGNITE-20477?page=com.atlassian.jira.plugin.system.issuetabpanels:all-tabpanel ]
Mirza Aliev updated IGNITE-20477: --------------------------------- Reviewer: Aleksandr Polovtcev > Async component start > --------------------- > > Key: IGNITE-20477 > URL: https://issues.apache.org/jira/browse/IGNITE-20477 > Project: Ignite > Issue Type: Task > Reporter: Aleksandr Polovtcev > Assignee: Mirza Aliev > Priority: Major > Labels: ignite-3 > Time Spent: 10m > Remaining Estimate: 0h > > Currently all Ignite components start synchronously (see > {{IgniteComponent#start}}). This is inconvenient, because some components can > complete their startup only when Meta Storage has initialized all Version > Values (see {{IgniteImpl#recoverComponentsStateOnStart}}). Because of this, > some components employ a hack which consists of having a "special" Versioned > Value, which is injected with a future that gets resolved only after the > enclosing component completes its startup (see {{startVv}} in > {{TableManager}} or {{IndexManager}}). This blocks the Watch Processor inside > Meta Storage, preventing it from processing further updates. > This problem with this approach that it is quite cryptic and hard to > understand. Instead I propose to do the following: > # Change the signature of {{IgniteComponent#start}} to > {{CompletableFuture<Void> start()}}. > # All actions in the components startup will be divided into two categories: > sync actions, that can be executed synchronously in order for the component > to be usable by other components during their startup, and async actions, > which need to wait for any of the Versioned Values to be initialized by the > Meta Storage. Such async actions should be wrapped in a {{CompletableFuture}} > and returned from the {{start}} method. > # {{IgniteImpl}} startup procedure should be updated to collect the futures > from all components and wait for their completion inside > {{recoverComponentsStateOnStart}}, after > {{metaStorageMgr.notifyRevisionUpdateListenerOnStart()}} has been called, but > before Watches are deployed ({{metaStorageMgr.deployWatches()}}) -- This message was sent by Atlassian Jira (v8.20.10#820010)