You are viewing a plain text version of this content. The canonical link for it is here.
Posted to commits@ignite.apache.org by ag...@apache.org on 2017/03/02 07:51:42 UTC

[1/3] ignite git commit: ignite-db-x Minor, print more info for investigation

Repository: ignite
Updated Branches:
  refs/heads/ignite-3477 c4490ddce -> c6df06030


ignite-db-x Minor, print more info for investigation


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

Branch: refs/heads/ignite-3477
Commit: 718da726f7474368fdc2dc5b06c190716a738ba7
Parents: aea459d
Author: Dmitriy Govorukhin <dg...@gridgain.com>
Authored: Wed Feb 22 12:47:04 2017 +0300
Committer: Dmitriy Govorukhin <dg...@gridgain.com>
Committed: Wed Feb 22 12:47:04 2017 +0300

----------------------------------------------------------------------
 .../cache/store/jdbc/CacheAbstractJdbcStore.java     | 15 +++++++++++----
 .../processors/query/h2/opt/GridH2Table.java         |  4 ++--
 2 files changed, 13 insertions(+), 6 deletions(-)
----------------------------------------------------------------------


http://git-wip-us.apache.org/repos/asf/ignite/blob/718da726/modules/core/src/main/java/org/apache/ignite/cache/store/jdbc/CacheAbstractJdbcStore.java
----------------------------------------------------------------------
diff --git a/modules/core/src/main/java/org/apache/ignite/cache/store/jdbc/CacheAbstractJdbcStore.java b/modules/core/src/main/java/org/apache/ignite/cache/store/jdbc/CacheAbstractJdbcStore.java
index 46a2387..9077523 100644
--- a/modules/core/src/main/java/org/apache/ignite/cache/store/jdbc/CacheAbstractJdbcStore.java
+++ b/modules/core/src/main/java/org/apache/ignite/cache/store/jdbc/CacheAbstractJdbcStore.java
@@ -424,14 +424,21 @@ public abstract class CacheAbstractJdbcStore<K, V> implements CacheStore<K, V>,
      * @param fetchSize Number of rows to fetch from DB.
      * @return Callable for pool submit.
      */
-    private Callable<Void> loadCacheRange(final EntryMapping em, final IgniteBiInClosure<K, V> clo,
-        @Nullable final Object[] lowerBound, @Nullable final Object[] upperBound, final int fetchSize) {
+    private Callable<Void> loadCacheRange(
+        final EntryMapping em,
+        final IgniteBiInClosure<K, V> clo,
+        @Nullable final Object[] lowerBound,
+        @Nullable final Object[] upperBound,
+        final int fetchSize
+    ) {
         return new Callable<Void>() {
             @Override public Void call() throws Exception {
                 Connection conn = null;
 
                 PreparedStatement stmt = null;
 
+                ResultSet rs = null;
+
                 try {
                     conn = openConnection(true);
 
@@ -453,7 +460,7 @@ public abstract class CacheAbstractJdbcStore<K, V> implements CacheStore<K, V>,
                             for (int j = 0; j < i; j++)
                                 stmt.setObject(idx++, upperBound[j]);
 
-                    ResultSet rs = stmt.executeQuery();
+                    rs = stmt.executeQuery();
 
                     while (rs.next()) {
                         K key = buildObject(em.cacheName, em.keyType(), em.keyKind(), em.keyColumns(), em.keyCols, em.loadColIdxs, rs);
@@ -468,7 +475,7 @@ public abstract class CacheAbstractJdbcStore<K, V> implements CacheStore<K, V>,
 
                     e.printStackTrace();
 
-                    System.out.println("conn:" + conn + " stmt:" + stmt);
+                    System.out.println("thread:" + Thread.currentThread().getName() + " conn:" + conn + " stmt:" + stmt + " rs:" + rs);
                 }
                 catch (SQLException e) {
                     throw new IgniteCheckedException("Failed to load cache", e);

http://git-wip-us.apache.org/repos/asf/ignite/blob/718da726/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 30219dc..3cdc095 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
@@ -450,9 +450,9 @@ public class GridH2Table extends TableBase {
 
             //todo only for investigation
             if (!sessions.isEmpty()){
-                System.out.println(sessions);
-
                 U.dumpThreads(null);
+
+                assert sessions.isEmpty() : sessions;
             }
 
             destroyed = true;


[3/3] ignite git commit: Merge branch 'ignite-db-x' of https://github.com/gridgain/apache-ignite into ignite-db-x

Posted by ag...@apache.org.
Merge branch 'ignite-db-x' of https://github.com/gridgain/apache-ignite into ignite-db-x


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

Branch: refs/heads/ignite-3477
Commit: c6df060303b667562d65516f25840f0503a7cafe
Parents: c4490dd fa3eab3
Author: Alexey Goncharuk <al...@gmail.com>
Authored: Thu Mar 2 10:49:17 2017 +0300
Committer: Alexey Goncharuk <al...@gmail.com>
Committed: Thu Mar 2 10:49:17 2017 +0300

----------------------------------------------------------------------
 .../store/jdbc/CacheAbstractJdbcStore.java      | 15 ++++++---
 .../cache/IgniteCacheOffheapManagerImpl.java    | 33 +++++++++++++++++++-
 .../cache/database/tree/BPlusTree.java          | 18 +++++++++++
 .../cache/database/tree/io/BPlusIO.java         |  9 ++++++
 .../processors/query/h2/opt/GridH2Table.java    |  4 +--
 5 files changed, 72 insertions(+), 7 deletions(-)
----------------------------------------------------------------------


http://git-wip-us.apache.org/repos/asf/ignite/blob/c6df0603/modules/core/src/main/java/org/apache/ignite/internal/processors/cache/IgniteCacheOffheapManagerImpl.java
----------------------------------------------------------------------

http://git-wip-us.apache.org/repos/asf/ignite/blob/c6df0603/modules/core/src/main/java/org/apache/ignite/internal/processors/cache/database/tree/BPlusTree.java
----------------------------------------------------------------------


[2/3] ignite git commit: ignite-db-x fix memory leak on destroy cache

Posted by ag...@apache.org.
ignite-db-x fix memory leak on destroy cache


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

Branch: refs/heads/ignite-3477
Commit: fa3eab3391794d08d61c84d8d4530ec51959b34e
Parents: 718da72
Author: Dmitriy Govorukhin <dg...@gridgain.com>
Authored: Tue Feb 28 20:04:06 2017 +0300
Committer: Dmitriy Govorukhin <dg...@gridgain.com>
Committed: Tue Feb 28 20:04:06 2017 +0300

----------------------------------------------------------------------
 .../cache/IgniteCacheOffheapManagerImpl.java    | 33 +++++++++++++++++++-
 .../cache/database/tree/BPlusTree.java          | 18 +++++++++++
 .../cache/database/tree/io/BPlusIO.java         |  9 ++++++
 3 files changed, 59 insertions(+), 1 deletion(-)
----------------------------------------------------------------------


http://git-wip-us.apache.org/repos/asf/ignite/blob/fa3eab33/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 5df99b6..aa6fb94 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
@@ -23,6 +23,7 @@ import java.util.Set;
 import java.util.concurrent.ConcurrentHashMap;
 import java.util.concurrent.ConcurrentMap;
 import java.util.concurrent.atomic.AtomicLong;
+import java.util.concurrent.atomic.AtomicReference;
 import javax.cache.Cache;
 import org.apache.ignite.IgniteCheckedException;
 import org.apache.ignite.IgniteException;
@@ -68,6 +69,7 @@ import org.apache.ignite.internal.util.typedef.F;
 import org.apache.ignite.internal.util.typedef.internal.S;
 import org.apache.ignite.internal.util.typedef.internal.U;
 import org.apache.ignite.lang.IgniteClosure;
+import org.apache.ignite.lang.IgniteInClosure;
 import org.apache.ignite.lang.IgnitePredicate;
 import org.jetbrains.annotations.Nullable;
 
@@ -1071,7 +1073,28 @@ public class IgniteCacheOffheapManagerImpl extends GridCacheManagerAdapter imple
 
         /** {@inheritDoc} */
         @Override public void destroy() throws IgniteCheckedException {
-            dataTree.destroy();
+            final AtomicReference<IgniteCheckedException> exception = new AtomicReference<>();
+
+            dataTree.destroy(new IgniteInClosure<CacheSearchRow>() {
+                @Override public void apply(CacheSearchRow row) {
+                    try {
+                        rowStore.removeRow(row.link());
+                    }
+                    catch (IgniteCheckedException e) {
+                        U.error(log, "Fail remove row [link=" + row.link() + "]");
+
+                        IgniteCheckedException ex = exception.get();
+
+                        if (ex == null)
+                            exception.set(e);
+                        else
+                            ex.addSuppressed(e);
+                    }
+                }
+            });
+
+            if (exception.get() != null)
+                throw new IgniteCheckedException("Fail destroy store", exception.get());
         }
 
         /** {@inheritDoc} */
@@ -1595,6 +1618,14 @@ public class IgniteCacheOffheapManagerImpl extends GridCacheManagerAdapter imple
         @Override public int getHash(long pageAddr, int idx) {
             return PageUtils.getInt(pageAddr, offset(idx) + 8);
         }
+
+        /** {@inheritDoc} */
+        @Override public void visit(long pageAddr, IgniteInClosure<CacheSearchRow> c) {
+            int cnt = getCount(pageAddr);
+
+            for (int i = 0; i < cnt; i++)
+                c.apply(new CacheDataRowAdapter(getLink(pageAddr, i)));
+        }
     }
 
     /**

http://git-wip-us.apache.org/repos/asf/ignite/blob/fa3eab33/modules/core/src/main/java/org/apache/ignite/internal/processors/cache/database/tree/BPlusTree.java
----------------------------------------------------------------------
diff --git a/modules/core/src/main/java/org/apache/ignite/internal/processors/cache/database/tree/BPlusTree.java b/modules/core/src/main/java/org/apache/ignite/internal/processors/cache/database/tree/BPlusTree.java
index aa61fbd..f1c16aa 100644
--- a/modules/core/src/main/java/org/apache/ignite/internal/processors/cache/database/tree/BPlusTree.java
+++ b/modules/core/src/main/java/org/apache/ignite/internal/processors/cache/database/tree/BPlusTree.java
@@ -63,6 +63,7 @@ import org.apache.ignite.internal.util.typedef.F;
 import org.apache.ignite.internal.util.typedef.internal.S;
 import org.apache.ignite.internal.util.typedef.internal.SB;
 import org.apache.ignite.internal.util.typedef.internal.U;
+import org.apache.ignite.lang.IgniteInClosure;
 
 import static org.apache.ignite.internal.processors.cache.database.tree.BPlusTree.Bool.DONE;
 import static org.apache.ignite.internal.processors.cache.database.tree.BPlusTree.Bool.FALSE;
@@ -1795,6 +1796,20 @@ public abstract class BPlusTree<L, T extends L> extends DataStructure implements
      * @throws IgniteCheckedException If failed.
      */
     public final long destroy() throws IgniteCheckedException {
+        return destroy(null);
+    }
+
+    /**
+     * Destroys tree. This method is allowed to be invoked only when the tree is out of use (no concurrent operations
+     * are trying to read or update the tree after destroy beginning).
+     *
+     * @param c Visitor closure. Visits only leaf pages.
+     * @return Number of pages recycled from this tree. If the tree was destroyed by someone else concurrently returns
+     *     {@code 0}, otherwise it should return at least {@code 2} (for meta page and root page), unless this tree is
+     *     used as metadata storage, or {@code -1} if we don't have a reuse list and did not do recycling at all.
+     * @throws IgniteCheckedException If failed.
+     */
+    public final long destroy(IgniteInClosure<L> c) throws IgniteCheckedException {
         if (!markDestroyed())
             return 0;
 
@@ -1819,6 +1834,9 @@ public abstract class BPlusTree<L, T extends L> extends DataStructure implements
                             try {
                                 BPlusIO<L> io = io(pageAddr);
 
+                                if (c != null && io.isLeaf())
+                                    io.visit(pageAddr, c);
+
                                 long fwdPageId = io.getForward(pageAddr);
 
                                 bag.addFreePage(recyclePage(pageId, page, pageAddr));

http://git-wip-us.apache.org/repos/asf/ignite/blob/fa3eab33/modules/core/src/main/java/org/apache/ignite/internal/processors/cache/database/tree/io/BPlusIO.java
----------------------------------------------------------------------
diff --git a/modules/core/src/main/java/org/apache/ignite/internal/processors/cache/database/tree/io/BPlusIO.java b/modules/core/src/main/java/org/apache/ignite/internal/processors/cache/database/tree/io/BPlusIO.java
index bcf2908..fe1a0d0 100644
--- a/modules/core/src/main/java/org/apache/ignite/internal/processors/cache/database/tree/io/BPlusIO.java
+++ b/modules/core/src/main/java/org/apache/ignite/internal/processors/cache/database/tree/io/BPlusIO.java
@@ -20,6 +20,7 @@ package org.apache.ignite.internal.processors.cache.database.tree.io;
 import org.apache.ignite.IgniteCheckedException;
 import org.apache.ignite.internal.pagemem.PageUtils;
 import org.apache.ignite.internal.processors.cache.database.tree.BPlusTree;
+import org.apache.ignite.lang.IgniteInClosure;
 
 /**
  * Abstract IO routines for B+Tree pages.
@@ -391,4 +392,12 @@ public abstract class BPlusIO<L> extends PageIO {
     private static void putBytes(long pageAddr, int pos, byte[] bytes) {
         PageUtils.putBytes(pageAddr, pos, bytes);
     }
+
+    /**
+     * @param pageAddr Page address.
+     * @param c Closure.
+     */
+    public void visit(long pageAddr, IgniteInClosure<L> c) {
+        // No-op.
+    }
 }