This is an automated email from the ASF dual-hosted git repository.
nizhikov 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 0ae8327ca09 IGNITE-27745 In code serializers for
DistributedMetaStorageHistoryItem, CacheMetricsSnapshot (#12706)
0ae8327ca09 is described below
commit 0ae8327ca09d126fcec010c62726268413941f6b
Author: Nikolay <[email protected]>
AuthorDate: Sat Feb 7 12:42:50 2026 +0300
IGNITE-27745 In code serializers for DistributedMetaStorageHistoryItem,
CacheMetricsSnapshot (#12706)
---
.../apache/ignite/util/GridCommandHandlerTest.java | 14 +-
.../util/OfflineTestCommandArgSerializer.java | 47 +++++
.../internal/dto/IgniteDataTransferObject.java | 50 ------
.../processors/cache/CacheMetricsSnapshot.java | 168 +----------------
.../cache/CacheMetricsSnapshotSerializer.java | 199 +++++++++++++++++++++
.../DistributedMetaStorageHistoryItem.java | 32 +---
...istributedMetaStorageHistoryItemSerializer.java | 62 +++++++
.../apache/ignite/internal/util/IgniteUtils.java | 4 +-
.../localtask/ConvertibleTaskSerializer.java | 25 +++
.../internal/processors/localtask/SimpleTask.java | 18 +-
.../processors/localtask/SimpleTaskSerializer.java | 46 +++++
.../commandline/CommandsProviderExtImpl.java | 16 +-
.../TestCommandCommandArgSerializer.java | 47 +++++
13 files changed, 435 insertions(+), 293 deletions(-)
diff --git
a/modules/control-utility/src/test/java/org/apache/ignite/util/GridCommandHandlerTest.java
b/modules/control-utility/src/test/java/org/apache/ignite/util/GridCommandHandlerTest.java
index 9a465ddefeb..79a69c1a9c4 100644
---
a/modules/control-utility/src/test/java/org/apache/ignite/util/GridCommandHandlerTest.java
+++
b/modules/control-utility/src/test/java/org/apache/ignite/util/GridCommandHandlerTest.java
@@ -19,8 +19,6 @@ package org.apache.ignite.util;
import java.io.File;
import java.io.IOException;
-import java.io.ObjectInput;
-import java.io.ObjectOutput;
import java.io.RandomAccessFile;
import java.io.Serializable;
import java.lang.reflect.Field;
@@ -4071,7 +4069,7 @@ public class GridCommandHandlerTest extends
GridCommandHandlerClusterPerMethodAb
public static class OfflineTestCommandArg extends IgniteDataTransferObject
{
/** */
@Argument
- private String input;
+ String input;
/** */
public String input() {
@@ -4082,15 +4080,5 @@ public class GridCommandHandlerTest extends
GridCommandHandlerClusterPerMethodAb
public void input(String input) {
this.input = input;
}
-
- /** {@inheritDoc} */
- @Override protected void writeExternalData(ObjectOutput out) throws
IOException {
- U.writeString(out, input);
- }
-
- /** {@inheritDoc} */
- @Override protected void readExternalData(ObjectInput in) throws
IOException {
- input = U.readString(in);
- }
}
}
diff --git
a/modules/control-utility/src/test/java/org/apache/ignite/util/OfflineTestCommandArgSerializer.java
b/modules/control-utility/src/test/java/org/apache/ignite/util/OfflineTestCommandArgSerializer.java
new file mode 100644
index 00000000000..2131c0c3367
--- /dev/null
+++
b/modules/control-utility/src/test/java/org/apache/ignite/util/OfflineTestCommandArgSerializer.java
@@ -0,0 +1,47 @@
+/*
+ * 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.util;
+
+import java.io.IOException;
+import java.io.ObjectInput;
+import java.io.ObjectOutput;
+import org.apache.ignite.internal.dto.IgniteDataTransferObject;
+import org.apache.ignite.internal.dto.IgniteDataTransferObjectSerializer;
+import org.apache.ignite.internal.util.typedef.internal.U;
+import org.apache.ignite.util.GridCommandHandlerTest.OfflineTestCommandArg;
+
+/**
+ * This class is implements {@link IgniteDataTransferObjectSerializer}.
+ * Most implementation of the interface autogenerated.
+ * Don't want to autogenerate this just to improve compilation time.
+ * There are only 3 extension of {@link IgniteDataTransferObject} int the
tests at the moment.
+ * Can just keep serializer in code.
+ *
+ * @see org.apache.ignite.internal.codegen.idto.IDTOSerializerFactory
+ */
+public class OfflineTestCommandArgSerializer implements
IgniteDataTransferObjectSerializer<OfflineTestCommandArg> {
+ /** {@inheritDoc} */
+ @Override public void writeExternal(OfflineTestCommandArg obj,
ObjectOutput out) throws IOException {
+ U.writeString(out, obj.input);
+ }
+
+ /** {@inheritDoc} */
+ @Override public void readExternal(OfflineTestCommandArg obj, ObjectInput
in) throws IOException, ClassNotFoundException {
+ obj.input = U.readString(in);
+ }
+}
diff --git
a/modules/core/src/main/java/org/apache/ignite/internal/dto/IgniteDataTransferObject.java
b/modules/core/src/main/java/org/apache/ignite/internal/dto/IgniteDataTransferObject.java
index b8af7dfc938..4d750a69cec 100644
---
a/modules/core/src/main/java/org/apache/ignite/internal/dto/IgniteDataTransferObject.java
+++
b/modules/core/src/main/java/org/apache/ignite/internal/dto/IgniteDataTransferObject.java
@@ -23,11 +23,8 @@ import java.io.ObjectInput;
import java.io.ObjectOutput;
import java.util.ArrayList;
import java.util.Collection;
-import java.util.LinkedHashSet;
import java.util.List;
-import java.util.Set;
import org.apache.ignite.internal.codegen.idto.IDTOSerializerFactory;
-import org.apache.ignite.internal.util.IgniteUtils;
import org.jetbrains.annotations.Nullable;
/**
@@ -52,29 +49,6 @@ public abstract class IgniteDataTransferObject implements
Externalizable {
return null;
}
- /**
- * @param col Source collection.
- * @param <T> Collection type.
- * @return List based on passed collection.
- */
- @Nullable protected static <T> Set<T> toSet(Collection<T> col) {
- if (col != null)
- return new LinkedHashSet<>(col);
-
- return null;
- }
-
- /**
- * Save object's specific data content.
- *
- * @param out Output object to write data content.
- * @throws IOException If I/O errors occur.
- */
- protected void writeExternalData(ObjectOutput out) throws IOException {
- throw new UnsupportedOperationException("Please, implement custom
method or provide support in " +
- "IDTOSerializerGenerator for " + getClass());
- }
-
/** {@inheritDoc} */
@Override public void writeExternal(ObjectOutput out) throws IOException {
out.writeInt(MAGIC);
@@ -82,28 +56,10 @@ public abstract class IgniteDataTransferObject implements
Externalizable {
try (IgniteDataTransferObjectOutput dtout = new
IgniteDataTransferObjectOutput(out)) {
IgniteDataTransferObjectSerializer serializer =
IDTOSerializerFactory.getInstance().serializer(getClass());
- if (serializer == IgniteUtils.EMPTY_DTO_SERIALIZER) {
- writeExternalData(dtout);
-
- return;
- }
-
serializer.writeExternal(this, dtout);
}
}
- /**
- * Load object's specific data content.
- *
- * @param in Input object to load data content.
- * @throws IOException If I/O errors occur.
- * @throws ClassNotFoundException If the class for an object being
restored cannot be found.
- */
- protected void readExternalData(ObjectInput in) throws IOException,
ClassNotFoundException {
- throw new UnsupportedOperationException("Please, implement custom
method or provide support in " +
- "IDTOSerializerGenerator for " + getClass());
- }
-
/** {@inheritDoc} */
@Override public void readExternal(ObjectInput in) throws IOException,
ClassNotFoundException {
int hdr = in.readInt();
@@ -115,12 +71,6 @@ public abstract class IgniteDataTransferObject implements
Externalizable {
try (IgniteDataTransferObjectInput dtin = new
IgniteDataTransferObjectInput(in)) {
IgniteDataTransferObjectSerializer serializer =
IDTOSerializerFactory.getInstance().serializer(getClass());
- if (serializer == IgniteUtils.EMPTY_DTO_SERIALIZER) {
- readExternalData(dtin);
-
- return;
- }
-
serializer.readExternal(this, dtin);
}
}
diff --git
a/modules/core/src/main/java/org/apache/ignite/internal/processors/cache/CacheMetricsSnapshot.java
b/modules/core/src/main/java/org/apache/ignite/internal/processors/cache/CacheMetricsSnapshot.java
index bef2759569b..44a4b2e2cf7 100644
---
a/modules/core/src/main/java/org/apache/ignite/internal/processors/cache/CacheMetricsSnapshot.java
+++
b/modules/core/src/main/java/org/apache/ignite/internal/processors/cache/CacheMetricsSnapshot.java
@@ -17,15 +17,11 @@
package org.apache.ignite.internal.processors.cache;
-import java.io.IOException;
-import java.io.ObjectInput;
-import java.io.ObjectOutput;
import java.util.Collection;
import org.apache.ignite.cache.CacheMetrics;
import org.apache.ignite.internal.dto.IgniteDataTransferObject;
import org.apache.ignite.internal.processors.cluster.CacheMetricsMessage;
import org.apache.ignite.internal.util.typedef.internal.S;
-import org.apache.ignite.internal.util.typedef.internal.U;
/**
* Metrics snapshot.
@@ -35,7 +31,7 @@ public class CacheMetricsSnapshot extends
IgniteDataTransferObject implements Ca
private static final long serialVersionUID = 0L;
/** Metrics values holder. */
- private CacheMetricsMessage m;
+ CacheMetricsMessage m;
/**
* Default constructor.
@@ -541,166 +537,4 @@ public class CacheMetricsSnapshot extends
IgniteDataTransferObject implements Ca
@Override public String toString() {
return S.toString(CacheMetricsSnapshot.class, this);
}
-
- /** {@inheritDoc} */
- @Override public void writeExternalData(ObjectOutput out) throws
IOException {
- out.writeLong(m.cacheGets());
- out.writeLong(m.cachePuts());
- out.writeLong(m.cacheHits());
- out.writeLong(m.cacheMisses());
- out.writeLong(m.cacheTxCommits());
- out.writeLong(m.cacheTxRollbacks());
- out.writeLong(m.cacheEvictions());
- out.writeLong(m.cacheRemovals());
-
- out.writeFloat(m.averagePutTime());
- out.writeFloat(m.averageGetTime());
- out.writeFloat(m.averageRemoveTime());
- out.writeFloat(m.averageTxCommitTime());
- out.writeFloat(m.averageTxRollbackTime());
-
- out.writeLong(m.offHeapGets());
- out.writeLong(m.offHeapPuts());
- out.writeLong(m.offHeapRemovals());
- out.writeLong(m.offHeapEvictions());
- out.writeLong(m.offHeapHits());
- out.writeLong(m.offHeapMisses());
- out.writeLong(m.offHeapEntriesCount());
- out.writeLong(m.heapEntriesCount());
- out.writeLong(m.offHeapPrimaryEntriesCount());
- out.writeLong(m.offHeapBackupEntriesCount());
- out.writeLong(m.offHeapAllocatedSize());
-
- out.writeInt(m.dhtEvictQueueCurrentSize());
- out.writeInt(m.txThreadMapSize());
- out.writeInt(m.txXidMapSize());
- out.writeInt(m.txCommitQueueSize());
- out.writeInt(m.txPrepareQueueSize());
- out.writeInt(m.txStartVersionCountsSize());
- out.writeInt(m.txCommittedVersionsSize());
- out.writeInt(m.txRolledbackVersionsSize());
- out.writeInt(m.txDhtThreadMapSize());
- out.writeInt(m.txDhtXidMapSize());
- out.writeInt(m.txDhtCommitQueueSize());
- out.writeInt(m.txDhtPrepareQueueSize());
- out.writeInt(m.txDhtStartVersionCountsSize());
- out.writeInt(m.txDhtCommittedVersionsSize());
- out.writeInt(m.txDhtRolledbackVersionsSize());
- out.writeInt(m.writeBehindTotalCriticalOverflowCount());
- out.writeInt(m.writeBehindCriticalOverflowCount());
- out.writeInt(m.writeBehindErrorRetryCount());
-
- out.writeInt(m.totalPartitionsCount());
- out.writeInt(m.rebalancingPartitionsCount());
- out.writeLong(m.keysToRebalanceLeft());
- out.writeLong(m.rebalancingBytesRate());
- out.writeLong(m.rebalancingKeysRate());
-
- out.writeLong(m.rebalancedKeys());
- out.writeLong(m.estimatedRebalancingKeys());
- out.writeLong(m.rebalancingStartTime());
- out.writeLong(m.rebalanceFinishTime());
- out.writeLong(m.rebalanceClearingPartitionsLeft());
-
- out.writeLong(m.entryProcessorPuts());
- out.writeFloat(m.entryProcessorAverageInvocationTime());
- out.writeLong(m.entryProcessorInvocations());
- out.writeFloat(m.entryProcessorMaxInvocationTime());
- out.writeFloat(m.entryProcessorMinInvocationTime());
- out.writeLong(m.entryProcessorReadOnlyInvocations());
- out.writeFloat(m.entryProcessorHitPercentage());
- out.writeLong(m.entryProcessorHits());
- out.writeLong(m.entryProcessorMisses());
- out.writeFloat(m.entryProcessorMissPercentage());
- out.writeLong(m.entryProcessorRemovals());
-
- out.writeLong(m.cacheSize());
- out.writeBoolean(m.empty());
- out.writeInt(m.size());
- out.writeInt(m.keySize());
- U.writeLongString(out, m.txKeyCollisions());
- out.writeInt(m.indexBuildPartitionsLeftCount());
- }
-
- /** {@inheritDoc} */
- @Override public void readExternalData(ObjectInput in) throws IOException,
ClassNotFoundException {
- m = new CacheMetricsMessage();
-
- m.cacheGets(in.readLong());
- m.cachePuts(in.readLong());
- m.cacheHits(in.readLong());
- m.cacheMisses(in.readLong());
- m.cacheTxCommits(in.readLong());
- m.cacheTxRollbacks(in.readLong());
- m.cacheEvictions(in.readLong());
- m.cacheRemovals(in.readLong());
-
- m.averagePutTime(in.readFloat());
- m.averageGetTime(in.readFloat());
- m.averageRemoveTime(in.readFloat());
- m.averageTxCommitTime(in.readFloat());
- m.averageTxRollbackTime(in.readFloat());
-
- m.offHeapGets(in.readLong());
- m.offHeapPuts(in.readLong());
- m.offHeapRemovals(in.readLong());
- m.offHeapEvictions(in.readLong());
- m.offHeapHits(in.readLong());
- m.offHeapMisses(in.readLong());
- m.offHeapEntriesCount(in.readLong());
- m.heapEntriesCount(in.readLong());
- m.offHeapPrimaryEntriesCount(in.readLong());
- m.offHeapBackupEntriesCount(in.readLong());
- m.offHeapAllocatedSize(in.readLong());
-
- m.dhtEvictQueueCurrentSize(in.readInt());
- m.txThreadMapSize(in.readInt());
- m.txXidMapSize(in.readInt());
- m.txCommitQueueSize(in.readInt());
- m.txPrepareQueueSize(in.readInt());
- m.txStartVersionCountsSize(in.readInt());
- m.txCommittedVersionsSize(in.readInt());
- m.txRolledbackVersionsSize(in.readInt());
- m.txDhtThreadMapSize(in.readInt());
- m.txDhtXidMapSize(in.readInt());
- m.txDhtCommitQueueSize(in.readInt());
- m.txDhtPrepareQueueSize(in.readInt());
- m.txDhtStartVersionCountsSize(in.readInt());
- m.txDhtCommittedVersionsSize(in.readInt());
- m.txDhtRolledbackVersionsSize(in.readInt());
- m.writeBehindTotalCriticalOverflowCount(in.readInt());
- m.writeBehindCriticalOverflowCount(in.readInt());
- m.writeBehindErrorRetryCount(in.readInt());
-
- m.totalPartitionsCount(in.readInt());
- m.rebalancingPartitionsCount(in.readInt());
- m.keysToRebalanceLeft(in.readLong());
- m.rebalancingBytesRate(in.readLong());
- m.rebalancingKeysRate(in.readLong());
-
- m.rebalancedKeys(in.readLong());
- m.estimatedRebalancingKeys(in.readLong());
- m.rebalancingStartTime(in.readLong());
- m.rebalanceFinishTime(in.readLong());
- m.rebalanceClearingPartitionsLeft(in.readLong());
-
- m.entryProcessorPuts(in.readLong());
- m.entryProcessorAverageInvocationTime(in.readFloat());
- m.entryProcessorInvocations(in.readLong());
- m.entryProcessorMaxInvocationTime(in.readFloat());
- m.entryProcessorMinInvocationTime(in.readFloat());
- m.entryProcessorReadOnlyInvocations(in.readLong());
- m.entryProcessorHitPercentage(in.readFloat());
- m.entryProcessorHits(in.readLong());
- m.entryProcessorMisses(in.readLong());
- m.entryProcessorMissPercentage(in.readFloat());
- m.entryProcessorRemovals(in.readLong());
-
- m.cacheSize(in.readLong());
- m.empty(in.readBoolean());
- m.size(in.readInt());
- m.keySize(in.readInt());
- m.txKeyCollisions(U.readLongString(in));
- m.indexBuildPartitionsLeftCount(in.readInt());
- }
}
diff --git
a/modules/core/src/main/java/org/apache/ignite/internal/processors/cache/CacheMetricsSnapshotSerializer.java
b/modules/core/src/main/java/org/apache/ignite/internal/processors/cache/CacheMetricsSnapshotSerializer.java
new file mode 100644
index 00000000000..678bce01e71
--- /dev/null
+++
b/modules/core/src/main/java/org/apache/ignite/internal/processors/cache/CacheMetricsSnapshotSerializer.java
@@ -0,0 +1,199 @@
+/*
+ * 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 java.io.IOException;
+import java.io.ObjectInput;
+import java.io.ObjectOutput;
+import org.apache.ignite.internal.dto.IgniteDataTransferObjectSerializer;
+import org.apache.ignite.internal.processors.cluster.CacheMetricsMessage;
+import org.apache.ignite.internal.util.typedef.internal.U;
+
+/**
+ * This class is implements {@link IgniteDataTransferObjectSerializer}.
+ * Most implementation of the interface autogenerated.
+ * <b>Please, be aware - serializer works while Rolling Upgrade in
progress.</b>
+ * All changes must be made with the respece of RU rules.
+ *
+ * @see org.apache.ignite.internal.codegen.idto.IDTOSerializerFactory
+ */
+public class CacheMetricsSnapshotSerializer implements
IgniteDataTransferObjectSerializer<CacheMetricsSnapshot> {
+ /** {@inheritDoc} */
+ @Override public void writeExternal(CacheMetricsSnapshot obj, ObjectOutput
out) throws IOException {
+ out.writeLong(obj.m.cacheGets());
+ out.writeLong(obj.m.cachePuts());
+ out.writeLong(obj.m.cacheHits());
+ out.writeLong(obj.m.cacheMisses());
+ out.writeLong(obj.m.cacheTxCommits());
+ out.writeLong(obj.m.cacheTxRollbacks());
+ out.writeLong(obj.m.cacheEvictions());
+ out.writeLong(obj.m.cacheRemovals());
+
+ out.writeFloat(obj.m.averagePutTime());
+ out.writeFloat(obj.m.averageGetTime());
+ out.writeFloat(obj.m.averageRemoveTime());
+ out.writeFloat(obj.m.averageTxCommitTime());
+ out.writeFloat(obj.m.averageTxRollbackTime());
+
+ out.writeLong(obj.m.offHeapGets());
+ out.writeLong(obj.m.offHeapPuts());
+ out.writeLong(obj.m.offHeapRemovals());
+ out.writeLong(obj.m.offHeapEvictions());
+ out.writeLong(obj.m.offHeapHits());
+ out.writeLong(obj.m.offHeapMisses());
+ out.writeLong(obj.m.offHeapEntriesCount());
+ out.writeLong(obj.m.heapEntriesCount());
+ out.writeLong(obj.m.offHeapPrimaryEntriesCount());
+ out.writeLong(obj.m.offHeapBackupEntriesCount());
+ out.writeLong(obj.m.offHeapAllocatedSize());
+
+ out.writeInt(obj.m.dhtEvictQueueCurrentSize());
+ out.writeInt(obj.m.txThreadMapSize());
+ out.writeInt(obj.m.txXidMapSize());
+ out.writeInt(obj.m.txCommitQueueSize());
+ out.writeInt(obj.m.txPrepareQueueSize());
+ out.writeInt(obj.m.txStartVersionCountsSize());
+ out.writeInt(obj.m.txCommittedVersionsSize());
+ out.writeInt(obj.m.txRolledbackVersionsSize());
+ out.writeInt(obj.m.txDhtThreadMapSize());
+ out.writeInt(obj.m.txDhtXidMapSize());
+ out.writeInt(obj.m.txDhtCommitQueueSize());
+ out.writeInt(obj.m.txDhtPrepareQueueSize());
+ out.writeInt(obj.m.txDhtStartVersionCountsSize());
+ out.writeInt(obj.m.txDhtCommittedVersionsSize());
+ out.writeInt(obj.m.txDhtRolledbackVersionsSize());
+ out.writeInt(obj.m.writeBehindTotalCriticalOverflowCount());
+ out.writeInt(obj.m.writeBehindCriticalOverflowCount());
+ out.writeInt(obj.m.writeBehindErrorRetryCount());
+
+ out.writeInt(obj.m.totalPartitionsCount());
+ out.writeInt(obj.m.rebalancingPartitionsCount());
+ out.writeLong(obj.m.keysToRebalanceLeft());
+ out.writeLong(obj.m.rebalancingBytesRate());
+ out.writeLong(obj.m.rebalancingKeysRate());
+
+ out.writeLong(obj.m.rebalancedKeys());
+ out.writeLong(obj.m.estimatedRebalancingKeys());
+ out.writeLong(obj.m.rebalancingStartTime());
+ out.writeLong(obj.m.rebalanceFinishTime());
+ out.writeLong(obj.m.rebalanceClearingPartitionsLeft());
+
+ out.writeLong(obj.m.entryProcessorPuts());
+ out.writeFloat(obj.m.entryProcessorAverageInvocationTime());
+ out.writeLong(obj.m.entryProcessorInvocations());
+ out.writeFloat(obj.m.entryProcessorMaxInvocationTime());
+ out.writeFloat(obj.m.entryProcessorMinInvocationTime());
+ out.writeLong(obj.m.entryProcessorReadOnlyInvocations());
+ out.writeFloat(obj.m.entryProcessorHitPercentage());
+ out.writeLong(obj.m.entryProcessorHits());
+ out.writeLong(obj.m.entryProcessorMisses());
+ out.writeFloat(obj.m.entryProcessorMissPercentage());
+ out.writeLong(obj.m.entryProcessorRemovals());
+
+ out.writeLong(obj.m.cacheSize());
+ out.writeBoolean(obj.m.empty());
+ out.writeInt(obj.m.size());
+ out.writeInt(obj.m.keySize());
+ U.writeLongString(out, obj.m.txKeyCollisions());
+ out.writeInt(obj.m.indexBuildPartitionsLeftCount());
+ }
+
+ /** {@inheritDoc} */
+ @Override public void readExternal(CacheMetricsSnapshot obj, ObjectInput
in) throws IOException, ClassNotFoundException {
+ CacheMetricsMessage m = new CacheMetricsMessage();
+
+ m.cacheGets(in.readLong());
+ m.cachePuts(in.readLong());
+ m.cacheHits(in.readLong());
+ m.cacheMisses(in.readLong());
+ m.cacheTxCommits(in.readLong());
+ m.cacheTxRollbacks(in.readLong());
+ m.cacheEvictions(in.readLong());
+ m.cacheRemovals(in.readLong());
+
+ m.averagePutTime(in.readFloat());
+ m.averageGetTime(in.readFloat());
+ m.averageRemoveTime(in.readFloat());
+ m.averageTxCommitTime(in.readFloat());
+ m.averageTxRollbackTime(in.readFloat());
+
+ m.offHeapGets(in.readLong());
+ m.offHeapPuts(in.readLong());
+ m.offHeapRemovals(in.readLong());
+ m.offHeapEvictions(in.readLong());
+ m.offHeapHits(in.readLong());
+ m.offHeapMisses(in.readLong());
+ m.offHeapEntriesCount(in.readLong());
+ m.heapEntriesCount(in.readLong());
+ m.offHeapPrimaryEntriesCount(in.readLong());
+ m.offHeapBackupEntriesCount(in.readLong());
+ m.offHeapAllocatedSize(in.readLong());
+
+ m.dhtEvictQueueCurrentSize(in.readInt());
+ m.txThreadMapSize(in.readInt());
+ m.txXidMapSize(in.readInt());
+ m.txCommitQueueSize(in.readInt());
+ m.txPrepareQueueSize(in.readInt());
+ m.txStartVersionCountsSize(in.readInt());
+ m.txCommittedVersionsSize(in.readInt());
+ m.txRolledbackVersionsSize(in.readInt());
+ m.txDhtThreadMapSize(in.readInt());
+ m.txDhtXidMapSize(in.readInt());
+ m.txDhtCommitQueueSize(in.readInt());
+ m.txDhtPrepareQueueSize(in.readInt());
+ m.txDhtStartVersionCountsSize(in.readInt());
+ m.txDhtCommittedVersionsSize(in.readInt());
+ m.txDhtRolledbackVersionsSize(in.readInt());
+ m.writeBehindTotalCriticalOverflowCount(in.readInt());
+ m.writeBehindCriticalOverflowCount(in.readInt());
+ m.writeBehindErrorRetryCount(in.readInt());
+
+ m.totalPartitionsCount(in.readInt());
+ m.rebalancingPartitionsCount(in.readInt());
+ m.keysToRebalanceLeft(in.readLong());
+ m.rebalancingBytesRate(in.readLong());
+ m.rebalancingKeysRate(in.readLong());
+
+ m.rebalancedKeys(in.readLong());
+ m.estimatedRebalancingKeys(in.readLong());
+ m.rebalancingStartTime(in.readLong());
+ m.rebalanceFinishTime(in.readLong());
+ m.rebalanceClearingPartitionsLeft(in.readLong());
+
+ m.entryProcessorPuts(in.readLong());
+ m.entryProcessorAverageInvocationTime(in.readFloat());
+ m.entryProcessorInvocations(in.readLong());
+ m.entryProcessorMaxInvocationTime(in.readFloat());
+ m.entryProcessorMinInvocationTime(in.readFloat());
+ m.entryProcessorReadOnlyInvocations(in.readLong());
+ m.entryProcessorHitPercentage(in.readFloat());
+ m.entryProcessorHits(in.readLong());
+ m.entryProcessorMisses(in.readLong());
+ m.entryProcessorMissPercentage(in.readFloat());
+ m.entryProcessorRemovals(in.readLong());
+
+ m.cacheSize(in.readLong());
+ m.empty(in.readBoolean());
+ m.size(in.readInt());
+ m.keySize(in.readInt());
+ m.txKeyCollisions(U.readLongString(in));
+ m.indexBuildPartitionsLeftCount(in.readInt());
+
+ obj.m = m;
+ }
+}
diff --git
a/modules/core/src/main/java/org/apache/ignite/internal/processors/metastorage/persistence/DistributedMetaStorageHistoryItem.java
b/modules/core/src/main/java/org/apache/ignite/internal/processors/metastorage/persistence/DistributedMetaStorageHistoryItem.java
index bc9e5a96cb1..b24a275e64b 100644
---
a/modules/core/src/main/java/org/apache/ignite/internal/processors/metastorage/persistence/DistributedMetaStorageHistoryItem.java
+++
b/modules/core/src/main/java/org/apache/ignite/internal/processors/metastorage/persistence/DistributedMetaStorageHistoryItem.java
@@ -17,14 +17,10 @@
package org.apache.ignite.internal.processors.metastorage.persistence;
-import java.io.IOException;
-import java.io.ObjectInput;
-import java.io.ObjectOutput;
import java.util.Arrays;
import org.apache.ignite.internal.dto.IgniteDataTransferObject;
import org.apache.ignite.internal.util.tostring.GridToStringInclude;
import org.apache.ignite.internal.util.typedef.internal.S;
-import org.apache.ignite.internal.util.typedef.internal.U;
/** */
final class DistributedMetaStorageHistoryItem extends IgniteDataTransferObject
{
@@ -36,11 +32,11 @@ final class DistributedMetaStorageHistoryItem extends
IgniteDataTransferObject {
/** */
@GridToStringInclude
- private String[] keys;
+ String[] keys;
/** */
@GridToStringInclude
- private byte[][] valBytesArr;
+ byte[][] valBytesArr;
/** */
private transient long longHash;
@@ -96,30 +92,6 @@ final class DistributedMetaStorageHistoryItem extends
IgniteDataTransferObject {
return valBytesArr;
}
- /** {@inheritDoc} */
- @Override protected void writeExternalData(ObjectOutput out) throws
IOException {
- out.writeInt(keys.length);
-
- for (int i = 0; i < keys.length; i++) {
- U.writeString(out, keys[i]);
-
- U.writeByteArray(out, valBytesArr[i]);
- }
- }
-
- /** {@inheritDoc} */
- @Override protected void readExternalData(ObjectInput in) throws
IOException {
- int len = in.readInt();
-
- keys = new String[len];
- valBytesArr = new byte[len][];
-
- for (int i = 0; i < len; i++) {
- keys[i] = U.readString(in);
- valBytesArr[i] = U.readByteArray(in);
- }
- }
-
/** {@inheritDoc} */
@Override public boolean equals(Object o) {
if (this == o)
diff --git
a/modules/core/src/main/java/org/apache/ignite/internal/processors/metastorage/persistence/DistributedMetaStorageHistoryItemSerializer.java
b/modules/core/src/main/java/org/apache/ignite/internal/processors/metastorage/persistence/DistributedMetaStorageHistoryItemSerializer.java
new file mode 100644
index 00000000000..1383f056167
--- /dev/null
+++
b/modules/core/src/main/java/org/apache/ignite/internal/processors/metastorage/persistence/DistributedMetaStorageHistoryItemSerializer.java
@@ -0,0 +1,62 @@
+/*
+ * 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.metastorage.persistence;
+
+import java.io.IOException;
+import java.io.ObjectInput;
+import java.io.ObjectOutput;
+import org.apache.ignite.internal.dto.IgniteDataTransferObjectSerializer;
+import org.apache.ignite.internal.util.typedef.internal.U;
+
+/**
+ * This class is implements {@link IgniteDataTransferObjectSerializer}.
+ * Most implementation of the interface autogenerated.
+ * <b>Please, be aware - serializer works while Rolling Upgrade in
progress.</b>
+ * All changes must be made with the respece of RU rules.
+ * <b>
+ * Note, this class written in PDS!
+ * All versions of PDS must be compatible!
+ * Be extremely cautious when change.
+ * </b>
+ *
+ * @see org.apache.ignite.internal.codegen.idto.IDTOSerializerFactory
+ */
+public class DistributedMetaStorageHistoryItemSerializer implements
IgniteDataTransferObjectSerializer<DistributedMetaStorageHistoryItem> {
+ /** {@inheritDoc} */
+ @Override public void writeExternal(DistributedMetaStorageHistoryItem obj,
ObjectOutput out) throws IOException {
+ out.writeInt(obj.keys.length);
+
+ for (int i = 0; i < obj.keys.length; i++) {
+ U.writeString(out, obj.keys[i]);
+ U.writeByteArray(out, obj.valBytesArr[i]);
+ }
+ }
+
+ /** {@inheritDoc} */
+ @Override public void readExternal(DistributedMetaStorageHistoryItem obj,
ObjectInput in) throws IOException, ClassNotFoundException {
+ int len = in.readInt();
+
+ obj.keys = new String[len];
+ obj.valBytesArr = new byte[len][];
+
+ for (int i = 0; i < len; i++) {
+ obj.keys[i] = U.readString(in);
+ obj.valBytesArr[i] = U.readByteArray(in);
+ }
+ }
+}
diff --git
a/modules/core/src/main/java/org/apache/ignite/internal/util/IgniteUtils.java
b/modules/core/src/main/java/org/apache/ignite/internal/util/IgniteUtils.java
index 65408e6ec0b..978698cb21e 100755
---
a/modules/core/src/main/java/org/apache/ignite/internal/util/IgniteUtils.java
+++
b/modules/core/src/main/java/org/apache/ignite/internal/util/IgniteUtils.java
@@ -8248,12 +8248,12 @@ public abstract class IgniteUtils extends CommonUtils {
public static final IgniteDataTransferObjectSerializer<?>
EMPTY_DTO_SERIALIZER = new IgniteDataTransferObjectSerializer() {
/** {@inheritDoc} */
@Override public void writeExternal(Object instance, ObjectOutput out)
{
- // No-op.
+ throw new IllegalStateException("Can't find serializer for: " +
instance.getClass());
}
/** {@inheritDoc} */
@Override public void readExternal(Object instance, ObjectInput in) {
- // No-op.
+ throw new IllegalStateException("Can't find serializer for: " +
instance.getClass());
}
};
diff --git
a/modules/core/src/test/java/org/apache/ignite/internal/processors/localtask/ConvertibleTaskSerializer.java
b/modules/core/src/test/java/org/apache/ignite/internal/processors/localtask/ConvertibleTaskSerializer.java
new file mode 100644
index 00000000000..7dee35dbaac
--- /dev/null
+++
b/modules/core/src/test/java/org/apache/ignite/internal/processors/localtask/ConvertibleTaskSerializer.java
@@ -0,0 +1,25 @@
+/*
+ * 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.localtask;
+
+/**
+ * The task to be convertible after restoring from metaStorage.
+ */
+public class ConvertibleTaskSerializer extends SimpleTaskSerializer {
+ // No-op.
+}
diff --git
a/modules/core/src/test/java/org/apache/ignite/internal/processors/localtask/SimpleTask.java
b/modules/core/src/test/java/org/apache/ignite/internal/processors/localtask/SimpleTask.java
index c6ed923c892..ff7a6a767e8 100644
---
a/modules/core/src/test/java/org/apache/ignite/internal/processors/localtask/SimpleTask.java
+++
b/modules/core/src/test/java/org/apache/ignite/internal/processors/localtask/SimpleTask.java
@@ -17,26 +17,22 @@
package org.apache.ignite.internal.processors.localtask;
-import java.io.IOException;
-import java.io.ObjectInput;
-import java.io.ObjectOutput;
import org.apache.ignite.internal.GridKernalContext;
import org.apache.ignite.internal.IgniteInternalFuture;
import org.apache.ignite.internal.dto.IgniteDataTransferObject;
import
org.apache.ignite.internal.processors.cache.persistence.metastorage.pendingtask.DurableBackgroundTask;
import
org.apache.ignite.internal.processors.cache.persistence.metastorage.pendingtask.DurableBackgroundTaskResult;
import org.apache.ignite.internal.util.future.GridFutureAdapter;
-import org.apache.ignite.internal.util.typedef.internal.U;
/**
* Simple {@link DurableBackgroundTask} implementation for tests.
*/
-class SimpleTask extends IgniteDataTransferObject implements
DurableBackgroundTask<Void> {
+public class SimpleTask extends IgniteDataTransferObject implements
DurableBackgroundTask<Void> {
/** Serial version UID. */
private static final long serialVersionUID = 0L;
/** Task name. */
- private String name;
+ String name;
/** Future that will be completed at the beginning of the {@link
#executeAsync}. */
final GridFutureAdapter<Void> onExecFut = new GridFutureAdapter<>();
@@ -79,16 +75,6 @@ class SimpleTask extends IgniteDataTransferObject implements
DurableBackgroundTa
return taskFut;
}
- /** {@inheritDoc} */
- @Override protected void writeExternalData(ObjectOutput out) throws
IOException {
- U.writeLongString(out, name);
- }
-
- /** {@inheritDoc} */
- @Override protected void readExternalData(ObjectInput in) throws
IOException, ClassNotFoundException {
- name = U.readLongString(in);
- }
-
/**
* Resetting internal futures.
*/
diff --git
a/modules/core/src/test/java/org/apache/ignite/internal/processors/localtask/SimpleTaskSerializer.java
b/modules/core/src/test/java/org/apache/ignite/internal/processors/localtask/SimpleTaskSerializer.java
new file mode 100644
index 00000000000..f74df1740ac
--- /dev/null
+++
b/modules/core/src/test/java/org/apache/ignite/internal/processors/localtask/SimpleTaskSerializer.java
@@ -0,0 +1,46 @@
+/*
+ * 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.localtask;
+
+import java.io.IOException;
+import java.io.ObjectInput;
+import java.io.ObjectOutput;
+import org.apache.ignite.internal.dto.IgniteDataTransferObject;
+import org.apache.ignite.internal.dto.IgniteDataTransferObjectSerializer;
+import org.apache.ignite.internal.util.typedef.internal.U;
+
+/**
+ * This class is implements {@link IgniteDataTransferObjectSerializer}.
+ * Most implementation of the interface autogenerated.
+ * Don't want to autogenerate this just to improve compilation time.
+ * There are only 3 extension of {@link IgniteDataTransferObject} int the
tests at the moment.
+ * Can just keep serializer in code.
+ *
+ * @see org.apache.ignite.internal.codegen.idto.IDTOSerializerFactory
+ */
+public class SimpleTaskSerializer implements
IgniteDataTransferObjectSerializer<SimpleTask> {
+ /** {@inheritDoc} */
+ @Override public void writeExternal(SimpleTask obj, ObjectOutput out)
throws IOException {
+ U.writeLongString(out, obj.name);
+ }
+
+ /** {@inheritDoc} */
+ @Override public void readExternal(SimpleTask obj, ObjectInput in) throws
IOException, ClassNotFoundException {
+ obj.name = U.readLongString(in);
+ }
+}
diff --git
a/modules/extdata/pluggable/src/test/java/org/apache/ignite/internal/commandline/CommandsProviderExtImpl.java
b/modules/extdata/pluggable/src/test/java/org/apache/ignite/internal/commandline/CommandsProviderExtImpl.java
index 72b10d898bd..33233eb595f 100644
---
a/modules/extdata/pluggable/src/test/java/org/apache/ignite/internal/commandline/CommandsProviderExtImpl.java
+++
b/modules/extdata/pluggable/src/test/java/org/apache/ignite/internal/commandline/CommandsProviderExtImpl.java
@@ -17,9 +17,6 @@
package org.apache.ignite.internal.commandline;
-import java.io.IOException;
-import java.io.ObjectInput;
-import java.io.ObjectOutput;
import java.util.Collection;
import java.util.function.Consumer;
import org.apache.ignite.Ignite;
@@ -32,7 +29,6 @@ import
org.apache.ignite.internal.management.api.ComputeCommand;
import org.apache.ignite.internal.management.api.NativeCommand;
import org.apache.ignite.internal.processors.task.GridInternal;
import org.apache.ignite.internal.util.typedef.F;
-import org.apache.ignite.internal.util.typedef.internal.U;
import org.apache.ignite.internal.visor.VisorJob;
import org.apache.ignite.internal.visor.VisorMultiNodeTask;
import org.apache.ignite.internal.visor.VisorOneNodeTask;
@@ -90,17 +86,7 @@ public class CommandsProviderExtImpl implements
CommandsProvider {
/** */
@Argument
- private String testPrint;
-
- /** {@inheritDoc} */
- @Override protected void writeExternalData(ObjectOutput out) throws
IOException {
- U.writeString(out, testPrint);
- }
-
- /** {@inheritDoc} */
- @Override protected void readExternalData(ObjectInput in) throws
IOException {
- testPrint = U.readString(in);
- }
+ String testPrint;
/** */
public void testPrint(String testPrint) {
diff --git
a/modules/extdata/pluggable/src/test/java/org/apache/ignite/internal/commandline/TestCommandCommandArgSerializer.java
b/modules/extdata/pluggable/src/test/java/org/apache/ignite/internal/commandline/TestCommandCommandArgSerializer.java
new file mode 100644
index 00000000000..94d25350cf5
--- /dev/null
+++
b/modules/extdata/pluggable/src/test/java/org/apache/ignite/internal/commandline/TestCommandCommandArgSerializer.java
@@ -0,0 +1,47 @@
+/*
+ * 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.commandline;
+
+import java.io.IOException;
+import java.io.ObjectInput;
+import java.io.ObjectOutput;
+import
org.apache.ignite.internal.commandline.CommandsProviderExtImpl.TestCommandCommandArg;
+import org.apache.ignite.internal.dto.IgniteDataTransferObject;
+import org.apache.ignite.internal.dto.IgniteDataTransferObjectSerializer;
+import org.apache.ignite.internal.util.typedef.internal.U;
+
+/**
+ * This class is implements {@link IgniteDataTransferObjectSerializer}.
+ * Most implementation of the interface autogenerated.
+ * Don't want to autogenerate this just to improve compilation time.
+ * There are only 3 extension of {@link IgniteDataTransferObject} int the
tests at the moment.
+ * Can just keep serializer in code.
+ *
+ * @see org.apache.ignite.internal.codegen.idto.IDTOSerializerFactory
+ */
+public class TestCommandCommandArgSerializer implements
IgniteDataTransferObjectSerializer<TestCommandCommandArg> {
+ /** {@inheritDoc} */
+ @Override public void writeExternal(TestCommandCommandArg obj,
ObjectOutput out) throws IOException {
+ U.writeString(out, obj.testPrint);
+ }
+
+ /** {@inheritDoc} */
+ @Override public void readExternal(TestCommandCommandArg obj, ObjectInput
in) throws IOException, ClassNotFoundException {
+ obj.testPrint = U.readString(in);
+ }
+}