Vladsz83 commented on code in PR #13462:
URL: https://github.com/apache/ignite/pull/13462#discussion_r3769002594
##########
modules/codegen/src/main/java/org/apache/ignite/internal/JdkMarshalled.java:
##########
@@ -14,25 +14,22 @@
* See the License for the specific language governing permissions and
* limitations under the License.
*/
+
package org.apache.ignite.internal;
-import java.lang.annotation.Documented;
+import java.lang.annotation.ElementType;
import java.lang.annotation.Retention;
+import java.lang.annotation.RetentionPolicy;
import java.lang.annotation.Target;
-import org.apache.ignite.internal.binary.BinaryMarshaller;
-import org.apache.ignite.plugin.extensions.communication.Message;
-
-import static java.lang.annotation.ElementType.TYPE;
-import static java.lang.annotation.RetentionPolicy.RUNTIME;
/**
- * In case message CAN contain user provided classes it must be marshalled
with the {@link BinaryMarshaller}.
- * {@link BinaryMarshaller} is able to process user classes using schema
tansfering protocol through Discovery.
- * Mark {@link Message} class with annotation to serialize it with {@link
BinaryMarshaller}.
+ * Marshals the message with the JDK marshaller of the local node, whatever
the transport speaks. Put it on a message
+ * that travels both transports: a {@link Marshalled} field caches its wire
form, and only the JDK marshaller is read
+ * by both. It also asks no cluster-wide type registration, which never
completes on a discovery thread.
+ *
+ * @see Marshalled
*/
-@Documented
-@Target(value = TYPE)
-@Retention(RUNTIME)
-public @interface UseBinaryMarshaller {
Review Comment:
Why binary changed on opposite JDK?
##########
modules/core/src/main/java/org/apache/ignite/internal/managers/communication/DiscoveryMarshalling.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.managers.communication;
+
+import org.apache.ignite.IgniteCheckedException;
+import org.apache.ignite.internal.GridKernalContext;
+import org.apache.ignite.internal.processors.cache.CacheObjectContext;
+import org.apache.ignite.plugin.extensions.communication.Message;
+import org.jetbrains.annotations.Nullable;
+
+/**
+ * Marshalling of the discovery transport, which speaks the JDK marshaller: a
discovery message is marshalled on a
+ * discovery thread, where waiting for a cluster-wide type registration would
never finish.
+ */
+public final class DiscoveryMarshalling {
Review Comment:
Why it is in `communication` package? Also package `managers` might be
revised
##########
modules/core/src/main/java/org/apache/ignite/internal/managers/communication/DiscoveryMarshalling.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.managers.communication;
+
+import org.apache.ignite.IgniteCheckedException;
+import org.apache.ignite.internal.GridKernalContext;
+import org.apache.ignite.internal.processors.cache.CacheObjectContext;
+import org.apache.ignite.plugin.extensions.communication.Message;
+import org.jetbrains.annotations.Nullable;
+
+/**
+ * Marshalling of the discovery transport, which speaks the JDK marshaller: a
discovery message is marshalled on a
Review Comment:
Let's rephrase `speaks`
##########
modules/core/src/main/java/org/apache/ignite/internal/managers/communication/CommunicationMarshalling.java:
##########
@@ -0,0 +1,49 @@
+/*
+ * 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.managers.communication;
+
+import org.apache.ignite.IgniteCheckedException;
+import org.apache.ignite.internal.GridKernalContext;
+import org.apache.ignite.internal.processors.cache.CacheObjectContext;
+import org.apache.ignite.plugin.extensions.communication.Message;
+import org.jetbrains.annotations.Nullable;
+
+/** Marshalling of the communication transport, which speaks the schema-aware
marshaller. */
Review Comment:
Let's reclarify `speaks`
##########
modules/core/src/main/java/org/apache/ignite/internal/processors/cache/distributed/dht/preloader/GridDhtPartitionsExchangeFuture.java:
##########
@@ -3821,7 +3821,7 @@ else if (forceAffReassignment)
// Marshal eagerly: the heavy partition-map copy lands in the
"Full message preparing" stage, and the
// message cached in FinishState is sent to late joiners as is
(the send-path marshal-once turns no-op).
- MessageMarshalling.marshal(msg, cctx.kernalContext(), null);
+ CommunicationMarshalling.marshal(msg, cctx.kernalContext(), null);
Review Comment:
Is it so obvious so it Communication-related? Why would I suppose it? Why
not discovery? If Communication proccesses the marshalling, lets let it decide
and choose.
##########
modules/core/src/main/java/org/apache/ignite/internal/processors/cache/query/continuous/CacheContinuousQueryHandler.java:
##########
@@ -1072,7 +1072,7 @@ private void notifyCallback0(UUID nodeId,
}
}
- MessageMarshalling.unmarshal(e, ctx,
cctx.cacheObjectContext(), ldr);
+ CommunicationMarshalling.unmarshal(e, ctx,
cctx.cacheObjectContext(), ldr);
Review Comment:
The same. Why Communication marshaling? How do I know it? To me,
`MessageMarshalling` look much better. It will decide what and how to do. Now I
need to decide. Let's reconsider.
##########
modules/core/src/main/java/org/apache/ignite/internal/processors/task/GridTaskWorker.java:
##########
@@ -824,7 +824,7 @@ void onResponse(GridJobExecuteResponse msg) {
boolean loc = ctx.localNodeId().equals(res.nodeId())
&& !ctx.config().isMarshalLocalJobs();
if (!loc)
- MessageMarshalling.unmarshal(res, ctx, null,
U.resolveClassLoader(dep.classLoader(), ctx.config()));
Review Comment:
All the others places too. `MessageMarshalling` looks better. Gets the work
of marsahaling type choise incapsulated. Not, exposed to a developer.
##########
modules/core/src/main/java/org/apache/ignite/internal/managers/communication/CommunicationMarshalling.java:
##########
@@ -0,0 +1,49 @@
+/*
+ * 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.managers.communication;
+
+import org.apache.ignite.IgniteCheckedException;
+import org.apache.ignite.internal.GridKernalContext;
+import org.apache.ignite.internal.processors.cache.CacheObjectContext;
+import org.apache.ignite.plugin.extensions.communication.Message;
+import org.jetbrains.annotations.Nullable;
+
+/** Marshalling of the communication transport, which speaks the schema-aware
marshaller. */
+public final class CommunicationMarshalling {
Review Comment:
Maybe package `managers` is not the best place for it.
##########
modules/core/src/main/java/org/apache/ignite/internal/managers/communication/CommunicationMarshalling.java:
##########
@@ -0,0 +1,49 @@
+/*
+ * 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.managers.communication;
+
+import org.apache.ignite.IgniteCheckedException;
+import org.apache.ignite.internal.GridKernalContext;
+import org.apache.ignite.internal.processors.cache.CacheObjectContext;
+import org.apache.ignite.plugin.extensions.communication.Message;
+import org.jetbrains.annotations.Nullable;
+
+/** Marshalling of the communication transport, which speaks the schema-aware
marshaller. */
+public final class CommunicationMarshalling {
Review Comment:
Only minority of the messages requires BinaryMarshaller. Why we use it for
all of them? It is able to marshall non-serializable and wont failt where
shoud. Is it faster that JDKMarshaller? Any proofs? It processes schema. Won't
we get any perf. drop on marshalling with it?
##########
modules/core/src/main/java/org/apache/ignite/internal/managers/eventstorage/GridEventStorageManager.java:
##########
@@ -1242,7 +1242,7 @@ private class RequestListener implements
GridMessageListener {
Collection<Event> evts;
try {
- MessageMarshalling.unmarshal(req, ctx, null,
+ CommunicationMarshalling.unmarshal(req, ctx, null,
Review Comment:
My idea was to bind thread an marshaller, not places where called. WDYT?
##########
modules/core/src/main/java/org/apache/ignite/internal/processors/cache/StoredCacheData.java:
##########
@@ -43,6 +44,8 @@
* <p>
* All changes must be made with the respect of RU rules.
*/
+// Travels both transports: by discovery when a cache starts, by communication
when a snapshot is restored.
+@JdkMarshalled
Review Comment:
Even so, why not marshall with the marshaller choosen? Why discovery ort
Communication should change marshaller?
##########
modules/core/src/main/java/org/apache/ignite/internal/processors/cache/transactions/IgniteTxManager.java:
##########
@@ -3507,7 +3507,7 @@ private void unmarshall(UUID nodeId, GridCacheMessage
cacheMsg) {
return;
try {
- MessageMarshalling.unmarshal(cacheMsg, cctx.kernalContext(),
null, cctx.deploy().globalLoader());
+ CommunicationMarshalling.unmarshal(cacheMsg,
cctx.kernalContext(), null, cctx.deploy().globalLoader());
Review Comment:
Same. Why `CommunicationMarshalling` ? Why if someone puts
`DiscoveryMarshalling`? Is it deprecated, protected?
##########
modules/core/src/main/java/org/apache/ignite/internal/processors/datastreamer/DataStreamProcessor.java:
##########
@@ -230,7 +230,7 @@ private void processRequest(final UUID nodeId, final
DataStreamerRequest req) {
StreamReceiver<?, ?> updater;
try {
- MessageMarshalling.unmarshal(req, ctx, null,
U.resolveClassLoader(clsLdr, ctx.config()));
+ CommunicationMarshalling.unmarshal(req, ctx, null,
U.resolveClassLoader(clsLdr, ctx.config()));
Review Comment:
Same. `MessageMarshalling` looks better. Noone cares which marshalling to
call. Just pick up `MessageMarshalling`. Now we need to know.
--
This is an automated message from the Apache Git Service.
To respond to the message, please log on to GitHub and use the
URL above to go to the specific comment.
To unsubscribe, e-mail: [email protected]
For queries about this service, please contact Infrastructure at:
[email protected]