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/12/08 09:31:08 UTC

[GitHub] [ignite] ibessonov opened a new pull request #8554: IGNITE-13101 Fixed uncompleted futures leak on node stop in distributed metastorage.

ibessonov opened a new pull request #8554:
URL: https://github.com/apache/ignite/pull/8554


   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] AMashenkov commented on a change in pull request #8554: IGNITE-13101 Fixed uncompleted futures leak on node stop in distributed metastorage.

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



##########
File path: modules/core/src/main/java/org/apache/ignite/internal/processors/metastorage/persistence/DistributedMetaStorageImpl.java
##########
@@ -1070,6 +1125,31 @@ else if (!isClient && ver.id() > 0) {
         return fut;
     }
 
+    /** */
+    private GridFutureAdapter<Boolean> validateBeforeWrite(String key) throws IgniteCheckedException {
+        boolean supported;
+
+        try {
+            supported = isSupported(ctx);

Review comment:
       Is it really necessary to validate all the nodes on every operation?
   Do we allow old nodes to connect to new grid? If no, then may be we can skip this check if once found all the nodes support the feature?




----------------------------------------------------------------
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] ibessonov commented on a change in pull request #8554: IGNITE-13101 Fixed uncompleted futures leak on node stop in distributed metastorage.

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



##########
File path: modules/core/src/main/java/org/apache/ignite/internal/processors/metastorage/persistence/DistributedMetaStorageImpl.java
##########
@@ -1033,14 +1058,29 @@ else if (!isClient && ver.id() > 0) {
      * @throws IgniteCheckedException If there was an error while sending discovery message.
      */
     private GridFutureAdapter<?> startWrite(String key, byte[] valBytes) throws IgniteCheckedException {
-       if (!isSupported(ctx))
-            throw new IgniteCheckedException(NOT_SUPPORTED_MSG);
+        GridFutureAdapter<?> validationRes = validateBeforeWrite(key);
+
+        if (validationRes != null)
+            return validationRes;
 
         UUID reqId = UUID.randomUUID();
 
         GridFutureAdapter<Boolean> fut = new GridFutureAdapter<>();
 
-        updateFuts.put(reqId, fut);
+        updateFutsStopLock.readLock().lock();
+
+        try {
+            if (stopped) {
+                fut.onDone(nodeStoppingException());
+

Review comment:
       Yes it does, thank you!




----------------------------------------------------------------
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] AMashenkov commented on a change in pull request #8554: IGNITE-13101 Fixed uncompleted futures leak on node stop in distributed metastorage.

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



##########
File path: modules/core/src/main/java/org/apache/ignite/internal/processors/metastorage/persistence/DistributedMetaStorageImpl.java
##########
@@ -1070,6 +1125,31 @@ else if (!isClient && ver.id() > 0) {
         return fut;
     }
 
+    /** */
+    private GridFutureAdapter<Boolean> validateBeforeWrite(String key) throws IgniteCheckedException {
+        boolean supported;
+
+        try {
+            supported = isSupported(ctx);

Review comment:
       Is it really necessary to validate all the nodes on every operation?
   Do we allow old nodes to connect to new grid? If no, then may be we can cache 'supported' flag and skip this check if once found all the nodes support the feature?




----------------------------------------------------------------
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] ibessonov commented on a change in pull request #8554: IGNITE-13101 Fixed uncompleted futures leak on node stop in distributed metastorage.

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



##########
File path: modules/core/src/main/java/org/apache/ignite/internal/processors/metastorage/persistence/DistributedMetaStorageImpl.java
##########
@@ -1070,6 +1125,31 @@ else if (!isClient && ver.id() > 0) {
         return fut;
     }
 
+    /** */
+    private GridFutureAdapter<Boolean> validateBeforeWrite(String key) throws IgniteCheckedException {
+        boolean supported;
+
+        try {
+            supported = isSupported(ctx);

Review comment:
       Every component does this, changing the approach is out of the scope. And yes, older node can enter the cluster sometimes.




----------------------------------------------------------------
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] ibessonov commented on a change in pull request #8554: IGNITE-13101 Fixed uncompleted futures leak on node stop in distributed metastorage.

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



##########
File path: modules/core/src/main/java/org/apache/ignite/internal/processors/metastorage/persistence/DistributedMetaStorageImpl.java
##########
@@ -1119,7 +1199,16 @@ private void onAckMessage(
         ClusterNode node,
         DistributedMetaStorageUpdateAckMessage msg
     ) {
-        GridFutureAdapter<Boolean> fut = updateFuts.remove(msg.requestId());
+        GridFutureAdapter<Boolean> fut;
+
+        updateFutsStopLock.readLock().lock();
+
+        try {
+            fut = updateFuts.remove(msg.requestId());
+        }
+        finally {
+            updateFutsStopLock.readLock().unlock();

Review comment:
       You're right, did that automatically.




----------------------------------------------------------------
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] AMashenkov commented on a change in pull request #8554: IGNITE-13101 Fixed uncompleted futures leak on node stop in distributed metastorage.

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



##########
File path: modules/core/src/main/java/org/apache/ignite/internal/processors/metastorage/persistence/DistributedMetaStorageImpl.java
##########
@@ -1033,14 +1058,29 @@ else if (!isClient && ver.id() > 0) {
      * @throws IgniteCheckedException If there was an error while sending discovery message.
      */
     private GridFutureAdapter<?> startWrite(String key, byte[] valBytes) throws IgniteCheckedException {
-       if (!isSupported(ctx))
-            throw new IgniteCheckedException(NOT_SUPPORTED_MSG);
+        GridFutureAdapter<?> validationRes = validateBeforeWrite(key);
+
+        if (validationRes != null)
+            return validationRes;
 
         UUID reqId = UUID.randomUUID();
 
         GridFutureAdapter<Boolean> fut = new GridFutureAdapter<>();
 
-        updateFuts.put(reqId, fut);
+        updateFutsStopLock.readLock().lock();
+
+        try {
+            if (stopped) {
+                fut.onDone(nodeStoppingException());
+

Review comment:
       Does it make sense to move this into 'validateBeforeWrite' ?
   'validateBeforeWrite' can be executed under read-lock as in normal case it always return null.




----------------------------------------------------------------
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 #8554: IGNITE-13101 Fixed uncompleted futures leak on node stop in distributed metastorage.

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


   


----------------------------------------------------------------
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] AMashenkov commented on a change in pull request #8554: IGNITE-13101 Fixed uncompleted futures leak on node stop in distributed metastorage.

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



##########
File path: modules/core/src/main/java/org/apache/ignite/internal/processors/metastorage/persistence/DistributedMetaStorageImpl.java
##########
@@ -1119,7 +1199,16 @@ private void onAckMessage(
         ClusterNode node,
         DistributedMetaStorageUpdateAckMessage msg
     ) {
-        GridFutureAdapter<Boolean> fut = updateFuts.remove(msg.requestId());
+        GridFutureAdapter<Boolean> fut;
+
+        updateFutsStopLock.readLock().lock();
+
+        try {
+            fut = updateFuts.remove(msg.requestId());
+        }
+        finally {
+            updateFutsStopLock.readLock().unlock();

Review comment:
       Readlock looks useless here.
   Anyway, you'll finish the future in few lines below.




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