kgusakov commented on code in PR #759:
URL: https://github.com/apache/ignite-3/pull/759#discussion_r862459074


##########
modules/table/src/main/java/org/apache/ignite/internal/table/distributed/raft/RebalanceRaftGroupEventsListener.java:
##########
@@ -0,0 +1,168 @@
+/*
+ * 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.raft;
+
+import static 
org.apache.ignite.internal.metastorage.client.Conditions.notExists;
+import static 
org.apache.ignite.internal.metastorage.client.Conditions.revision;
+import static org.apache.ignite.internal.metastorage.client.Operations.ops;
+import static org.apache.ignite.internal.metastorage.client.Operations.put;
+import static org.apache.ignite.internal.metastorage.client.Operations.remove;
+import static 
org.apache.ignite.internal.utils.RebalanceUtil.partAssignmentsPendingKey;
+import static 
org.apache.ignite.internal.utils.RebalanceUtil.partAssignmentsPlannedKey;
+import static 
org.apache.ignite.internal.utils.RebalanceUtil.partAssignmentsStableKey;
+
+import java.util.List;
+import java.util.Map;
+import java.util.Set;
+import java.util.function.Function;
+import java.util.stream.Collectors;
+import org.apache.ignite.configuration.schemas.table.TableConfiguration;
+import org.apache.ignite.internal.configuration.schema.ExtendedTableChange;
+import org.apache.ignite.internal.metastorage.MetaStorageManager;
+import org.apache.ignite.internal.metastorage.client.Entry;
+import org.apache.ignite.internal.metastorage.client.If;
+import org.apache.ignite.internal.raft.server.RaftGroupEventsListener;
+import org.apache.ignite.internal.util.ByteUtils;
+import org.apache.ignite.internal.util.IgniteSpinBusyLock;
+import org.apache.ignite.lang.ByteArray;
+import org.apache.ignite.lang.IgniteInternalException;
+import org.apache.ignite.lang.NodeStoppingException;
+import org.apache.ignite.network.ClusterNode;
+import org.apache.ignite.network.NetworkAddress;
+import org.apache.ignite.raft.jraft.Status;
+import org.apache.ignite.raft.jraft.entity.PeerId;
+
+/**
+ * Listener for the raft group events, which must provide correct error 
handling of rebalance process
+ * and start new rebalance after the current one finished.
+ */
+public class RebalanceRaftGroupEventsListener implements 
RaftGroupEventsListener {
+
+    /** Meta storage manager. */
+    private final MetaStorageManager metaStorageMgr;
+
+    /** Table configuration instance. */
+    private final TableConfiguration tblConfiguration;
+
+    /** Unique partition id. */
+    private final String partId;
+
+    /** Partition number. */
+    private final int partNum;
+
+    /** Busy lock of parent component for synchronous stop. */
+    private IgniteSpinBusyLock busyLock;
+
+    /** Resolver that resolves a network address to cluster node. */
+    private final Function<NetworkAddress, ClusterNode> clusterNodeRslvr;
+
+    /**
+     * Constructs new listener.
+     *
+     * @param metaStorageMgr Meta storage manager.
+     * @param tblConfiguration Table configuration.
+     * @param partId Partition id.
+     * @param partNum Partition number.
+     */
+    public RebalanceRaftGroupEventsListener(
+            MetaStorageManager metaStorageMgr,
+            TableConfiguration tblConfiguration,
+            String partId,
+            int partNum,
+            IgniteSpinBusyLock busyLock,
+            Function<NetworkAddress, ClusterNode> clusterNodeRslvr) {
+        this.metaStorageMgr = metaStorageMgr;
+        this.tblConfiguration = tblConfiguration;
+        this.partId = partId;
+        this.partNum = partNum;
+        this.busyLock = busyLock;
+        this.clusterNodeRslvr = clusterNodeRslvr;
+    }
+
+    /** {@inheritDoc} */
+    @Override
+    public void onLeaderElected() {
+        // TODO: IGNITE-16800 implement this method
+    }
+
+    /** {@inheritDoc} */
+    @Override
+    public void onNewPeersConfigurationApplied(List<PeerId> peers) {
+        if (!busyLock.enterBusy()) {
+            throw new IgniteInternalException(new NodeStoppingException());

Review Comment:
   Fixed by no-op reaction.



##########
modules/table/src/main/java/org/apache/ignite/internal/table/distributed/raft/RebalanceRaftGroupEventsListener.java:
##########
@@ -0,0 +1,168 @@
+/*
+ * 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.raft;
+
+import static 
org.apache.ignite.internal.metastorage.client.Conditions.notExists;
+import static 
org.apache.ignite.internal.metastorage.client.Conditions.revision;
+import static org.apache.ignite.internal.metastorage.client.Operations.ops;
+import static org.apache.ignite.internal.metastorage.client.Operations.put;
+import static org.apache.ignite.internal.metastorage.client.Operations.remove;
+import static 
org.apache.ignite.internal.utils.RebalanceUtil.partAssignmentsPendingKey;
+import static 
org.apache.ignite.internal.utils.RebalanceUtil.partAssignmentsPlannedKey;
+import static 
org.apache.ignite.internal.utils.RebalanceUtil.partAssignmentsStableKey;
+
+import java.util.List;
+import java.util.Map;
+import java.util.Set;
+import java.util.function.Function;
+import java.util.stream.Collectors;
+import org.apache.ignite.configuration.schemas.table.TableConfiguration;
+import org.apache.ignite.internal.configuration.schema.ExtendedTableChange;
+import org.apache.ignite.internal.metastorage.MetaStorageManager;
+import org.apache.ignite.internal.metastorage.client.Entry;
+import org.apache.ignite.internal.metastorage.client.If;
+import org.apache.ignite.internal.raft.server.RaftGroupEventsListener;
+import org.apache.ignite.internal.util.ByteUtils;
+import org.apache.ignite.internal.util.IgniteSpinBusyLock;
+import org.apache.ignite.lang.ByteArray;
+import org.apache.ignite.lang.IgniteInternalException;
+import org.apache.ignite.lang.NodeStoppingException;
+import org.apache.ignite.network.ClusterNode;
+import org.apache.ignite.network.NetworkAddress;
+import org.apache.ignite.raft.jraft.Status;
+import org.apache.ignite.raft.jraft.entity.PeerId;
+
+/**
+ * Listener for the raft group events, which must provide correct error 
handling of rebalance process
+ * and start new rebalance after the current one finished.
+ */
+public class RebalanceRaftGroupEventsListener implements 
RaftGroupEventsListener {
+
+    /** Meta storage manager. */
+    private final MetaStorageManager metaStorageMgr;
+
+    /** Table configuration instance. */
+    private final TableConfiguration tblConfiguration;
+
+    /** Unique partition id. */
+    private final String partId;
+
+    /** Partition number. */
+    private final int partNum;
+
+    /** Busy lock of parent component for synchronous stop. */
+    private IgniteSpinBusyLock busyLock;
+
+    /** Resolver that resolves a network address to cluster node. */
+    private final Function<NetworkAddress, ClusterNode> clusterNodeRslvr;

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: [email protected]

For queries about this service, please contact Infrastructure at:
[email protected]

Reply via email to