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 @@ -571,7 +571,7 @@ public void onLocalJoin() {
if (ctx.clientNode())
return;

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

if (F.isEmpty(encKeysFromCluster))
return;
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -1179,7 +1179,7 @@ private int[] copy(int[] arr) {
if (ctx.clientNode())
return;

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

GridIntList toEnable = new GridIntList(clusterData.size());
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -430,7 +430,7 @@ private boolean isLocalNodeCoordinator() {

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

/** {@inheritDoc} */
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -1504,10 +1504,10 @@
if (data.commonData() == null)
return;

assert joinDiscoData != null || disconnectedState();
assert data.commonData() instanceof CacheNodeCommonDiscoveryData : data;
CacheNodeCommonDiscoveryData cachesData = data.commonData();

CacheNodeCommonDiscoveryData cachesData = (CacheNodeCommonDiscoveryData)data.commonData();
assert joinDiscoData != null || disconnectedState();
assert cachesData instanceof CacheNodeCommonDiscoveryData : data;

Check warning on line 1510 in modules/core/src/main/java/org/apache/ignite/internal/processors/cache/ClusterCachesInfo.java

View check run for this annotation

SonarQubeCloud / SonarCloud Code Analysis

Replace this assert with a proper check.

See more on https://sonarcloud.io/project/issues?id=apache_ignite&issues=AZ5BQruAWYXZhVQqAsO4&open=AZ5BQruAWYXZhVQqAsO4&pullRequest=13157

// CacheGroup configurations that were created from local node configuration.
Map<Integer, CacheGroupDescriptor> locCacheGrps = new HashMap<>(registeredCacheGroups());
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -1530,7 +1530,7 @@ private IgniteNodeValidationResult validateBinaryMetadata(UUID rmtNodeId, Binary

/** {@inheritDoc} */
@Override public void onGridDataReceived(GridDiscoveryData data) {
Map<Integer, BinaryMetadataVersionInfo> receivedData = (Map<Integer, BinaryMetadataVersionInfo>)data.commonData();
Map<Integer, BinaryMetadataVersionInfo> receivedData = data.commonData();

if (receivedData != null) {
for (Map.Entry<Integer, BinaryMetadataVersionInfo> e : receivedData.entrySet()) {
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -488,7 +488,7 @@

/** {@inheritDoc} */
@Override public void onGridDataReceived(GridDiscoveryData data) {
Map<UUID, Serializable> nodeSpecData = data.nodeSpecificData();
Map<UUID, Map<String, Boolean>> nodeSpecData = data.nodeSpecificData();

if (nodeSpecData != null) {
Boolean lstFlag = findLastFlag(nodeSpecData.values());
Expand All @@ -497,7 +497,7 @@
notifyEnabled.set(lstFlag);
}

ClusterIdAndTag commonData = (ClusterIdAndTag)data.commonData();
ClusterIdAndTag commonData = data.commonData();

if (commonData != null) {
Serializable remoteClusterId = commonData.id();
Expand All @@ -523,19 +523,13 @@
/**
* @param vals collection to seek through.
*/
private Boolean findLastFlag(Collection<Serializable> vals) {
Boolean flag = null;

for (Serializable ser : vals) {
if (ser != null) {
Map<String, Object> map = (Map<String, Object>)ser;

if (map.containsKey(ATTR_UPDATE_NOTIFIER_STATUS))
flag = (Boolean)map.get(ATTR_UPDATE_NOTIFIER_STATUS);
}
private Boolean findLastFlag(Collection<Map<String, Boolean>> vals) {
for (Map<String, Boolean> map : vals) {
if (map != null && map.containsKey(ATTR_UPDATE_NOTIFIER_STATUS))
return map.get(ATTR_UPDATE_NOTIFIER_STATUS);
}

return flag;
return null;

Check failure on line 532 in modules/core/src/main/java/org/apache/ignite/internal/processors/cluster/ClusterProcessor.java

View check run for this annotation

SonarQubeCloud / SonarCloud Code Analysis

Null is returned but a "Boolean" is expected.

See more on https://sonarcloud.io/project/issues?id=apache_ignite&issues=AZ5BQrvkWYXZhVQqAsO7&open=AZ5BQrvkWYXZhVQqAsO7&pullRequest=13157
}

/** {@inheritDoc} */
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -965,14 +965,16 @@ protected IgniteCheckedException concurrentStateChangeError(ClusterState state,

/** {@inheritDoc} */
@Override public void onGridDataReceived(DiscoveryDataBag.GridDiscoveryData data) {
if (data.commonData() instanceof DiscoveryDataClusterState) {
Serializable commonData = data.commonData();

if (commonData instanceof DiscoveryDataClusterState) {
if (globalState != null && globalState.baselineTopology() != null)
//node with BaselineTopology is not allowed to join mixed cluster
// (where some nodes don't support BaselineTopology)
throw new IgniteException("Node with BaselineTopology cannot join" +
" mixed cluster running in compatibility mode");

globalState = (DiscoveryDataClusterState)data.commonData();
globalState = (DiscoveryDataClusterState)commonData;

compatibilityMode = true;

Expand All @@ -981,7 +983,7 @@ protected IgniteCheckedException concurrentStateChangeError(ClusterState state,
return;
}

BaselineStateAndHistoryData stateDiscoData = (BaselineStateAndHistoryData)data.commonData();
BaselineStateAndHistoryData stateDiscoData = (BaselineStateAndHistoryData)commonData;

if (stateDiscoData != null) {
DiscoveryDataClusterState state = stateDiscoData.globalState;
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -540,8 +540,7 @@ private Map<UUID, LocalRoutineInfo> copyLocalInfos(Map<UUID, LocalRoutineInfo> l
@Override public void onGridDataReceived(GridDiscoveryData data) {
if (immutableDiscoCustomMsg) {
if (data.commonData() != null) {
ContinuousRoutinesCommonDiscoveryData commonData =
(ContinuousRoutinesCommonDiscoveryData)data.commonData();
ContinuousRoutinesCommonDiscoveryData commonData = data.commonData();

for (ContinuousRoutineInfo routineInfo : commonData.startedRoutines) {
if (routinesInfo.routineExists(routineInfo.routineId))
Expand All @@ -554,11 +553,11 @@ private Map<UUID, LocalRoutineInfo> copyLocalInfos(Map<UUID, LocalRoutineInfo> l
}
}
else {
Map<UUID, Serializable> nodeSpecData = data.nodeSpecificData();
Map<UUID, DiscoveryData> nodeSpecData = data.nodeSpecificData();

if (nodeSpecData != null) {
for (Map.Entry<UUID, Serializable> e : nodeSpecData.entrySet())
onDiscoveryDataReceivedMutable((DiscoveryData)e.getValue());
for (DiscoveryData val : nodeSpecData.values())
onDiscoveryDataReceivedMutable(val);
}
}
}
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -344,7 +344,7 @@ private final class MappingAcceptedListener implements CustomEventListener<Mappi

/** {@inheritDoc} */
@Override public void onGridDataReceived(GridDiscoveryData data) {
List<Map<Integer, MappedName>> mappings = (List<Map<Integer, MappedName>>)data.commonData();
List<Map<Integer, MappedName>> mappings = data.commonData();

processIncomingMappings(mappings);
}
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -958,7 +958,7 @@ private DistributedMetaStorageKeyValuePair[] localFullData() {
lock.writeLock().lock();

try {
DistributedMetaStorageClusterNodeData nodeData = (DistributedMetaStorageClusterNodeData)data.commonData();
DistributedMetaStorageClusterNodeData nodeData = data.commonData();

if (nodeData != null) {
if (nodeData.fullData != null) {
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -202,17 +202,14 @@ private Serializable getDiscoveryData(UUID joiningNodeId) {

/** {@inheritDoc} */
@Override public void onGridDataReceived(GridDiscoveryData data) {
Map<UUID, Serializable> nodeSpecificData = data.nodeSpecificData();
Map<UUID, Map<String, Serializable>> nodeSpecificData = data.nodeSpecificData();

if (nodeSpecificData != null) {
UUID joiningNodeId = data.joiningNodeId();

for (Serializable v : nodeSpecificData.values()) {
if (v != null) {
Map<String, Serializable> pluginsData = (Map<String, Serializable>)v;

for (Map<String, Serializable> pluginsData : nodeSpecificData.values()) {
if (pluginsData != null)
applyPluginsData(joiningNodeId, pluginsData);
}
}
}
}
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -17,7 +17,6 @@

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

import java.io.Serializable;
import java.util.ArrayList;
import java.util.Collection;
import java.util.Collections;
Expand Down Expand Up @@ -181,9 +180,6 @@
*/
@SuppressWarnings("rawtypes")
public class GridQueryProcessor extends GridProcessorAdapter {
/** */
private static final String INLINE_SIZES_DISCO_BAG_KEY = "inline_sizes";

/** Warn message if some indexes have different inline sizes on the nodes. */
public static final String INLINE_SIZES_DIFFER_WARN_MSG_FORMAT = "Inline sizes on local node and node %s are different. " +
"Please drop and create again these indexes to avoid performance problems with SQL queries. Problem indexes: %s";
Expand Down Expand Up @@ -484,13 +480,8 @@

// We should send inline index sizes information only to server nodes.
if (!dataBag.isJoiningNodeClient()) {
HashMap<String, Serializable> nodeSpecificMap = new HashMap<>();

Serializable oldVal = nodeSpecificMap.put(INLINE_SIZES_DISCO_BAG_KEY, collectSecondaryIndexesInlineSize());

assert oldVal == null : oldVal;

dataBag.addNodeSpecificData(DiscoveryDataExchangeType.QUERY_PROC.ordinal(), nodeSpecificMap);
dataBag.addNodeSpecificData(DiscoveryDataExchangeType.QUERY_PROC.ordinal(),
new InlineSizesData(secondaryIndexesInlineSize()));
}
}

Expand All @@ -499,7 +490,7 @@
Object joiningNodeData = data.joiningNodeData();

if (joiningNodeData instanceof InlineSizesData) {
Map<String, Integer> joiningNodeIndexesInlineSize = ((InlineSizesData)joiningNodeData).sizes;
Map<String, Integer> joiningNodeIndexesInlineSize = ((InlineSizesData)joiningNodeData).sizes();

checkInlineSizes(secondaryIndexesInlineSize(), joiningNodeIndexesInlineSize, data.joiningNodeId());
}
Expand All @@ -514,8 +505,7 @@
/** {@inheritDoc} */
@Override public void onGridDataReceived(DiscoveryDataBag.GridDiscoveryData data) {
// Preserve proposals.
LinkedHashMap<UUID, SchemaProposeDiscoveryMessage> activeProposals =
(LinkedHashMap<UUID, SchemaProposeDiscoveryMessage>)data.commonData();
LinkedHashMap<UUID, SchemaProposeDiscoveryMessage> activeProposals = data.commonData();

Check warning on line 508 in modules/core/src/main/java/org/apache/ignite/internal/processors/query/GridQueryProcessor.java

View check run for this annotation

SonarQubeCloud / SonarCloud Code Analysis

Rename "activeProposals" which hides the field declared at line 241.

See more on https://sonarcloud.io/project/issues?id=apache_ignite&issues=AZ5BQrvEWYXZhVQqAsO5&open=AZ5BQrvEWYXZhVQqAsO5&pullRequest=13157

// Process proposals as if they were received as regular discovery messages.
if (!F.isEmpty(activeProposals)) {
Expand All @@ -525,19 +515,17 @@
}
}

if (!F.isEmpty(data.nodeSpecificData())) {
Map<UUID, InlineSizesData> nodedSpecificData = data.nodeSpecificData();

if (!F.isEmpty(nodedSpecificData)) {
Map<String, Integer> indexesInlineSize = secondaryIndexesInlineSize();

if (!F.isEmpty(indexesInlineSize)) {
for (UUID nodeId : data.nodeSpecificData().keySet()) {
Serializable serializable = data.nodeSpecificData().get(nodeId);

assert serializable instanceof Map : serializable;
for (UUID nodeId : nodedSpecificData.keySet()) {

Check warning on line 524 in modules/core/src/main/java/org/apache/ignite/internal/processors/query/GridQueryProcessor.java

View check run for this annotation

SonarQubeCloud / SonarCloud Code Analysis

Iterate over the "entrySet" instead of the "keySet".

See more on https://sonarcloud.io/project/issues?id=apache_ignite&issues=AZ5BQrvEWYXZhVQqAsO6&open=AZ5BQrvEWYXZhVQqAsO6&pullRequest=13157
InlineSizesData inlineSizesData = nodedSpecificData.get(nodeId);

Map<String, Serializable> nodeSpecificData = (Map<String, Serializable>)serializable;

if (nodeSpecificData.containsKey(INLINE_SIZES_DISCO_BAG_KEY))
checkInlineSizes(indexesInlineSize, (Map<String, Integer>)nodeSpecificData.get(INLINE_SIZES_DISCO_BAG_KEY), nodeId);
if (inlineSizesData != null)
checkInlineSizes(indexesInlineSize, inlineSizesData.sizes(), nodeId);
}
}
}
Expand Down Expand Up @@ -685,16 +673,6 @@
}
}

/**
* @return Serializable information about secondary indexes inline size.
* @see #secondaryIndexesInlineSize()
*/
private Serializable collectSecondaryIndexesInlineSize() {
Map<String, Integer> map = secondaryIndexesInlineSize();

return map instanceof Serializable ? (Serializable)map : new HashMap<>(map);
}

/**
* Process schema propose message from discovery thread.
*
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -36,4 +36,11 @@ public InlineSizesData() {}
public InlineSizesData(Map<String, Integer> sizes) {
this.sizes = sizes;
}

/**
* @return Inline sizes.
*/
public Map<String, Integer> sizes() {
return sizes;
}
}
Original file line number Diff line number Diff line change
Expand Up @@ -389,7 +389,7 @@ private void cancelDeployedServices() {
if (data.commonData() == null)
return;

ServiceProcessorCommonDiscoveryData clusterData = (ServiceProcessorCommonDiscoveryData)data.commonData();
ServiceProcessorCommonDiscoveryData clusterData = data.commonData();

for (ServiceInfo desc : clusterData.registeredServices()) {
try {
Expand Down
Loading
Loading