Skip to content
Open
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
Original file line number Diff line number Diff line change
Expand Up @@ -40,10 +40,13 @@
import org.apache.ignite.internal.managers.encryption.GenerateEncryptionKeyRequest;
import org.apache.ignite.internal.managers.encryption.GenerateEncryptionKeyResponse;
import org.apache.ignite.internal.managers.encryption.GroupKeyEncrypted;
import org.apache.ignite.internal.managers.encryption.KnownEncryptionKeys;
import org.apache.ignite.internal.managers.encryption.MasterKeyChangeRequest;
import org.apache.ignite.internal.managers.encryption.NodeEncryptionKeys;
import org.apache.ignite.internal.managers.eventstorage.EnabledEvents;
import org.apache.ignite.internal.managers.eventstorage.GridEventStorageMessage;
import org.apache.ignite.internal.plugin.AbstractMarshallableMessageFactoryProvider;
import org.apache.ignite.internal.processors.authentication.InitialUsersData;
import org.apache.ignite.internal.processors.authentication.User;
import org.apache.ignite.internal.processors.authentication.UserAcceptedMessage;
import org.apache.ignite.internal.processors.authentication.UserAuthenticateRequestMessage;
Expand Down Expand Up @@ -181,6 +184,8 @@
import org.apache.ignite.internal.processors.cluster.CacheMetricsMessage;
import org.apache.ignite.internal.processors.cluster.ChangeGlobalStateFinishMessage;
import org.apache.ignite.internal.processors.cluster.ChangeGlobalStateMessage;
import org.apache.ignite.internal.processors.cluster.ClusterFlags;
import org.apache.ignite.internal.processors.cluster.ClusterIdAndTag;
import org.apache.ignite.internal.processors.cluster.ClusterMetricsUpdateMessage;
import org.apache.ignite.internal.processors.cluster.NodeFullMetricsMessage;
import org.apache.ignite.internal.processors.cluster.NodeMetricsMessage;
Expand All @@ -205,14 +210,17 @@
import org.apache.ignite.internal.processors.metastorage.persistence.DistributedMetaStorageCasMessage;
import org.apache.ignite.internal.processors.metastorage.persistence.DistributedMetaStorageUpdateAckMessage;
import org.apache.ignite.internal.processors.metastorage.persistence.DistributedMetaStorageUpdateMessage;
import org.apache.ignite.internal.processors.query.InlineSizesData;
import org.apache.ignite.internal.processors.plugin.PluginsData;
import org.apache.ignite.internal.processors.query.QueryField;
import org.apache.ignite.internal.processors.query.h2.twostep.messages.GridQueryCancelRequest;
import org.apache.ignite.internal.processors.query.h2.twostep.messages.GridQueryFailResponse;
import org.apache.ignite.internal.processors.query.h2.twostep.messages.GridQueryNextPageRequest;
import org.apache.ignite.internal.processors.query.h2.twostep.messages.GridQueryNextPageResponse;
import org.apache.ignite.internal.processors.query.messages.GridQueryKillRequest;
import org.apache.ignite.internal.processors.query.messages.GridQueryKillResponse;
import org.apache.ignite.internal.processors.query.schema.message.ActiveProposals;
import org.apache.ignite.internal.processors.query.schema.message.InlineSizesData;
import org.apache.ignite.internal.processors.query.schema.message.QueryEntityMessage;
import org.apache.ignite.internal.processors.query.schema.message.SchemaFinishDiscoveryMessage;
import org.apache.ignite.internal.processors.query.schema.message.SchemaOperationStatusMessage;
import org.apache.ignite.internal.processors.query.schema.message.SchemaProposeDiscoveryMessage;
Expand Down Expand Up @@ -253,7 +261,7 @@
import org.apache.ignite.spi.communication.tcp.messages.HandshakeWaitMessage;
import org.apache.ignite.spi.communication.tcp.messages.NodeIdMessage;
import org.apache.ignite.spi.communication.tcp.messages.RecoveryLastReceivedMessage;
import org.apache.ignite.spi.discovery.ObjectData;
import org.apache.ignite.spi.discovery.DataBagItem;
import org.apache.ignite.spi.discovery.tcp.internal.DiscoveryDataPacket;
import org.apache.ignite.spi.discovery.tcp.internal.TcpDiscoveryNode;
import org.apache.ignite.spi.discovery.tcp.messages.InetAddressMessage;
Expand Down Expand Up @@ -353,7 +361,7 @@ public CoreMessagesProvider(Marshaller dfltMarsh, Marshaller schemaAwareMarsh, C
withNoSchema(GridCacheVersion.class);
withNoSchema(GridCacheVersionEx.class);
withNoSchema(WALPointer.class);
withNoSchemaResolvedClassLoader(ObjectData.class);
withNoSchemaResolvedClassLoader(DataBagItem.class);
withSchemaResolvedClassLoader(GridTopicMessage.class);

// [5700 - 5900]: Discovery originated messages.
Expand Down Expand Up @@ -446,6 +454,7 @@ public CoreMessagesProvider(Marshaller dfltMarsh, Marshaller schemaAwareMarsh, C
withNoSchema(CacheStatisticsClearMessage.class);
withNoSchema(ClientCacheChangeDummyDiscoveryMessage.class);
withNoSchema(DynamicCacheChangeBatch.class);
withNoSchema(InitialUsersData.class);

// [10000 - 10200]: Transaction and lock related messages. Most of them originally comes from Communication.
msgIdx = 10000;
Expand Down Expand Up @@ -575,6 +584,8 @@ public CoreMessagesProvider(Marshaller dfltMarsh, Marshaller schemaAwareMarsh, C
withNoSchema(CacheContinuousQueryBatchAck.class);
withSchema(CacheContinuousQueryEntry.class);
withNoSchema(InlineSizesData.class);
withNoSchema(ActiveProposals.class);
withNoSchema(QueryEntityMessage.class);

// [11200 - 11300]: Compute, distributed process messages.
msgIdx = 11200;
Expand Down Expand Up @@ -652,6 +663,7 @@ public CoreMessagesProvider(Marshaller dfltMarsh, Marshaller schemaAwareMarsh, C
withNoSchema(MasterKeyChangeRequest.class);
withNoSchema(GroupKeyEncrypted.class);
withNoSchema(NodeEncryptionKeys.class);
withNoSchema(KnownEncryptionKeys.class);

// [13000 - 13300]: Control, configuration, diagnostincs and other messages.
msgIdx = 13000;
Expand All @@ -665,6 +677,10 @@ public CoreMessagesProvider(Marshaller dfltMarsh, Marshaller schemaAwareMarsh, C
withNoSchemaResolvedClassLoader(DynamicCacheChangeRequest.class);
withNoSchema(PartitionHashRecord.class);
withNoSchema(TransactionsHashRecord.class);
withNoSchema(ClusterIdAndTag.class);
withNoSchema(ClusterFlags.class);
withNoSchemaResolvedClassLoader(PluginsData.class);
withSchema(EnabledEvents.class);

assert msgIdx <= MAX_MESSAGE_ID;
}
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -17,10 +17,10 @@

package org.apache.ignite.internal;

import java.io.Serializable;
import java.util.Map;
import org.apache.ignite.IgniteCheckedException;
import org.apache.ignite.cluster.ClusterNode;
import org.apache.ignite.internal.processors.plugin.PluginsData;
import org.apache.ignite.internal.util.typedef.F;
import org.apache.ignite.lang.IgniteFuture;
import org.apache.ignite.plugin.PluginProvider;
import org.apache.ignite.plugin.PluginValidationException;
Expand Down Expand Up @@ -115,10 +115,10 @@ public PluginProvider plugin() {
@Nullable @Override public IgniteNodeValidationResult validateNode(ClusterNode node,
JoiningNodeDiscoveryData discoData) {
try {
Map<String, Serializable> map = discoData.joiningNodeData();
PluginsData pluginsData = discoData.joiningNodeData();

if (map != null)
plugin.validateNewNode(node, map.get(plugin.name()));
if (pluginsData != null && !F.isEmpty(pluginsData.data()))
plugin.validateNewNode(node, pluginsData.data().get(plugin.name()));
else
plugin.validateNewNode(node, null);

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -563,28 +563,23 @@ public void onLocalJoin() {
}
}

dataBag.addGridCommonData(ENCRYPTION_MGR.ordinal(), knownEncKeys);
dataBag.addGridCommonData(ENCRYPTION_MGR.ordinal(), new KnownEncryptionKeys(knownEncKeys));
}

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

Map<Integer, Object> encKeysFromCluster = (Map<Integer, Object>)data.commonData();
KnownEncryptionKeys encKeysFromCluster = data.commonData();

if (F.isEmpty(encKeysFromCluster))
if (encKeysFromCluster == null || F.isEmpty(encKeysFromCluster.keys))
return;

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

GroupKeyEncrypted rmtKey;

if (entry.getValue() instanceof GroupKeyEncrypted)
rmtKey = (GroupKeyEncrypted)entry.getValue();
else
rmtKey = new GroupKeyEncrypted(INITIAL_KEY_ID, (byte[])entry.getValue());
GroupKeyEncrypted rmtKey = entry.getValue();

GroupKey locGrpKey = getActiveKey(grpId);

Expand Down
Original file line number Diff line number Diff line change
@@ -0,0 +1,37 @@
/*
* 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.managers.encryption;

import java.util.Map;
import org.apache.ignite.internal.Order;
import org.apache.ignite.plugin.extensions.communication.Message;

/** */
public class KnownEncryptionKeys implements Message {
/** */
@Order(0)
Map<Integer, GroupKeyEncrypted> keys;

/** */
public KnownEncryptionKeys() {}

/** */
KnownEncryptionKeys(Map<Integer, GroupKeyEncrypted> keys) {
this.keys = keys;
}
}
Original file line number Diff line number Diff line change
@@ -0,0 +1,40 @@
/*
* 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.managers.eventstorage;

import org.apache.ignite.internal.Order;
import org.apache.ignite.plugin.extensions.communication.Message;

/**
*
*/
public class EnabledEvents implements Message {
/** */
@Order(0)
int[] evts;

/** */
public EnabledEvents() { }

/**
* @param events Enabled events.
*/
public EnabledEvents(int[] events) {
this.evts = events;
}
}
Original file line number Diff line number Diff line change
Expand Up @@ -1173,13 +1173,15 @@ private int[] copy(int[] arr) {

/** {@inheritDoc} */
@Override public void onGridDataReceived(DiscoveryDataBag.GridDiscoveryData data) {
if (data.commonData() == null)
EnabledEvents enabled = data.commonData();

if (enabled == null)
return;

if (ctx.clientNode())
return;

GridIntList clusterData = new GridIntList((int[])data.commonData());
GridIntList clusterData = new GridIntList(enabled.evts);
GridIntList nodeData = new GridIntList(enabledEvents());

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

int[] clusterData = enabledEvents();

dataBag.addGridCommonData(EVENT_MGR.ordinal(), clusterData);
dataBag.addGridCommonData(EVENT_MGR.ordinal(), new EnabledEvents(enabledEvents()));
}

/**
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -60,7 +60,6 @@
import org.apache.ignite.internal.thread.pool.IgniteThreadPoolExecutor;
import org.apache.ignite.internal.util.future.GridFutureAdapter;
import org.apache.ignite.internal.util.tostring.GridToStringExclude;
import org.apache.ignite.internal.util.tostring.GridToStringInclude;
import org.apache.ignite.internal.util.typedef.F;
import org.apache.ignite.internal.util.typedef.internal.CU;
import org.apache.ignite.internal.util.typedef.internal.S;
Expand Down Expand Up @@ -430,7 +429,7 @@ private boolean isLocalNodeCoordinator() {

/** {@inheritDoc} */
@Override public void onGridDataReceived(DiscoveryDataBag.GridDiscoveryData data) {
initUsrs = (InitialUsersData)data.commonData();
initUsrs = data.commonData();
}

/** {@inheritDoc} */
Expand Down Expand Up @@ -999,36 +998,6 @@ public void checkUserOperation(UserManagementOperation op) throws IgniteAccessCo
}

/**
* Initial data is collected on coordinator to send to join node.
*/
private static final class InitialUsersData implements Serializable {
/** */
private static final long serialVersionUID = 0L;

/** Users. */
@GridToStringInclude
private final ArrayList<User> usrs;

/** Active user operations. */
@GridToStringInclude
private final ArrayList<UserManagementOperation> activeOps;

/**
* @param usrs Users.
* @param ops Active operations on cluster.
*/
InitialUsersData(Collection<User> usrs, Collection<UserManagementOperation> ops) {
this.usrs = new ArrayList<>(usrs);
activeOps = new ArrayList<>(ops);
}

/** {@inheritDoc} */
@Override public String toString() {
return S.toString(InitialUsersData.class, this);
}
}

/**i
*
*/
private final class UserProposedListener implements CustomEventListener<UserProposedMessage> {
Expand Down
Original file line number Diff line number Diff line change
@@ -0,0 +1,55 @@
/*
* 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.processors.authentication;

import java.util.ArrayList;
import java.util.Collection;
import org.apache.ignite.internal.Order;
import org.apache.ignite.internal.util.tostring.GridToStringInclude;
import org.apache.ignite.internal.util.typedef.internal.S;
import org.apache.ignite.plugin.extensions.communication.Message;

/** Initial data is collected on coordinator to send to join node. */
public class InitialUsersData implements Message {
/** Users. */
@GridToStringInclude
@Order(0)
ArrayList<User> usrs;

/** Active user operations. */
@GridToStringInclude
@Order(1)
ArrayList<UserManagementOperation> activeOps;

/** */
public InitialUsersData() { }

/**
* @param usrs Users.
* @param ops Active operations on cluster.
*/
InitialUsersData(Collection<User> usrs, Collection<UserManagementOperation> ops) {
this.usrs = new ArrayList<>(usrs);
activeOps = new ArrayList<>(ops);
}

/** {@inheritDoc} */
@Override public String toString() {
return S.toString(InitialUsersData.class, this);
}
}
Original file line number Diff line number Diff line change
Expand Up @@ -17,7 +17,6 @@

package org.apache.ignite.internal.processors.authentication;

import java.io.Serializable;
import java.util.Objects;
import org.apache.ignite.internal.Order;
import org.apache.ignite.internal.util.typedef.internal.S;
Expand All @@ -27,10 +26,7 @@
/**
* The operation with users. Used to deliver the information about requested operation to all server nodes.
*/
public class UserManagementOperation implements Serializable, Message {
/** */
private static final long serialVersionUID = 0L;

public class UserManagementOperation implements Message {
/** User. */
@Order(0)
User usr;
Expand Down
Loading
Loading