Repository: ignite Updated Branches: refs/heads/ignite-5658 66645fe49 -> b16455779
FreeList striped pool optimisation Project: http://git-wip-us.apache.org/repos/asf/ignite/repo Commit: http://git-wip-us.apache.org/repos/asf/ignite/commit/b1645577 Tree: http://git-wip-us.apache.org/repos/asf/ignite/tree/b1645577 Diff: http://git-wip-us.apache.org/repos/asf/ignite/diff/b1645577 Branch: refs/heads/ignite-5658 Commit: b1645577980c2f547133b883604900af8b58f78b Parents: 66645fe Author: Igor Seliverstov <gvvinbl...@gmail.com> Authored: Mon Jul 31 18:53:08 2017 +0300 Committer: Igor Seliverstov <gvvinbl...@gmail.com> Committed: Mon Jul 31 18:53:08 2017 +0300 ---------------------------------------------------------------------- .../cache/persistence/freelist/PagesList.java | 21 ++++++++++++-------- 1 file changed, 13 insertions(+), 8 deletions(-) ---------------------------------------------------------------------- http://git-wip-us.apache.org/repos/asf/ignite/blob/b1645577/modules/core/src/main/java/org/apache/ignite/internal/processors/cache/persistence/freelist/PagesList.java ---------------------------------------------------------------------- diff --git a/modules/core/src/main/java/org/apache/ignite/internal/processors/cache/persistence/freelist/PagesList.java b/modules/core/src/main/java/org/apache/ignite/internal/processors/cache/persistence/freelist/PagesList.java index 15bc4a0..6284da0 100644 --- a/modules/core/src/main/java/org/apache/ignite/internal/processors/cache/persistence/freelist/PagesList.java +++ b/modules/core/src/main/java/org/apache/ignite/internal/processors/cache/persistence/freelist/PagesList.java @@ -508,21 +508,26 @@ public abstract class PagesList extends DataStructure { * @throws IgniteCheckedException If failed. */ private Stripe getPageForPut(int bucket) throws IgniteCheckedException { - Stripe[] tails = getBucket(bucket); - - if (tails == null) - return addStripe(bucket, true); - // Striped pool optimization int stripeIdx = IgniteThread.currentStripe(); if (stripeIdx != -1) { - if (stripeIdx >= tails.length) - return addStripe(bucket, true); + Stripe[] tails = getBucket(bucket); + + while (tails == null || stripeIdx >= tails.length) { + addStripe(bucket, true); + + tails = getBucket(bucket); + } return tails[stripeIdx]; } + Stripe[] tails = getBucket(bucket); + + if (tails == null) + return addStripe(bucket, true); + return randomTail(tails); } @@ -932,7 +937,7 @@ public abstract class PagesList extends DataStructure { if (stripeIdx != -1) { if (stripeIdx >= len) - return addStripe(bucket, !isReuseBucket(bucket)); + return null; Stripe stripe = tails[stripeIdx];