You are viewing a plain text version of this content. The canonical link for it is here.
Posted to dev@storm.apache.org by GitBox <gi...@apache.org> on 2021/01/05 17:44:09 UTC

[GitHub] [storm] agresch opened a new pull request #3370: STORM-3733 fix AsyncLocalizer from updating dead topology blobs

agresch opened a new pull request #3370:
URL: https://github.com/apache/storm/pull/3370


   ## What is the purpose of the change
   
   When a local assignment changes for a slot, the blob references are not updated. This causes a mismatch between the slot PNA and the blob reference PNA. When the topology is killed, the blob tries to remove the slot PNA and cannot find the reference. The AsyncLocalizer still has the old slot PNA as a reference, so cannot release the blob.
   
   The local assignment could change due to a reordering of the same executors on a nimbus restart or something similar.
   
   The fix is basically removeReference() changes in LocallyCachedBlob.  We make sure that we are checking for an equivalent PNA object instead of equals.  Additional logging was also added to track down this issue.  I think it's not excessive and considering how long this problem has existed, important to have.
   
   ## How was the change tested
   
   Ran storm-server unit tests.  This change has been tested internally by running integration tests and on our staging clusters for a couple weeks and validated that we no longer get AsyncLocalizer alerts for this condition. 
   


----------------------------------------------------------------
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] [storm] bipinprasad commented on a change in pull request #3370: STORM-3733 fix AsyncLocalizer from updating dead topology blobs

Posted by GitBox <gi...@apache.org>.
bipinprasad commented on a change in pull request #3370:
URL: https://github.com/apache/storm/pull/3370#discussion_r552152419



##########
File path: storm-server/src/main/java/org/apache/storm/utils/EquivalenceUtils.java
##########
@@ -0,0 +1,134 @@
+/*
+ * 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.storm.utils;
+
+import com.google.common.annotations.VisibleForTesting;
+import java.util.HashMap;
+import java.util.HashSet;
+import java.util.Map;
+import java.util.Set;
+import org.apache.storm.generated.ExecutorInfo;
+import org.apache.storm.generated.LocalAssignment;
+import org.apache.storm.generated.WorkerResources;
+
+public class EquivalenceUtils {
+
+    /**
+     * Decide the equivalence of two local assignments, ignoring the order of executors This is different from #equal method.
+     *
+     * @param first  Local assignment A
+     * @param second Local assignment B
+     * @return True if A and B are equivalent, ignoring the order of the executors
+     */
+    public static boolean areLocalAssignmentsEquivalent(LocalAssignment first, LocalAssignment second) {
+        if (first == null && second == null) {
+            return true;
+        }
+        if (first != null && second != null) {
+            if (first.get_topology_id().equals(second.get_topology_id())) {
+                Set<ExecutorInfo> aexec = new HashSet<>(first.get_executors());
+                Set<ExecutorInfo> bexec = new HashSet<>(second.get_executors());
+                if (aexec.equals(bexec)) {
+                    boolean firstHasResources = first.is_set_resources();
+                    boolean secondHasResources = second.is_set_resources();
+                    if (!firstHasResources && !secondHasResources) {
+                        return true;
+                    }
+                    if (firstHasResources && secondHasResources) {
+                        WorkerResources firstResources = first.get_resources();
+                        WorkerResources secondResources = second.get_resources();
+                        return customWorkerResourcesEquality(firstResources, secondResources);
+                    }
+                }
+            }
+        }
+        return false;
+    }
+
+    /**
+     * This method compares WorkerResources while considering any resources are NULL to be 0.0
+     *
+     * @param first  WorkerResources A
+     * @param second WorkerResources B
+     * @return True if A and B are equivalent, treating the absent resources as 0.0
+     */
+    @VisibleForTesting
+    static boolean customWorkerResourcesEquality(WorkerResources first, WorkerResources second) {
+        if (first == null) {
+            return false;
+        }
+        if (first == second) {
+            return true;
+        }
+        if (first.equals(second)) {
+            return true;
+        }
+
+        if (first.get_cpu() != second.get_cpu()) {

Review comment:
       Can second be null when first is not null? If so, an NPE here.




----------------------------------------------------------------
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] [storm] agresch commented on a change in pull request #3370: STORM-3733 fix AsyncLocalizer from updating dead topology blobs

Posted by GitBox <gi...@apache.org>.
agresch commented on a change in pull request #3370:
URL: https://github.com/apache/storm/pull/3370#discussion_r552235748



##########
File path: storm-server/src/main/java/org/apache/storm/utils/EquivalenceUtils.java
##########
@@ -0,0 +1,134 @@
+/*
+ * 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.storm.utils;
+
+import com.google.common.annotations.VisibleForTesting;
+import java.util.HashMap;
+import java.util.HashSet;
+import java.util.Map;
+import java.util.Set;
+import org.apache.storm.generated.ExecutorInfo;
+import org.apache.storm.generated.LocalAssignment;
+import org.apache.storm.generated.WorkerResources;
+
+public class EquivalenceUtils {
+
+    /**
+     * Decide the equivalence of two local assignments, ignoring the order of executors This is different from #equal method.
+     *
+     * @param first  Local assignment A
+     * @param second Local assignment B
+     * @return True if A and B are equivalent, ignoring the order of the executors
+     */
+    public static boolean areLocalAssignmentsEquivalent(LocalAssignment first, LocalAssignment second) {
+        if (first == null && second == null) {
+            return true;
+        }
+        if (first != null && second != null) {
+            if (first.get_topology_id().equals(second.get_topology_id())) {
+                Set<ExecutorInfo> aexec = new HashSet<>(first.get_executors());
+                Set<ExecutorInfo> bexec = new HashSet<>(second.get_executors());
+                if (aexec.equals(bexec)) {
+                    boolean firstHasResources = first.is_set_resources();
+                    boolean secondHasResources = second.is_set_resources();
+                    if (!firstHasResources && !secondHasResources) {
+                        return true;
+                    }
+                    if (firstHasResources && secondHasResources) {
+                        WorkerResources firstResources = first.get_resources();
+                        WorkerResources secondResources = second.get_resources();
+                        return customWorkerResourcesEquality(firstResources, secondResources);
+                    }
+                }
+            }
+        }
+        return false;
+    }
+
+    /**
+     * This method compares WorkerResources while considering any resources are NULL to be 0.0
+     *
+     * @param first  WorkerResources A
+     * @param second WorkerResources B
+     * @return True if A and B are equivalent, treating the absent resources as 0.0
+     */
+    @VisibleForTesting
+    static boolean customWorkerResourcesEquality(WorkerResources first, WorkerResources second) {
+        if (first == null) {
+            return false;
+        }
+        if (first == second) {
+            return true;
+        }
+        if (first.equals(second)) {
+            return true;
+        }
+
+        if (first.get_cpu() != second.get_cpu()) {

Review comment:
       updated




----------------------------------------------------------------
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] [storm] agresch merged pull request #3370: STORM-3733 fix AsyncLocalizer from updating dead topology blobs

Posted by GitBox <gi...@apache.org>.
agresch merged pull request #3370:
URL: https://github.com/apache/storm/pull/3370


   


----------------------------------------------------------------
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] [storm] Ethanlm commented on a change in pull request #3370: STORM-3733 fix AsyncLocalizer from updating dead topology blobs

Posted by GitBox <gi...@apache.org>.
Ethanlm commented on a change in pull request #3370:
URL: https://github.com/apache/storm/pull/3370#discussion_r555381461



##########
File path: storm-server/src/main/java/org/apache/storm/utils/EquivalenceUtils.java
##########
@@ -0,0 +1,137 @@
+/*
+ * 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.storm.utils;
+
+import com.google.common.annotations.VisibleForTesting;
+import java.util.HashMap;
+import java.util.HashSet;
+import java.util.Map;
+import java.util.Set;
+import org.apache.storm.generated.ExecutorInfo;
+import org.apache.storm.generated.LocalAssignment;
+import org.apache.storm.generated.WorkerResources;
+
+public class EquivalenceUtils {
+
+    /**
+     * Decide the equivalence of two local assignments, ignoring the order of executors This is different from #equal method.
+     *
+     * @param first  Local assignment A
+     * @param second Local assignment B
+     * @return True if A and B are equivalent, ignoring the order of the executors
+     */
+    public static boolean areLocalAssignmentsEquivalent(LocalAssignment first, LocalAssignment second) {
+        if (first == null && second == null) {
+            return true;
+        }
+        if (first != null && second != null) {
+            if (first.get_topology_id().equals(second.get_topology_id())) {
+                Set<ExecutorInfo> aexec = new HashSet<>(first.get_executors());
+                Set<ExecutorInfo> bexec = new HashSet<>(second.get_executors());
+                if (aexec.equals(bexec)) {
+                    boolean firstHasResources = first.is_set_resources();
+                    boolean secondHasResources = second.is_set_resources();
+                    if (!firstHasResources && !secondHasResources) {
+                        return true;
+                    }
+                    if (firstHasResources && secondHasResources) {
+                        WorkerResources firstResources = first.get_resources();
+                        WorkerResources secondResources = second.get_resources();
+                        return customWorkerResourcesEquality(firstResources, secondResources);
+                    }
+                }
+            }
+        }
+        return false;
+    }
+
+    /**
+     * This method compares WorkerResources while considering any resources are NULL to be 0.0
+     *
+     * @param first  WorkerResources A
+     * @param second WorkerResources B
+     * @return True if A and B are equivalent, treating the absent resources as 0.0
+     */
+    @VisibleForTesting
+    static boolean customWorkerResourcesEquality(WorkerResources first, WorkerResources second) {
+        if (first == null) {

Review comment:
       It is a little wired that `customWorkerResourcesEquality(null, null)` would return `false`. But since this is not related to this PR as the code is moved from other places in storm, I am not worried about it in this PR




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