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/11/03 13:54:39 UTC

[GitHub] [ignite] akorensh opened a new pull request #8417: IGNITE-13655 Implement readiness probe REST endpoint

akorensh opened a new pull request #8417:
URL: https://github.com/apache/ignite/pull/8417


   Thank you for submitting the pull request to the Apache Ignite.
   
   In order to streamline the review of the contribution 
   we ask you to ensure the following steps have been taken:
   
   ### The Contribution Checklist
   - [ ] 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 pull request body describes changes that have been made. 
   The description explains _WHAT_ and _WHY_ was made instead of _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.
   - [ ] A reviewer has been mentioned through the JIRA comments 
   (see [the Maintainers list](https://cwiki.apache.org/confluence/display/IGNITE/How+to+Contribute#HowtoContribute-ReviewProcessandMaintainers)) 
   - [ ] The pull request has been checked by the Teamcity Bot and 
   the `green visa` attached to the JIRA ticket (see [TC.Bot: Check PR](https://mtcga.gridgain.com/prs.html))
   
   ### Notes
   - [How to Contribute](https://cwiki.apache.org/confluence/display/IGNITE/How+to+Contribute)
   - [Coding abbreviation rules](https://cwiki.apache.org/confluence/display/IGNITE/Abbreviation+Rules)
   - [Coding Guidelines](https://cwiki.apache.org/confluence/display/IGNITE/Coding+Guidelines)
   - [Apache Ignite Teamcity Bot](https://cwiki.apache.org/confluence/display/IGNITE/Apache+Ignite+Teamcity+Bot)
   
   If you need any help, please email dev@ignite.apache.org or ask anу advice on http://asf.slack.com _#ignite_ channel.
   


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



[GitHub] [ignite] akorensh commented on a change in pull request #8417: IGNITE-13655 Implement readiness probe REST endpoint

Posted by GitBox <gi...@apache.org>.
akorensh commented on a change in pull request #8417:
URL: https://github.com/apache/ignite/pull/8417#discussion_r518847229



##########
File path: modules/rest-http/src/test/java/org/apache/ignite/internal/processors/rest/protocols/http/jetty/GridRestSuite.java
##########
@@ -24,7 +24,8 @@
  */
 @RunWith(Suite.class)
 @Suite.SuiteClasses({
-    RestSetupSimpleTest.class
+    RestSetupSimpleTest.class,

Review comment:
       This is where REST is started. Other REST tests don't actually start http-rest module.




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



[GitHub] [ignite] alamar commented on a change in pull request #8417: IGNITE-13655 Implement readiness probe REST endpoint

Posted by GitBox <gi...@apache.org>.
alamar commented on a change in pull request #8417:
URL: https://github.com/apache/ignite/pull/8417#discussion_r518845321



##########
File path: modules/core/src/main/java/org/apache/ignite/internal/IgnitionEx.java
##########
@@ -3209,6 +3214,13 @@ public void setCounter(int cnt) {
                 this.cnt = cnt;
             }
         }
+
+        /**
+         *
+         * @return whether the startLatch has been counted down, thereby indicating that the kernal has full started.
+         */
+        public boolean hasStartLatchCompleted() { return startLatch.getCount() == 0; }

Review comment:
       Every please unroll method body to 3 lines. You can import code conventions in your IDEA from https://cwiki.apache.org/confluence/display/IGNITE/Coding+Guidelines
   
   Can you also discuss this approach on the developers list? I'm not sure we should use this latch for checking.

##########
File path: modules/core/src/main/java/org/apache/ignite/internal/IgnitionEx.java
##########
@@ -1476,6 +1476,11 @@ public static DependencyResolver dependencyResolver() {
         return dependencyResolver.get();
     }
 
+    public static boolean hasKernalStarted(String name) {
+        IgniteNamedInstance grid = name != null ? grids.get(name) : dfltGrid;
+        return grid != null && grid.hasStartLatchCompleted();

Review comment:
       newline is needed before this line




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



[GitHub] [ignite] akorensh commented on a change in pull request #8417: IGNITE-13655 Implement readiness probe REST endpoint

Posted by GitBox <gi...@apache.org>.
akorensh commented on a change in pull request #8417:
URL: https://github.com/apache/ignite/pull/8417#discussion_r520127297



##########
File path: modules/core/src/main/java/org/apache/ignite/internal/IgnitionEx.java
##########
@@ -1476,6 +1476,11 @@ public static DependencyResolver dependencyResolver() {
         return dependencyResolver.get();
     }
 
+    public static boolean hasKernalStarted(String name) {

Review comment:
       done

##########
File path: modules/core/src/main/java/org/apache/ignite/internal/IgnitionEx.java
##########
@@ -3209,6 +3214,13 @@ public void setCounter(int cnt) {
                 this.cnt = cnt;
             }
         }
+
+        /**
+         *
+         * @return whether the startLatch has been counted down, thereby indicating that the kernal has full started.

Review comment:
       yes




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



[GitHub] [ignite] asfgit closed pull request #8417: IGNITE-13655 Implement readiness probe REST endpoint

Posted by GitBox <gi...@apache.org>.
asfgit closed pull request #8417:
URL: https://github.com/apache/ignite/pull/8417


   


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



[GitHub] [ignite] alamar commented on a change in pull request #8417: IGNITE-13655 Implement readiness probe REST endpoint

Posted by GitBox <gi...@apache.org>.
alamar commented on a change in pull request #8417:
URL: https://github.com/apache/ignite/pull/8417#discussion_r518842047



##########
File path: modules/core/src/main/java/org/apache/ignite/internal/IgnitionEx.java
##########
@@ -3209,6 +3214,13 @@ public void setCounter(int cnt) {
                 this.cnt = cnt;
             }
         }
+
+        /**
+         *
+         * @return whether the startLatch has been counted down, thereby indicating that the kernal has full started.

Review comment:
       Does it fit in 120 chars?

##########
File path: modules/core/src/main/java/org/apache/ignite/internal/IgnitionEx.java
##########
@@ -1476,6 +1476,11 @@ public static DependencyResolver dependencyResolver() {
         return dependencyResolver.get();
     }
 
+    public static boolean hasKernalStarted(String name) {

Review comment:
       Please add javadoc.

##########
File path: modules/rest-http/src/test/java/org/apache/ignite/internal/processors/rest/protocols/http/jetty/GridProbeCommandTest.java
##########
@@ -0,0 +1,226 @@
+/*
+ * 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.processors.rest.protocols.http.jetty;
+
+import java.io.IOException;
+import java.io.InputStreamReader;
+import java.net.HttpURLConnection;
+import java.net.URL;
+import java.util.Map;
+import java.util.concurrent.CountDownLatch;
+import com.fasterxml.jackson.core.type.TypeReference;
+import com.fasterxml.jackson.databind.ObjectMapper;
+import org.apache.ignite.configuration.ConnectorConfiguration;
+import org.apache.ignite.configuration.IgniteConfiguration;
+import org.apache.ignite.internal.IgniteInternalFuture;
+import org.apache.ignite.internal.processors.rest.GridRestCommand;
+import org.apache.ignite.internal.processors.rest.GridRestResponse;
+import org.apache.ignite.internal.processors.rest.handlers.GridRestCommandHandler;
+import org.apache.ignite.internal.processors.rest.handlers.probe.GridProbeCommandHandler;
+import org.apache.ignite.internal.processors.rest.request.GridRestCacheRequest;
+import org.apache.ignite.plugin.AbstractTestPluginProvider;
+import org.apache.ignite.plugin.PluginProvider;
+import org.apache.ignite.testframework.junits.common.GridCommonAbstractTest;
+import org.junit.Test;
+
+/**
+ * REST probe cmd test.
+ */
+public class GridProbeCommandTest extends GridCommonAbstractTest {
+

Review comment:
       newline not needed, but javadoc is needed (here and below)

##########
File path: modules/rest-http/pom.xml
##########
@@ -146,6 +146,13 @@
             <scope>test</scope>
         </dependency>
 
+        <dependency>

Review comment:
       Why is it needed now? Maybe move test to ignite-client module?

##########
File path: modules/rest-http/src/test/java/org/apache/ignite/internal/processors/rest/protocols/http/jetty/GridProbeCommandTest.java
##########
@@ -0,0 +1,226 @@
+/*
+ * 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.processors.rest.protocols.http.jetty;
+
+import java.io.IOException;
+import java.io.InputStreamReader;
+import java.net.HttpURLConnection;
+import java.net.URL;
+import java.util.Map;
+import java.util.concurrent.CountDownLatch;
+import com.fasterxml.jackson.core.type.TypeReference;
+import com.fasterxml.jackson.databind.ObjectMapper;
+import org.apache.ignite.configuration.ConnectorConfiguration;
+import org.apache.ignite.configuration.IgniteConfiguration;
+import org.apache.ignite.internal.IgniteInternalFuture;
+import org.apache.ignite.internal.processors.rest.GridRestCommand;
+import org.apache.ignite.internal.processors.rest.GridRestResponse;
+import org.apache.ignite.internal.processors.rest.handlers.GridRestCommandHandler;
+import org.apache.ignite.internal.processors.rest.handlers.probe.GridProbeCommandHandler;
+import org.apache.ignite.internal.processors.rest.request.GridRestCacheRequest;
+import org.apache.ignite.plugin.AbstractTestPluginProvider;
+import org.apache.ignite.plugin.PluginProvider;
+import org.apache.ignite.testframework.junits.common.GridCommonAbstractTest;
+import org.junit.Test;
+
+/**
+ * REST probe cmd test.
+ */
+public class GridProbeCommandTest extends GridCommonAbstractTest {
+
+    private static final int JETTY_PORT = 8080;
+
+    private CountDownLatch triggerRestCmdLatch = new CountDownLatch(1);
+
+    private CountDownLatch triggerPluginStartLatch = new CountDownLatch(1);
+
+    public static Map<String, Object> executeProbeRestRequest() throws IOException {
+

Review comment:
       no newline at start of method

##########
File path: modules/rest-http/src/test/java/org/apache/ignite/internal/processors/rest/protocols/http/jetty/GridRestSuite.java
##########
@@ -24,7 +24,8 @@
  */
 @RunWith(Suite.class)
 @Suite.SuiteClasses({
-    RestSetupSimpleTest.class
+    RestSetupSimpleTest.class,

Review comment:
       Do we run this suite anywhere? I guess we don't.
   
   Let's find where the rest of REST tests are (ignite-clients?), move it there.




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