You are viewing a plain text version of this content. The canonical link for it is here.
Posted to notifications@ignite.apache.org by "rpuch (via GitHub)" <gi...@apache.org> on 2024/05/15 09:48:51 UTC

[PR] IGNITE-19234 Enable and fix group reentry logic for volatile storages [ignite-3]

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

   https://issues.apache.org/jira/browse/IGNITE-19234
   
   The reentry logic (see IGNITE-16668) was erroneously disabled. This commit enables it back and contains fixes required to make it work (due to changes made to the common rebalancing code since it was disabled).


-- 
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-19234 Enable and fix group reentry logic for volatile storages [ignite-3]

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


##########
modules/table/src/main/java/org/apache/ignite/internal/table/distributed/PartitionReplicatorNodeRecovery.java:
##########
@@ -285,12 +314,30 @@ private CompletableFuture<Long> queryDataNodesCount(Collection<Peer> peers, HasD
                         .thenApply(response -> {
                             assert response instanceof HasDataResponse : response;
 
-                            return ((HasDataResponse) response).result();
+                            return ((HasDataResponse) response).presence();
                         })
-                        .exceptionally(unused -> false))
+                        .exceptionally(unused -> DataPresence.UNKNOWN))
                 .toArray(CompletableFuture[]::new);
 
-        return allOf(requestFutures)
-                .thenApply(unused -> Arrays.stream(requestFutures).filter(CompletableFuture::join).count());
+        return allOf(presenceFutures)
+                .thenApply(unused -> {
+                    List<DataPresence> hasDataFlags = Arrays.stream(presenceFutures)
+                            .map(CompletableFuture::join)
+                            .collect(toList());
+
+                    long nodesSurelyHavingData = hasDataFlags.stream().filter(presence -> presence == DataPresence.HAS_DATA).count();
+                    long nodesSurelyEmpty = hasDataFlags.stream().filter(presence -> presence == DataPresence.EMPTY).count();
+                    return new DataNodesCounts(nodesSurelyHavingData, nodesSurelyEmpty);
+                });
+    }
+
+    private static class DataNodesCounts {
+        private final long nodesSurelyHavingData;

Review Comment:
   For me, actually, the current naming was very confusing for some reason. I had to re-read them multiple times. If you don't like my suggestion, maybe you could provide something simpler?



-- 
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-19234 Enable and fix group reentry logic for volatile storages [ignite-3]

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


##########
modules/table/src/main/java/org/apache/ignite/internal/table/distributed/message/DataPresence.java:
##########
@@ -0,0 +1,27 @@
+/*
+ * 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.table.distributed.message;
+
+/**
+ * Whether a node has data or not (or it's not known).

Review Comment:
   Added clarifications



-- 
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-19234 Enable and fix group reentry logic for volatile storages [ignite-3]

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


##########
modules/table/src/main/java/org/apache/ignite/internal/table/distributed/PartitionReplicatorNodeRecovery.java:
##########
@@ -285,12 +314,30 @@ private CompletableFuture<Long> queryDataNodesCount(Collection<Peer> peers, HasD
                         .thenApply(response -> {
                             assert response instanceof HasDataResponse : response;
 
-                            return ((HasDataResponse) response).result();
+                            return ((HasDataResponse) response).presence();
                         })
-                        .exceptionally(unused -> false))
+                        .exceptionally(unused -> DataPresence.UNKNOWN))
                 .toArray(CompletableFuture[]::new);
 
-        return allOf(requestFutures)
-                .thenApply(unused -> Arrays.stream(requestFutures).filter(CompletableFuture::join).count());
+        return allOf(presenceFutures)
+                .thenApply(unused -> {
+                    List<DataPresence> hasDataFlags = Arrays.stream(presenceFutures)
+                            .map(CompletableFuture::join)
+                            .collect(toList());
+
+                    long nodesSurelyHavingData = hasDataFlags.stream().filter(presence -> presence == DataPresence.HAS_DATA).count();
+                    long nodesSurelyEmpty = hasDataFlags.stream().filter(presence -> presence == DataPresence.EMPTY).count();
+                    return new DataNodesCounts(nodesSurelyHavingData, nodesSurelyEmpty);
+                });
+    }
+
+    private static class DataNodesCounts {
+        private final long nodesSurelyHavingData;

Review Comment:
   Is it a problem? As a result, the code that uses them is self-explanatory. On the other hand, `dataNodesCnt` does not tell you that we actually checked that there is the given count of replicas *available*.



-- 
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-19234 Enable and fix group reentry logic for volatile storages [ignite-3]

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


##########
modules/table/src/main/java/org/apache/ignite/internal/table/distributed/message/DataPresence.java:
##########
@@ -0,0 +1,27 @@
+/*
+ * 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.table.distributed.message;
+
+/**
+ * Whether a node has data or not (or it's not known).
+ */
+public enum DataPresence {

Review Comment:
   Can we serialize it into an int, not a string?



##########
modules/table/src/main/java/org/apache/ignite/internal/table/distributed/PartitionReplicatorNodeRecovery.java:
##########
@@ -285,12 +314,30 @@ private CompletableFuture<Long> queryDataNodesCount(Collection<Peer> peers, HasD
                         .thenApply(response -> {
                             assert response instanceof HasDataResponse : response;
 
-                            return ((HasDataResponse) response).result();
+                            return ((HasDataResponse) response).presence();
                         })
-                        .exceptionally(unused -> false))
+                        .exceptionally(unused -> DataPresence.UNKNOWN))
                 .toArray(CompletableFuture[]::new);
 
-        return allOf(requestFutures)
-                .thenApply(unused -> Arrays.stream(requestFutures).filter(CompletableFuture::join).count());
+        return allOf(presenceFutures)
+                .thenApply(unused -> {
+                    List<DataPresence> hasDataFlags = Arrays.stream(presenceFutures)
+                            .map(CompletableFuture::join)
+                            .collect(toList());
+
+                    long nodesSurelyHavingData = hasDataFlags.stream().filter(presence -> presence == DataPresence.HAS_DATA).count();
+                    long nodesSurelyEmpty = hasDataFlags.stream().filter(presence -> presence == DataPresence.EMPTY).count();
+                    return new DataNodesCounts(nodesSurelyHavingData, nodesSurelyEmpty);
+                });
+    }
+
+    private static class DataNodesCounts {
+        private final long nodesSurelyHavingData;

Review Comment:
   These fields' names are a bit of a mouthful. Can we rename them to something like "dataNodesCnt" and "emptyNodesCnt"?



##########
modules/table/src/main/java/org/apache/ignite/internal/table/distributed/message/DataPresence.java:
##########
@@ -0,0 +1,27 @@
+/*
+ * 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.table.distributed.message;
+
+/**
+ * Whether a node has data or not (or it's not known).

Review Comment:
   Can you please clarify a bit, what does "not known" mean?



-- 
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-19234 Enable and fix group reentry logic for volatile storages [ignite-3]

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


-- 
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-19234 Enable and fix group reentry logic for volatile storages [ignite-3]

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


##########
modules/table/src/main/java/org/apache/ignite/internal/table/distributed/message/DataPresence.java:
##########
@@ -0,0 +1,27 @@
+/*
+ * 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.table.distributed.message;
+
+/**
+ * Whether a node has data or not (or it's not known).
+ */
+public enum DataPresence {

Review Comment:
   Maybe I just missed this, but I did not see this approach in use for network messages. I still prefer strings for the reason I described earlier when the performance penalty is small (like in this case).



-- 
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-19234 Enable and fix group reentry logic for volatile storages [ignite-3]

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


##########
modules/table/src/main/java/org/apache/ignite/internal/table/distributed/message/DataPresence.java:
##########
@@ -0,0 +1,27 @@
+/*
+ * 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.table.distributed.message;
+
+/**
+ * Whether a node has data or not (or it's not known).
+ */
+public enum DataPresence {

Review Comment:
   We can, but what's the point? These messages are only sent during node start, and there should not be too many of them. With ordinals it seems easier to silently deserialize to another enum constant if the enum gets changed.



-- 
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-19234 Enable and fix group reentry logic for volatile storages [ignite-3]

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


##########
modules/table/src/main/java/org/apache/ignite/internal/table/distributed/message/DataPresence.java:
##########
@@ -0,0 +1,27 @@
+/*
+ * 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.table.distributed.message;
+
+/**
+ * Whether a node has data or not (or it's not known).
+ */
+public enum DataPresence {

Review Comment:
   I don't mean to use ordinals, I mean to use an explicit int value. Don't we have a similar approach in other enums? Anyway, that's up to 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.

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

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