Skip to content

Commit 3d25fed

Browse files
committed
1 parent 23a9223 commit 3d25fed

32 files changed

Lines changed: 540 additions & 360 deletions

modules/core/src/main/java/org/apache/ignite/internal/CoreMessagesProvider.java

Lines changed: 12 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -40,8 +40,10 @@
4040
import org.apache.ignite.internal.managers.encryption.GenerateEncryptionKeyRequest;
4141
import org.apache.ignite.internal.managers.encryption.GenerateEncryptionKeyResponse;
4242
import org.apache.ignite.internal.managers.encryption.GroupKeyEncrypted;
43+
import org.apache.ignite.internal.managers.encryption.KnownEncryptionKeys;
4344
import org.apache.ignite.internal.managers.encryption.MasterKeyChangeRequest;
4445
import org.apache.ignite.internal.managers.encryption.NodeEncryptionKeys;
46+
import org.apache.ignite.internal.managers.eventstorage.EnabledEvents;
4547
import org.apache.ignite.internal.managers.eventstorage.GridEventStorageMessage;
4648
import org.apache.ignite.internal.plugin.AbstractMarshallableMessageFactoryProvider;
4749
import org.apache.ignite.internal.processors.authentication.User;
@@ -181,6 +183,8 @@
181183
import org.apache.ignite.internal.processors.cluster.CacheMetricsMessage;
182184
import org.apache.ignite.internal.processors.cluster.ChangeGlobalStateFinishMessage;
183185
import org.apache.ignite.internal.processors.cluster.ChangeGlobalStateMessage;
186+
import org.apache.ignite.internal.processors.cluster.ClusterFlags;
187+
import org.apache.ignite.internal.processors.cluster.ClusterIdAndTag;
184188
import org.apache.ignite.internal.processors.cluster.ClusterMetricsUpdateMessage;
185189
import org.apache.ignite.internal.processors.cluster.NodeFullMetricsMessage;
186190
import org.apache.ignite.internal.processors.cluster.NodeMetricsMessage;
@@ -205,6 +209,7 @@
205209
import org.apache.ignite.internal.processors.metastorage.persistence.DistributedMetaStorageCasMessage;
206210
import org.apache.ignite.internal.processors.metastorage.persistence.DistributedMetaStorageUpdateAckMessage;
207211
import org.apache.ignite.internal.processors.metastorage.persistence.DistributedMetaStorageUpdateMessage;
212+
import org.apache.ignite.internal.processors.plugin.PluginsData;
208213
import org.apache.ignite.internal.processors.query.InlineSizesData;
209214
import org.apache.ignite.internal.processors.query.QueryField;
210215
import org.apache.ignite.internal.processors.query.h2.twostep.messages.GridQueryCancelRequest;
@@ -253,7 +258,7 @@
253258
import org.apache.ignite.spi.communication.tcp.messages.HandshakeWaitMessage;
254259
import org.apache.ignite.spi.communication.tcp.messages.NodeIdMessage;
255260
import org.apache.ignite.spi.communication.tcp.messages.RecoveryLastReceivedMessage;
256-
import org.apache.ignite.spi.discovery.ObjectData;
261+
import org.apache.ignite.spi.discovery.DataBagItem;
257262
import org.apache.ignite.spi.discovery.tcp.internal.DiscoveryDataPacket;
258263
import org.apache.ignite.spi.discovery.tcp.internal.TcpDiscoveryNode;
259264
import org.apache.ignite.spi.discovery.tcp.messages.InetAddressMessage;
@@ -353,7 +358,7 @@ public CoreMessagesProvider(Marshaller dfltMarsh, Marshaller schemaAwareMarsh, C
353358
withNoSchema(GridCacheVersion.class);
354359
withNoSchema(GridCacheVersionEx.class);
355360
withNoSchema(WALPointer.class);
356-
withNoSchemaResolvedClassLoader(ObjectData.class);
361+
withNoSchemaResolvedClassLoader(DataBagItem.class);
357362
withSchemaResolvedClassLoader(GridTopicMessage.class);
358363

359364
// [5700 - 5900]: Discovery originated messages.
@@ -652,10 +657,12 @@ public CoreMessagesProvider(Marshaller dfltMarsh, Marshaller schemaAwareMarsh, C
652657
withNoSchema(MasterKeyChangeRequest.class);
653658
withNoSchema(GroupKeyEncrypted.class);
654659
withNoSchema(NodeEncryptionKeys.class);
660+
withNoSchema(KnownEncryptionKeys.class);
655661

656662
// [13000 - 13300]: Control, configuration, diagnostincs and other messages.
657663
msgIdx = 13000;
658664
withSchema(GridEventStorageMessage.class);
665+
withSchema(EnabledEvents.class);
659666
withNoSchema(ChangeGlobalStateMessage.class);
660667
withNoSchema(GridChangeGlobalStateMessageResponse.class);
661668
withSchema(IgniteDiagnosticRequest.class);
@@ -665,6 +672,9 @@ public CoreMessagesProvider(Marshaller dfltMarsh, Marshaller schemaAwareMarsh, C
665672
withNoSchemaResolvedClassLoader(DynamicCacheChangeRequest.class);
666673
withNoSchema(PartitionHashRecord.class);
667674
withNoSchema(TransactionsHashRecord.class);
675+
withNoSchema(ClusterIdAndTag.class);
676+
withNoSchema(ClusterFlags.class);
677+
withNoSchemaResolvedClassLoader(PluginsData.class);
668678

669679
assert msgIdx <= MAX_MESSAGE_ID;
670680
}

modules/core/src/main/java/org/apache/ignite/internal/managers/encryption/GridEncryptionManager.java

Lines changed: 5 additions & 10 deletions
Original file line numberDiff line numberDiff line change
@@ -563,28 +563,23 @@ public void onLocalJoin() {
563563
}
564564
}
565565

566-
dataBag.addGridCommonData(ENCRYPTION_MGR.ordinal(), knownEncKeys);
566+
dataBag.addGridCommonData(ENCRYPTION_MGR.ordinal(), new KnownEncryptionKeys(knownEncKeys));
567567
}
568568

569569
/** {@inheritDoc} */
570570
@Override public void onGridDataReceived(GridDiscoveryData data) {
571571
if (ctx.clientNode())
572572
return;
573573

574-
Map<Integer, Object> encKeysFromCluster = (Map<Integer, Object>)data.commonData();
574+
KnownEncryptionKeys encKeysFromCluster = data.commonData();
575575

576-
if (F.isEmpty(encKeysFromCluster))
576+
if (encKeysFromCluster == null || F.isEmpty(encKeysFromCluster.keys))
577577
return;
578578

579-
for (Map.Entry<Integer, Object> entry : encKeysFromCluster.entrySet()) {
579+
for (Map.Entry<Integer, GroupKeyEncrypted> entry : encKeysFromCluster.keys.entrySet()) {
580580
int grpId = entry.getKey();
581581

582-
GroupKeyEncrypted rmtKey;
583-
584-
if (entry.getValue() instanceof GroupKeyEncrypted)
585-
rmtKey = (GroupKeyEncrypted)entry.getValue();
586-
else
587-
rmtKey = new GroupKeyEncrypted(INITIAL_KEY_ID, (byte[])entry.getValue());
582+
GroupKeyEncrypted rmtKey = entry.getValue();
588583

589584
GroupKey locGrpKey = getActiveKey(grpId);
590585

Lines changed: 37 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,37 @@
1+
/*
2+
* Licensed to the Apache Software Foundation (ASF) under one or more
3+
* contributor license agreements. See the NOTICE file distributed with
4+
* this work for additional information regarding copyright ownership.
5+
* The ASF licenses this file to You under the Apache License, Version 2.0
6+
* (the "License"); you may not use this file except in compliance with
7+
* the License. You may obtain a copy of the License at
8+
*
9+
* http://www.apache.org/licenses/LICENSE-2.0
10+
*
11+
* Unless required by applicable law or agreed to in writing, software
12+
* distributed under the License is distributed on an "AS IS" BASIS,
13+
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
14+
* See the License for the specific language governing permissions and
15+
* limitations under the License.
16+
*/
17+
18+
package org.apache.ignite.internal.managers.encryption;
19+
20+
import java.util.Map;
21+
import org.apache.ignite.internal.Order;
22+
import org.apache.ignite.plugin.extensions.communication.Message;
23+
24+
/** */
25+
public class KnownEncryptionKeys implements Message {
26+
/** */
27+
@Order(0)
28+
Map<Integer, GroupKeyEncrypted> keys;
29+
30+
/** */
31+
public KnownEncryptionKeys() {}
32+
33+
/** */
34+
KnownEncryptionKeys(Map<Integer, GroupKeyEncrypted> keys) {
35+
this.keys = keys;
36+
}
37+
}
Lines changed: 40 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,40 @@
1+
/*
2+
* Licensed to the Apache Software Foundation (ASF) under one or more
3+
* contributor license agreements. See the NOTICE file distributed with
4+
* this work for additional information regarding copyright ownership.
5+
* The ASF licenses this file to You under the Apache License, Version 2.0
6+
* (the "License"); you may not use this file except in compliance with
7+
* the License. You may obtain a copy of the License at
8+
*
9+
* http://www.apache.org/licenses/LICENSE-2.0
10+
*
11+
* Unless required by applicable law or agreed to in writing, software
12+
* distributed under the License is distributed on an "AS IS" BASIS,
13+
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
14+
* See the License for the specific language governing permissions and
15+
* limitations under the License.
16+
*/
17+
18+
package org.apache.ignite.internal.managers.eventstorage;
19+
20+
import org.apache.ignite.internal.Order;
21+
import org.apache.ignite.plugin.extensions.communication.Message;
22+
23+
/**
24+
*
25+
*/
26+
public class EnabledEvents implements Message {
27+
/** */
28+
@Order(0)
29+
int[] evts;
30+
31+
/** */
32+
public EnabledEvents() { }
33+
34+
/**
35+
* @param events Enabled events.
36+
*/
37+
public EnabledEvents(int[] events) {
38+
this.evts = events;
39+
}
40+
}

modules/core/src/main/java/org/apache/ignite/internal/managers/eventstorage/GridEventStorageManager.java

Lines changed: 5 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -1173,13 +1173,15 @@ private int[] copy(int[] arr) {
11731173

11741174
/** {@inheritDoc} */
11751175
@Override public void onGridDataReceived(DiscoveryDataBag.GridDiscoveryData data) {
1176-
if (data.commonData() == null)
1176+
EnabledEvents enabled = data.commonData();
1177+
1178+
if (enabled == null)
11771179
return;
11781180

11791181
if (ctx.clientNode())
11801182
return;
11811183

1182-
GridIntList clusterData = new GridIntList((int[])data.commonData());
1184+
GridIntList clusterData = new GridIntList(enabled.evts);
11831185
GridIntList nodeData = new GridIntList(enabledEvents());
11841186

11851187
GridIntList toEnable = new GridIntList(clusterData.size());
@@ -1207,9 +1209,7 @@ private int[] copy(int[] arr) {
12071209
if (dataBag.isJoiningNodeClient() && dataBag.commonDataCollectedFor(EVENT_MGR.ordinal()))
12081210
return;
12091211

1210-
int[] clusterData = enabledEvents();
1211-
1212-
dataBag.addGridCommonData(EVENT_MGR.ordinal(), clusterData);
1212+
dataBag.addGridCommonData(EVENT_MGR.ordinal(), new EnabledEvents(enabledEvents()));
12131213
}
12141214

12151215
/**

modules/core/src/main/java/org/apache/ignite/internal/processors/authentication/IgniteAuthenticationProcessor.java

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -430,7 +430,7 @@ private boolean isLocalNodeCoordinator() {
430430

431431
/** {@inheritDoc} */
432432
@Override public void onGridDataReceived(DiscoveryDataBag.GridDiscoveryData data) {
433-
initUsrs = (InitialUsersData)data.commonData();
433+
initUsrs = data.commonData();
434434
}
435435

436436
/** {@inheritDoc} */

modules/core/src/main/java/org/apache/ignite/internal/processors/cache/ClusterCachesInfo.java

Lines changed: 2 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -1504,10 +1504,9 @@ public void onGridDataReceived(DiscoveryDataBag.GridDiscoveryData data) {
15041504
if (data.commonData() == null)
15051505
return;
15061506

1507-
assert joinDiscoData != null || disconnectedState();
1508-
assert data.commonData() instanceof CacheNodeCommonDiscoveryData : data;
1507+
CacheNodeCommonDiscoveryData cachesData = data.commonData();
15091508

1510-
CacheNodeCommonDiscoveryData cachesData = (CacheNodeCommonDiscoveryData)data.commonData();
1509+
assert joinDiscoData != null || disconnectedState();
15111510

15121511
// CacheGroup configurations that were created from local node configuration.
15131512
Map<Integer, CacheGroupDescriptor> locCacheGrps = new HashMap<>(registeredCacheGroups());

modules/core/src/main/java/org/apache/ignite/internal/processors/cache/binary/CacheObjectBinaryProcessorImpl.java

Lines changed: 4 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -18,7 +18,6 @@
1818
package org.apache.ignite.internal.processors.cache.binary;
1919

2020
import java.io.File;
21-
import java.io.Serializable;
2221
import java.nio.ByteBuffer;
2322
import java.util.Arrays;
2423
import java.util.Collection;
@@ -1464,7 +1463,7 @@ private IgniteNodeValidationResult validateBinaryMetadata(UUID rmtNodeId, Binary
14641463
res.put(e.getKey(), e.getValue());
14651464
}
14661465

1467-
dataBag.addGridCommonData(BINARY_PROC.ordinal(), (Serializable)res);
1466+
dataBag.addGridCommonData(BINARY_PROC.ordinal(), new BinaryMetadataVersionsData(res));
14681467
}
14691468
}
14701469

@@ -1530,10 +1529,10 @@ private IgniteNodeValidationResult validateBinaryMetadata(UUID rmtNodeId, Binary
15301529

15311530
/** {@inheritDoc} */
15321531
@Override public void onGridDataReceived(GridDiscoveryData data) {
1533-
Map<Integer, BinaryMetadataVersionInfo> receivedData = (Map<Integer, BinaryMetadataVersionInfo>)data.commonData();
1532+
BinaryMetadataVersionsData receivedData = data.commonData();
15341533

1535-
if (receivedData != null) {
1536-
for (Map.Entry<Integer, BinaryMetadataVersionInfo> e : receivedData.entrySet()) {
1534+
if (receivedData != null && !F.isEmpty(receivedData.data)) {
1535+
for (Map.Entry<Integer, BinaryMetadataVersionInfo> e : receivedData.data.entrySet()) {
15371536
BinaryMetadataVersionInfo metaVerInfo = e.getValue();
15381537

15391538
BinaryMetadataVersionInfo locMetaVerInfo = new BinaryMetadataVersionInfo(metaVerInfo.metadata(),
Lines changed: 38 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,38 @@
1+
/*
2+
* Licensed to the Apache Software Foundation (ASF) under one or more
3+
* contributor license agreements. See the NOTICE file distributed with
4+
* this work for additional information regarding copyright ownership.
5+
* The ASF licenses this file to You under the Apache License, Version 2.0
6+
* (the "License"); you may not use this file except in compliance with
7+
* the License. You may obtain a copy of the License at
8+
*
9+
* http://www.apache.org/licenses/LICENSE-2.0
10+
*
11+
* Unless required by applicable law or agreed to in writing, software
12+
* distributed under the License is distributed on an "AS IS" BASIS,
13+
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
14+
* See the License for the specific language governing permissions and
15+
* limitations under the License.
16+
*/
17+
18+
package org.apache.ignite.internal.processors.cluster;
19+
20+
import org.apache.ignite.internal.Order;
21+
import org.apache.ignite.plugin.extensions.communication.Message;
22+
23+
/** */
24+
public class ClusterFlags implements Message {
25+
/** Update notifier enabled flag. */
26+
@Order(0)
27+
boolean updateNotifierEnabled;
28+
29+
/** */
30+
public ClusterFlags() { }
31+
32+
/**
33+
* @param updateNotifierEnabled Update notifier enabled flag.
34+
*/
35+
public ClusterFlags(boolean updateNotifierEnabled) {
36+
this.updateNotifierEnabled = updateNotifierEnabled;
37+
}
38+
}

modules/core/src/main/java/org/apache/ignite/internal/processors/cluster/ClusterIdAndTag.java

Lines changed: 10 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -20,20 +20,27 @@
2020
import java.io.Serializable;
2121
import java.util.Objects;
2222
import java.util.UUID;
23+
import org.apache.ignite.internal.Order;
2324
import org.apache.ignite.internal.util.typedef.internal.S;
25+
import org.apache.ignite.plugin.extensions.communication.Message;
2426

2527
/**
2628
* Container class to send cluster ID and tag in disco data and to write them atomically to metastorage.
2729
*/
28-
public class ClusterIdAndTag implements Serializable {
30+
public class ClusterIdAndTag implements Serializable, Message {
2931
/** */
3032
private static final long serialVersionUID = 0L;
3133

3234
/** */
33-
private final UUID id;
35+
@Order(0)
36+
UUID id;
3437

3538
/** */
36-
private final String tag;
39+
@Order(1)
40+
String tag;
41+
42+
/** */
43+
public ClusterIdAndTag() { }
3744

3845
/**
3946
* @param id Cluster ID.

0 commit comments

Comments
 (0)