Skip to content

Commit

Permalink
IGNITE-15083 Remove "instanceof BinaryMarshaller" from production code
Browse files Browse the repository at this point in the history
  • Loading branch information
nizhikov committed Dec 27, 2024
1 parent 322592d commit 951038c
Show file tree
Hide file tree
Showing 5 changed files with 3 additions and 61 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -250,7 +250,6 @@
import static org.apache.ignite.internal.IgniteNodeAttributes.ATTR_LANG_RUNTIME;
import static org.apache.ignite.internal.IgniteNodeAttributes.ATTR_LATE_AFFINITY_ASSIGNMENT;
import static org.apache.ignite.internal.IgniteNodeAttributes.ATTR_MACS;
import static org.apache.ignite.internal.IgniteNodeAttributes.ATTR_MARSHALLER;
import static org.apache.ignite.internal.IgniteNodeAttributes.ATTR_MARSHALLER_COMPACT_FOOTER;
import static org.apache.ignite.internal.IgniteNodeAttributes.ATTR_MARSHALLER_USE_BINARY_STRING_SER_VER_2;
import static org.apache.ignite.internal.IgniteNodeAttributes.ATTR_MARSHALLER_USE_DFLT_SUID;
Expand Down Expand Up @@ -1648,7 +1647,6 @@ private void fillNodeAttributes(boolean notifyEnabled) throws IgniteCheckedExcep
add(ATTR_JIT_NAME, U.getCompilerMx() == null ? "" : U.getCompilerMx().getName());
add(ATTR_BUILD_VER, VER_STR);
add(ATTR_BUILD_DATE, BUILD_TSTAMP_STR);
add(ATTR_MARSHALLER, cfg.getMarshaller().getClass().getName());
add(ATTR_MARSHALLER_USE_DFLT_SUID,
getBoolean(IGNITE_OPTIMIZED_MARSHALLER_USE_DEFAULT_SUID, OptimizedMarshaller.USE_DFLT_SUID));
add(ATTR_LATE_AFFINITY_ASSIGNMENT, cfg.isLateAffinityAssignment());
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -47,7 +47,7 @@ public class CacheObjectContext implements CacheObjectValueContext {
/** */
private final boolean addDepInfo;

/** Boinary enabled flag. */
/** Binary enabled flag. */
private final boolean binaryEnabled;

/**
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -156,7 +156,7 @@ public class CacheObjectBinaryProcessorImpl extends GridProcessorAdapter impleme
private BinaryContext binaryCtx;

/** */
private Marshaller marsh;
private final Marshaller marsh;

/** */
private GridBinaryMarshaller binaryMarsh;
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -174,7 +174,6 @@
import static org.apache.ignite.failure.FailureType.CRITICAL_ERROR;
import static org.apache.ignite.failure.FailureType.SYSTEM_WORKER_TERMINATION;
import static org.apache.ignite.internal.IgniteNodeAttributes.ATTR_LATE_AFFINITY_ASSIGNMENT;
import static org.apache.ignite.internal.IgniteNodeAttributes.ATTR_MARSHALLER;
import static org.apache.ignite.internal.IgniteNodeAttributes.ATTR_MARSHALLER_COMPACT_FOOTER;
import static org.apache.ignite.internal.IgniteNodeAttributes.ATTR_MARSHALLER_USE_BINARY_STRING_SER_VER_2;
import static org.apache.ignite.internal.IgniteNodeAttributes.ATTR_MARSHALLER_USE_DFLT_SUID;
Expand Down Expand Up @@ -4501,60 +4500,6 @@ else if (log.isDebugEnabled())
return;
}

final String locMarsh = locNode.attribute(ATTR_MARSHALLER);
final String rmtMarsh = node.attribute(ATTR_MARSHALLER);

if (!F.eq(locMarsh, rmtMarsh)) {
utilityPool.execute(
new Runnable() {
@Override public void run() {
String errMsg = "Local node's marshaller differs from remote node's marshaller " +
"(to make sure all nodes in topology have identical marshaller, " +
"configure marshaller explicitly in configuration) " +
"[locMarshaller=" + locMarsh + ", rmtMarshaller=" + rmtMarsh +
", locNodeAddrs=" + U.addressesAsString(locNode) +
", rmtNodeAddrs=" + U.addressesAsString(node) +
", locNodeId=" + locNode.id() + ", rmtNodeId=" + msg.creatorNodeId() + ']';

LT.warn(log, errMsg);

// Always output in debug.
if (log.isDebugEnabled())
log.debug(errMsg);

try {
String sndMsg = "Local node's marshaller differs from remote node's marshaller " +
"(to make sure all nodes in topology have identical marshaller, " +
"configure marshaller explicitly in configuration) " +
"[locMarshaller=" + rmtMarsh + ", rmtMarshaller=" + locMarsh +
", locNodeAddrs=" + U.addressesAsString(node) + ", locPort=" + node.discoveryPort() +
", rmtNodeAddr=" + U.addressesAsString(locNode) + ", locNodeId=" + node.id() +
", rmtNodeId=" + locNode.id() + ']';

trySendMessageDirectly(node,
new TcpDiscoveryCheckFailedMessage(locNodeId, sndMsg));
}
catch (IgniteSpiException e) {
if (log.isDebugEnabled())
log.debug("Failed to send marshaller check failed message to node " +
"[node=" + node + ", err=" + e.getMessage() + ']');

onException("Failed to send marshaller check failed message to node " +
"[node=" + node + ", err=" + e.getMessage() + ']', e);
}
}
}
);

// Ignore join request.
msg.spanContainer().span()
.addLog(() -> "Ignored")
.setStatus(SpanStatus.ABORTED)
.end();

return;
}

// If node have no value for this attribute then we treat it as true.
final Boolean locMarshUseDfltSuid = locNode.attribute(ATTR_MARSHALLER_USE_DFLT_SUID);
boolean locMarshUseDfltSuidBool = locMarshUseDfltSuid == null ? true : locMarshUseDfltSuid;
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -55,7 +55,6 @@
import org.yardstickframework.BenchmarkServer;
import org.yardstickframework.BenchmarkUtils;

import static org.apache.ignite.internal.IgniteNodeAttributes.ATTR_MARSHALLER;
import static org.apache.ignite.yardstick.IgniteBenchmarkUtils.checkIfNoLocalhost;
import static org.apache.ignite.yardstick.IgniteBenchmarkUtils.getPortList;

Expand Down Expand Up @@ -220,7 +219,7 @@ public IgniteNode(boolean clientMode, Ignite ignite) {

ignite = IgniteSpring.start(c, appCtx);

BenchmarkUtils.println("Configured marshaller: " + ignite.cluster().localNode().attribute(ATTR_MARSHALLER));
BenchmarkUtils.println("Configured marshaller: " + ignite.configuration().getMarshaller().getClass());
}

/**
Expand Down

0 comments on commit 951038c

Please sign in to comment.