You are viewing a plain text version of this content. The canonical link for it is here.
Posted to notifications@ignite.apache.org by "sk0x50 (via GitHub)" <gi...@apache.org> on 2024/06/03 11:06:27 UTC

[PR] IGNITE-20450 [ignite-3]

sk0x50 opened a new pull request, #3862:
URL: https://github.com/apache/ignite-3/pull/3862

   https://issues.apache.org/jira/browse/IGNITE-20450
   
   Thank you for submitting the pull request.
   
   To streamline the review process of the patch and ensure better code quality
   we ask both an author and a reviewer to verify the following:
   
   ### The Review Checklist
   - [ ] **Formal criteria:** TC status, codestyle, mandatory documentation. Also make sure to complete the following:  
   \- There is a single JIRA ticket related to the pull request.  
   \- The web-link to the pull request is attached to the JIRA ticket.  
   \- The JIRA ticket has the Patch Available state.  
   \- The description of the JIRA ticket explains WHAT was made, WHY and HOW.  
   \- The pull request title is treated as the final commit message. The following pattern must be used: IGNITE-XXXX Change summary where XXXX - number of JIRA issue.
   - [ ] **Design:** new code conforms with the design principles of the components it is added to.
   - [ ] **Patch quality:** patch cannot be split into smaller pieces, its size must be reasonable.
   - [ ] **Code quality:** code is clean and readable, necessary developer documentation is added if needed.
   - [ ] **Tests code quality:** test set covers positive/negative scenarios, happy/edge cases. Tests are effective in terms of execution time and resources.
   
   ### Notes
   - [Apache Ignite Coding Guidelines](https://cwiki.apache.org/confluence/display/IGNITE/Java+Code+Style+Guide)


-- 
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.

To unsubscribe, e-mail: notifications-unsubscribe@ignite.apache.org

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


Re: [PR] IGNITE-20450 Add failure processor and failure handlers configuration. [ignite-3]

Posted by "sk0x50 (via GitHub)" <gi...@apache.org>.
sk0x50 commented on code in PR #3862:
URL: https://github.com/apache/ignite-3/pull/3862#discussion_r1625953218


##########
modules/failure-handler/src/main/java/org/apache/ignite/internal/failure/configuration/FailureProcessorConfigurationSchema.java:
##########
@@ -0,0 +1,32 @@
+/*
+ * 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.internal.failure.configuration;
+
+import org.apache.ignite.configuration.annotation.ConfigValue;
+import org.apache.ignite.configuration.annotation.ConfigurationRoot;
+import org.apache.ignite.configuration.annotation.ConfigurationType;
+import org.apache.ignite.internal.failure.handlers.configuration.FailureHandlerConfigurationSchema;
+
+/**
+ * Failure processor configuration schema.
+ */
+@ConfigurationRoot(rootName = "failureProcessor", type = ConfigurationType.LOCAL)

Review Comment:
   RU is not the case. I meant nodes for different purposes in the same cluster (compute nodes, data nodes, service nodes etc). 



-- 
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.

To unsubscribe, e-mail: notifications-unsubscribe@ignite.apache.org

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


Re: [PR] IGNITE-20450 Add failure processor and failure handlers configuration. [ignite-3]

Posted by "sanpwc (via GitHub)" <gi...@apache.org>.
sanpwc commented on code in PR #3862:
URL: https://github.com/apache/ignite-3/pull/3862#discussion_r1625824154


##########
modules/failure-handler/src/main/java/org/apache/ignite/internal/failure/configuration/FailureProcessorConfigurationSchema.java:
##########
@@ -0,0 +1,32 @@
+/*
+ * 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.internal.failure.configuration;
+
+import org.apache.ignite.configuration.annotation.ConfigValue;
+import org.apache.ignite.configuration.annotation.ConfigurationRoot;
+import org.apache.ignite.configuration.annotation.ConfigurationType;
+import org.apache.ignite.internal.failure.handlers.configuration.FailureHandlerConfigurationSchema;
+
+/**
+ * Failure processor configuration schema.
+ */
+@ConfigurationRoot(rootName = "failureProcessor", type = ConfigurationType.LOCAL)

Review Comment:
   > Another case is a heterogeneous cluster, in that case, you might want to treat criticalWorkerBlocked as a critical failure and stop the node (honestly, I don't think anyone would do it).
   
   I didn't get the point. Do you mean that you won't to threat failure conditions differently on different nodes while rolling upgrade?



-- 
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.

To unsubscribe, e-mail: notifications-unsubscribe@ignite.apache.org

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


Re: [PR] IGNITE-20450 Add failure processor and failure handlers configuration. [ignite-3]

Posted by "sk0x50 (via GitHub)" <gi...@apache.org>.
sk0x50 commented on code in PR #3862:
URL: https://github.com/apache/ignite-3/pull/3862#discussion_r1629324452


##########
modules/failure-handler/src/main/java/org/apache/ignite/internal/failure/handlers/configuration/NoOpFailureHandlerConfigurationSchema.java:
##########
@@ -0,0 +1,29 @@
+/*
+ * 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.internal.failure.handlers.configuration;
+
+import org.apache.ignite.configuration.annotation.PolymorphicConfigInstance;
+
+/**
+ * Configuration schema for {@link org.apache.ignite.internal.failure.handlers.NoOpFailureHandler}.
+ */
+@PolymorphicConfigInstance(NoOpFailureHandlerConfigurationSchema.TYPE)
+public class NoOpFailureHandlerConfigurationSchema extends FailureHandlerConfigurationSchema {
+    /** Failure handler type name. */
+    public static final String TYPE = "noOp";

Review Comment:
   changed to `noop`



-- 
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.

To unsubscribe, e-mail: notifications-unsubscribe@ignite.apache.org

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


Re: [PR] IGNITE-20450 Add failure processor and failure handlers configuration. [ignite-3]

Posted by "sk0x50 (via GitHub)" <gi...@apache.org>.
sk0x50 commented on code in PR #3862:
URL: https://github.com/apache/ignite-3/pull/3862#discussion_r1625953218


##########
modules/failure-handler/src/main/java/org/apache/ignite/internal/failure/configuration/FailureProcessorConfigurationSchema.java:
##########
@@ -0,0 +1,32 @@
+/*
+ * 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.internal.failure.configuration;
+
+import org.apache.ignite.configuration.annotation.ConfigValue;
+import org.apache.ignite.configuration.annotation.ConfigurationRoot;
+import org.apache.ignite.configuration.annotation.ConfigurationType;
+import org.apache.ignite.internal.failure.handlers.configuration.FailureHandlerConfigurationSchema;
+
+/**
+ * Failure processor configuration schema.
+ */
+@ConfigurationRoot(rootName = "failureProcessor", type = ConfigurationType.LOCAL)

Review Comment:
   RU is not the case. I meant nodes for different purposes in the same cluster (compute nodes, data nodes, service nodes etc). Anyway, as I said before, I see only one option in real-life/prod scenarios - using `StopOrHalt` across the cluster.



-- 
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.

To unsubscribe, e-mail: notifications-unsubscribe@ignite.apache.org

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


Re: [PR] IGNITE-20450 Add failure processor and failure handlers configuration. [ignite-3]

Posted by "sk0x50 (via GitHub)" <gi...@apache.org>.
sk0x50 merged PR #3862:
URL: https://github.com/apache/ignite-3/pull/3862


-- 
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.

To unsubscribe, e-mail: notifications-unsubscribe@ignite.apache.org

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


Re: [PR] IGNITE-20450 Add failure processor and failure handlers configuration. [ignite-3]

Posted by "sanpwc (via GitHub)" <gi...@apache.org>.
sanpwc commented on code in PR #3862:
URL: https://github.com/apache/ignite-3/pull/3862#discussion_r1625767828


##########
modules/failure-handler/src/main/java/org/apache/ignite/internal/failure/configuration/FailureProcessorConfigurationSchema.java:
##########
@@ -0,0 +1,32 @@
+/*
+ * 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.internal.failure.configuration;
+
+import org.apache.ignite.configuration.annotation.ConfigValue;
+import org.apache.ignite.configuration.annotation.ConfigurationRoot;
+import org.apache.ignite.configuration.annotation.ConfigurationType;
+import org.apache.ignite.internal.failure.handlers.configuration.FailureHandlerConfigurationSchema;
+
+/**
+ * Failure processor configuration schema.
+ */
+@ConfigurationRoot(rootName = "failureProcessor", type = ConfigurationType.LOCAL)

Review Comment:
   What's the point in having different failure detector configuration (logic) on different nodes? I don't have strong position here, just wondering why it's local, and thus different.



-- 
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.

To unsubscribe, e-mail: notifications-unsubscribe@ignite.apache.org

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


Re: [PR] IGNITE-20450 Add failure processor and failure handlers configuration. [ignite-3]

Posted by "ibessonov (via GitHub)" <gi...@apache.org>.
ibessonov commented on code in PR #3862:
URL: https://github.com/apache/ignite-3/pull/3862#discussion_r1627850959


##########
modules/failure-handler/src/main/java/org/apache/ignite/internal/failure/FailureProcessor.java:
##########
@@ -146,19 +161,58 @@ private synchronized boolean process(FailureContext failureCtx, FailureHandler h
         return invalidated;
     }
 
-    /**
-     * Returns {@code true} if the given failure type is ignored by the given handler.
-     *
-     * @param failureCtx Failure context.
-     * @param handler Handler.
-     */
-    private static boolean failureTypeIgnored(FailureContext failureCtx, FailureHandler handler) {
-        return handler instanceof AbstractFailureHandler
-                && ((AbstractFailureHandler) handler).ignoredFailureTypes().contains(failureCtx.type());
+    private void initFailureHandler() {
+        if (configuration == null) {
+            assert this.handler != null : "Failure handler is not initialized.";
+
+            return;
+        }
+
+        AbstractFailureHandler hnd;
+
+        FailureHandlerConfiguration handlerConfiguration = configuration.failureHandler();
+
+        switch (handlerConfiguration.failureHandlerType().value()) {
+            case NoOpFailureHandlerConfigurationSchema.TYPE:
+                hnd = new NoOpFailureHandler();
+                break;
+            case StopNodeFailureHandlerConfigurationSchema.TYPE:
+                hnd = new StopNodeFailureHandler();
+                break;
+            case StopNodeOrHaltFailureHandlerConfigurationSchema.TYPE:
+                StopNodeOrHaltFailureHandlerConfiguration stopNodeOrHaltConfiguration =
+                        (StopNodeOrHaltFailureHandlerConfiguration) handlerConfiguration;
+
+                boolean tryToStop = stopNodeOrHaltConfiguration.tryStop().value();
+                long timeoutToStop = stopNodeOrHaltConfiguration.timeout().value();
+
+                hnd = new StopNodeOrHaltFailureHandler(tryToStop, timeoutToStop);

Review Comment:
   Why not just passing a configuration instance into a constructor?



##########
modules/failure-handler/src/main/java/org/apache/ignite/internal/failure/FailureProcessor.java:
##########
@@ -146,19 +161,58 @@ private synchronized boolean process(FailureContext failureCtx, FailureHandler h
         return invalidated;
     }
 
-    /**
-     * Returns {@code true} if the given failure type is ignored by the given handler.
-     *
-     * @param failureCtx Failure context.
-     * @param handler Handler.
-     */
-    private static boolean failureTypeIgnored(FailureContext failureCtx, FailureHandler handler) {
-        return handler instanceof AbstractFailureHandler
-                && ((AbstractFailureHandler) handler).ignoredFailureTypes().contains(failureCtx.type());
+    private void initFailureHandler() {
+        if (configuration == null) {
+            assert this.handler != null : "Failure handler is not initialized.";
+
+            return;
+        }
+
+        AbstractFailureHandler hnd;
+
+        FailureHandlerConfiguration handlerConfiguration = configuration.failureHandler();
+
+        switch (handlerConfiguration.failureHandlerType().value()) {
+            case NoOpFailureHandlerConfigurationSchema.TYPE:
+                hnd = new NoOpFailureHandler();
+                break;
+            case StopNodeFailureHandlerConfigurationSchema.TYPE:
+                hnd = new StopNodeFailureHandler();
+                break;
+            case StopNodeOrHaltFailureHandlerConfigurationSchema.TYPE:
+                StopNodeOrHaltFailureHandlerConfiguration stopNodeOrHaltConfiguration =
+                        (StopNodeOrHaltFailureHandlerConfiguration) handlerConfiguration;
+
+                boolean tryToStop = stopNodeOrHaltConfiguration.tryStop().value();

Review Comment:
   Calling `stopNodeOrHaltConfiguration.value()` once and then accessing individual properties is a preferable way of doing it. Or even better - you could call `configuration.value()` in the beginning.



##########
modules/failure-handler/src/main/java/org/apache/ignite/internal/failure/handlers/configuration/NoOpFailureHandlerConfigurationSchema.java:
##########
@@ -0,0 +1,29 @@
+/*
+ * 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.internal.failure.handlers.configuration;
+
+import org.apache.ignite.configuration.annotation.PolymorphicConfigInstance;
+
+/**
+ * Configuration schema for {@link org.apache.ignite.internal.failure.handlers.NoOpFailureHandler}.
+ */
+@PolymorphicConfigInstance(NoOpFailureHandlerConfigurationSchema.TYPE)
+public class NoOpFailureHandlerConfigurationSchema extends FailureHandlerConfigurationSchema {
+    /** Failure handler type name. */
+    public static final String TYPE = "noOp";

Review Comment:
   Should it be a "noop" instead? Why did you capitalize the O? It's a commonly known word



-- 
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.

To unsubscribe, e-mail: notifications-unsubscribe@ignite.apache.org

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


Re: [PR] IGNITE-20450 Add failure processor and failure handlers configuration. [ignite-3]

Posted by "sk0x50 (via GitHub)" <gi...@apache.org>.
sk0x50 commented on code in PR #3862:
URL: https://github.com/apache/ignite-3/pull/3862#discussion_r1625804214


##########
modules/failure-handler/src/main/java/org/apache/ignite/internal/failure/configuration/FailureProcessorConfigurationSchema.java:
##########
@@ -0,0 +1,32 @@
+/*
+ * 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.internal.failure.configuration;
+
+import org.apache.ignite.configuration.annotation.ConfigValue;
+import org.apache.ignite.configuration.annotation.ConfigurationRoot;
+import org.apache.ignite.configuration.annotation.ConfigurationType;
+import org.apache.ignite.internal.failure.handlers.configuration.FailureHandlerConfigurationSchema;
+
+/**
+ * Failure processor configuration schema.
+ */
+@ConfigurationRoot(rootName = "failureProcessor", type = ConfigurationType.LOCAL)

Review Comment:
   > What's the point in having different failure detector configuration (logic) on different nodes?
   
   This is not a detector, it represents an action that should be done to handle a critical failure. Regarding your question, in the case of the homogeneous cluster in production, I don't see any reason to use a failure handler except `StopOrHalt` (I mean using the same configuration across the whole cluster). Another case is a heterogeneous cluster, in that case, you might want to treat `criticalWorkerBlocked` as a critical failure and stop the node (honestly, I don't think anyone would do it).
   
   All in all, the configuration is local for the following reasons:
    - it describes an individual node behavior
    - it might be useful for testing purposes
   
   Perhaps, I'm missing something because I'm not deeply involved in AI3 development.
   
   



-- 
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.

To unsubscribe, e-mail: notifications-unsubscribe@ignite.apache.org

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


Re: [PR] IGNITE-20450 Add failure processor and failure handlers configuration. [ignite-3]

Posted by "sk0x50 (via GitHub)" <gi...@apache.org>.
sk0x50 commented on code in PR #3862:
URL: https://github.com/apache/ignite-3/pull/3862#discussion_r1629320158


##########
modules/failure-handler/src/main/java/org/apache/ignite/internal/failure/FailureProcessor.java:
##########
@@ -146,19 +161,58 @@ private synchronized boolean process(FailureContext failureCtx, FailureHandler h
         return invalidated;
     }
 
-    /**
-     * Returns {@code true} if the given failure type is ignored by the given handler.
-     *
-     * @param failureCtx Failure context.
-     * @param handler Handler.
-     */
-    private static boolean failureTypeIgnored(FailureContext failureCtx, FailureHandler handler) {
-        return handler instanceof AbstractFailureHandler
-                && ((AbstractFailureHandler) handler).ignoredFailureTypes().contains(failureCtx.type());
+    private void initFailureHandler() {
+        if (configuration == null) {
+            assert this.handler != null : "Failure handler is not initialized.";
+
+            return;
+        }
+
+        AbstractFailureHandler hnd;
+
+        FailureHandlerConfiguration handlerConfiguration = configuration.failureHandler();
+
+        switch (handlerConfiguration.failureHandlerType().value()) {
+            case NoOpFailureHandlerConfigurationSchema.TYPE:
+                hnd = new NoOpFailureHandler();
+                break;
+            case StopNodeFailureHandlerConfigurationSchema.TYPE:
+                hnd = new StopNodeFailureHandler();
+                break;
+            case StopNodeOrHaltFailureHandlerConfigurationSchema.TYPE:
+                StopNodeOrHaltFailureHandlerConfiguration stopNodeOrHaltConfiguration =
+                        (StopNodeOrHaltFailureHandlerConfiguration) handlerConfiguration;
+
+                boolean tryToStop = stopNodeOrHaltConfiguration.tryStop().value();
+                long timeoutToStop = stopNodeOrHaltConfiguration.timeout().value();
+
+                hnd = new StopNodeOrHaltFailureHandler(tryToStop, timeoutToStop);

Review Comment:
   Yep, it makes sense to me. Will fix.



-- 
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.

To unsubscribe, e-mail: notifications-unsubscribe@ignite.apache.org

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


Re: [PR] IGNITE-20450 Add failure processor and failure handlers configuration. [ignite-3]

Posted by "sanpwc (via GitHub)" <gi...@apache.org>.
sanpwc commented on code in PR #3862:
URL: https://github.com/apache/ignite-3/pull/3862#discussion_r1625684111


##########
modules/failure-handler/src/main/java/org/apache/ignite/internal/failure/configuration/FailureProcessorConfigurationSchema.java:
##########
@@ -0,0 +1,32 @@
+/*
+ * 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.internal.failure.configuration;
+
+import org.apache.ignite.configuration.annotation.ConfigValue;
+import org.apache.ignite.configuration.annotation.ConfigurationRoot;
+import org.apache.ignite.configuration.annotation.ConfigurationType;
+import org.apache.ignite.internal.failure.handlers.configuration.FailureHandlerConfigurationSchema;
+
+/**
+ * Failure processor configuration schema.
+ */
+@ConfigurationRoot(rootName = "failureProcessor", type = ConfigurationType.LOCAL)

Review Comment:
   Why it's local? We wont different values on different nodes?



-- 
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.

To unsubscribe, e-mail: notifications-unsubscribe@ignite.apache.org

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


Re: [PR] IGNITE-20450 Add failure processor and failure handlers configuration. [ignite-3]

Posted by "sk0x50 (via GitHub)" <gi...@apache.org>.
sk0x50 commented on code in PR #3862:
URL: https://github.com/apache/ignite-3/pull/3862#discussion_r1625746862


##########
modules/failure-handler/src/main/java/org/apache/ignite/internal/failure/configuration/FailureProcessorConfigurationSchema.java:
##########
@@ -0,0 +1,32 @@
+/*
+ * 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.internal.failure.configuration;
+
+import org.apache.ignite.configuration.annotation.ConfigValue;
+import org.apache.ignite.configuration.annotation.ConfigurationRoot;
+import org.apache.ignite.configuration.annotation.ConfigurationType;
+import org.apache.ignite.internal.failure.handlers.configuration.FailureHandlerConfigurationSchema;
+
+/**
+ * Failure processor configuration schema.
+ */
+@ConfigurationRoot(rootName = "failureProcessor", type = ConfigurationType.LOCAL)

Review Comment:
   IMHO, this policy is about local node behavior and does not relate to the whole cluster. This might be useful for testing purposes as well.
   The approach is the same as we use to configure critical workers https://github.com/apache/ignite-3/blob/main/modules/workers/src/main/java/org/apache/ignite/internal/worker/configuration/CriticalWorkersConfigurationModule.java#L34



-- 
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.

To unsubscribe, e-mail: notifications-unsubscribe@ignite.apache.org

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


Re: [PR] IGNITE-20450 Add failure processor and failure handlers configuration. [ignite-3]

Posted by "sk0x50 (via GitHub)" <gi...@apache.org>.
sk0x50 commented on code in PR #3862:
URL: https://github.com/apache/ignite-3/pull/3862#discussion_r1629320158


##########
modules/failure-handler/src/main/java/org/apache/ignite/internal/failure/FailureProcessor.java:
##########
@@ -146,19 +161,58 @@ private synchronized boolean process(FailureContext failureCtx, FailureHandler h
         return invalidated;
     }
 
-    /**
-     * Returns {@code true} if the given failure type is ignored by the given handler.
-     *
-     * @param failureCtx Failure context.
-     * @param handler Handler.
-     */
-    private static boolean failureTypeIgnored(FailureContext failureCtx, FailureHandler handler) {
-        return handler instanceof AbstractFailureHandler
-                && ((AbstractFailureHandler) handler).ignoredFailureTypes().contains(failureCtx.type());
+    private void initFailureHandler() {
+        if (configuration == null) {
+            assert this.handler != null : "Failure handler is not initialized.";
+
+            return;
+        }
+
+        AbstractFailureHandler hnd;
+
+        FailureHandlerConfiguration handlerConfiguration = configuration.failureHandler();
+
+        switch (handlerConfiguration.failureHandlerType().value()) {
+            case NoOpFailureHandlerConfigurationSchema.TYPE:
+                hnd = new NoOpFailureHandler();
+                break;
+            case StopNodeFailureHandlerConfigurationSchema.TYPE:
+                hnd = new StopNodeFailureHandler();
+                break;
+            case StopNodeOrHaltFailureHandlerConfigurationSchema.TYPE:
+                StopNodeOrHaltFailureHandlerConfiguration stopNodeOrHaltConfiguration =
+                        (StopNodeOrHaltFailureHandlerConfiguration) handlerConfiguration;
+
+                boolean tryToStop = stopNodeOrHaltConfiguration.tryStop().value();
+                long timeoutToStop = stopNodeOrHaltConfiguration.timeout().value();
+
+                hnd = new StopNodeOrHaltFailureHandler(tryToStop, timeoutToStop);

Review Comment:
   Yeo, it makes sense to me. Will fix.



-- 
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.

To unsubscribe, e-mail: notifications-unsubscribe@ignite.apache.org

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