You are viewing a plain text version of this content. The canonical link for it is here.
Posted to notifications@ignite.apache.org by "rpuch (via GitHub)" <gi...@apache.org> on 2023/12/27 07:13:49 UTC
[PR] IGNITE-21159 Deserialization of Instant field in a Marshallable fails [ignite-3]
rpuch opened a new pull request, #2993:
URL: https://github.com/apache/ignite-3/pull/2993
https://issues.apache.org/jira/browse/IGNITE-21159
Thank you for submitting the pull request.
To streamline the review process of the patch and ensure better code quality
we ask both an author and a reviewer to verify the following:
### The Review Checklist
- [ ] **Formal criteria:** TC status, codestyle, mandatory documentation. Also make sure to complete the following:
\- There is a single JIRA ticket related to the pull request.
\- The web-link to the pull request is attached to the JIRA ticket.
\- The JIRA ticket has the Patch Available state.
\- The description of the JIRA ticket explains WHAT was made, WHY and HOW.
\- The pull request title is treated as the final commit message. The following pattern must be used: IGNITE-XXXX Change summary where XXXX - number of JIRA issue.
- [ ] **Design:** new code conforms with the design principles of the components it is added to.
- [ ] **Patch quality:** patch cannot be split into smaller pieces, its size must be reasonable.
- [ ] **Code quality:** code is clean and readable, necessary developer documentation is added if needed.
- [ ] **Tests code quality:** test set covers positive/negative scenarios, happy/edge cases. Tests are effective in terms of execution time and resources.
### Notes
- [Apache Ignite Coding Guidelines](https://cwiki.apache.org/confluence/display/IGNITE/Java+Code+Style+Guide)
--
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: notifications-unsubscribe@ignite.apache.org
For queries about this service, please contact Infrastructure at:
users@infra.apache.org
Re: [PR] IGNITE-21159 Deserialization of Instant field in a Marshallable fails [ignite-3]
Posted by "rpuch (via GitHub)" <gi...@apache.org>.
rpuch commented on code in PR #2993:
URL: https://github.com/apache/ignite-3/pull/2993#discussion_r1436866505
##########
modules/network/src/test/java/org/apache/ignite/internal/network/serialization/marshal/TestUnmarshalUtils.java:
##########
@@ -0,0 +1,57 @@
+/*
+ * 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.network.serialization.marshal;
+
+import static org.hamcrest.MatcherAssert.assertThat;
+import static org.hamcrest.Matchers.is;
+import static org.hamcrest.Matchers.notNullValue;
+
+import org.apache.ignite.internal.network.serialization.ClassDescriptor;
+import org.apache.ignite.internal.network.serialization.ClassDescriptorRegistry;
+import org.apache.ignite.internal.network.serialization.DescriptorRegistry;
+
+/**
+ * Test utilities for unmarshalling.
+ */
+class TestUnmarshalUtils {
Review Comment:
Renamed the class. WDYT?
--
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: notifications-unsubscribe@ignite.apache.org
For queries about this service, please contact Infrastructure at:
users@infra.apache.org
Re: [PR] IGNITE-21159 Deserialization of Instant field in a Marshallable fails [ignite-3]
Posted by "rpuch (via GitHub)" <gi...@apache.org>.
rpuch commented on code in PR #2993:
URL: https://github.com/apache/ignite-3/pull/2993#discussion_r1436865839
##########
modules/network/src/main/java/org/apache/ignite/internal/network/serialization/DeclaredType.java:
##########
@@ -29,11 +29,10 @@ public interface DeclaredType {
int typeDescriptorId();
/**
- * Returns {@code true} if the type slot can only host (at runtime) instances of its declared type (and not subtypes),
- * so the runtime marshalling type is known upfront. This is also true for enums, even though technically their values might
+ * Returns {@code true} if the contents of the type slot can only hove (at runtime) instances serialized as its declared type
Review Comment:
It's either a field or a component of an array. So it's a slot for which some 'declared type' is statically known.
--
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: notifications-unsubscribe@ignite.apache.org
For queries about this service, please contact Infrastructure at:
users@infra.apache.org
Re: [PR] IGNITE-21159 Deserialization of Instant field in a Marshallable fails [ignite-3]
Posted by "sashapolo (via GitHub)" <gi...@apache.org>.
sashapolo commented on code in PR #2993:
URL: https://github.com/apache/ignite-3/pull/2993#discussion_r1436889333
##########
modules/network/src/test/java/org/apache/ignite/internal/network/serialization/marshal/CleanSlateUnmarshaller.java:
##########
@@ -26,20 +26,27 @@
import org.apache.ignite.internal.network.serialization.DescriptorRegistry;
/**
- * Unmarshalling we do it tests.
+ * Unmarshaller that, during each unmarshalling, only uses built-in descriptors and the descriptors that were actually
+ * used when marshalling.
*/
-class TestUnmarshaling {
+class CleanSlateUnmarshaller {
+ private final UserObjectMarshaller marshaller;
+ private final DescriptorRegistry marshallingRegistry;
+
+ CleanSlateUnmarshaller(UserObjectMarshaller marshaller, DescriptorRegistry marshallingRegistry) {
+ this.marshaller = marshaller;
+ this.marshallingRegistry = marshallingRegistry;
+ }
+
/**
* Unmarshals using a fresh registry and only injecting the descriptors that were reported to be used when marshalling.
*
* @param marshalled Marshalling result.
- * @param marshaller Marshaller to use.
- * @param marshallingRegistry Registry that was used when marshalling.
* @param <T> Expected type of the unmarshalled value.
* @return Unmarshalled value.
* @throws UnmarshalException If something goes wrong.
*/
- static <T> T unmarshalNonNull(MarshalledObject marshalled, UserObjectMarshaller marshaller, DescriptorRegistry marshallingRegistry)
+ <T> T unmarshalNonNull(MarshalledObject marshalled)
throws UnmarshalException {
Review Comment:
This formatting is a little bit off
--
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: notifications-unsubscribe@ignite.apache.org
For queries about this service, please contact Infrastructure at:
users@infra.apache.org
Re: [PR] IGNITE-21159 Deserialization of Instant field in a Marshallable fails [ignite-3]
Posted by "sashapolo (via GitHub)" <gi...@apache.org>.
sashapolo commented on code in PR #2993:
URL: https://github.com/apache/ignite-3/pull/2993#discussion_r1436871506
##########
modules/network/src/test/java/org/apache/ignite/internal/network/serialization/marshal/TestUnmarshaling.java:
##########
@@ -0,0 +1,57 @@
+/*
+ * 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.network.serialization.marshal;
+
+import static org.hamcrest.MatcherAssert.assertThat;
+import static org.hamcrest.Matchers.is;
+import static org.hamcrest.Matchers.notNullValue;
+
+import org.apache.ignite.internal.network.serialization.ClassDescriptor;
+import org.apache.ignite.internal.network.serialization.ClassDescriptorRegistry;
+import org.apache.ignite.internal.network.serialization.DescriptorRegistry;
+
+/**
+ * Unmarshalling we do it tests.
Review Comment:
This javadoc looks wrong
--
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: notifications-unsubscribe@ignite.apache.org
For queries about this service, please contact Infrastructure at:
users@infra.apache.org
Re: [PR] IGNITE-21159 Deserialization of Instant field in a Marshallable fails [ignite-3]
Posted by "rpuch (via GitHub)" <gi...@apache.org>.
rpuch commented on code in PR #2993:
URL: https://github.com/apache/ignite-3/pull/2993#discussion_r1436891197
##########
modules/network/src/main/java/org/apache/ignite/internal/network/serialization/DeclaredType.java:
##########
@@ -29,11 +29,10 @@ public interface DeclaredType {
int typeDescriptorId();
/**
- * Returns {@code true} if the type slot can only host (at runtime) instances of its declared type (and not subtypes),
- * so the runtime marshalling type is known upfront. This is also true for enums, even though technically their values might
+ * Returns {@code true} if the contents of the type slot can only hove (at runtime) instances serialized as its declared type
Review Comment:
I don't know, I had to invent something myself. Any ideas are welcome :)
--
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: notifications-unsubscribe@ignite.apache.org
For queries about this service, please contact Infrastructure at:
users@infra.apache.org
Re: [PR] IGNITE-21159 Deserialization of Instant field in a Marshallable fails [ignite-3]
Posted by "sashapolo (via GitHub)" <gi...@apache.org>.
sashapolo commented on code in PR #2993:
URL: https://github.com/apache/ignite-3/pull/2993#discussion_r1436871754
##########
modules/network/src/test/java/org/apache/ignite/internal/network/serialization/marshal/TestUnmarshaling.java:
##########
@@ -0,0 +1,57 @@
+/*
+ * 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.network.serialization.marshal;
+
+import static org.hamcrest.MatcherAssert.assertThat;
+import static org.hamcrest.Matchers.is;
+import static org.hamcrest.Matchers.notNullValue;
+
+import org.apache.ignite.internal.network.serialization.ClassDescriptor;
+import org.apache.ignite.internal.network.serialization.ClassDescriptorRegistry;
+import org.apache.ignite.internal.network.serialization.DescriptorRegistry;
+
+/**
+ * Unmarshalling we do it tests.
+ */
+class TestUnmarshaling {
Review Comment:
```suggestion
class TestUnmarshalling {
```
--
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: notifications-unsubscribe@ignite.apache.org
For queries about this service, please contact Infrastructure at:
users@infra.apache.org
Re: [PR] IGNITE-21159 Deserialization of Instant field in a Marshallable fails [ignite-3]
Posted by "sashapolo (via GitHub)" <gi...@apache.org>.
sashapolo commented on code in PR #2993:
URL: https://github.com/apache/ignite-3/pull/2993#discussion_r1436870830
##########
modules/network/src/main/java/org/apache/ignite/internal/network/serialization/DeclaredType.java:
##########
@@ -29,11 +29,10 @@ public interface DeclaredType {
int typeDescriptorId();
/**
- * Returns {@code true} if the type slot can only host (at runtime) instances of its declared type (and not subtypes),
- * so the runtime marshalling type is known upfront. This is also true for enums, even though technically their values might
+ * Returns {@code true} if the contents of the type slot can only hove (at runtime) instances serialized as its declared type
Review Comment:
Is this terminology used anywhere else? It is quite confusing...
--
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: notifications-unsubscribe@ignite.apache.org
For queries about this service, please contact Infrastructure at:
users@infra.apache.org
Re: [PR] IGNITE-21159 Deserialization of Instant field in a Marshallable fails [ignite-3]
Posted by "sashapolo (via GitHub)" <gi...@apache.org>.
sashapolo merged PR #2993:
URL: https://github.com/apache/ignite-3/pull/2993
--
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: notifications-unsubscribe@ignite.apache.org
For queries about this service, please contact Infrastructure at:
users@infra.apache.org
Re: [PR] IGNITE-21159 Deserialization of Instant field in a Marshallable fails [ignite-3]
Posted by "sashapolo (via GitHub)" <gi...@apache.org>.
sashapolo commented on code in PR #2993:
URL: https://github.com/apache/ignite-3/pull/2993#discussion_r1436836520
##########
modules/network/src/main/java/org/apache/ignite/internal/network/serialization/ClassDescriptorFactory.java:
##########
@@ -244,7 +244,7 @@ private boolean hasReadResolve(Class<? extends Serializable> clazz) {
}
private boolean hasWriteReplace(Class<? extends Serializable> clazz) {
Review Comment:
Can we inline this method?
##########
modules/network/src/main/java/org/apache/ignite/internal/network/serialization/DeclaredType.java:
##########
@@ -29,11 +29,10 @@ public interface DeclaredType {
int typeDescriptorId();
/**
- * Returns {@code true} if the type slot can only host (at runtime) instances of its declared type (and not subtypes),
- * so the runtime marshalling type is known upfront. This is also true for enums, even though technically their values might
+ * Returns {@code true} if the contents of the type slot can only hove (at runtime) instances serialized as its declared type
Review Comment:
What's a "type slot"?
##########
modules/network/src/main/java/org/apache/ignite/internal/network/serialization/DeclaredType.java:
##########
@@ -29,11 +29,10 @@ public interface DeclaredType {
int typeDescriptorId();
/**
- * Returns {@code true} if the type slot can only host (at runtime) instances of its declared type (and not subtypes),
- * so the runtime marshalling type is known upfront. This is also true for enums, even though technically their values might
+ * Returns {@code true} if the contents of the type slot can only hove (at runtime) instances serialized as its declared type
Review Comment:
```suggestion
* Returns {@code true} if the contents of the type slot can only have (at runtime) instances serialized as its declared type
```
##########
modules/network/src/test/java/org/apache/ignite/internal/network/serialization/marshal/TestUnmarshalUtils.java:
##########
@@ -0,0 +1,57 @@
+/*
+ * 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.network.serialization.marshal;
+
+import static org.hamcrest.MatcherAssert.assertThat;
+import static org.hamcrest.Matchers.is;
+import static org.hamcrest.Matchers.notNullValue;
+
+import org.apache.ignite.internal.network.serialization.ClassDescriptor;
+import org.apache.ignite.internal.network.serialization.ClassDescriptorRegistry;
+import org.apache.ignite.internal.network.serialization.DescriptorRegistry;
+
+/**
+ * Test utilities for unmarshalling.
+ */
+class TestUnmarshalUtils {
Review Comment:
I would prefer this class not to be a utility class, something like `NonNullUnmarshaller`
##########
modules/network/src/test/java/org/apache/ignite/network/DefaultMessagingServiceTest.java:
##########
@@ -343,6 +348,31 @@ private static int extractChannelIdFromThreadName(Thread thread) {
return Integer.parseInt(matcher.group(1));
}
+ @Test
+ @Timeout(10)
Review Comment:
Why do you need this timeout? Shall we use a timeout provided by `willBe`?
--
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: notifications-unsubscribe@ignite.apache.org
For queries about this service, please contact Infrastructure at:
users@infra.apache.org