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/09/03 08:57:54 UTC

[PR] IGNITE-22883 Send all cluster IDs to thin client on connection [ignite-3]

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

   https://issues.apache.org/jira/browse/IGNITE-22883


-- 
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-22883 Send all cluster IDs to thin client on connection [ignite-3]

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


##########
modules/client-handler/src/main/java/org/apache/ignite/client/handler/ClientHandlerModule.java:
##########
@@ -276,7 +275,7 @@ public void enable() {
      */
     private CompletableFuture<Channel> startEndpoint(ClientConnectorView configuration) {
         ServerBootstrap bootstrap = bootstrapFactory.createServerBootstrap();
-        CompletableFuture<ClusterTag> clusterTag = clusterTagSupplier.get();
+        CompletableFuture<ClusterInfo> clusterInfo = clusterInfoSupplier.get();

Review Comment:
   Currently, this doesn't seem to be a problem as a cluster ID is always changed via a restart. But we now have a storage from which we can read ClusterState, allowing us to not use the future (and `join()`) anymore, so I switched to this approach.



##########
modules/client-handler/src/main/java/org/apache/ignite/client/handler/ClusterInfo.java:
##########
@@ -0,0 +1,48 @@
+/*
+ * 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.client.handler;
+
+import java.util.List;
+import java.util.UUID;
+import org.apache.ignite.internal.cluster.management.ClusterTag;
+
+/**
+ * Information about the cluster.
+ */
+public class ClusterInfo {
+    private final ClusterTag tag;
+    private final List<UUID> idHistory;
+
+    /**
+     * Constructor.
+     */
+    public ClusterInfo(ClusterTag tag, List<UUID> idHistory) {
+        this.tag = tag;
+        this.idHistory = List.copyOf(idHistory);

Review Comment:
   Fixed



-- 
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-22883 Send all cluster IDs to thin client on connection [ignite-3]

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


-- 
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-22883 Send all cluster IDs to thin client on connection [ignite-3]

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


##########
modules/client-handler/src/main/java/org/apache/ignite/client/handler/ClusterInfo.java:
##########
@@ -0,0 +1,48 @@
+/*
+ * 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.client.handler;
+
+import java.util.List;
+import java.util.UUID;
+import org.apache.ignite.internal.cluster.management.ClusterTag;
+
+/**
+ * Information about the cluster.
+ */
+public class ClusterInfo {
+    private final ClusterTag tag;
+    private final List<UUID> idHistory;
+
+    /**
+     * Constructor.
+     */
+    public ClusterInfo(ClusterTag tag, List<UUID> idHistory) {
+        this.tag = tag;
+        this.idHistory = List.copyOf(idHistory);

Review Comment:
   I don't think we need a defensive copy in the internal API, the caller already creates a new `ArrayList`.



##########
modules/client-handler/src/main/java/org/apache/ignite/client/handler/ClientHandlerModule.java:
##########
@@ -276,7 +275,7 @@ public void enable() {
      */
     private CompletableFuture<Channel> startEndpoint(ClientConnectorView configuration) {
         ServerBootstrap bootstrap = bootstrapFactory.createServerBootstrap();
-        CompletableFuture<ClusterTag> clusterTag = clusterTagSupplier.get();
+        CompletableFuture<ClusterInfo> clusterInfo = clusterInfoSupplier.get();

Review Comment:
   `startEndpoint` is called once during node startup. Looks like we won't receive any cluster id history updates that may occur during the node life time.



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