You are viewing a plain text version of this content. The canonical link for it is here.
Posted to notifications@ignite.apache.org by GitBox <gi...@apache.org> on 2020/08/03 03:07:13 UTC

[GitHub] [ignite] alievmirza opened a new pull request #8113: IGNITE-5038 recovered

alievmirza opened a new pull request #8113:
URL: https://github.com/apache/ignite/pull/8113


   Thank you for submitting the pull request to the Apache Ignite.
   
   In order to streamline the review of the contribution 
   we ask you to ensure the following steps have been taken:
   
   ### The Contribution Checklist
   - [ ] 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 pull request body describes changes that have been made. 
   The description explains _WHAT_ and _WHY_ was made instead of _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.
   - [ ] A reviewer has been mentioned through the JIRA comments 
   (see [the Maintainers list](https://cwiki.apache.org/confluence/display/IGNITE/How+to+Contribute#HowtoContribute-ReviewProcessandMaintainers)) 
   - [ ] The pull request has been checked by the Teamcity Bot and 
   the `green visa` attached to the JIRA ticket (see [TC.Bot: Check PR](https://mtcga.gridgain.com/prs.html))
   
   ### Notes
   - [How to Contribute](https://cwiki.apache.org/confluence/display/IGNITE/How+to+Contribute)
   - [Coding abbreviation rules](https://cwiki.apache.org/confluence/display/IGNITE/Abbreviation+Rules)
   - [Coding Guidelines](https://cwiki.apache.org/confluence/display/IGNITE/Coding+Guidelines)
   - [Apache Ignite Teamcity Bot](https://cwiki.apache.org/confluence/display/IGNITE/Apache+Ignite+Teamcity+Bot)
   
   If you need any help, please email dev@ignite.apache.org or ask anу advice on http://asf.slack.com _#ignite_ channel.
   


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

For queries about this service, please contact Infrastructure at:
users@infra.apache.org



[GitHub] [ignite] alievmirza closed pull request #8113: IGNITE-5038 recovered

Posted by GitBox <gi...@apache.org>.
alievmirza closed pull request #8113:
URL: https://github.com/apache/ignite/pull/8113


   


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

For queries about this service, please contact Infrastructure at:
users@infra.apache.org



[GitHub] [ignite] glukos commented on a change in pull request #8113: IGNITE-5038 recovered

Posted by GitBox <gi...@apache.org>.
glukos commented on a change in pull request #8113:
URL: https://github.com/apache/ignite/pull/8113#discussion_r469214456



##########
File path: modules/core/src/main/java/org/apache/ignite/internal/marshaller/optimized/OptimizedClassDescriptor.java
##########
@@ -740,7 +768,7 @@ void write(OptimizedObjectOutputStream out, Object obj) throws IOException {
 
             case OBJ_ARR:
                 OptimizedClassDescriptor compDesc = OptimizedMarshallerUtils.classDescriptor(clsMap,
-                    obj.getClass().getComponentType(),
+                    obj.getClass().getComponentType(), true,

Review comment:
       Fixed.




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

For queries about this service, please contact Infrastructure at:
users@infra.apache.org



[GitHub] [ignite] vldpyatkov commented on a change in pull request #8113: IGNITE-5038 recovered

Posted by GitBox <gi...@apache.org>.
vldpyatkov commented on a change in pull request #8113:
URL: https://github.com/apache/ignite/pull/8113#discussion_r466494208



##########
File path: modules/core/src/main/java/org/apache/ignite/internal/binary/BinaryEnumObjectImpl.java
##########
@@ -174,10 +174,40 @@ public BinaryEnumObjectImpl(BinaryContext ctx, byte[] arr) {
     }
 
     /** {@inheritDoc} */
-    @Override public <T> T deserialize() throws BinaryObjectException {
-        Class cls = BinaryUtils.resolveClass(ctx, typeId, clsName, ctx.configuration().getClassLoader(), false);
+    @Override public <T> T deserialize(@Nullable ClassLoader ldr) throws BinaryObjectException {
+        ClassLoader resolveLdr = ldr == null ? ctx.configuration().getClassLoader() : ldr;
+
+        Class cls = BinaryUtils.resolveClass(ctx, typeId, clsName, resolveLdr, false);
+
+        return (T)(ldr == null ? BinaryEnumCache.get(cls, ord) : uncachedValue(cls));
+    }
+
+    /**
+     * Get value for the given class without any caching.

Review comment:
       Add a description of parameter ord.

##########
File path: modules/core/src/main/java/org/apache/ignite/internal/marshaller/optimized/OptimizedClassDescriptor.java
##########
@@ -740,7 +768,7 @@ void write(OptimizedObjectOutputStream out, Object obj) throws IOException {
 
             case OBJ_ARR:
                 OptimizedClassDescriptor compDesc = OptimizedMarshallerUtils.classDescriptor(clsMap,
-                    obj.getClass().getComponentType(),
+                    obj.getClass().getComponentType(), true,

Review comment:
       Add a new line before useCache flag.

##########
File path: modules/core/src/main/java/org/apache/ignite/internal/binary/BinaryObjectImpl.java
##########
@@ -629,6 +629,16 @@ else if (fieldOffsetLen == BinaryUtils.OFFSET_2)
         return reader(null, false).findFieldByName(fieldName);
     }
 
+    /** {@inheritDoc} */
+    @Nullable @Override public <T> T deserialize(@Nullable ClassLoader ldr) throws BinaryObjectException {
+        if (ldr == null)
+            return deserialize();
+
+        GridBinaryMarshaller.USE_CACHE.set(Boolean.FALSE);

Review comment:
       Same as above it has to change to true in finaly block.

##########
File path: modules/core/src/main/java/org/apache/ignite/internal/binary/BinaryEnumObjectImpl.java
##########
@@ -174,10 +174,40 @@ public BinaryEnumObjectImpl(BinaryContext ctx, byte[] arr) {
     }
 
     /** {@inheritDoc} */
-    @Override public <T> T deserialize() throws BinaryObjectException {
-        Class cls = BinaryUtils.resolveClass(ctx, typeId, clsName, ctx.configuration().getClassLoader(), false);
+    @Override public <T> T deserialize(@Nullable ClassLoader ldr) throws BinaryObjectException {
+        ClassLoader resolveLdr = ldr == null ? ctx.configuration().getClassLoader() : ldr;
+
+        Class cls = BinaryUtils.resolveClass(ctx, typeId, clsName, resolveLdr, false);
+
+        return (T)(ldr == null ? BinaryEnumCache.get(cls, ord) : uncachedValue(cls));
+    }
+
+    /**
+     * Get value for the given class without any caching.
+     *
+     * @param cls Class.
+     */
+    private <T> T uncachedValue(Class<?> cls) throws BinaryObjectException {
+        assert cls != null;
 
-        return (T)BinaryEnumCache.get(cls, ord);
+        GridBinaryMarshaller.USE_CACHE.set(Boolean.FALSE);

Review comment:
       How does it return to true?

##########
File path: modules/core/src/main/java/org/apache/ignite/internal/marshaller/optimized/OptimizedMarshaller.java
##########
@@ -100,9 +100,14 @@
     /** Class descriptors by class. */
     private final ConcurrentMap<Class, OptimizedClassDescriptor> clsMap = new ConcurrentHashMap<>();
 
+    /** Node name. */
+    private volatile String nodeName = U.LOC_IGNITE_NAME_EMPTY;

Review comment:
       Why do you need to lay the constant field to volatile field?




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

For queries about this service, please contact Infrastructure at:
users@infra.apache.org



[GitHub] [ignite] glukos commented on a change in pull request #8113: IGNITE-5038 recovered

Posted by GitBox <gi...@apache.org>.
glukos commented on a change in pull request #8113:
URL: https://github.com/apache/ignite/pull/8113#discussion_r469214228



##########
File path: modules/core/src/main/java/org/apache/ignite/internal/binary/BinaryEnumObjectImpl.java
##########
@@ -174,10 +174,40 @@ public BinaryEnumObjectImpl(BinaryContext ctx, byte[] arr) {
     }
 
     /** {@inheritDoc} */
-    @Override public <T> T deserialize() throws BinaryObjectException {
-        Class cls = BinaryUtils.resolveClass(ctx, typeId, clsName, ctx.configuration().getClassLoader(), false);
+    @Override public <T> T deserialize(@Nullable ClassLoader ldr) throws BinaryObjectException {
+        ClassLoader resolveLdr = ldr == null ? ctx.configuration().getClassLoader() : ldr;
+
+        Class cls = BinaryUtils.resolveClass(ctx, typeId, clsName, resolveLdr, false);
+
+        return (T)(ldr == null ? BinaryEnumCache.get(cls, ord) : uncachedValue(cls));
+    }
+
+    /**
+     * Get value for the given class without any caching.

Review comment:
       Seems like it's not actual: there's no parameter "ord"




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

For queries about this service, please contact Infrastructure at:
users@infra.apache.org



[GitHub] [ignite] vldpyatkov commented on a change in pull request #8113: IGNITE-5038 recovered

Posted by GitBox <gi...@apache.org>.
vldpyatkov commented on a change in pull request #8113:
URL: https://github.com/apache/ignite/pull/8113#discussion_r466564947



##########
File path: modules/core/src/main/java/org/apache/ignite/internal/binary/BinaryUtils.java
##########
@@ -1998,6 +2027,14 @@ public static Object doReadOptimized(BinaryInputStream in, BinaryContext ctx, @N
         }
     }
 
+    /**
+     * @param ctx Context.
+     * @param clsLdr Class loader.
+     */
+    public static boolean isClassCacheWillUsed(BinaryContext ctx, ClassLoader clsLdr) {

Review comment:
       This method looks suspicion, moreover we have GridBinaryMarshaller.USE_CACHE.
   Why we cannot use the thread local variable everywhere?




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

For queries about this service, please contact Infrastructure at:
users@infra.apache.org



[GitHub] [ignite] glukos commented on a change in pull request #8113: IGNITE-5038 recovered

Posted by GitBox <gi...@apache.org>.
glukos commented on a change in pull request #8113:
URL: https://github.com/apache/ignite/pull/8113#discussion_r469215254



##########
File path: modules/core/src/main/java/org/apache/ignite/internal/marshaller/optimized/OptimizedMarshaller.java
##########
@@ -100,9 +100,14 @@
     /** Class descriptors by class. */
     private final ConcurrentMap<Class, OptimizedClassDescriptor> clsMap = new ConcurrentHashMap<>();
 
+    /** Node name. */
+    private volatile String nodeName = U.LOC_IGNITE_NAME_EMPTY;

Review comment:
       Field is unused, I've removed it




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

For queries about this service, please contact Infrastructure at:
users@infra.apache.org