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

[7/8] ignite git commit: ignite-3477 fixed free list buckets usage

ignite-3477 fixed free list buckets usage


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

Branch: refs/heads/ignite-3477-putdown
Commit: 8d5d686090b5fd70baeb907448a6f1777318582e
Parents: 1f86c05
Author: sboikov <sb...@gridgain.com>
Authored: Mon Feb 6 11:05:59 2017 +0300
Committer: sboikov <sb...@gridgain.com>
Committed: Mon Feb 6 11:05:59 2017 +0300

----------------------------------------------------------------------
 .../processors/cache/database/freelist/FreeListImpl.java        | 5 ++++-
 1 file changed, 4 insertions(+), 1 deletion(-)
----------------------------------------------------------------------


http://git-wip-us.apache.org/repos/asf/ignite/blob/8d5d6860/modules/core/src/main/java/org/apache/ignite/internal/processors/cache/database/freelist/FreeListImpl.java
----------------------------------------------------------------------
diff --git a/modules/core/src/main/java/org/apache/ignite/internal/processors/cache/database/freelist/FreeListImpl.java b/modules/core/src/main/java/org/apache/ignite/internal/processors/cache/database/freelist/FreeListImpl.java
index 7d2d370..94fcc17 100644
--- a/modules/core/src/main/java/org/apache/ignite/internal/processors/cache/database/freelist/FreeListImpl.java
+++ b/modules/core/src/main/java/org/apache/ignite/internal/processors/cache/database/freelist/FreeListImpl.java
@@ -361,7 +361,7 @@ public class FreeListImpl extends PagesList implements FreeList, ReuseList {
             boolean reuseBucket = false;
 
             // TODO: properly handle reuse bucket.
-            for (int b = bucket; b < BUCKETS - 1; b++) {
+            for (int b = bucket + 1; b < BUCKETS - 1; b++) {
                 pageId = takeEmptyPage(b, DataPageIO.VERSIONS);
 
                 if (pageId != 0L) {
@@ -371,6 +371,9 @@ public class FreeListImpl extends PagesList implements FreeList, ReuseList {
                 }
             }
 
+            if (pageId == 0L)
+                pageId = takeEmptyPage(bucket, DataPageIO.VERSIONS);
+
             try (Page page = pageId == 0 ? allocateDataPage(row.partition()) : pageMem.page(cacheId, pageId)) {
                 // If it is an existing page, we do not need to initialize it.
                 DataPageIO init = reuseBucket || pageId == 0L ? DataPageIO.VERSIONS.latest() : null;