ignite-commits mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From sboi...@apache.org
Subject [39/50] ignite git commit: ignite-db - minor
Date Thu, 28 Apr 2016 08:53:09 GMT
ignite-db - minor


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

Branch: refs/heads/ignite-db-x-10884
Commit: 8bb76a8065080bd9ba9230e51bbd32305f84e0c3
Parents: 83d7a5c
Author: S.Vladykin <svladykin@gridgain.com>
Authored: Wed Apr 27 06:23:50 2016 +0300
Committer: S.Vladykin <svladykin@gridgain.com>
Committed: Wed Apr 27 06:23:50 2016 +0300

----------------------------------------------------------------------
 .../cache/database/tree/reuse/ReuseList.java     | 19 +++++++------------
 .../processors/database/BPlusTreeSelfTest.java   |  6 +++---
 2 files changed, 10 insertions(+), 15 deletions(-)
----------------------------------------------------------------------


http://git-wip-us.apache.org/repos/asf/ignite/blob/8bb76a80/modules/core/src/main/java/org/apache/ignite/internal/processors/cache/database/tree/reuse/ReuseList.java
----------------------------------------------------------------------
diff --git a/modules/core/src/main/java/org/apache/ignite/internal/processors/cache/database/tree/reuse/ReuseList.java
b/modules/core/src/main/java/org/apache/ignite/internal/processors/cache/database/tree/reuse/ReuseList.java
index eb89da9..c1e3d53 100644
--- a/modules/core/src/main/java/org/apache/ignite/internal/processors/cache/database/tree/reuse/ReuseList.java
+++ b/modules/core/src/main/java/org/apache/ignite/internal/processors/cache/database/tree/reuse/ReuseList.java
@@ -83,7 +83,7 @@ public final class ReuseList {
 
         assert tree != null;
 
-        // Avoid recursion on the same tree.
+        // Avoid recursion on the same tree to avoid dead lock.
         if (tree == client) {
             treeIdx++; // Go forward and take the next tree.
 
@@ -106,14 +106,8 @@ public final class ReuseList {
         if (trees == null)
             return null;
 
-        ReuseTree tree = tree(client);
-
         // Remove and return page at min possible position.
-        FullPageId res = tree.removeCeil(MIN, bag);
-
-        assert res != null || tree.size() == 0; // TODO remove
-
-        return res;
+        return tree(client).removeCeil(MIN, bag);
     }
 
     /**
@@ -125,15 +119,16 @@ public final class ReuseList {
         if (bag == null)
             return;
 
-        ReuseTree tree = tree(client);
-
-        for (;;) {
+        for (int i = client.randomInt(trees.length);;) {
             FullPageId pageId = bag.pollFreePage();
 
             if (pageId == null)
                 break;
 
-            tree.put(pageId, bag);
+            trees[i].put(pageId, bag);
+
+            if (++i == trees.length)
+                i = 0;
         }
     }
 }

http://git-wip-us.apache.org/repos/asf/ignite/blob/8bb76a80/modules/indexing/src/test/java/org/apache/ignite/internal/processors/database/BPlusTreeSelfTest.java
----------------------------------------------------------------------
diff --git a/modules/indexing/src/test/java/org/apache/ignite/internal/processors/database/BPlusTreeSelfTest.java
b/modules/indexing/src/test/java/org/apache/ignite/internal/processors/database/BPlusTreeSelfTest.java
index 7258f36..3d4a62e 100644
--- a/modules/indexing/src/test/java/org/apache/ignite/internal/processors/database/BPlusTreeSelfTest.java
+++ b/modules/indexing/src/test/java/org/apache/ignite/internal/processors/database/BPlusTreeSelfTest.java
@@ -121,7 +121,7 @@ public class BPlusTreeSelfTest extends GridCommonAbstractTest {
         if (reuseList != null) {
             long size = reuseList.size();
 
-            assertTrue("Reuse size: " + size, size < CNT);
+            assertTrue("Reuse size: " + size, size < 2000);
         }
 
         pageMem.stop();
@@ -492,10 +492,10 @@ public class BPlusTreeSelfTest extends GridCommonAbstractTest {
 
         Map<Long,Long> map = new HashMap<>();
 
-        for (int i = 0 ; i < 100_000; i++) {
+        for (int i = 0 ; i < 1_000_000; i++) {
             Long x = (long)tree.randomInt(CNT);
 
-            if (i % 1000 == 0)
+            if (i % 100_000 == 0)
                 X.println(" --> " + i + "  " + x);
 
             if (tree.randomInt(2) == 0)


Mime
View raw message