ignite-commits mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From sboi...@apache.org
Subject [06/31] incubator-ignite git commit: ignite-341 - fix attempt 4
Date Fri, 27 Mar 2015 11:34:00 GMT
ignite-341 - fix attempt 4


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

Branch: refs/heads/ignite-611
Commit: 8921129266ad0fc10ca5007c0bbcfc22313b401d
Parents: d33edd5
Author: S.Vladykin <svladykin@gridgain.com>
Authored: Tue Mar 24 18:42:27 2015 +0300
Committer: S.Vladykin <svladykin@gridgain.com>
Committed: Tue Mar 24 18:42:27 2015 +0300

----------------------------------------------------------------------
 .../junits/common/GridCommonAbstractTest.java   |  1 -
 .../query/h2/opt/GridH2AbstractKeyValueRow.java | 11 ++++++-
 .../query/h2/opt/GridH2KeyValueRowOffheap.java  | 32 +++++++++++++++-----
 .../processors/query/h2/opt/GridH2Table.java    |  2 +-
 ...CacheOffheapTieredMultithreadedSelfTest.java |  9 ++----
 5 files changed, 37 insertions(+), 18 deletions(-)
----------------------------------------------------------------------


http://git-wip-us.apache.org/repos/asf/incubator-ignite/blob/89211292/modules/core/src/test/java/org/apache/ignite/testframework/junits/common/GridCommonAbstractTest.java
----------------------------------------------------------------------
diff --git a/modules/core/src/test/java/org/apache/ignite/testframework/junits/common/GridCommonAbstractTest.java
b/modules/core/src/test/java/org/apache/ignite/testframework/junits/common/GridCommonAbstractTest.java
index 2f5a2e1..1d37fad 100644
--- a/modules/core/src/test/java/org/apache/ignite/testframework/junits/common/GridCommonAbstractTest.java
+++ b/modules/core/src/test/java/org/apache/ignite/testframework/junits/common/GridCommonAbstractTest.java
@@ -18,7 +18,6 @@
 package org.apache.ignite.testframework.junits.common;
 
 import org.apache.ignite.*;
-import org.apache.ignite.cache.*;
 import org.apache.ignite.cache.affinity.*;
 import org.apache.ignite.cluster.*;
 import org.apache.ignite.compute.*;

http://git-wip-us.apache.org/repos/asf/incubator-ignite/blob/89211292/modules/indexing/src/main/java/org/apache/ignite/internal/processors/query/h2/opt/GridH2AbstractKeyValueRow.java
----------------------------------------------------------------------
diff --git a/modules/indexing/src/main/java/org/apache/ignite/internal/processors/query/h2/opt/GridH2AbstractKeyValueRow.java
b/modules/indexing/src/main/java/org/apache/ignite/internal/processors/query/h2/opt/GridH2AbstractKeyValueRow.java
index 90e329d..e85d1fb 100644
--- a/modules/indexing/src/main/java/org/apache/ignite/internal/processors/query/h2/opt/GridH2AbstractKeyValueRow.java
+++ b/modules/indexing/src/main/java/org/apache/ignite/internal/processors/query/h2/opt/GridH2AbstractKeyValueRow.java
@@ -179,7 +179,7 @@ public abstract class GridH2AbstractKeyValueRow extends GridH2Row {
 
         if (oldVal == null || oldVal instanceof WeakValue)
             onUnswap(val);
-        // Else we would assert that val.equals(oldVal) but value is not necessarily implements
equals() correctly.
+        // Else we would assert that val.equals(oldVal.getObject()) but value is not necessarily
implements equals() correctly.
     }
 
     /**
@@ -322,12 +322,21 @@ public abstract class GridH2AbstractKeyValueRow extends GridH2Row {
      */
     protected abstract Value getOffheapValue(int col);
 
+    /**
+     * Adds offheap row ID.
+     */
+    protected void addOffheapRowId(SB sb) {
+        // No-op.
+    }
+
     /** {@inheritDoc} */
     @Override public String toString() {
         SB sb = new SB("Row@");
 
         sb.a(Integer.toHexString(System.identityHashCode(this)));
 
+        addOffheapRowId(sb);
+
         Value v = super.getValue(KEY_COL);
         sb.a("[ key: ").a(v == null ? "nil" : v.getString());
 

http://git-wip-us.apache.org/repos/asf/incubator-ignite/blob/89211292/modules/indexing/src/main/java/org/apache/ignite/internal/processors/query/h2/opt/GridH2KeyValueRowOffheap.java
----------------------------------------------------------------------
diff --git a/modules/indexing/src/main/java/org/apache/ignite/internal/processors/query/h2/opt/GridH2KeyValueRowOffheap.java
b/modules/indexing/src/main/java/org/apache/ignite/internal/processors/query/h2/opt/GridH2KeyValueRowOffheap.java
index 8341233..34eaba9 100644
--- a/modules/indexing/src/main/java/org/apache/ignite/internal/processors/query/h2/opt/GridH2KeyValueRowOffheap.java
+++ b/modules/indexing/src/main/java/org/apache/ignite/internal/processors/query/h2/opt/GridH2KeyValueRowOffheap.java
@@ -20,6 +20,7 @@ package org.apache.ignite.internal.processors.query.h2.opt;
 import org.apache.ignite.*;
 import org.apache.ignite.internal.util.*;
 import org.apache.ignite.internal.util.offheap.unsafe.*;
+import org.apache.ignite.internal.util.typedef.internal.*;
 import org.apache.ignite.spi.*;
 import org.h2.store.*;
 import org.h2.value.*;
@@ -213,6 +214,13 @@ public class GridH2KeyValueRowOffheap extends GridH2AbstractKeyValueRow
{
     }
 
     /** {@inheritDoc} */
+    @Override public synchronized void unswapBeforeRemove(Object val) throws IgniteCheckedException
{
+        assert val != null;
+
+        onUnswap(val);
+    }
+
+    /** {@inheritDoc} */
     @SuppressWarnings("NonSynchronizedMethodOverridesSynchronizedMethod")
     @Override protected Value updateWeakValue(Value exp, Value upd) {
         setValue(VAL_COL, upd);
@@ -224,14 +232,6 @@ public class GridH2KeyValueRowOffheap extends GridH2AbstractKeyValueRow
{
     @Override public synchronized void onUnswap(Object val) throws IgniteCheckedException
{
         super.onUnswap(val);
 
-        Value v = getValue(VAL_COL);
-
-        byte[] bytes = new byte[SIZE_CALCULATOR.getValueLen(v)];
-
-        Data data = Data.create(null, bytes);
-
-        data.writeValue(v);
-
         long p = ptr;
 
         assert p > 0 : p;
@@ -241,6 +241,17 @@ public class GridH2KeyValueRowOffheap extends GridH2AbstractKeyValueRow
{
         try {
             GridUnsafeMemory mem = desc.memory();
 
+            if (mem.readLongVolatile(p + OFFSET_VALUE_REF) != 0)
+                return; // The offheap value is in its place, nothing to do here.
+
+            Value v = getValue(VAL_COL); // We just set the value above, so it will be returned
right away.
+
+            byte[] bytes = new byte[SIZE_CALCULATOR.getValueLen(v)];
+
+            Data data = Data.create(null, bytes);
+
+            data.writeValue(v);
+
             long valPtr = mem.allocate(bytes.length + OFFSET_VALUE);
 
             mem.writeInt(valPtr, bytes.length);
@@ -353,4 +364,9 @@ public class GridH2KeyValueRowOffheap extends GridH2AbstractKeyValueRow
{
 
         mem.release(p, mem.readInt(p + OFFSET_KEY_SIZE) + OFFSET_KEY);
     }
+
+    /** {@inheritDoc} */
+    @Override protected void addOffheapRowId(SB sb) {
+        sb.a('-').a(ptr);
+    }
 }

http://git-wip-us.apache.org/repos/asf/incubator-ignite/blob/89211292/modules/indexing/src/main/java/org/apache/ignite/internal/processors/query/h2/opt/GridH2Table.java
----------------------------------------------------------------------
diff --git a/modules/indexing/src/main/java/org/apache/ignite/internal/processors/query/h2/opt/GridH2Table.java
b/modules/indexing/src/main/java/org/apache/ignite/internal/processors/query/h2/opt/GridH2Table.java
index 0b5d0b5..b2ad611 100644
--- a/modules/indexing/src/main/java/org/apache/ignite/internal/processors/query/h2/opt/GridH2Table.java
+++ b/modules/indexing/src/main/java/org/apache/ignite/internal/processors/query/h2/opt/GridH2Table.java
@@ -382,7 +382,7 @@ public class GridH2Table extends TableBase {
                     Value v = row.getValue(GridH2AbstractKeyValueRow.VAL_COL);
 
                     if (v != null)
-                        ((GridH2AbstractKeyValueRow)old).unswapBeforeRemove(v);
+                        ((GridH2AbstractKeyValueRow)old).unswapBeforeRemove(v.getObject());
                 }
 
                 if (old != null) {

http://git-wip-us.apache.org/repos/asf/incubator-ignite/blob/89211292/modules/indexing/src/test/java/org/apache/ignite/internal/processors/cache/IgniteCacheOffheapTieredMultithreadedSelfTest.java
----------------------------------------------------------------------
diff --git a/modules/indexing/src/test/java/org/apache/ignite/internal/processors/cache/IgniteCacheOffheapTieredMultithreadedSelfTest.java
b/modules/indexing/src/test/java/org/apache/ignite/internal/processors/cache/IgniteCacheOffheapTieredMultithreadedSelfTest.java
index 24dd89e..b1f9701 100644
--- a/modules/indexing/src/test/java/org/apache/ignite/internal/processors/cache/IgniteCacheOffheapTieredMultithreadedSelfTest.java
+++ b/modules/indexing/src/test/java/org/apache/ignite/internal/processors/cache/IgniteCacheOffheapTieredMultithreadedSelfTest.java
@@ -88,11 +88,6 @@ public class IgniteCacheOffheapTieredMultithreadedSelfTest extends GridCommonAbs
         stopAllGrids();
     }
 
-    /** {@inheritDoc} */
-    @Override protected long getTestTimeout() {
-        return 10 * 60 * 1000;
-    }
-
     /**
      * @throws Exception If failed.
      */
@@ -128,9 +123,9 @@ public class IgniteCacheOffheapTieredMultithreadedSelfTest extends GridCommonAbs
 
                 return null;
             }
-        }, 5);
+        }, 64);
 
-        Thread.sleep(5 * 60 * 1000);
+        Thread.sleep(3 * 60 * 1000);
 
         end.set(true);
 


Mime
View raw message