petrov-mg commented on code in PR #12887:
URL: https://github.com/apache/ignite/pull/12887#discussion_r2964188545


##########
modules/core/src/main/java/org/apache/ignite/internal/management/event/EventListCommandArg.java:
##########
@@ -0,0 +1,45 @@
+/*
+ * 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.management.event;
+
+import org.apache.ignite.internal.Order;
+import org.apache.ignite.internal.dto.IgniteDataTransferObject;
+import org.apache.ignite.internal.management.api.Argument;
+
+/** */
+public class EventListCommandArg extends IgniteDataTransferObject {
+    /** */
+    private static final long serialVersionUID = 0;
+
+    /** */
+    @Order(0)
+    @Argument(
+        optional = true,
+        description = "Only enabled events")

Review Comment:
   Only enabled events -> Filter only enabled events



##########
docs/_docs/tools/control-script.adoc:
##########
@@ -1628,3 +1628,55 @@ Parameters:
 |--node-id | A list of nodes to rebuild indexes on. If not specified, 
schedules rebuild on all nodes.
 |--cache-names | Comma-separated list of cache names, optionally with indexes. 
If indexes are not specified, all indexes of the cache will be scheduled for 
the rebuild operation. Can be used simultaneously with cache group names.
 |--group-names | Comma-separated list of cache group names. Can be used 
simultaneously with cache names.
+
+
+== Events management
+
+The control utility provides commands to enable events, disable events, check 
the status of events on all server nodes.

Review Comment:
   The control utility provides commands to enable events, disable events, 
check the status of events on all server nodes. -> The control utility provides 
commands to enable, disable and check the status of events on all server nodes.



##########
modules/core/src/main/java/org/apache/ignite/internal/managers/eventstorage/GridEventStorageManager.java:
##########
@@ -1163,6 +1160,52 @@ private int[] copy(int[] arr) {
         return Arrays.copyOf(arr, arr.length);
     }
 
+    /** {@inheritDoc} */
+    @Override public DiscoveryDataExchangeType discoveryDataType() {
+        return DiscoveryDataExchangeType.EVENT_MGR;
+    }
+
+    /** {@inheritDoc} */
+    @Override public void 
onGridDataReceived(DiscoveryDataBag.GridDiscoveryData data) {
+        if (data.commonData() == null)
+            return;
+
+        if (ctx.clientNode())
+            return;
+
+        GridIntList clusterData = new GridIntList((int[])data.commonData());
+        GridIntList nodeData = new GridIntList(enabledEvents());
+
+        GridIntList toEnable = new GridIntList(clusterData.size());
+        GridIntList toDisable = new GridIntList(nodeData.size());
+
+        for (int i = 0; i < clusterData.size(); i++) {
+            if (!nodeData.contains(clusterData.get(i)))
+                toEnable.add(clusterData.get(i));
+        }
+
+        for (int i = 0; i < nodeData.size(); i++) {
+            if (!clusterData.contains(nodeData.get(i)))
+                toDisable.add(nodeData.get(i));
+        }
+
+        if (!toEnable.isEmpty())
+            enableEvents(toEnable.arrayCopy());

Review Comment:
   It does not look like a good idea to use enableEvents/disableEvents here. 
Doing so would trigger EVENTS_ENABLE/EVENTS_DISABLE authorization checks during 
the node joining process, which is unrelated to user-initiated operations.



##########
docs/_docs/tools/control-script.adoc:
##########
@@ -1628,3 +1628,55 @@ Parameters:
 |--node-id | A list of nodes to rebuild indexes on. If not specified, 
schedules rebuild on all nodes.
 |--cache-names | Comma-separated list of cache names, optionally with indexes. 
If indexes are not specified, all indexes of the cache will be scheduled for 
the rebuild operation. Can be used simultaneously with cache group names.
 |--group-names | Comma-separated list of cache group names. Can be used 
simultaneously with cache names.
+
+
+== Events management

Review Comment:
   Events management -> Event management



##########
docs/_docs/tools/control-script.adoc:
##########
@@ -1628,3 +1628,55 @@ Parameters:
 |--node-id | A list of nodes to rebuild indexes on. If not specified, 
schedules rebuild on all nodes.
 |--cache-names | Comma-separated list of cache names, optionally with indexes. 
If indexes are not specified, all indexes of the cache will be scheduled for 
the rebuild operation. Can be used simultaneously with cache group names.
 |--group-names | Comma-separated list of cache group names. Can be used 
simultaneously with cache names.
+
+
+== Events management
+
+The control utility provides commands to enable events, disable events, check 
the status of events on all server nodes.
+
+=== Enable/disable events
+
+To eneble or disable events on all server nodes, use the `--event 
enable/disable` command.

Review Comment:
   eneble -> enable.



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