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/02 16:16:35 UTC

ignite git commit: ignite-3477 fix free list usage

Repository: ignite
Updated Branches:
  refs/heads/ignite-3477-test [created] 3f3ca1204


ignite-3477 fix free list usage


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

Branch: refs/heads/ignite-3477-test
Commit: 3f3ca1204e6e7e9c08d4433ac896859f9c112ec3
Parents: bac9b69
Author: sboikov <sb...@gridgain.com>
Authored: Thu Feb 2 19:16:25 2017 +0300
Committer: sboikov <sb...@gridgain.com>
Committed: Thu Feb 2 19:16:25 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/3f3ca120/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;