You are viewing a plain text version of this content. The canonical link for it is here.
Posted to notifications@ignite.apache.org by GitBox <gi...@apache.org> on 2020/10/09 12:41:56 UTC

[GitHub] [ignite] sergey-chugunov-1985 commented on a change in pull request #8325: IGNITE-13366 Maintenance Mode for corrupted PDS case

sergey-chugunov-1985 commented on a change in pull request #8325:
URL: https://github.com/apache/ignite/pull/8325#discussion_r502399395



##########
File path: modules/core/src/main/java/org/apache/ignite/maintenance/MaintenanceRegistry.java
##########
@@ -0,0 +1,132 @@
+/*
+ * Licensed to the Apache Software Foundation (ASF) under one or more
+ * contributor license agreements.  See the NOTICE file distributed with
+ * this work for additional information regarding copyright ownership.
+ * The ASF licenses this file to You under the Apache License, Version 2.0
+ * (the "License"); you may not use this file except in compliance with
+ * the License.  You may obtain a copy of the License at
+ *
+ *      http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing, software
+ * distributed under the License is distributed on an "AS IS" BASIS,
+ * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+ * See the License for the specific language governing permissions and
+ * limitations under the License.
+ */
+
+package org.apache.ignite.maintenance;
+
+import java.util.List;
+import java.util.UUID;
+
+import org.apache.ignite.IgniteCheckedException;
+import org.apache.ignite.lang.IgniteExperimental;
+import org.jetbrains.annotations.NotNull;
+import org.jetbrains.annotations.Nullable;
+
+/**
+ * {@link MaintenanceRegistry} is a service local to each Ignite node
+ * that allows to request performing maintenance actions on that particular node.
+ *
+ * <p>
+ *     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.
+ * </p>
+ *
+ * <p>
+ *     Implementing new task for maintenance mode requires several pieces of code.
+ *
+ *     <ul>
+ *         <li>
+ *             First, component requiring Maintenance Mode should be able to register new {@link MaintenanceTask}
+ *             with {@link MaintenanceRegistry#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).
+ *         </li>
+ *         <li>
+ *             Component responsible for handling this {@link MaintenanceTask}
+ *             on startup checks if the task is registered (thus it should go to Maintenance Mode).
+ *             If task is found component provides to {@link MaintenanceRegistry} its own implementation
+ *             of {@link MaintenanceWorkflowCallback} interface
+ *             via method {@link MaintenanceRegistry#registerWorkflowCallback(UUID, MaintenanceWorkflowCallback)}.
+ *         </li>
+ *         <li>
+ *             {@link MaintenanceWorkflowCallback} should provide {@link MaintenanceRegistry} with
+ *             {@link 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.
+ *         </li>
+ *         <li>
+ *             When maintenance task is fixed, it should be removed from {@link MaintenanceRegistry}
+ *             with call {@link MaintenanceRegistry#unregisterMaintenanceTask(UUID)}.
+ *         </li>
+ *     </ul>
+ * </p>
+ */
+@IgniteExperimental
+public interface MaintenanceRegistry {
+    /**
+     * @return {@code True} if any maintenance task was found.
+     */
+    public boolean isMaintenanceMode();
+
+    /**
+     * @param task {@link MaintenanceTask} object with maintenance information that needs
+     *                                     to be stored to maintenance registry.
+     *
+     * @throws IgniteCheckedException If handling or storing maintenance task failed.
+     *
+     * @return Previously registered {@link MaintenanceTask} with the same ID
+     * or null if no tasks were registered for this ID.
+     */
+    public @Nullable MaintenanceTask registerMaintenanceTask(MaintenanceTask task) throws IgniteCheckedException;
+
+    /**
+     * Deletes {@link MaintenanceTask} of given ID from maintenance registry.
+     *
+     * @param mntcId
+     */
+    public void unregisterMaintenanceTask(UUID mntcId);

Review comment:
       fixed




----------------------------------------------------------------
This is an automated message from the Apache Git Service.
To respond to the message, please log on to GitHub and use the
URL above to go to the specific comment.

For queries about this service, please contact Infrastructure at:
users@infra.apache.org