Vladsz83 commented on code in PR #13454:
URL: https://github.com/apache/ignite/pull/13454#discussion_r3751485323


##########
modules/core/src/main/java/org/apache/ignite/internal/processors/datastreamer/DataStreamerBuiltInUpdater.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.datastreamer;
+
+import org.apache.ignite.stream.StreamReceiver;
+import org.jetbrains.annotations.Nullable;
+
+/**
+ * The updaters DataStreamer ships with. Every node has them, so a request 
names the one it needs instead of carrying
+ * a serialized copy.
+ */
+enum DataStreamerBuiltInUpdater {
+    /** {@link DataStreamerImpl#ISOLATED_UPDATER}. */
+    ISOLATED(DataStreamerImpl.ISOLATED_UPDATER),
+
+    /** {@link DataStreamerCacheUpdaters#individual()}. */
+    INDIVIDUAL(DataStreamerCacheUpdaters.individual()),
+
+    /** {@link DataStreamerCacheUpdaters#batched()}. */
+    BATCHED(DataStreamerCacheUpdaters.batched()),
+
+    /** {@link DataStreamerCacheUpdaters#batchedSorted()}. */
+    BATCHED_SORTED(DataStreamerCacheUpdaters.batchedSorted());
+
+    /** */
+    private final StreamReceiver<?, ?> updater;
+
+    /** */
+    private final DataStreamerReceiverMessage msg;
+
+    /** @param updater Updater this constant stands for. */
+    DataStreamerBuiltInUpdater(StreamReceiver<?, ?> updater) {
+        this.updater = updater;
+
+        msg = new DataStreamerReceiverMessage(this);
+    }
+
+    /** @return Updater of this node. */
+    StreamReceiver<?, ?> updater() {
+        return updater;

Review Comment:
   I would prefer to create updater on demand.



##########
modules/core/src/main/java/org/apache/ignite/internal/processors/datastreamer/DataStreamerBuiltInUpdater.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.datastreamer;
+
+import org.apache.ignite.stream.StreamReceiver;
+import org.jetbrains.annotations.Nullable;
+
+/**
+ * The updaters DataStreamer ships with. Every node has them, so a request 
names the one it needs instead of carrying
+ * a serialized copy.
+ */
+enum DataStreamerBuiltInUpdater {
+    /** {@link DataStreamerImpl#ISOLATED_UPDATER}. */
+    ISOLATED(DataStreamerImpl.ISOLATED_UPDATER),
+
+    /** {@link DataStreamerCacheUpdaters#individual()}. */
+    INDIVIDUAL(DataStreamerCacheUpdaters.individual()),
+
+    /** {@link DataStreamerCacheUpdaters#batched()}. */
+    BATCHED(DataStreamerCacheUpdaters.batched()),
+
+    /** {@link DataStreamerCacheUpdaters#batchedSorted()}. */
+    BATCHED_SORTED(DataStreamerCacheUpdaters.batchedSorted());
+
+    /** */
+    private final StreamReceiver<?, ?> updater;
+
+    /** */
+    private final DataStreamerReceiverMessage msg;
+
+    /** @param updater Updater this constant stands for. */
+    DataStreamerBuiltInUpdater(StreamReceiver<?, ?> updater) {
+        this.updater = updater;
+
+        msg = new DataStreamerReceiverMessage(this);
+    }
+
+    /** @return Updater of this node. */
+    StreamReceiver<?, ?> updater() {
+        return updater;
+    }
+
+    /** @return Message holding {@link #updater()}; one per constant, as these 
updaters never change. */
+    DataStreamerReceiverMessage message() {
+        return msg;

Review Comment:
   I would prefer to create message on demand. DataStreamer might not be used 
at all.



##########
modules/core/src/main/java/org/apache/ignite/internal/processors/datastreamer/DataStreamerReceiverMessage.java:
##########
@@ -0,0 +1,67 @@
+/*
+ * 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.datastreamer;
+
+import org.apache.ignite.internal.Marshalled;
+import org.apache.ignite.internal.Order;
+import org.apache.ignite.internal.UseBinaryMarshaller;
+import org.apache.ignite.plugin.extensions.communication.Message;
+import org.apache.ignite.stream.StreamReceiver;
+
+/** DataStreamer cache receiver/updater message. */
+@UseBinaryMarshaller
+public class DataStreamerReceiverMessage implements Message {
+    /** DataStreamer cache receiver/updater; {@code null} when {@link 
#builtIn} names it. */

Review Comment:
   `names it` -> `is effective`



##########
modules/core/src/main/java/org/apache/ignite/internal/processors/datastreamer/DataStreamerReceiverMessage.java:
##########
@@ -0,0 +1,67 @@
+/*
+ * 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.datastreamer;
+
+import org.apache.ignite.internal.Marshalled;
+import org.apache.ignite.internal.Order;
+import org.apache.ignite.internal.UseBinaryMarshaller;
+import org.apache.ignite.plugin.extensions.communication.Message;
+import org.apache.ignite.stream.StreamReceiver;
+
+/** DataStreamer cache receiver/updater message. */
+@UseBinaryMarshaller
+public class DataStreamerReceiverMessage implements Message {
+    /** DataStreamer cache receiver/updater; {@code null} when {@link 
#builtIn} names it. */
+    @Marshalled("rcvrBytes")
+    StreamReceiver<?, ?> rcvr;
+
+    /** Serialized {@link #rcvr}. */
+    @Order(0)
+    volatile byte[] rcvrBytes;
+
+    /** The updater every node has; {@code null} when {@link #rcvr} is a user 
one. */
+    @Order(1)
+    DataStreamerBuiltInUpdater builtIn;

Review Comment:
   `@Nullable`



##########
modules/core/src/main/java/org/apache/ignite/internal/processors/datastreamer/DataStreamerReceiverMessage.java:
##########
@@ -0,0 +1,67 @@
+/*
+ * 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.datastreamer;
+
+import org.apache.ignite.internal.Marshalled;
+import org.apache.ignite.internal.Order;
+import org.apache.ignite.internal.UseBinaryMarshaller;
+import org.apache.ignite.plugin.extensions.communication.Message;
+import org.apache.ignite.stream.StreamReceiver;
+
+/** DataStreamer cache receiver/updater message. */
+@UseBinaryMarshaller
+public class DataStreamerReceiverMessage implements Message {
+    /** DataStreamer cache receiver/updater; {@code null} when {@link 
#builtIn} names it. */
+    @Marshalled("rcvrBytes")
+    StreamReceiver<?, ?> rcvr;
+
+    /** Serialized {@link #rcvr}. */
+    @Order(0)
+    volatile byte[] rcvrBytes;
+
+    /** The updater every node has; {@code null} when {@link #rcvr} is a user 
one. */

Review Comment:
   `The updater every node has` -> `A built-in updater every node has`



##########
modules/core/src/main/java/org/apache/ignite/internal/processors/datastreamer/DataStreamerImpl.java:
##########
@@ -655,7 +667,7 @@ public IgniteFuture<?> addDataInternal(Collection<? extends 
DataStreamerEntry> e
 
         lock(false);
 
-        if (rcvr instanceof IsolatedUpdater && 
inconsistencyWarned.compareAndSet(false, true))
+        if (!allowOverwrite() && inconsistencyWarned.compareAndSet(false, 
true))

Review Comment:
   Let's add comment about Isolated updater



##########
modules/core/src/main/java/org/apache/ignite/internal/processors/datastreamer/DataStreamerRequest.java:
##########
@@ -155,9 +157,14 @@ String cacheName() {
         return cacheName;
     }
 
+    /** @return {@code True} if the updater travelled with the request instead 
of being named. */

Review Comment:
   Let's used notations like `build-in`or `custom/user's`



##########
modules/core/src/main/java/org/apache/ignite/internal/processors/datastreamer/DataStreamerReceiverMessage.java:
##########
@@ -0,0 +1,67 @@
+/*
+ * 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.datastreamer;
+
+import org.apache.ignite.internal.Marshalled;
+import org.apache.ignite.internal.Order;
+import org.apache.ignite.internal.UseBinaryMarshaller;
+import org.apache.ignite.plugin.extensions.communication.Message;
+import org.apache.ignite.stream.StreamReceiver;
+
+/** DataStreamer cache receiver/updater message. */
+@UseBinaryMarshaller
+public class DataStreamerReceiverMessage implements Message {
+    /** DataStreamer cache receiver/updater; {@code null} when {@link 
#builtIn} names it. */
+    @Marshalled("rcvrBytes")
+    StreamReceiver<?, ?> rcvr;
+
+    /** Serialized {@link #rcvr}. */
+    @Order(0)
+    volatile byte[] rcvrBytes;
+
+    /** The updater every node has; {@code null} when {@link #rcvr} is a user 
one. */
+    @Order(1)
+    DataStreamerBuiltInUpdater builtIn;
+
+    /** Empty constructor for serialization purposes. */
+    public DataStreamerReceiverMessage() {
+        // No-op.
+    }
+
+    /** @param rcvr User receiver. */
+    DataStreamerReceiverMessage(StreamReceiver<?, ?> rcvr) {
+        assert DataStreamerBuiltInUpdater.of(rcvr) == null : "A built-in 
updater travels by name: " + rcvr;
+
+        this.rcvr = rcvr;
+    }
+
+    /** @param builtIn Updater every node has, named rather than carried. */
+    DataStreamerReceiverMessage(DataStreamerBuiltInUpdater builtIn) {
+        this.builtIn = builtIn;
+    }
+
+    /** @return {@code True} if the receiver travels with this message rather 
than being named. */
+    boolean user() {

Review Comment:
   Let's say smth. like `builtIn` instead



##########
modules/core/src/main/java/org/apache/ignite/internal/processors/datastreamer/DataStreamerReceiverMessage.java:
##########
@@ -0,0 +1,67 @@
+/*
+ * 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.datastreamer;
+
+import org.apache.ignite.internal.Marshalled;
+import org.apache.ignite.internal.Order;
+import org.apache.ignite.internal.UseBinaryMarshaller;
+import org.apache.ignite.plugin.extensions.communication.Message;
+import org.apache.ignite.stream.StreamReceiver;
+
+/** DataStreamer cache receiver/updater message. */
+@UseBinaryMarshaller
+public class DataStreamerReceiverMessage implements Message {
+    /** DataStreamer cache receiver/updater; {@code null} when {@link 
#builtIn} names it. */
+    @Marshalled("rcvrBytes")
+    StreamReceiver<?, ?> rcvr;
+
+    /** Serialized {@link #rcvr}. */
+    @Order(0)
+    volatile byte[] rcvrBytes;
+
+    /** The updater every node has; {@code null} when {@link #rcvr} is a user 
one. */
+    @Order(1)
+    DataStreamerBuiltInUpdater builtIn;
+
+    /** Empty constructor for serialization purposes. */
+    public DataStreamerReceiverMessage() {
+        // No-op.
+    }
+
+    /** @param rcvr User receiver. */
+    DataStreamerReceiverMessage(StreamReceiver<?, ?> rcvr) {
+        assert DataStreamerBuiltInUpdater.of(rcvr) == null : "A built-in 
updater travels by name: " + rcvr;
+
+        this.rcvr = rcvr;
+    }
+
+    /** @param builtIn Updater every node has, named rather than carried. */
+    DataStreamerReceiverMessage(DataStreamerBuiltInUpdater builtIn) {
+        this.builtIn = builtIn;
+    }
+
+    /** @return {@code True} if the receiver travels with this message rather 
than being named. */
+    boolean user() {
+        return builtIn == null;
+    }
+
+    /** @return Receiver: the one carried here, or the node's own that this 
message names. */

Review Comment:
   Smth. like `If is a built-in receviver or user's custom one`



##########
modules/core/src/main/java/org/apache/ignite/internal/processors/datastreamer/DataStreamerBuiltInUpdater.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.datastreamer;
+
+import org.apache.ignite.stream.StreamReceiver;
+import org.jetbrains.annotations.Nullable;
+
+/**
+ * The updaters DataStreamer ships with. Every node has them, so a request 
names the one it needs instead of carrying
+ * a serialized copy.
+ */
+enum DataStreamerBuiltInUpdater {
+    /** {@link DataStreamerImpl#ISOLATED_UPDATER}. */
+    ISOLATED(DataStreamerImpl.ISOLATED_UPDATER),
+
+    /** {@link DataStreamerCacheUpdaters#individual()}. */
+    INDIVIDUAL(DataStreamerCacheUpdaters.individual()),
+
+    /** {@link DataStreamerCacheUpdaters#batched()}. */
+    BATCHED(DataStreamerCacheUpdaters.batched()),
+
+    /** {@link DataStreamerCacheUpdaters#batchedSorted()}. */
+    BATCHED_SORTED(DataStreamerCacheUpdaters.batchedSorted());
+
+    /** */
+    private final StreamReceiver<?, ?> updater;
+
+    /** */
+    private final DataStreamerReceiverMessage msg;
+
+    /** @param updater Updater this constant stands for. */
+    DataStreamerBuiltInUpdater(StreamReceiver<?, ?> updater) {
+        this.updater = updater;
+
+        msg = new DataStreamerReceiverMessage(this);
+    }
+
+    /** @return Updater of this node. */
+    StreamReceiver<?, ?> updater() {
+        return updater;
+    }
+
+    /** @return Message holding {@link #updater()}; one per constant, as these 
updaters never change. */
+    DataStreamerReceiverMessage message() {
+        return msg;
+    }
+
+    /**
+     * @param updater Updater to look up.
+     * @return Constant standing for {@code updater}, or {@code null} when it 
is not one the streamer ships with.

Review Comment:
   Lets use `build-in` notations. Datastreamer is shipped only with Isolated 
updater. Whereas built-in updaters are external to him



##########
modules/core/src/main/java/org/apache/ignite/internal/processors/datastreamer/DataStreamerReceiverMessage.java:
##########
@@ -0,0 +1,67 @@
+/*
+ * 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.datastreamer;
+
+import org.apache.ignite.internal.Marshalled;
+import org.apache.ignite.internal.Order;
+import org.apache.ignite.internal.UseBinaryMarshaller;
+import org.apache.ignite.plugin.extensions.communication.Message;
+import org.apache.ignite.stream.StreamReceiver;
+
+/** DataStreamer cache receiver/updater message. */
+@UseBinaryMarshaller
+public class DataStreamerReceiverMessage implements Message {
+    /** DataStreamer cache receiver/updater; {@code null} when {@link 
#builtIn} names it. */
+    @Marshalled("rcvrBytes")
+    StreamReceiver<?, ?> rcvr;

Review Comment:
   `@Nullable`



##########
modules/core/src/main/java/org/apache/ignite/internal/processors/datastreamer/DataStreamerReceiverMessage.java:
##########
@@ -0,0 +1,67 @@
+/*
+ * 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.datastreamer;
+
+import org.apache.ignite.internal.Marshalled;
+import org.apache.ignite.internal.Order;
+import org.apache.ignite.internal.UseBinaryMarshaller;
+import org.apache.ignite.plugin.extensions.communication.Message;
+import org.apache.ignite.stream.StreamReceiver;
+
+/** DataStreamer cache receiver/updater message. */
+@UseBinaryMarshaller
+public class DataStreamerReceiverMessage implements Message {
+    /** DataStreamer cache receiver/updater; {@code null} when {@link 
#builtIn} names it. */
+    @Marshalled("rcvrBytes")
+    StreamReceiver<?, ?> rcvr;
+
+    /** Serialized {@link #rcvr}. */
+    @Order(0)
+    volatile byte[] rcvrBytes;
+
+    /** The updater every node has; {@code null} when {@link #rcvr} is a user 
one. */
+    @Order(1)
+    DataStreamerBuiltInUpdater builtIn;
+
+    /** Empty constructor for serialization purposes. */
+    public DataStreamerReceiverMessage() {
+        // No-op.
+    }
+
+    /** @param rcvr User receiver. */
+    DataStreamerReceiverMessage(StreamReceiver<?, ?> rcvr) {
+        assert DataStreamerBuiltInUpdater.of(rcvr) == null : "A built-in 
updater travels by name: " + rcvr;
+
+        this.rcvr = rcvr;
+    }
+
+    /** @param builtIn Updater every node has, named rather than carried. */

Review Comment:
   `A built-in updater every node has`



-- 
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]

Reply via email to