Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

IGNITE-15803 Remove most of BinaryMarshaller from tests #11786

Open
wants to merge 34 commits into
base: master
Choose a base branch
from
Open
Show file tree
Hide file tree
Changes from all commits
Commits
Show all changes
34 commits
Select commit Hold shift + click to select a range
afb0801
IGNITE-15083 Remove explicit call of setMarshaller(null) or setMarsha…
nizhikov Dec 16, 2024
3d83214
Merge branch 'master' into IGNITE-15083
nizhikov Dec 17, 2024
7807daf
IGNITE-15083 WIP
nizhikov Dec 17, 2024
7c84d79
IGNITE-24013 Remove setSharedMemoryPort
nizhikov Dec 17, 2024
03e027e
Merge branch 'master' into IGNITE-15083-2
nizhikov Dec 17, 2024
34b9b83
Merge branch 'master' into IGNITE-15083
nizhikov Dec 17, 2024
30128ac
IGNITE-15083 WIP
nizhikov Dec 17, 2024
fc47e85
Merge branch 'master' into IGNITE-15083-2
nizhikov Dec 18, 2024
5ea792e
IGNITE-15083 WIP
nizhikov Dec 18, 2024
ca40d22
Merge branch 'master' into IGNITE-15083
nizhikov Dec 18, 2024
1868c14
IGNITE-15083 Code review fixes
nizhikov Dec 18, 2024
bc9ca0e
Merge branch 'master' into IGNITE-15083-2
nizhikov Dec 18, 2024
301c375
IGNITE-15083 WIP
nizhikov Dec 19, 2024
62fea49
IGNITE-15083 WIP
nizhikov Dec 19, 2024
05200a3
IGNITE-15083 WIP
nizhikov Dec 20, 2024
b3927d1
IGNITE-15083 WIP
nizhikov Dec 20, 2024
c6aa177
IGNITE-15083 WIP
nizhikov Dec 20, 2024
753c145
IGNITE-15083 WIP
nizhikov Dec 20, 2024
c7e2380
IGNITE-15083 WIP
nizhikov Dec 20, 2024
f5509f3
IGNITE-15083 WIP
nizhikov Dec 21, 2024
3b61ce0
Merge branch 'master' into IGNITE-15083-3
nizhikov Dec 21, 2024
79db70a
IGNITE-24074 Fix createStatement() throws when tx aware queries enabled
nizhikov Dec 21, 2024
36d2443
IGNITE-24074 Fix createStatement() throws when tx aware queries enabled
nizhikov Dec 21, 2024
95f3cf2
IGNITE-15083 WIP
nizhikov Dec 21, 2024
94dfa54
IGNITE-15083 WIP
nizhikov Dec 21, 2024
93bf156
Merge branch 'master' into IGNITE-15083
nizhikov Dec 26, 2024
c5ec20d
Merge branch 'master' into IGNITE-15083-2
nizhikov Dec 26, 2024
f3243aa
IGNITE-24076 Move connection enabled check earlier
nizhikov Dec 26, 2024
34fba63
Merge branch 'IGNITE-15083-2' into IGNITE-15083
nizhikov Dec 26, 2024
5df994d
Merge branch 'IGNITE-15083-3' into IGNITE-15083
nizhikov Dec 26, 2024
f1e7ab1
Merge branch 'master' into IGNITE-15083-3
nizhikov Dec 27, 2024
54e9fb9
IGNITE-15803 Merge fixes
nizhikov Dec 27, 2024
65fe45e
IGNITE-15803 WIP
nizhikov Dec 28, 2024
5cdc826
IGNITE-15803 WIP
nizhikov Dec 28, 2024
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 @@ -47,6 +47,7 @@
import org.apache.ignite.events.Event;
import org.apache.ignite.events.EventType;
import org.apache.ignite.failure.FailureHandler;
import org.apache.ignite.internal.binary.BinaryMarshaller;
import org.apache.ignite.internal.managers.eventstorage.GridEventStorageManager;
import org.apache.ignite.internal.processors.odbc.ClientListenerProcessor;
import org.apache.ignite.internal.util.typedef.internal.A;
Expand Down Expand Up @@ -333,7 +334,7 @@ public class IgniteConfiguration {
private UUID nodeId;

/** Marshaller. */
private Marshaller marsh;
private Marshaller marsh = new BinaryMarshaller();

/** Marshal local jobs. */
private boolean marshLocJobs = DFLT_MARSHAL_LOCAL_JOBS;
Expand Down Expand Up @@ -1417,8 +1418,6 @@ public Marshaller getMarshaller() {
*/
@Deprecated
public IgniteConfiguration setMarshaller(Marshaller marsh) {
this.marsh = marsh;

return this;
}

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -1521,21 +1521,17 @@ private void checkPhysicalRam() {

/** */
private void initializeMarshaller() {
Marshaller marsh = ctx.config().getMarshaller();

if (marsh == null) {
if (!BinaryMarshaller.available()) {
U.warn(log, "Standard BinaryMarshaller can't be used on this JVM. " +
"Switch to HotSpot JVM or reach out Apache Ignite community for recommendations.");
if (!BinaryMarshaller.available()) {
String errMsg = "Standard BinaryMarshaller can't be used on this JVM. " +
"Switch to HotSpot JVM or reach out Apache Ignite community for recommendations.";

marsh = ctx.marshallerContext().jdkMarshaller();
}
else
marsh = new BinaryMarshaller();
U.warn(log, errMsg);

ctx.config().setMarshaller(marsh);
throw new IgniteException(errMsg);
}

Marshaller marsh = ctx.config().getMarshaller();

marsh.setContext(ctx.marshallerContext());

MarshallerUtils.setNodeName(marsh, ctx.igniteInstanceName());
Expand All @@ -1558,9 +1554,6 @@ private void suggestOptimizations(IgniteConfiguration cfg) {

if (cfg.getIncludeEventTypes() != null && cfg.getIncludeEventTypes().length != 0)
perf.add("Disable grid events (remove 'includeEventTypes' from configuration)");

if (BinaryMarshaller.available() && (cfg.getMarshaller() != null && !(cfg.getMarshaller() instanceof BinaryMarshaller)))
perf.add("Use default binary marshaller (do not set 'marshaller' explicitly)");
}

/**
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -39,7 +39,6 @@
import org.apache.ignite.internal.IgniteKernal;
import org.apache.ignite.internal.LongJVMPauseDetector;
import org.apache.ignite.internal.MarshallerContextImpl;
import org.apache.ignite.internal.binary.BinaryMarshaller;
import org.apache.ignite.internal.cache.query.index.IndexProcessor;
import org.apache.ignite.internal.cache.transform.CacheObjectTransformerProcessor;
import org.apache.ignite.internal.managers.checkpoint.GridCheckpointManager;
Expand Down Expand Up @@ -102,7 +101,6 @@
import org.apache.ignite.internal.util.typedef.internal.U;
import org.apache.ignite.internal.worker.WorkersRegistry;
import org.apache.ignite.maintenance.MaintenanceRegistry;
import org.apache.ignite.marshaller.Marshaller;
import org.apache.ignite.marshaller.MarshallerUtils;
import org.apache.ignite.plugin.PluginNotFoundException;
import org.apache.ignite.plugin.PluginProvider;
Expand Down Expand Up @@ -256,17 +254,14 @@ protected IgniteConfiguration prepareIgniteConfiguration() {
cfg.setDiscoverySpi(new StandaloneNoopDiscoverySpi());
cfg.setCommunicationSpi(new StandaloneNoopCommunicationSpi());

final Marshaller marshaller = new BinaryMarshaller();
cfg.setMarshaller(marshaller);

final DataStorageConfiguration pstCfg = new DataStorageConfiguration();
final DataRegionConfiguration regCfg = new DataRegionConfiguration();
regCfg.setPersistenceEnabled(true);
pstCfg.setDefaultDataRegionConfiguration(regCfg);

cfg.setDataStorageConfiguration(pstCfg);

marshaller.setContext(marshallerCtx);
cfg.getMarshaller().setContext(marshallerCtx);

cfg.setMetricExporterSpi(new NoopMetricExporterSpi());
cfg.setSystemViewExporterSpi(new JmxSystemViewExporterSpi());
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -73,15 +73,7 @@ public PlatformCppConfigurationClosure(long envPtr) {
// Check marshaller
Marshaller marsh = igniteCfg.getMarshaller();

if (marsh == null) {
igniteCfg.setMarshaller(new BinaryMarshaller());

cppCfg0.warnings(Collections.singleton("Marshaller is automatically set to " +
BinaryMarshaller.class.getName() + " (other nodes must have the same marshaller type)."));
}
else if (!(marsh instanceof BinaryMarshaller))
throw new IgniteException("Unsupported marshaller (only " + BinaryMarshaller.class.getName() +
" can be used when running Apache Ignite C++): " + marsh.getClass().getName());
assert marsh != null;

BinaryConfiguration bCfg = igniteCfg.getBinaryConfiguration();

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -18,14 +18,11 @@
package org.apache.ignite.internal.processors.platform.dotnet;

import java.util.ArrayList;
import java.util.Collections;
import java.util.List;
import org.apache.ignite.IgniteException;
import org.apache.ignite.configuration.BinaryConfiguration;
import org.apache.ignite.configuration.CacheConfiguration;
import org.apache.ignite.configuration.IgniteConfiguration;
import org.apache.ignite.configuration.PlatformConfiguration;
import org.apache.ignite.internal.binary.BinaryMarshaller;
import org.apache.ignite.internal.binary.BinaryRawWriterEx;
import org.apache.ignite.internal.binary.BinaryReaderExImpl;
import org.apache.ignite.internal.binary.GridBinaryMarshaller;
Expand All @@ -39,7 +36,6 @@
import org.apache.ignite.internal.processors.platform.utils.PlatformUtils;
import org.apache.ignite.internal.util.typedef.internal.U;
import org.apache.ignite.lifecycle.LifecycleBean;
import org.apache.ignite.marshaller.Marshaller;
import org.apache.ignite.platform.dotnet.PlatformDotNetAffinityFunction;
import org.apache.ignite.platform.dotnet.PlatformDotNetConfiguration;
import org.apache.ignite.platform.dotnet.PlatformDotNetLifecycleBean;
Expand Down Expand Up @@ -108,32 +104,6 @@ public PlatformDotNetConfigurationClosure(long envPtr, boolean useLogger) {

// Callback to .Net.
prepare(igniteCfg, dotNetCfg0);

// Make sure binary config is right.
setBinaryConfiguration(igniteCfg, dotNetCfg0);
}

/**
* Sets binary config.
*
* @param igniteCfg Ignite config.
* @param dotNetCfg .NET config.
*/
private void setBinaryConfiguration(IgniteConfiguration igniteCfg, PlatformDotNetConfigurationEx dotNetCfg) {
// Check marshaller.
Marshaller marsh = igniteCfg.getMarshaller();

if (marsh == null) {
igniteCfg.setMarshaller(new BinaryMarshaller());

dotNetCfg.warnings(Collections.singleton("Marshaller is automatically set to " +
BinaryMarshaller.class.getName() + " (other nodes must have the same marshaller type)."));
}
else if (!(marsh instanceof BinaryMarshaller))
throw new IgniteException("Unsupported marshaller (only " + BinaryMarshaller.class.getName() +
" can be used when running Apache Ignite.NET): " + marsh.getClass().getName());

BinaryConfiguration bCfg = igniteCfg.getBinaryConfiguration();
}

/**
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -30,41 +30,8 @@
* <p>
* Ignite provides the following {@code Marshaller} implementations:
* <ul>
* <li>Default binary marshaller. Will be used when no other marshaller is explicitly set to the
* configuration. For more information, see {@link IgniteBinary}.</li>
* <li>{@link org.apache.ignite.marshaller.jdk.JdkMarshaller}</li>
* <li>Default binary marshaller. For more information, see {@link IgniteBinary}.</li>
* </ul>
* <p>
* Below are examples of marshaller configuration, usage, and injection into tasks, jobs,
* and SPI's.
* <h2 class="header">Java Example</h2>
* {@code Marshaller} can be explicitly configured in code.
* <pre name="code" class="java">
* JdkMarshaller marshaller = new JdkMarshaller();
*
* IgniteConfiguration cfg = new IgniteConfiguration();
*
* // Override marshaller.
* cfg.setMarshaller(marshaller);
*
* // Starts grid.
* G.start(cfg);
* </pre>
* <h2 class="header">Spring Example</h2>
* Marshaller can be configured from Spring XML configuration file:
* <pre name="code" class="xml">
* &lt;bean id="grid.custom.cfg" class="org.apache.ignite.configuration.IgniteConfiguration" singleton="true"&gt;
* ...
* &lt;property name="marshaller"&gt;
* &lt;bean class="org.apache.ignite.marshaller.jdk.JdkMarshaller"/&gt;
* &lt;/property&gt;
* ...
* &lt;/bean&gt;
* </pre>
* <p>
* <img src="http://ignite.apache.org/images/spring-small.png">
* <br>
* For information about Spring framework visit <a href="http://www.springframework.org/">www.springframework.org</a>
*/
public interface Marshaller {
/**
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -23,7 +23,6 @@
import org.apache.ignite.configuration.ConnectorConfiguration;
import org.apache.ignite.configuration.ConnectorMessageInterceptor;
import org.apache.ignite.configuration.IgniteConfiguration;
import org.apache.ignite.internal.binary.BinaryMarshaller;
import org.apache.ignite.lifecycle.LifecycleAware;
import org.apache.ignite.lifecycle.LifecycleBean;
import org.apache.ignite.lifecycle.LifecycleEventType;
Expand Down Expand Up @@ -102,30 +101,6 @@ private static class TestLifecycleBean extends TestLifecycleAware implements Lif
}
}

/**
*/
private static class TestMarshaller extends BinaryMarshaller implements LifecycleAware {
/** */
private final TestLifecycleAware lifecycleAware = new TestLifecycleAware(null);

/** {@inheritDoc} */
@Override public void start() {
lifecycleAware.start();
}

/** {@inheritDoc} */
@Override public void stop() {
lifecycleAware.stop();
}

/**
* @return Lifecycle aware.
*/
TestLifecycleAware lifecycleAware() {
return lifecycleAware;
}
}

/**
*/
private static class TestLogger extends JavaLogger implements LifecycleAware {
Expand Down Expand Up @@ -182,12 +157,6 @@ TestLifecycleAware lifecycleAware() {

lifecycleAwares.add(lifecycleBean);

TestMarshaller marshaller = new TestMarshaller();

cfg.setMarshaller(marshaller);

lifecycleAwares.add(marshaller.lifecycleAware());

TestLogger testLog = new TestLogger();

cfg.setGridLogger(testLog);
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -15,9 +15,8 @@
* limitations under the License.
*/

package org.apache.ignite.internal.marshaller.optimized;
package org.apache.ignite.internal;

import java.io.File;
import java.io.Serializable;
import java.util.HashMap;
import java.util.Map;
Expand All @@ -26,9 +25,6 @@
import org.apache.ignite.IgniteCache;
import org.apache.ignite.configuration.CacheConfiguration;
import org.apache.ignite.configuration.IgniteConfiguration;
import org.apache.ignite.internal.IgniteInternalFuture;
import org.apache.ignite.internal.util.typedef.internal.U;
import org.apache.ignite.marshaller.Marshaller;
import org.apache.ignite.testframework.GridTestUtils;
import org.apache.ignite.testframework.junits.common.GridCommonAbstractTest;
import org.junit.Test;
Expand All @@ -39,21 +35,14 @@
/**
*
*/
public class OptimizedMarshallerNodeFailoverTest extends GridCommonAbstractTest {
public class NodeFailoverTest extends GridCommonAbstractTest {
/** */
private boolean cache;

/** */
private String workDir;

/** {@inheritDoc} */
@Override protected IgniteConfiguration getConfiguration(String igniteInstanceName) throws Exception {
IgniteConfiguration cfg = super.getConfiguration(igniteInstanceName);

cfg.setMarshaller(new OptimizedMarshaller());

cfg.setWorkDirectory(workDir);

if (cache) {
CacheConfiguration ccfg = new CacheConfiguration(DEFAULT_CACHE_NAME);

Expand Down Expand Up @@ -128,63 +117,6 @@ private void classCacheUpdateFailover(boolean stopSrv) throws Exception {
assertNotNull(ignite.cache(DEFAULT_CACHE_NAME));
}

/**
* @throws Exception If failed.
*/
@Test
public void testRestartAllNodes() throws Exception {
cache = true;

String home = U.getIgniteHome();

String[] workDirs = new String[3];

for (int i = 0; i < 3; i++) {
workDirs[i] = home + "/work/marshallerTestNode_" + i;

File file = new File(workDirs[i]);

if (file.exists())
assert U.delete(file);
}

try {
for (int i = 0; i < workDirs.length; i++) {
workDir = workDirs[i];

startGrid(i);
}

Marshaller marsh = ignite(0).configuration().getMarshaller();

TestClass1 obj = new TestClass1();

obj.val = 111;

byte[] bytes = marsh.marshal(obj);

stopAllGrids();

for (int i = 0; i < workDirs.length; i++) {
workDir = workDirs[i];

startGrid(i);
}

for (int i = 0; i < 3; i++) {
marsh = ignite(i).configuration().getMarshaller();

TestClass1 obj0 = marsh.unmarshal(bytes, null);

assertEquals(111, obj0.val);
}
}
finally {
for (String dir : workDirs)
assert U.delete(new File(dir));
}
}

/** {@inheritDoc} */
@Override protected void afterTest() throws Exception {
super.afterTest();
Expand Down
Loading
Loading