You are viewing a plain text version of this content. The canonical link for it is here.
Posted to commits@ignite.apache.org by tl...@apache.org on 2021/02/26 08:12:15 UTC

[ignite] branch master updated: IGNITE-14206 fix compatibility inline POJO between 2.8.1 and 2.9.0: fix javadoc & jdk11 optimization (#8830)

This is an automated email from the ASF dual-hosted git repository.

tledkov pushed a commit to branch master
in repository https://gitbox.apache.org/repos/asf/ignite.git


The following commit(s) were added to refs/heads/master by this push:
     new 93b7492  IGNITE-14206 fix compatibility inline POJO between 2.8.1 and 2.9.0: fix javadoc & jdk11 optimization (#8830)
93b7492 is described below

commit 93b74922bd04b164301d7bc5a2788b9693d4a8a4
Author: Maksim Timonin <ti...@gmail.com>
AuthorDate: Fri Feb 26 11:11:41 2021 +0300

    IGNITE-14206 fix compatibility inline POJO between 2.8.1 and 2.9.0: fix javadoc & jdk11 optimization (#8830)
---
 .../persistence/InlineIndexCompatibilityTest.java     |  2 +-
 .../query/h2/database/InlineObjectBytesDetector.java  | 19 ++++++++++---------
 2 files changed, 11 insertions(+), 10 deletions(-)

diff --git a/modules/compatibility/src/test/java/org/apache/ignite/compatibility/persistence/InlineIndexCompatibilityTest.java b/modules/compatibility/src/test/java/org/apache/ignite/compatibility/persistence/InlineIndexCompatibilityTest.java
index dbdd2098..f178c02 100644
--- a/modules/compatibility/src/test/java/org/apache/ignite/compatibility/persistence/InlineIndexCompatibilityTest.java
+++ b/modules/compatibility/src/test/java/org/apache/ignite/compatibility/persistence/InlineIndexCompatibilityTest.java
@@ -321,7 +321,7 @@ public class InlineIndexCompatibilityTest extends IgnitePersistenceCompatibility
 
         /** {@inheritDoc} */
         @Override public int hashCode() {
-            return 1 + val;
+            return val;
         }
 
         /** {@inheritDoc} */
diff --git a/modules/indexing/src/main/java/org/apache/ignite/internal/processors/query/h2/database/InlineObjectBytesDetector.java b/modules/indexing/src/main/java/org/apache/ignite/internal/processors/query/h2/database/InlineObjectBytesDetector.java
index 1064a73..fc77acb 100644
--- a/modules/indexing/src/main/java/org/apache/ignite/internal/processors/query/h2/database/InlineObjectBytesDetector.java
+++ b/modules/indexing/src/main/java/org/apache/ignite/internal/processors/query/h2/database/InlineObjectBytesDetector.java
@@ -17,6 +17,7 @@
 
 package org.apache.ignite.internal.processors.query.h2.database;
 
+import java.util.Arrays;
 import java.util.List;
 import org.apache.ignite.IgniteCheckedException;
 import org.apache.ignite.IgniteLogger;
@@ -28,7 +29,7 @@ import org.h2.value.Value;
 import org.h2.value.ValueNull;
 
 /**
- * This class helps detects whether tree contains inline JO type.
+ * This class helps to detect whether tree contains inlined JO type.
  *
  * When starting on old Ignite versions it's impossible to discover whether JO type was inlined or not.
  * Then try to find that with 2 steps:
@@ -57,6 +58,8 @@ public class InlineObjectBytesDetector implements BPlusTree.TreeRowClosure<H2Row
     /**
      * @param inlineSize Inline size.
      * @param inlineCols Inline columns.
+     * @param idxName Index name.
+     * @param log Ignite logger.
      */
     InlineObjectBytesDetector(int inlineSize, List<InlineIndexColumn> inlineCols, String tblName, String idxName,
         IgniteLogger log) {
@@ -117,12 +120,10 @@ public class InlineObjectBytesDetector implements BPlusTree.TreeRowClosure<H2Row
                 // Try compare byte by byte for fully or partial inlined object.
                 byte[] inlineBytes = PageUtils.getBytes(pageAddr, off + fieldOff + 3, len);
 
-                for (int i = 0; i < len; i++) {
-                    if (inlineBytes[i] != originalObjBytes[i]) {
-                        inlineObjectSupportedDecision(false, i + " byte compare");
+                if (!Arrays.equals(inlineBytes, originalObjBytes)) {
+                    inlineObjectSupportedDecision(false, "byte compare");
 
-                        return true;
-                    }
+                    return true;
                 }
 
                 inlineObjectSupportedDecision(true, len + " bytes compared");
@@ -131,9 +132,9 @@ public class InlineObjectBytesDetector implements BPlusTree.TreeRowClosure<H2Row
             }
 
             if (type == Value.UNKNOWN && varLenPresents) {
-                // we can't guarantee in case unknown type and should check next row:
-                //1: long string, UNKNOWN for java object.
-                //2: short string, inlined java object
+                // We can't guarantee in case unknown type and should check next row:
+                // 1: long string, UNKNOWN for java object.
+                // 2: short string, inlined java object
                 return false;
             }