ignite-commits mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From agoncha...@apache.org
Subject [1/2] ignite git commit: ignite-gg-8.0.2.ea2 igfs test fix
Date Tue, 17 Jan 2017 17:54:20 GMT
Repository: ignite
Updated Branches:
  refs/heads/ignite-3477 7db65ddd1 -> f8c775339


ignite-gg-8.0.2.ea2 igfs test fix

(cherry picked from commit 9b40d0e)


Project: http://git-wip-us.apache.org/repos/asf/ignite/repo
Commit: http://git-wip-us.apache.org/repos/asf/ignite/commit/b721d73d
Tree: http://git-wip-us.apache.org/repos/asf/ignite/tree/b721d73d
Diff: http://git-wip-us.apache.org/repos/asf/ignite/diff/b721d73d

Branch: refs/heads/ignite-3477
Commit: b721d73dfe4bc5c64a9de0d93119c482a7020d79
Parents: cb60e38
Author: Dmitriy Govorukhin <dgovorukhin@gridgain.com>
Authored: Tue Jan 17 20:44:15 2017 +0300
Committer: Dmitriy Govorukhin <dgovorukhin@gridgain.com>
Committed: Tue Jan 17 20:50:57 2017 +0300

----------------------------------------------------------------------
 .../processors/cache/GridCacheMapEntry.java     | 31 -------------
 .../processors/cache/GridCacheProcessor.java    |  9 ++--
 .../cache/IgniteCacheOffheapManagerImpl.java    | 48 ++++++++++++++++++++
 .../query/h2/opt/GridH2TreeIndex.java           |  2 +-
 4 files changed, 55 insertions(+), 35 deletions(-)
----------------------------------------------------------------------


http://git-wip-us.apache.org/repos/asf/ignite/blob/b721d73d/modules/core/src/main/java/org/apache/ignite/internal/processors/cache/GridCacheMapEntry.java
----------------------------------------------------------------------
diff --git a/modules/core/src/main/java/org/apache/ignite/internal/processors/cache/GridCacheMapEntry.java
b/modules/core/src/main/java/org/apache/ignite/internal/processors/cache/GridCacheMapEntry.java
index 9f01888..ee39ed9 100644
--- a/modules/core/src/main/java/org/apache/ignite/internal/processors/cache/GridCacheMapEntry.java
+++ b/modules/core/src/main/java/org/apache/ignite/internal/processors/cache/GridCacheMapEntry.java
@@ -205,40 +205,9 @@ public abstract class GridCacheMapEntry extends GridMetadataAwareAdapter
impleme
     protected void value(@Nullable CacheObject val) {
         assert Thread.holdsLock(this);
 
-        // In case we deal with IGFS cache, count updated data
-        if (cctx.cache().isIgfsDataCache() &&
-            cctx.kernalContext().igfsHelper().isIgfsBlockKey(keyValue(false))) {
-            int newSize = valueLength0(val, null);
-            int oldSize = valueLength0(this.val, null);
-
-            int delta = newSize - oldSize;
-
-            if (delta != 0 && !cctx.isNear())
-                cctx.cache().onIgfsDataSizeChanged(delta);
-        }
-
         this.val = val;
     }
 
-    /**
-     * Isolated method to get length of IGFS block.
-     *
-     * @param val Value.
-     * @param valBytes Value bytes.
-     * @return Length of value.
-     */
-    private int valueLength0(@Nullable CacheObject val, @Nullable IgniteBiTuple<byte[],
Byte> valBytes) {
-        byte[] bytes = val != null ? (byte[])val.value(cctx.cacheObjectContext(), false)
: null;
-
-        if (bytes != null)
-            return bytes.length;
-
-        if (valBytes == null)
-            return 0;
-
-        return valBytes.get1().length - (((valBytes.get2() == CacheObject.TYPE_BYTE_ARR)
? 0 : 6));
-    }
-
     /** {@inheritDoc} */
     @Override public int memorySize() throws IgniteCheckedException {
         byte[] kb;

http://git-wip-us.apache.org/repos/asf/ignite/blob/b721d73d/modules/core/src/main/java/org/apache/ignite/internal/processors/cache/GridCacheProcessor.java
----------------------------------------------------------------------
diff --git a/modules/core/src/main/java/org/apache/ignite/internal/processors/cache/GridCacheProcessor.java
b/modules/core/src/main/java/org/apache/ignite/internal/processors/cache/GridCacheProcessor.java
index be22aed..57b0d84 100644
--- a/modules/core/src/main/java/org/apache/ignite/internal/processors/cache/GridCacheProcessor.java
+++ b/modules/core/src/main/java/org/apache/ignite/internal/processors/cache/GridCacheProcessor.java
@@ -2037,9 +2037,12 @@ public class GridCacheProcessor extends GridProcessorAdapter {
 
                 if (desc == null)
                     continue;
-                // requestId must be null because on different node will be different byte
[] and we get duplicate discovery data
-                // see TcpDiscoveryNodeAddedMessage#addDiscoveryData 'Arrays.equals(curData,
discoDataEntry.getValue())'
-                DynamicCacheChangeRequest req = new DynamicCacheChangeRequest(null, cache.name(),
null);
+
+                // RequestId must be null because on different node will be different byte
[] and
+                // we get duplicate discovery data, for more details see
+                // TcpDiscoveryNodeAddedMessage#addDiscoveryData.
+                DynamicCacheChangeRequest req = new DynamicCacheChangeRequest(
+                    null, cache.name(), null);
 
                 req.startCacheConfiguration(desc.cacheConfiguration());
 

http://git-wip-us.apache.org/repos/asf/ignite/blob/b721d73d/modules/core/src/main/java/org/apache/ignite/internal/processors/cache/IgniteCacheOffheapManagerImpl.java
----------------------------------------------------------------------
diff --git a/modules/core/src/main/java/org/apache/ignite/internal/processors/cache/IgniteCacheOffheapManagerImpl.java
b/modules/core/src/main/java/org/apache/ignite/internal/processors/cache/IgniteCacheOffheapManagerImpl.java
index 76450fb..6aea247 100644
--- a/modules/core/src/main/java/org/apache/ignite/internal/processors/cache/IgniteCacheOffheapManagerImpl.java
+++ b/modules/core/src/main/java/org/apache/ignite/internal/processors/cache/IgniteCacheOffheapManagerImpl.java
@@ -921,6 +921,8 @@ public class IgniteCacheOffheapManagerImpl extends GridCacheManagerAdapter
imple
 
                 if (pendingEntries != null && expireTime != 0)
                     pendingEntries.put(new PendingRow(expireTime, dataRow.link()));
+
+                updateIgfsMetrics(key, (old != null ? old.value() : null), val);
             }
             finally {
                 busyLock.leaveBusy();
@@ -961,6 +963,8 @@ public class IgniteCacheOffheapManagerImpl extends GridCacheManagerAdapter
imple
 
                 if (dataRow != null)
                     rowStore.removeRow(dataRow.link());
+
+                updateIgfsMetrics(key, (dataRow != null ? dataRow.value() : null), null);
             }
             finally {
                 busyLock.leaveBusy();
@@ -1029,6 +1033,50 @@ public class IgniteCacheOffheapManagerImpl extends GridCacheManagerAdapter
imple
             storageSize.set(size);
             cntr.set(updCntr);
         }
+
+        /**
+         * @param key Key.
+         * @param oldVal Old value.
+         * @param newVal New value.
+         */
+        private void updateIgfsMetrics(
+            KeyCacheObject key,
+            CacheObject oldVal,
+            CacheObject newVal
+            ) throws IgniteCheckedException {
+            // In case we deal with IGFS cache, count updated data
+            if (cctx.cache().isIgfsDataCache() &&
+                !cctx.isNear() &&
+                cctx.kernalContext()
+                    .igfsHelper()
+                    .isIgfsBlockKey(key.value(cctx.cacheObjectContext(), false))) {
+                int oldSize = valueLength(oldVal);
+                int newSize = valueLength(newVal);
+
+                int delta = newSize - oldSize;
+
+                if (delta != 0)
+                    cctx.cache().onIgfsDataSizeChanged(delta);
+            }
+        }
+
+        /**
+         * Isolated method to get length of IGFS block.
+         *
+         * @param val Value.
+         * @return Length of value.
+         */
+        private int valueLength(@Nullable CacheObject val) {
+            if (val == null)
+                return 0;
+
+            byte[] bytes = val.value(cctx.cacheObjectContext(), false);
+
+            if (bytes != null)
+                return bytes.length;
+            else
+                return 0;
+        }
     }
 
     /**

http://git-wip-us.apache.org/repos/asf/ignite/blob/b721d73d/modules/indexing/src/main/java/org/apache/ignite/internal/processors/query/h2/opt/GridH2TreeIndex.java
----------------------------------------------------------------------
diff --git a/modules/indexing/src/main/java/org/apache/ignite/internal/processors/query/h2/opt/GridH2TreeIndex.java
b/modules/indexing/src/main/java/org/apache/ignite/internal/processors/query/h2/opt/GridH2TreeIndex.java
index 0f93f52..729309a 100644
--- a/modules/indexing/src/main/java/org/apache/ignite/internal/processors/query/h2/opt/GridH2TreeIndex.java
+++ b/modules/indexing/src/main/java/org/apache/ignite/internal/processors/query/h2/opt/GridH2TreeIndex.java
@@ -521,7 +521,7 @@ public class GridH2TreeIndex extends GridH2IndexBase implements Comparator<GridS
             else if (lower == null)
                 rows = tree.headMap(upper).values();
             else
-                rows = tree.subMap(lower, true, upper, true).values();
+                rows = tree.subMap(lower, false, upper, false).values();
 
             return new GridCursorIteratorWrapper<>(rows.iterator());
         }


Mime
View raw message