public interface MaintenanceRegistry
MaintenanceRegistry
is a service local to each Ignite node
that allows to request performing maintenance actions on that particular node.
When a node gets into a situation when some specific actions are required it enters the special mode called maintenance mode. In maintenance mode it doesn't join to the rest of the cluster but still allows to connect to it with control.{sh|bat} script or via JXM interface and perform needed actions.
Implementing new task for maintenance mode requires several pieces of code.
MaintenanceTask
with registerMaintenanceTask(MaintenanceTask)
method.
Registration could happen automatically (e.g. if component detects some emergency situation
that requires user intervention)
or by user request (e.g. for a planned maintenance that requires
detaching node from the rest of the cluster).
MaintenanceTask
on startup checks if the task is registered (thus it should go to Maintenance Mode).
If task is found component provides to MaintenanceRegistry
its own implementation
of MaintenanceWorkflowCallback
interface
via method registerWorkflowCallback(String, MaintenanceWorkflowCallback)
.
MaintenanceWorkflowCallback
should provide MaintenanceRegistry
with
MaintenanceAction
s that are able to resolve maintenance task,
get information about it and so on.
Logic of these actions is completely up to the component providing it
and depends only on particular maintenance task.
MaintenanceRegistry
with call unregisterMaintenanceTask(String)
.
Modifier and Type | Method and Description |
---|---|
List<MaintenanceAction<?>> |
actionsForMaintenanceTask(String maintenanceTaskName)
All
MaintenanceAction s provided by a component for MaintenanceTask with a given name. |
@Nullable MaintenanceTask |
activeMaintenanceTask(String maintenanceTaskName)
Returns active
MaintenanceTask by its name. |
boolean |
isMaintenanceMode() |
void |
prepareAndExecuteMaintenance()
Examine all components if they need to execute maintenance actions.
|
@Nullable MaintenanceTask |
registerMaintenanceTask(MaintenanceTask task)
Method to register
MaintenanceTask locally on the node where method is called. |
void |
registerMaintenanceTask(MaintenanceTask task,
UnaryOperator<MaintenanceTask> remappingFunction)
Method to register
MaintenanceTask locally on the node where method is called. |
void |
registerWorkflowCallback(@NotNull String maintenanceTaskName,
@NotNull MaintenanceWorkflowCallback cb)
Registers
MaintenanceWorkflowCallback for a MaintenanceTask with a given name. |
default void |
registerWorkflowCallbackIfTaskExists(@NotNull String maintenanceTaskName,
@NotNull org.apache.ignite.internal.util.lang.IgniteThrowableFunction<MaintenanceTask,MaintenanceWorkflowCallback> workflowCalProvider)
Call the
registerWorkflowCallback(String, MaintenanceWorkflowCallback) if the active maintenance task
with given name exists. |
@Nullable MaintenanceTask |
requestedTask(String maintenanceTaskName) |
boolean |
unregisterMaintenanceTask(String maintenanceTaskName)
Deletes
MaintenanceTask of given ID from maintenance registry. |
boolean isMaintenanceMode()
True
if any maintenance task was found.@Nullable @Nullable MaintenanceTask registerMaintenanceTask(MaintenanceTask task) throws IgniteCheckedException
MaintenanceTask
locally on the node where method is called.
For now it is not allowed to register new Maintenance Tasks in Maintenance Mode so this method should be called only when node operates normally. This may change in the future so it will become possible to create other maintenance tasks on node that is already entered Maintenance Mode.
When task is registered node continues to operate normally and will enter Maintenance Mode only after restart.
task
- MaintenanceTask
object with maintenance information that needs
to be stored to maintenance registry.MaintenanceTask
with the same ID
or null if no tasks were registered for this ID.IgniteCheckedException
- If handling or storing maintenance task failed.void registerMaintenanceTask(MaintenanceTask task, UnaryOperator<MaintenanceTask> remappingFunction) throws IgniteCheckedException
MaintenanceTask
locally on the node where method is called. If an old task
with the same name exists, applies remapping function to compute a new task.
Has the same restrictions as the registerMaintenanceTask(MaintenanceTask)
.task
- MaintenanceTask
object with maintenance information that needs
to be stored to maintenance registry.remappingFunction
- Function to compute a task if an old MaintenanceTask
with the same name exists.IgniteCheckedException
- If handling or storing maintenance task failed.boolean unregisterMaintenanceTask(String maintenanceTaskName)
MaintenanceTask
of given ID from maintenance registry.maintenanceTaskName
- name of MaintenanceTask
to be deleted.true
if existing task has been deleted.@Nullable @Nullable MaintenanceTask activeMaintenanceTask(String maintenanceTaskName)
MaintenanceTask
by its name.
There are active tasks only when node entered Maintenance Mode.
MaintenanceTask
becomes active when node enters Maintenance Mode and doesn't resolve the task
during maintenance prepare phase.maintenanceTaskName
- Maintenance Task name.MaintenanceTask
object for given name or null if no maintenance task was found.void registerWorkflowCallback(@NotNull @NotNull String maintenanceTaskName, @NotNull @NotNull MaintenanceWorkflowCallback cb)
MaintenanceWorkflowCallback
for a MaintenanceTask
with a given name.
Component registered MaintenanceTask
automatically or by user request
is responsible for providing MaintenanceRegistry
with an implementation of
MaintenanceWorkflowCallback
where registry obtains MaintenanceAction
s
to be executed for this task and does a preliminary check before starting maintenance.maintenanceTaskName
- name of MaintenanceTask
this callback is registered for.cb
- MaintenanceWorkflowCallback
interface used by MaintenanceRegistry to execute
maintenance steps by workflow.List<MaintenanceAction<?>> actionsForMaintenanceTask(String maintenanceTaskName)
MaintenanceAction
s provided by a component for MaintenanceTask
with a given name.maintenanceTaskName
- name of Maintenance Task.List
of all available MaintenanceAction
s for given Maintenance Task.IgniteException
- if no Maintenance Tasks are registered for provided name.void prepareAndExecuteMaintenance()
Maintenance tasks
for these components are removed
and their maintenance actions
are not executed.default void registerWorkflowCallbackIfTaskExists(@NotNull @NotNull String maintenanceTaskName, @NotNull @NotNull org.apache.ignite.internal.util.lang.IgniteThrowableFunction<MaintenanceTask,MaintenanceWorkflowCallback> workflowCalProvider) throws IgniteCheckedException
registerWorkflowCallback(String, MaintenanceWorkflowCallback)
if the active maintenance task
with given name exists.maintenanceTaskName
- name of MaintenanceTask
this callback is registered for.workflowCalProvider
- provider of MaintenanceWorkflowCallback
which construct the callback by given
task.IgniteCheckedException
@Nullable @Nullable MaintenanceTask requestedTask(String maintenanceTaskName)
maintenanceTaskName
- Task's name.null
.
GridGain In-Memory Computing Platform : ver. 8.9.15 Release Date : December 3 2024