Alexey Scherbakov created IGNITE-21538:
------------------------------------------
Summary: Remowk component lifycycle mode to asynchronous
Key: IGNITE-21538
URL: https://issues.apache.org/jira/browse/IGNITE-21538
Project: Ignite
Issue Type: Task
Affects Versions: 3.0.0-beta2
Reporter: Alexey Scherbakov
Fix For: 3.0
Current design for comp lifecycle has issues:
1. It was designed for synchronous components, but almost all components are
asynchronous.
This causes to appear ugly things like inBusyLockAsync and inefficient code like
public @Nullable TxStateMeta stateMeta(UUID txId) {
return inBusyLock(busyLock, () -> txStateVolatileStorage.state(txId));
}
2. Currently it's not possible to do truly graceful node shutdown, because IO
layer is disabled forcefully before components are stopped, causing operation
failures.
I suggest to rework comp lifecycle to async model:
1. Each component tracks it's inflight async ops (as list of async chains)
1. On start components are initialized using startAsync() method from root to
leafs of dependency tree
2. On shutdown
2.1 beforeShutdownAsync is called on comp from leafs to root direction in
dependency tree. This step waits for all active futures to complete. Any new
operation return a future with NodeStoppingException
2.2 stop is called on comp from leafs to root direction in dependency tree.
This step destroys component resources, like pools, etc.
--
This message was sent by Atlassian Jira
(v8.20.10#820010)