ignite-commits mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From sboi...@apache.org
Subject [38/50] [abbrv] ignite git commit: ignite-split2 - test fix
Date Mon, 15 Feb 2016 07:52:22 GMT
ignite-split2 - test fix


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

Branch: refs/heads/ignite-1232
Commit: baba57287f962551dd87234fe80c2ddf3e5ca2cc
Parents: 2bdbd7e
Author: S.Vladykin <svladykin@gridgain.com>
Authored: Sat Dec 26 12:59:32 2015 +0300
Committer: S.Vladykin <svladykin@gridgain.com>
Committed: Sat Dec 26 12:59:32 2015 +0300

----------------------------------------------------------------------
 .../offheap/unsafe/GridOffHeapSnapTreeMap.java  |  5 +++--
 .../query/h2/opt/GridH2QueryContext.java        | 22 ++++++++++++++------
 .../processors/query/h2/opt/GridH2Table.java    |  2 ++
 .../query/h2/opt/GridH2TreeIndex.java           |  2 ++
 4 files changed, 23 insertions(+), 8 deletions(-)
----------------------------------------------------------------------


http://git-wip-us.apache.org/repos/asf/ignite/blob/baba5728/modules/core/src/main/java/org/apache/ignite/internal/util/offheap/unsafe/GridOffHeapSnapTreeMap.java
----------------------------------------------------------------------
diff --git a/modules/core/src/main/java/org/apache/ignite/internal/util/offheap/unsafe/GridOffHeapSnapTreeMap.java
b/modules/core/src/main/java/org/apache/ignite/internal/util/offheap/unsafe/GridOffHeapSnapTreeMap.java
index 9b136d2..7bde651 100644
--- a/modules/core/src/main/java/org/apache/ignite/internal/util/offheap/unsafe/GridOffHeapSnapTreeMap.java
+++ b/modules/core/src/main/java/org/apache/ignite/internal/util/offheap/unsafe/GridOffHeapSnapTreeMap.java
@@ -1048,7 +1048,7 @@ public class GridOffHeapSnapTreeMap<K extends GridOffHeapSmartPointer,V
extends
     private volatile StoppableRecycleQueue recycleBin;
 
     /** */
-    private final AtomicInteger reservations = new AtomicInteger();
+    private AtomicInteger reservations;
 
     /** */
     private volatile boolean closing;
@@ -1125,7 +1125,7 @@ public class GridOffHeapSnapTreeMap<K extends GridOffHeapSmartPointer,V
extends
     @Override public void close() {
         closing = true;
 
-        if (reservations.compareAndSet(0, -1))
+        if (reservations == null || reservations.compareAndSet(0, -1))
             doClose();
     }
 
@@ -1192,6 +1192,7 @@ public class GridOffHeapSnapTreeMap<K extends GridOffHeapSmartPointer,V
extends
         copy.holderRef = rootHolder(holderRef);
         markShared(root());
 
+        copy.reservations = new AtomicInteger();
         copy.size = new AtomicInteger(size());
         copy.recycleBin = new StoppableRecycleQueue();
 

http://git-wip-us.apache.org/repos/asf/ignite/blob/baba5728/modules/indexing/src/main/java/org/apache/ignite/internal/processors/query/h2/opt/GridH2QueryContext.java
----------------------------------------------------------------------
diff --git a/modules/indexing/src/main/java/org/apache/ignite/internal/processors/query/h2/opt/GridH2QueryContext.java
b/modules/indexing/src/main/java/org/apache/ignite/internal/processors/query/h2/opt/GridH2QueryContext.java
index d5fc41d..223dad6 100644
--- a/modules/indexing/src/main/java/org/apache/ignite/internal/processors/query/h2/opt/GridH2QueryContext.java
+++ b/modules/indexing/src/main/java/org/apache/ignite/internal/processors/query/h2/opt/GridH2QueryContext.java
@@ -245,6 +245,21 @@ public class GridH2QueryContext {
     }
 
     /**
+     * Clear taken snapshots.
+     */
+    public void clearSnapshots() {
+        if (F.isEmpty(snapshots))
+            return;
+
+        for (Object snapshot : snapshots.values()) {
+            if (snapshot instanceof GridReservable)
+                ((GridReservable)snapshot).release();
+        }
+
+        snapshots = null;
+    }
+
+    /**
      * @param idxId Index ID.
      * @return Index snapshot or {@code null} if none.
      */
@@ -389,12 +404,7 @@ public class GridH2QueryContext {
 
         assert x.key.equals(key);
 
-        if (!F.isEmpty(x.snapshots)) {
-            for (Object snapshot : x.snapshots.values()) {
-                if (snapshot instanceof GridReservable)
-                    ((GridReservable)snapshot).release();
-            }
-        }
+        x.clearSnapshots();
 
         List<GridReservable> r = x.reservations;
 

http://git-wip-us.apache.org/repos/asf/ignite/blob/baba5728/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 ac21807..afdf40f 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
@@ -395,6 +395,8 @@ public class GridH2Table extends TableBase {
 
             if (reuseExisting && s == null) { // Existing snapshot was invalidated
before we were able to reserve it.
                 // Release already taken snapshots.
+                qctx.clearSnapshots();
+
                 for (int j = 1; j < i; j++)
                     index(j).releaseSnapshot();
 

http://git-wip-us.apache.org/repos/asf/ignite/blob/baba5728/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 95efc8e..1d4efff 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
@@ -376,6 +376,8 @@ public class GridH2TreeIndex extends GridH2IndexBase implements Comparator<GridS
 
     /** {@inheritDoc} */
     @Override protected Object doTakeSnapshot() {
+        assert snapshotEnabled;
+
         return tree instanceof SnapTreeMap ?
             ((SnapTreeMap)tree).clone() :
             ((GridOffHeapSnapTreeMap)tree).clone();


Mime
View raw message