Hello, dear Igniters!

I'd like to propose a refactoring of the current Shutdown Policy mechanism.
Currently, node shutdown is controlled by a bunch of flags and enums (I may
be missing some of them):

1. ShutdownPolicy enum has only two entries and is basically a flag that
dictates if we need to wait for the data to be backed up, so that we will
not lose any data when the node goes offline.
2. "cancel" flag is passed to the stop method and indicates that all long
running jobs should be interrupted. For example, it prevents the node
performing a checkpoint on shutdown. I'm pretty sure this flag is nearly
always set to "true", because it is used by the Shutdown Hook.
3. There are also a bunch of system properties that affect the shutdown:
    * IGNITE_PDS_SKIP_CHECKPOINT_ON_NODE_STOP - disables checkpoints on
node stop, which heavily correlates with the "cancel" flag.
    * IGNITE_WAIT_FOR_BACKUPS_ON_SHUTDOWN - deprecated and duplicates the
ShutdownPolicy enum
    * IGNITE_NO_SHUTDOWN_HOOK - disables the shutdown hook. I don't know if
it is really useful.

I think that this approach is counter intuitive and would like to
incorporate all aforementioned flags into the ShutdownPolicy enum. For
example, it can look as follows:

public enum ShutdownPolicy {
    IMMEDIATE // Stops the node and cancels all running jobs
    GRACEFUL // Stops the node, does not cancel running jobs and waits for
backups
    GRACEFUL_NO_BACKUPS // Stops the node, does not cancel running jobs,
does not wait for backups
}

After that, the "cancel" flag and all corresponding properties can be
removed (apart from the IGNITE_NO_SHUTDOWN_HOOK, if it is still needed).

Does this make sense? What do you think?

-- 
With regards,
Aleksandr Polovtsev

Reply via email to