This is an automated email from the ASF dual-hosted git repository.
shishkovilja pushed a commit to branch master
in repository https://gitbox.apache.org/repos/asf/ignite.git
The following commit(s) were added to refs/heads/master by this push:
new 1639c6eddc3 IGNITE-28787 Use MessageSerializer for
CacheClientReconnectDiscoveryData and CacheJoinNodeDiscoveryData (#13254)
1639c6eddc3 is described below
commit 1639c6eddc30190be82a980d28f4806c033bb1c2
Author: Ilya Shishkov <[email protected]>
AuthorDate: Thu Jul 16 12:13:37 2026 +0300
IGNITE-28787 Use MessageSerializer for CacheClientReconnectDiscoveryData
and CacheJoinNodeDiscoveryData (#13254)
---
.../ignite/internal/CoreMessagesProvider.java | 14 +-
.../cache/CacheClientReconnectDiscoveryData.java | 167 ++-------------------
.../processors/cache/CacheGroupRecoveryState.java | 14 +-
.../internal/processors/cache/CacheJoinInfo.java | 98 ++++++++++++
.../cache/CacheJoinNodeDiscoveryData.java | 156 ++++---------------
.../processors/cache/CacheReconnectInfo.java | 75 +++++++++
.../cache/ClusterCacheGroupRecoveryData.java | 22 +--
.../processors/cache/ClusterCachesInfo.java | 75 ++++-----
.../processors/cache/GridLocalConfigManager.java | 20 +--
.../cache/ValidationOnNodeJoinUtils.java | 2 +-
.../dht/topology/GridDhtPartitionTopologyImpl.java | 4 +-
.../main/resources/META-INF/classnames.properties | 3 -
12 files changed, 286 insertions(+), 364 deletions(-)
diff --git
a/modules/core/src/main/java/org/apache/ignite/internal/CoreMessagesProvider.java
b/modules/core/src/main/java/org/apache/ignite/internal/CoreMessagesProvider.java
index f7330c5a47f..2580a267e32 100644
---
a/modules/core/src/main/java/org/apache/ignite/internal/CoreMessagesProvider.java
+++
b/modules/core/src/main/java/org/apache/ignite/internal/CoreMessagesProvider.java
@@ -54,14 +54,20 @@ import
org.apache.ignite.internal.processors.authentication.UserManagementOperat
import
org.apache.ignite.internal.processors.authentication.UserManagementOperationFinishedMessage;
import
org.apache.ignite.internal.processors.authentication.UserProposedMessage;
import org.apache.ignite.internal.processors.cache.CacheAffinityChangeMessage;
+import
org.apache.ignite.internal.processors.cache.CacheClientReconnectDiscoveryData;
import
org.apache.ignite.internal.processors.cache.CacheConfigurationEnrichment;
import org.apache.ignite.internal.processors.cache.CacheEntryPredicateAdapter;
import org.apache.ignite.internal.processors.cache.CacheEvictionEntry;
+import org.apache.ignite.internal.processors.cache.CacheGroupRecoveryState;
import org.apache.ignite.internal.processors.cache.CacheInvokeDirectResult;
+import org.apache.ignite.internal.processors.cache.CacheJoinInfo;
+import org.apache.ignite.internal.processors.cache.CacheJoinNodeDiscoveryData;
+import org.apache.ignite.internal.processors.cache.CacheReconnectInfo;
import org.apache.ignite.internal.processors.cache.CacheStatisticsClearMessage;
import
org.apache.ignite.internal.processors.cache.CacheStatisticsModeChangeMessage;
import
org.apache.ignite.internal.processors.cache.ClientCacheChangeDiscoveryMessage;
import
org.apache.ignite.internal.processors.cache.ClientCacheChangeDummyDiscoveryMessage;
+import
org.apache.ignite.internal.processors.cache.ClusterCacheGroupRecoveryData;
import org.apache.ignite.internal.processors.cache.DynamicCacheChangeBatch;
import org.apache.ignite.internal.processors.cache.DynamicCacheChangeRequest;
import org.apache.ignite.internal.processors.cache.ExchangeFailureMessage;
@@ -458,6 +464,12 @@ public class CoreMessagesProvider extends
AbstractMarshallableMessageFactoryProv
withNoSchema(CacheStatisticsClearMessage.class);
withNoSchema(ClientCacheChangeDummyDiscoveryMessage.class);
withNoSchema(DynamicCacheChangeBatch.class);
+
withNoSchemaResolvedClassLoader(CacheClientReconnectDiscoveryData.class);
+ withNoSchemaResolvedClassLoader(CacheGroupRecoveryState.class);
+ withNoSchemaResolvedClassLoader(CacheJoinInfo.class);
+ withNoSchemaResolvedClassLoader(CacheJoinNodeDiscoveryData.class);
+ withNoSchemaResolvedClassLoader(CacheReconnectInfo.class);
+ withNoSchemaResolvedClassLoader(ClusterCacheGroupRecoveryData.class);
// [10000 - 10200]: Transaction and lock related messages. Most of
them originally comes from Communication.
msgIdx = 10000;
@@ -529,7 +541,7 @@ public class CoreMessagesProvider extends
AbstractMarshallableMessageFactoryProv
withNoSchema(StartRequestData.class);
withNoSchema(StartRoutineAckDiscoveryMessage.class);
withNoSchema(StartRoutineDiscoveryMessage.class);
- withNoSchema(StoredCacheData.class);
+ withNoSchemaResolvedClassLoader(StoredCacheData.class);
// [10600-10800]: Affinity & partition maps.
msgIdx = 10600;
diff --git
a/modules/core/src/main/java/org/apache/ignite/internal/processors/cache/CacheClientReconnectDiscoveryData.java
b/modules/core/src/main/java/org/apache/ignite/internal/processors/cache/CacheClientReconnectDiscoveryData.java
index 83692fb7520..98f0b746d59 100644
---
a/modules/core/src/main/java/org/apache/ignite/internal/processors/cache/CacheClientReconnectDiscoveryData.java
+++
b/modules/core/src/main/java/org/apache/ignite/internal/processors/cache/CacheClientReconnectDiscoveryData.java
@@ -17,175 +17,30 @@
package org.apache.ignite.internal.processors.cache;
-import java.io.Serializable;
import java.util.Map;
-import org.apache.ignite.configuration.CacheConfiguration;
+import org.apache.ignite.internal.Order;
import org.apache.ignite.internal.util.typedef.internal.S;
-import org.apache.ignite.lang.IgniteUuid;
-
-/**
- * Discovery data sent from client reconnecting to cluster.
- */
-public class CacheClientReconnectDiscoveryData implements Serializable {
- /** */
- private static final long serialVersionUID = 0L;
+import org.apache.ignite.plugin.extensions.communication.Message;
+/** Discovery data sent from client reconnecting to cluster. */
+public class CacheClientReconnectDiscoveryData implements Message {
/** */
- private final Map<Integer, CacheGroupInfo> clientCacheGrps;
+ @Order(0)
+ Map<String, CacheReconnectInfo> clientCaches;
/** */
- private final Map<String, CacheInfo> clientCaches;
+ public CacheClientReconnectDiscoveryData() { }
- /**
- * @param clientCaches Information about caches started on re-joining
client node.
- * @param clientCacheGrps Information about cach groups started on
re-joining client node.
- */
- CacheClientReconnectDiscoveryData(Map<Integer, CacheGroupInfo>
clientCacheGrps,
- Map<String, CacheInfo> clientCaches) {
- this.clientCacheGrps = clientCacheGrps;
+ /** @param clientCaches Information about caches started on re-joining
client node. */
+ CacheClientReconnectDiscoveryData(Map<String, CacheReconnectInfo>
clientCaches) {
this.clientCaches = clientCaches;
}
- /**
- * @return Information about caches started on re-joining client node.
- */
- Map<Integer, CacheGroupInfo> clientCacheGroups() {
- return clientCacheGrps;
- }
-
- /**
- * @return Information about caches started on re-joining client node.
- */
- public Map<String, CacheInfo> clientCaches() {
+ /** @return Information about caches started on re-joining client node. */
+ public Map<String, CacheReconnectInfo> clientCaches() {
return clientCaches;
}
- /**
- *
- */
- static class CacheGroupInfo implements Serializable {
- /** */
- private static final long serialVersionUID = 0L;
-
- /** */
- private final CacheConfiguration ccfg;
-
- /** */
- private final IgniteUuid deploymentId;
-
- /** Flags added for future usage. */
- private final long flags;
-
- /**
- * @param ccfg Cache group configuration.
- * @param deploymentId Cache group deployment ID.
- * @param flags Flags (for future usage).
- */
- CacheGroupInfo(CacheConfiguration ccfg,
- IgniteUuid deploymentId,
- long flags) {
- assert ccfg != null;
- assert deploymentId != null;
-
- this.ccfg = ccfg;
- this.deploymentId = deploymentId;
- this.flags = flags;
- }
-
- /**
- * @return Cache group configuration.
- */
- CacheConfiguration config() {
- return ccfg;
- }
-
- /**
- * @return Cache group deployment ID.
- */
- IgniteUuid deploymentId() {
- return deploymentId;
- }
- }
-
- /**
- *
- */
- static class CacheInfo implements Serializable {
- /** */
- private static final long serialVersionUID = 0L;
-
- /** */
- private final CacheConfiguration ccfg;
-
- /** */
- private final CacheType cacheType;
-
- /** */
- private final IgniteUuid deploymentId;
-
- /** */
- private final boolean nearCache;
-
- /** Flags added for future usage. */
- private final long flags;
-
- /**
- * @param ccfg Cache configuration.
- * @param cacheType Cache type.
- * @param deploymentId Cache deployment ID.
- * @param nearCache Near cache flag.
- * @param flags Flags (for future usage).
- */
- CacheInfo(CacheConfiguration ccfg,
- CacheType cacheType,
- IgniteUuid deploymentId,
- boolean nearCache,
- long flags) {
- assert ccfg != null;
- assert cacheType != null;
- assert deploymentId != null;
-
- this.ccfg = ccfg;
- this.cacheType = cacheType;
- this.deploymentId = deploymentId;
- this.nearCache = nearCache;
- this.flags = flags;
- }
-
- /**
- * @return Cache configuration.
- */
- CacheConfiguration config() {
- return ccfg;
- }
-
- /**
- * @return Cache type.
- */
- CacheType cacheType() {
- return cacheType;
- }
-
- /**
- * @return Cache deployment ID.
- */
- IgniteUuid deploymentId() {
- return deploymentId;
- }
-
- /**
- * @return Near cache flag.
- */
- boolean nearCache() {
- return nearCache;
- }
-
- /** {@inheritDoc} */
- @Override public String toString() {
- return S.toString(CacheInfo.class, this);
- }
- }
-
/** {@inheritDoc} */
@Override public String toString() {
return S.toString(CacheClientReconnectDiscoveryData.class, this);
diff --git
a/modules/core/src/main/java/org/apache/ignite/internal/processors/cache/CacheGroupRecoveryState.java
b/modules/core/src/main/java/org/apache/ignite/internal/processors/cache/CacheGroupRecoveryState.java
index 880fa09b21c..3cd4e77ea04 100644
---
a/modules/core/src/main/java/org/apache/ignite/internal/processors/cache/CacheGroupRecoveryState.java
+++
b/modules/core/src/main/java/org/apache/ignite/internal/processors/cache/CacheGroupRecoveryState.java
@@ -25,19 +25,23 @@ import java.util.Arrays;
import java.util.Collections;
import java.util.Set;
import java.util.stream.Collectors;
+import org.apache.ignite.internal.Order;
import
org.apache.ignite.internal.processors.cache.distributed.dht.topology.GridDhtPartitionTopology;
import org.apache.ignite.internal.util.typedef.internal.U;
+import org.apache.ignite.plugin.extensions.communication.Message;
/** */
-public class CacheGroupRecoveryState implements Externalizable {
+public class CacheGroupRecoveryState implements Externalizable, Message {
/** */
private static final long serialVersionUID = 0L;
/** */
- private Set<Integer> lostParts;
+ @Order(0)
+ Set<Integer> lostParts;
/** */
- private Set<Integer> zeroParts;
+ @Order(1)
+ Set<Integer> zeroParts;
/** */
public CacheGroupRecoveryState() {
@@ -53,12 +57,12 @@ public class CacheGroupRecoveryState implements
Externalizable {
}
/** */
- public Set<Integer> zeroUpdateCounterParititons() {
+ public Set<Integer> zeroUpdateCounterPartitions() {
return Collections.unmodifiableSet(zeroParts);
}
/** */
- public Set<Integer> lostParititons() {
+ public Set<Integer> lostPartitions() {
return Collections.unmodifiableSet(lostParts);
}
diff --git
a/modules/core/src/main/java/org/apache/ignite/internal/processors/cache/CacheJoinInfo.java
b/modules/core/src/main/java/org/apache/ignite/internal/processors/cache/CacheJoinInfo.java
new file mode 100644
index 00000000000..b1151d5a62a
--- /dev/null
+++
b/modules/core/src/main/java/org/apache/ignite/internal/processors/cache/CacheJoinInfo.java
@@ -0,0 +1,98 @@
+/*
+ * 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.cache;
+
+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;
+
+/** Cache information exchanged during node join. */
+public class CacheJoinInfo implements Message {
+ /** */
+ @Order(0)
+ @GridToStringInclude
+ StoredCacheData cacheData;
+
+ /** */
+ @Order(1)
+ @GridToStringInclude
+ CacheType cacheType;
+
+ /** */
+ @Order(2)
+ @GridToStringInclude
+ boolean sql;
+
+ /** Flags added for future usage. */
+ @Order(3)
+ long flags;
+
+ /** Statically configured flag. */
+ @Order(4)
+ boolean staticallyConfigured;
+
+ /** */
+ public CacheJoinInfo() { }
+
+ /**
+ * @param cacheData Cache data.
+ * @param cacheType Cache type.
+ * @param sql SQL flag - {@code true} if cache was created with {@code
CREATE TABLE}.
+ * @param flags Flags (for future usage).
+ * @param staticallyConfigured {@code true} if it was configured by static
config and {@code false} otherwise.
+ */
+ public CacheJoinInfo(StoredCacheData cacheData, CacheType cacheType,
boolean sql, long flags,
+ boolean staticallyConfigured) {
+ this.cacheData = cacheData;
+ this.cacheType = cacheType;
+ this.sql = sql;
+ this.flags = flags;
+ this.staticallyConfigured = staticallyConfigured;
+ }
+
+ /** @return Cache data. */
+ public StoredCacheData cacheData() {
+ return cacheData;
+ }
+
+ /** @return Cache type. */
+ public CacheType cacheType() {
+ return cacheType;
+ }
+
+ /** @return SQL flag - {@code true} if cache was created with {@code
CREATE TABLE}. */
+ public boolean sql() {
+ return sql;
+ }
+
+ /** @return {@code true} if it was configured by static config and {@code
false} otherwise. */
+ public boolean isStaticallyConfigured() {
+ return staticallyConfigured;
+ }
+
+ /** @return Long which bits represent some flags. */
+ public long getFlags() {
+ return flags;
+ }
+
+ /** {@inheritDoc} */
+ @Override public String toString() {
+ return S.toString(CacheJoinInfo.class, this);
+ }
+}
diff --git
a/modules/core/src/main/java/org/apache/ignite/internal/processors/cache/CacheJoinNodeDiscoveryData.java
b/modules/core/src/main/java/org/apache/ignite/internal/processors/cache/CacheJoinNodeDiscoveryData.java
index 700d5166608..e36c193ddeb 100644
---
a/modules/core/src/main/java/org/apache/ignite/internal/processors/cache/CacheJoinNodeDiscoveryData.java
+++
b/modules/core/src/main/java/org/apache/ignite/internal/processors/cache/CacheJoinNodeDiscoveryData.java
@@ -17,39 +17,41 @@
package org.apache.ignite.internal.processors.cache;
-import java.io.IOException;
-import java.io.ObjectInputStream;
-import java.io.Serializable;
import java.util.Map;
+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.lang.IgniteUuid;
+import org.apache.ignite.plugin.extensions.communication.Message;
import org.jetbrains.annotations.Nullable;
-/**
- * Information about configured caches sent from joining node.
- */
-public class CacheJoinNodeDiscoveryData implements Serializable {
+/** Information about configured caches sent from joining node. */
+public class CacheJoinNodeDiscoveryData implements Message {
/** */
- private static final long serialVersionUID = 0L;
+ @Order(0)
+ @GridToStringInclude
+ Map<String, CacheJoinInfo> caches;
/** */
+ @Order(1)
@GridToStringInclude
- private final Map<String, CacheInfo> caches;
+ Map<String, CacheJoinInfo> templates;
/** */
+ @Order(2)
@GridToStringInclude
- private final Map<String, CacheInfo> templates;
+ IgniteUuid cacheDeploymentId;
/** */
- @GridToStringInclude
- private final IgniteUuid cacheDeploymentId;
+ @Order(3)
+ boolean startCaches;
/** */
- private final boolean startCaches;
+ @Order(4)
+ @Nullable ClusterCacheGroupRecoveryData clusterCacheGrpRecoveryData;
/** */
- @Nullable private ClusterCacheGroupRecoveryData
clusterCacheGroupRecoveryData;
+ public CacheJoinNodeDiscoveryData() { }
/**
* @param cacheDeploymentId Deployment ID for started caches.
@@ -59,8 +61,8 @@ public class CacheJoinNodeDiscoveryData implements
Serializable {
*/
public CacheJoinNodeDiscoveryData(
IgniteUuid cacheDeploymentId,
- Map<String, CacheJoinNodeDiscoveryData.CacheInfo> caches,
- Map<String, CacheJoinNodeDiscoveryData.CacheInfo> templates,
+ Map<String, CacheJoinInfo> caches,
+ Map<String, CacheJoinInfo> templates,
boolean startCaches
) {
this.cacheDeploymentId = cacheDeploymentId;
@@ -69,138 +71,34 @@ public class CacheJoinNodeDiscoveryData implements
Serializable {
this.startCaches = startCaches;
}
- /**
- * @return {@code True} if required to start all caches on joining node.
- */
+ /** @return {@code True} if required to start all caches on joining node.
*/
boolean startCaches() {
return startCaches;
}
- /**
- * @return Deployment ID assigned on joining node.
- */
+ /** @return Deployment ID assigned on joining node. */
public IgniteUuid cacheDeploymentId() {
return cacheDeploymentId;
}
- /**
- * @return Templates configured on joining node.
- */
- public Map<String, CacheInfo> templates() {
+ /** @return Templates configured on joining node. */
+ public Map<String, CacheJoinInfo> templates() {
return templates;
}
- /**
- * @return Caches configured on joining node.
- */
- public Map<String, CacheInfo> caches() {
+ /** @return Caches configured on joining node. */
+ public Map<String, CacheJoinInfo> caches() {
return caches;
}
/** */
- public void clusterCacheGroupRecoveryData(@Nullable
ClusterCacheGroupRecoveryData clusterCacheGroupRecoveryData) {
- this.clusterCacheGroupRecoveryData = clusterCacheGroupRecoveryData;
+ public void clusterCacheGroupRecoveryData(@Nullable
ClusterCacheGroupRecoveryData clusterCacheGrpRecoveryData) {
+ this.clusterCacheGrpRecoveryData = clusterCacheGrpRecoveryData;
}
/** */
@Nullable public ClusterCacheGroupRecoveryData
clusterCacheGroupRecoveryData() {
- return clusterCacheGroupRecoveryData;
- }
-
- /**
- *
- */
- public static class CacheInfo implements Serializable {
- /** */
- private static final long serialVersionUID = 0L;
-
- /** */
- @GridToStringInclude
- private StoredCacheData cacheData;
-
- /** */
- @GridToStringInclude
- private CacheType cacheType;
-
- /** */
- @GridToStringInclude
- private boolean sql;
-
- /** Flags added for future usage. */
- private long flags;
-
- /** Statically configured flag */
- private boolean staticallyConfigured;
-
- /**
- * @param cacheData Cache data.
- * @param cacheType Cache type.
- * @param sql SQL flag - {@code true} if cache was created with {@code
CREATE TABLE}.
- * @param flags Flags (for future usage).
- * @param staticallyConfigured {@code true} if it was configured by
static config and {@code false} otherwise.
- */
- public CacheInfo(StoredCacheData cacheData, CacheType cacheType,
boolean sql, long flags,
- boolean staticallyConfigured) {
- this.cacheData = cacheData;
- this.cacheType = cacheType;
- this.sql = sql;
- this.flags = flags;
- this.staticallyConfigured = staticallyConfigured;
- }
-
- /**
- * @return Cache data.
- */
- public StoredCacheData cacheData() {
- return cacheData;
- }
-
- /**
- * @return Cache type.
- */
- public CacheType cacheType() {
- return cacheType;
- }
-
- /**
- * @return SQL flag - {@code true} if cache was created with {@code
CREATE TABLE}.
- */
- public boolean sql() {
- return sql;
- }
-
- /**
- * @return {@code true} if it was configured by static config and
{@code false} otherwise.
- */
- public boolean isStaticallyConfigured() {
- return staticallyConfigured;
- }
-
- /**
- * @return Long which bits represent some flags.
- */
- public long getFlags() {
- return flags;
- }
-
- /**
- * @param ois ObjectInputStream.
- */
- private void readObject(ObjectInputStream ois)
- throws IOException, ClassNotFoundException {
- ObjectInputStream.GetField gf = ois.readFields();
-
- cacheData = (StoredCacheData)gf.get("cacheData", null);
- cacheType = (CacheType)gf.get("cacheType", null);
- sql = gf.get("sql", false);
- flags = gf.get("flags", 0L);
- staticallyConfigured = gf.get("staticallyConfigured", true);
- }
-
- /** {@inheritDoc} */
- @Override public String toString() {
- return S.toString(CacheInfo.class, this);
- }
+ return clusterCacheGrpRecoveryData;
}
/** {@inheritDoc} */
diff --git
a/modules/core/src/main/java/org/apache/ignite/internal/processors/cache/CacheReconnectInfo.java
b/modules/core/src/main/java/org/apache/ignite/internal/processors/cache/CacheReconnectInfo.java
new file mode 100644
index 00000000000..ad9453a0e7d
--- /dev/null
+++
b/modules/core/src/main/java/org/apache/ignite/internal/processors/cache/CacheReconnectInfo.java
@@ -0,0 +1,75 @@
+/*
+ * 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.cache;
+
+import org.apache.ignite.internal.Order;
+import org.apache.ignite.internal.util.typedef.internal.S;
+import org.apache.ignite.lang.IgniteUuid;
+import org.apache.ignite.plugin.extensions.communication.Message;
+
+/** Cache information from a reconnecting client node. */
+public class CacheReconnectInfo implements Message {
+ /** */
+ @Order(0)
+ String cacheName;
+
+ /** */
+ @Order(1)
+ IgniteUuid deploymentId;
+
+ /** */
+ @Order(2)
+ boolean nearCache;
+
+ /** */
+ public CacheReconnectInfo() { }
+
+ /**
+ * @param cacheName Cache name.
+ * @param deploymentId Cache deployment ID.
+ * @param nearCache Near cache flag.
+ */
+ public CacheReconnectInfo(String cacheName, IgniteUuid deploymentId,
boolean nearCache) {
+ assert cacheName != null;
+ assert deploymentId != null;
+
+ this.cacheName = cacheName;
+ this.deploymentId = deploymentId;
+ this.nearCache = nearCache;
+ }
+
+ /** @return Cache configuration. */
+ String cacheName() {
+ return cacheName;
+ }
+
+ /** @return Cache deployment ID. */
+ IgniteUuid deploymentId() {
+ return deploymentId;
+ }
+
+ /** @return Near cache flag. */
+ boolean nearCache() {
+ return nearCache;
+ }
+
+ /** {@inheritDoc} */
+ @Override public String toString() {
+ return S.toString(CacheReconnectInfo.class, this);
+ }
+}
diff --git
a/modules/core/src/main/java/org/apache/ignite/internal/processors/cache/ClusterCacheGroupRecoveryData.java
b/modules/core/src/main/java/org/apache/ignite/internal/processors/cache/ClusterCacheGroupRecoveryData.java
index 0d71593378a..6cf7f44053e 100644
---
a/modules/core/src/main/java/org/apache/ignite/internal/processors/cache/ClusterCacheGroupRecoveryData.java
+++
b/modules/core/src/main/java/org/apache/ignite/internal/processors/cache/ClusterCacheGroupRecoveryData.java
@@ -24,19 +24,23 @@ import java.io.ObjectOutput;
import java.util.Collection;
import java.util.Map;
import java.util.stream.Collectors;
+import org.apache.ignite.internal.Order;
import org.apache.ignite.internal.util.typedef.internal.U;
+import org.apache.ignite.plugin.extensions.communication.Message;
import org.jetbrains.annotations.Nullable;
/** */
-public class ClusterCacheGroupRecoveryData implements Externalizable {
+public class ClusterCacheGroupRecoveryData implements Externalizable, Message {
/** */
private static final long serialVersionUID = 0L;
/** */
- private long clusterBaselineTopologyVersion;
+ @Order(0)
+ long clusterBaselineTopVer;
/** */
- private Map<Integer, CacheGroupRecoveryState> grpStates;
+ @Order(1)
+ Map<Integer, CacheGroupRecoveryState> grpStates;
/** */
public ClusterCacheGroupRecoveryData() {
@@ -44,14 +48,14 @@ public class ClusterCacheGroupRecoveryData implements
Externalizable {
}
/** */
- public ClusterCacheGroupRecoveryData(long clusterBaselineTopologyVersion,
Collection<CacheGroupContext> grps) {
- this.clusterBaselineTopologyVersion = clusterBaselineTopologyVersion;
- this.grpStates =
grps.stream().collect(Collectors.toMap(CacheGroupContext::groupId,
CacheGroupRecoveryState::new));
+ public ClusterCacheGroupRecoveryData(long clusterBaselineTopVer,
Collection<CacheGroupContext> grps) {
+ this.clusterBaselineTopVer = clusterBaselineTopVer;
+ grpStates =
grps.stream().collect(Collectors.toMap(CacheGroupContext::groupId,
CacheGroupRecoveryState::new));
}
/** */
public boolean isMoreRelevantThan(ClusterCacheGroupRecoveryData data) {
- return clusterBaselineTopologyVersion >
data.clusterBaselineTopologyVersion;
+ return clusterBaselineTopVer > data.clusterBaselineTopVer;
}
/** */
@@ -61,13 +65,13 @@ public class ClusterCacheGroupRecoveryData implements
Externalizable {
/** {@inheritDoc} */
@Override public void writeExternal(ObjectOutput out) throws IOException {
- out.writeLong(clusterBaselineTopologyVersion);
+ out.writeLong(clusterBaselineTopVer);
U.writeMap(out, grpStates);
}
/** {@inheritDoc} */
@Override public void readExternal(ObjectInput in) throws IOException,
ClassNotFoundException {
- clusterBaselineTopologyVersion = in.readLong();
+ clusterBaselineTopVer = in.readLong();
grpStates = U.readHashMap(in);
}
}
diff --git
a/modules/core/src/main/java/org/apache/ignite/internal/processors/cache/ClusterCachesInfo.java
b/modules/core/src/main/java/org/apache/ignite/internal/processors/cache/ClusterCachesInfo.java
index d5c7d8dce25..a9101902b22 100644
---
a/modules/core/src/main/java/org/apache/ignite/internal/processors/cache/ClusterCachesInfo.java
+++
b/modules/core/src/main/java/org/apache/ignite/internal/processors/cache/ClusterCachesInfo.java
@@ -18,7 +18,6 @@
package org.apache.ignite.internal.processors.cache;
import java.io.File;
-import java.io.Serializable;
import java.nio.file.InvalidPathException;
import java.util.ArrayList;
import java.util.Arrays;
@@ -82,6 +81,7 @@ import org.apache.ignite.lang.IgniteUuid;
import org.apache.ignite.plugin.CachePluginContext;
import org.apache.ignite.plugin.CachePluginProvider;
import org.apache.ignite.plugin.PluginProvider;
+import org.apache.ignite.plugin.extensions.communication.Message;
import org.apache.ignite.spi.discovery.DiscoveryDataBag;
import org.apache.ignite.spi.systemview.view.CacheGroupView;
import org.apache.ignite.spi.systemview.view.CacheView;
@@ -301,7 +301,7 @@ public class ClusterCachesInfo {
Map<String, CacheConfiguration> grpCfgs = new HashMap<>();
- for (CacheJoinNodeDiscoveryData.CacheInfo info :
joinDiscoData.caches().values()) {
+ for (CacheJoinInfo info : joinDiscoData.caches().values()) {
if (info.cacheData().config().getGroupName() == null)
continue;
@@ -330,7 +330,7 @@ public class ClusterCachesInfo {
if (gridData != null && gridData.joinDiscoData != null) {
CacheJoinNodeDiscoveryData joinDiscoData = gridData.joinDiscoData;
- for (CacheJoinNodeDiscoveryData.CacheInfo locCacheInfo :
joinDiscoData.caches().values()) {
+ for (CacheJoinInfo locCacheInfo : joinDiscoData.caches().values())
{
CacheConfiguration locCfg = locCacheInfo.cacheData().config();
CacheData cacheData =
gridData.gridData.caches().get(locCfg.getName());
@@ -388,7 +388,7 @@ public class ClusterCachesInfo {
* @throws IgniteCheckedException If check failed.
*/
@SuppressWarnings("unchecked")
- private void checkCache(CacheJoinNodeDiscoveryData.CacheInfo locInfo,
CacheData rmtData, UUID rmt)
+ private void checkCache(CacheJoinInfo locInfo, CacheData rmtData, UUID rmt)
throws IgniteCheckedException {
GridCacheAttributes rmtAttr = new
GridCacheAttributes(rmtData.cacheConfiguration(),
rmtData.cacheConfigurationEnrichment());
GridCacheAttributes locAttr =
@@ -1277,37 +1277,22 @@ public class ClusterCachesInfo {
/**
* @return Discovery date sent on local node join.
*/
- private Serializable joinDiscoveryData() {
+ private Message joinDiscoveryData() {
if (cachesOnDisconnect != null) {
- Map<Integer, CacheClientReconnectDiscoveryData.CacheGroupInfo>
cacheGrpsInfo = new HashMap<>();
- Map<String, CacheClientReconnectDiscoveryData.CacheInfo>
cachesInfo = new HashMap<>();
+ Map<String, CacheReconnectInfo> cachesInfo = new HashMap<>();
- Map<Integer, CacheGroupDescriptor> grps =
cachesOnDisconnect.cacheGrps;
Map<String, DynamicCacheDescriptor> caches =
cachesOnDisconnect.caches;
- for (CacheGroupContext grp : ctx.cache().cacheGroups()) {
- CacheGroupDescriptor desc = grps.get(grp.groupId());
-
- assert desc != null : grp.cacheOrGroupName();
-
- cacheGrpsInfo.put(grp.groupId(), new
CacheClientReconnectDiscoveryData.CacheGroupInfo(desc.config(),
- desc.deploymentId(),
- 0));
- }
-
- for (IgniteInternalCache cache : ctx.cache().caches()) {
+ for (IgniteInternalCache<?, ?> cache : ctx.cache().caches()) {
DynamicCacheDescriptor desc = caches.get(cache.name());
assert desc != null : cache.name();
- cachesInfo.put(cache.name(), new
CacheClientReconnectDiscoveryData.CacheInfo(desc.cacheConfiguration(),
- desc.cacheType(),
- desc.deploymentId(),
- cache.context().isNear(),
- 0));
+ cachesInfo.put(cache.name(), new
CacheReconnectInfo(desc.cacheConfiguration().getName(),
+ desc.deploymentId(), cache.context().isNear()));
}
- return new CacheClientReconnectDiscoveryData(cacheGrpsInfo,
cachesInfo);
+ return new CacheClientReconnectDiscoveryData(cachesInfo);
}
else {
assert joinDiscoData != null;
@@ -1539,7 +1524,7 @@ public class ClusterCachesInfo {
String conflictErr = null;
if (joinDiscoData != null) {
- for (Map.Entry<String, CacheJoinNodeDiscoveryData.CacheInfo> e :
joinDiscoData.caches().entrySet()) {
+ for (Map.Entry<String, CacheJoinInfo> e :
joinDiscoData.caches().entrySet()) {
if (!registeredCaches.containsKey(e.getKey())) {
conflictErr =
checkCacheConflict(e.getValue().cacheData().config(), true);
@@ -1811,7 +1796,7 @@ public class ClusterCachesInfo {
if (joinDiscoData == null)
return Collections.emptyList();
- CacheJoinNodeDiscoveryData.CacheInfo cacheInfo =
joinDiscoData.caches().get(cacheName);
+ CacheJoinInfo cacheInfo = joinDiscoData.caches().get(cacheName);
if (cacheInfo == null)
return Collections.emptyList();
@@ -1848,7 +1833,7 @@ public class ClusterCachesInfo {
if (reconnect && surviveReconnect(cfg.getName()) &&
cachesOnDisconnect.state.active() && active)
continue;
- CacheJoinNodeDiscoveryData.CacheInfo locCfg =
joinDiscoData.caches().get(cfg.getName());
+ CacheJoinInfo locCfg =
joinDiscoData.caches().get(cfg.getName());
NearCacheConfiguration nearCfg = null;
@@ -2037,20 +2022,18 @@ public class ClusterCachesInfo {
*/
public void
onJoiningNodeDataReceived(DiscoveryDataBag.JoiningNodeDiscoveryData data) {
if (data.hasJoiningNodeData()) {
- Serializable joiningNodeData = data.joiningNodeData();
-
- if (joiningNodeData instanceof CacheClientReconnectDiscoveryData) {
+ if (data.joiningNodeData() instanceof
CacheClientReconnectDiscoveryData reconData) {
if (disconnectedState()) {
if (clientReconnectReqs == null)
clientReconnectReqs = new LinkedHashMap<>();
- clientReconnectReqs.put(data.joiningNodeId(),
(CacheClientReconnectDiscoveryData)joiningNodeData);
+ clientReconnectReqs.put(data.joiningNodeId(), reconData);
}
else
-
processClientReconnectData((CacheClientReconnectDiscoveryData)joiningNodeData,
data.joiningNodeId());
+ processClientReconnectData(reconData,
data.joiningNodeId());
}
- else if (joiningNodeData instanceof CacheJoinNodeDiscoveryData)
-
processJoiningNode((CacheJoinNodeDiscoveryData)joiningNodeData,
data.joiningNodeId(), false);
+ else if (data.joiningNodeData() instanceof
CacheJoinNodeDiscoveryData joinData)
+ processJoiningNode(joinData, data.joiningNodeId(), false);
}
}
@@ -2061,15 +2044,11 @@ public class ClusterCachesInfo {
*/
public String
validateJoiningNodeData(DiscoveryDataBag.JoiningNodeDiscoveryData data, boolean
joiningNodeClient) {
if (data.hasJoiningNodeData()) {
- Serializable joiningNodeData = data.joiningNodeData();
-
- if (joiningNodeData instanceof CacheJoinNodeDiscoveryData) {
- CacheJoinNodeDiscoveryData joinData =
(CacheJoinNodeDiscoveryData)joiningNodeData;
-
+ if (data.joiningNodeData() instanceof CacheJoinNodeDiscoveryData
joinData) {
Set<String> problemCaches = null;
Set<String> encClientCaches = null;
- for (CacheJoinNodeDiscoveryData.CacheInfo cacheInfo :
joinData.caches().values()) {
+ for (CacheJoinInfo cacheInfo : joinData.caches().values()) {
CacheConfiguration<?, ?> cfg =
cacheInfo.cacheData().config();
if (!registeredCaches.containsKey(cfg.getName())) {
@@ -2125,16 +2104,16 @@ public class ClusterCachesInfo {
DiscoveryDataClusterState state = ctx.state().clusterState();
if (state.state().active() && !state.transition()) {
- for (CacheClientReconnectDiscoveryData.CacheInfo cacheInfo :
clientData.clientCaches().values()) {
- String cacheName = cacheInfo.config().getName();
+ for (CacheReconnectInfo cacheReconnectInfo :
clientData.clientCaches().values()) {
+ String cacheName = cacheReconnectInfo.cacheName();
if (surviveReconnect(cacheName))
ctx.discovery().addClientNode(cacheName, clientNodeId,
false);
else {
DynamicCacheDescriptor desc =
registeredCaches.get(cacheName);
- if (desc != null &&
desc.deploymentId().equals(cacheInfo.deploymentId()))
- ctx.discovery().addClientNode(cacheName, clientNodeId,
cacheInfo.nearCache());
+ if (desc != null &&
desc.deploymentId().equals(cacheReconnectInfo.deploymentId()))
+ ctx.discovery().addClientNode(cacheName, clientNodeId,
cacheReconnectInfo.nearCache());
}
}
}
@@ -2216,7 +2195,7 @@ public class ClusterCachesInfo {
boolean hasSchemaPatchConflict = false;
boolean active = ctx.state().clusterState().active();
- for (CacheJoinNodeDiscoveryData.CacheInfo cacheInfo :
joinData.caches().values()) {
+ for (CacheJoinInfo cacheInfo : joinData.caches().values()) {
CacheConfiguration<?, ?> cfg = cacheInfo.cacheData().config();
if (!registeredCaches.containsKey(cfg.getName())) {
@@ -2278,7 +2257,7 @@ public class ClusterCachesInfo {
private void registerNewCache(
CacheJoinNodeDiscoveryData joinData,
UUID nodeId,
- CacheJoinNodeDiscoveryData.CacheInfo cacheInfo
+ CacheJoinInfo cacheInfo
) {
CacheConfiguration<?, ?> cfg = cacheInfo.cacheData().config();
@@ -2345,7 +2324,7 @@ public class ClusterCachesInfo {
* @param nodeId Joining node id.
*/
private void registerNewCacheTemplates(CacheJoinNodeDiscoveryData
joinData, UUID nodeId) {
- for (CacheJoinNodeDiscoveryData.CacheInfo cacheInfo :
joinData.templates().values()) {
+ for (CacheJoinInfo cacheInfo : joinData.templates().values()) {
CacheConfiguration<?, ?> cfg = cacheInfo.cacheData().config();
if (!registeredTemplates.containsKey(cfg.getName())) {
diff --git
a/modules/core/src/main/java/org/apache/ignite/internal/processors/cache/GridLocalConfigManager.java
b/modules/core/src/main/java/org/apache/ignite/internal/processors/cache/GridLocalConfigManager.java
index 24ec163584f..324849ec7af 100644
---
a/modules/core/src/main/java/org/apache/ignite/internal/processors/cache/GridLocalConfigManager.java
+++
b/modules/core/src/main/java/org/apache/ignite/internal/processors/cache/GridLocalConfigManager.java
@@ -354,9 +354,9 @@ public class GridLocalConfigManager {
* @throws IgniteCheckedException If failed.
*/
public CacheJoinNodeDiscoveryData restoreCacheConfigurations() throws
IgniteCheckedException {
- Map<String, CacheJoinNodeDiscoveryData.CacheInfo> caches = new
HashMap<>();
+ Map<String, CacheJoinInfo> caches = new HashMap<>();
- Map<String, CacheJoinNodeDiscoveryData.CacheInfo> templates = new
HashMap<>();
+ Map<String, CacheJoinInfo> templates = new HashMap<>();
restoreCaches(caches, templates, ctx.config());
@@ -488,8 +488,8 @@ public class GridLocalConfigManager {
* @param igniteCfg Ignite configuration.
*/
private void restoreCaches(
- Map<String, CacheJoinNodeDiscoveryData.CacheInfo> caches,
- Map<String, CacheJoinNodeDiscoveryData.CacheInfo> templates,
+ Map<String, CacheJoinInfo> caches,
+ Map<String, CacheJoinInfo> templates,
IgniteConfiguration igniteCfg
) throws IgniteCheckedException {
CacheConfiguration[] cfgs = igniteCfg.getCacheConfiguration();
@@ -567,7 +567,7 @@ public class GridLocalConfigManager {
* @param isStaticallyConfigured Statically configured flag.
*/
private void addStoredCache(
- Map<String, CacheJoinNodeDiscoveryData.CacheInfo> caches,
+ Map<String, CacheJoinInfo> caches,
StoredCacheData cacheData,
String cacheName,
CacheType cacheType,
@@ -581,7 +581,7 @@ public class GridLocalConfigManager {
stopSeq.addFirst(cacheName);
}
- caches.put(cacheName, new
CacheJoinNodeDiscoveryData.CacheInfo(cacheData, cacheType, cacheData.sql(),
+ caches.put(cacheName, new CacheJoinInfo(cacheData, cacheType,
cacheData.sql(),
persistedBefore ? 1 : 0, isStaticallyConfigured));
}
@@ -595,8 +595,8 @@ public class GridLocalConfigManager {
private void addCacheFromConfiguration(
CacheConfiguration<?, ?> cfg,
boolean sql,
- Map<String, CacheJoinNodeDiscoveryData.CacheInfo> caches,
- Map<String, CacheJoinNodeDiscoveryData.CacheInfo> templates
+ Map<String, CacheJoinInfo> caches,
+ Map<String, CacheJoinInfo> templates
) throws IgniteCheckedException {
String cacheName = cfg.getName();
@@ -604,7 +604,7 @@ public class GridLocalConfigManager {
Collection<CacheConfiguration<?, ?>> ccfgs = new
ArrayList<>(caches.size());
- for (CacheJoinNodeDiscoveryData.CacheInfo cacheInfo : caches.values())
+ for (CacheJoinInfo cacheInfo : caches.values())
ccfgs.add(cacheInfo.cacheData().config());
String err = validateIncomingConfiguration(ccfgs, cfg);
@@ -631,7 +631,7 @@ public class GridLocalConfigManager {
cfg = splitCfg.get1();
if (GridCacheUtils.isCacheTemplateName(cacheName))
- templates.put(cacheName, new
CacheJoinNodeDiscoveryData.CacheInfo(cacheData, CacheType.USER, false, 0,
true));
+ templates.put(cacheName, new CacheJoinInfo(cacheData,
CacheType.USER, false, 0, true));
else {
if (caches.containsKey(cacheName)) {
throw new IgniteCheckedException("Duplicate cache name found
(check configuration and " +
diff --git
a/modules/core/src/main/java/org/apache/ignite/internal/processors/cache/ValidationOnNodeJoinUtils.java
b/modules/core/src/main/java/org/apache/ignite/internal/processors/cache/ValidationOnNodeJoinUtils.java
index 16ea96c3cf4..4e039917c83 100644
---
a/modules/core/src/main/java/org/apache/ignite/internal/processors/cache/ValidationOnNodeJoinUtils.java
+++
b/modules/core/src/main/java/org/apache/ignite/internal/processors/cache/ValidationOnNodeJoinUtils.java
@@ -156,7 +156,7 @@ public class ValidationOnNodeJoinUtils {
}
}
- for (CacheJoinNodeDiscoveryData.CacheInfo cacheInfo :
nodeData.caches().values()) {
+ for (CacheJoinInfo cacheInfo : nodeData.caches().values()) {
if (secCtx != null && cacheInfo.cacheType() == CacheType.USER)
{
try (Scope ignored = ctx.security().withContext(secCtx)) {
GridCacheProcessor.authorizeCacheCreate(ctx.security(),
cacheInfo.cacheData().config());
diff --git
a/modules/core/src/main/java/org/apache/ignite/internal/processors/cache/distributed/dht/topology/GridDhtPartitionTopologyImpl.java
b/modules/core/src/main/java/org/apache/ignite/internal/processors/cache/distributed/dht/topology/GridDhtPartitionTopologyImpl.java
index 5c651e8e7ad..afbb0c191f6 100644
---
a/modules/core/src/main/java/org/apache/ignite/internal/processors/cache/distributed/dht/topology/GridDhtPartitionTopologyImpl.java
+++
b/modules/core/src/main/java/org/apache/ignite/internal/processors/cache/distributed/dht/topology/GridDhtPartitionTopologyImpl.java
@@ -3260,12 +3260,12 @@ public class GridDhtPartitionTopologyImpl implements
GridDhtPartitionTopology {
/** */
private void restoreLostPartitions(CacheGroupRecoveryState grpState) {
- grpState.lostParititons().forEach(this::registerLostPartition);
+ grpState.lostPartitions().forEach(this::registerLostPartition);
}
/** */
private void detectPartitionLossDuringInactivity(CacheGroupRecoveryState
grpState) {
- Set<Integer> recoveryZeroParts =
grpState.zeroUpdateCounterParititons();
+ Set<Integer> recoveryZeroParts =
grpState.zeroUpdateCounterPartitions();
Set<Integer> detectedLostParts = new HashSet<>();
diff --git a/modules/core/src/main/resources/META-INF/classnames.properties
b/modules/core/src/main/resources/META-INF/classnames.properties
index 431e7ee68b9..91b37c246ef 100644
--- a/modules/core/src/main/resources/META-INF/classnames.properties
+++ b/modules/core/src/main/resources/META-INF/classnames.properties
@@ -796,8 +796,6 @@
org.apache.ignite.internal.processors.cache.CacheAffinitySharedManager$7
org.apache.ignite.internal.processors.cache.CacheAffinitySharedManager$8
org.apache.ignite.internal.processors.cache.CacheAffinitySharedManager$9
org.apache.ignite.internal.processors.cache.CacheClientReconnectDiscoveryData
-org.apache.ignite.internal.processors.cache.CacheClientReconnectDiscoveryData$CacheGroupInfo
-org.apache.ignite.internal.processors.cache.CacheClientReconnectDiscoveryData$CacheInfo
org.apache.ignite.internal.processors.cache.CacheConfigurationEnrichment
org.apache.ignite.internal.processors.cache.CacheData
org.apache.ignite.internal.processors.cache.CacheDefaultBinaryAffinityKeyMapper
@@ -813,7 +811,6 @@
org.apache.ignite.internal.processors.cache.CacheInvokeDirectResult
org.apache.ignite.internal.processors.cache.CacheInvokeEntry$Operation
org.apache.ignite.internal.processors.cache.CacheInvokeResult
org.apache.ignite.internal.processors.cache.CacheJoinNodeDiscoveryData
-org.apache.ignite.internal.processors.cache.CacheJoinNodeDiscoveryData$CacheInfo
org.apache.ignite.internal.processors.cache.CacheMetricsSnapshot
org.apache.ignite.internal.processors.cache.CacheNodeCommonDiscoveryData
org.apache.ignite.internal.processors.cache.CacheObject