Return-Path: X-Original-To: apmail-ignite-commits-archive@minotaur.apache.org Delivered-To: apmail-ignite-commits-archive@minotaur.apache.org Received: from mail.apache.org (hermes.apache.org [140.211.11.3]) by minotaur.apache.org (Postfix) with SMTP id 44F7E181FF for ; Mon, 6 Jul 2015 02:30:37 +0000 (UTC) Received: (qmail 51204 invoked by uid 500); 6 Jul 2015 02:30:37 -0000 Delivered-To: apmail-ignite-commits-archive@ignite.apache.org Received: (qmail 51171 invoked by uid 500); 6 Jul 2015 02:30:37 -0000 Mailing-List: contact commits-help@ignite.incubator.apache.org; run by ezmlm Precedence: bulk List-Help: List-Unsubscribe: List-Post: List-Id: Reply-To: dev@ignite.incubator.apache.org Delivered-To: mailing list commits@ignite.incubator.apache.org Received: (qmail 51162 invoked by uid 99); 6 Jul 2015 02:30:37 -0000 Received: from Unknown (HELO spamd1-us-west.apache.org) (209.188.14.142) by apache.org (qpsmtpd/0.29) with ESMTP; Mon, 06 Jul 2015 02:30:37 +0000 Received: from localhost (localhost [127.0.0.1]) by spamd1-us-west.apache.org (ASF Mail Server at spamd1-us-west.apache.org) with ESMTP id B83E2D2636 for ; Mon, 6 Jul 2015 02:30:36 +0000 (UTC) X-Virus-Scanned: Debian amavisd-new at spamd1-us-west.apache.org X-Spam-Flag: NO X-Spam-Score: 1.23 X-Spam-Level: * X-Spam-Status: No, score=1.23 tagged_above=-999 required=6.31 tests=[KAM_ASCII_DIVIDERS=0.8, KAM_LAZY_DOMAIN_SECURITY=1, RP_MATCHES_RCVD=-0.571, URIBL_BLOCKED=0.001] autolearn=disabled Received: from mx1-us-east.apache.org ([10.40.0.8]) by localhost (spamd1-us-west.apache.org [10.40.0.7]) (amavisd-new, port 10024) with ESMTP id TGWK8GGHZ6z0 for ; Mon, 6 Jul 2015 02:30:24 +0000 (UTC) Received: from mail.apache.org (hermes.apache.org [140.211.11.3]) by mx1-us-east.apache.org (ASF Mail Server at mx1-us-east.apache.org) with SMTP id 46C5E4C104 for ; Mon, 6 Jul 2015 02:30:24 +0000 (UTC) Received: (qmail 50592 invoked by uid 99); 6 Jul 2015 02:30:23 -0000 Received: from git1-us-west.apache.org (HELO git1-us-west.apache.org) (140.211.11.23) by apache.org (qpsmtpd/0.29) with ESMTP; Mon, 06 Jul 2015 02:30:23 +0000 Received: by git1-us-west.apache.org (ASF Mail Server at git1-us-west.apache.org, from userid 33) id 523E2DFE80; Mon, 6 Jul 2015 02:30:23 +0000 (UTC) Content-Type: text/plain; charset="us-ascii" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit From: sergi@apache.org To: commits@ignite.incubator.apache.org Date: Mon, 06 Jul 2015 02:30:37 -0000 Message-Id: In-Reply-To: <2cfa15f03fb44b91b0e72f44a503a907@git.apache.org> References: <2cfa15f03fb44b91b0e72f44a503a907@git.apache.org> X-Mailer: ASF-Git Admin Mailer Subject: [15/50] incubator-ignite git commit: ignite-973-2 - metrics tests ignite-973-2 - metrics tests Project: http://git-wip-us.apache.org/repos/asf/incubator-ignite/repo Commit: http://git-wip-us.apache.org/repos/asf/incubator-ignite/commit/4902e8f6 Tree: http://git-wip-us.apache.org/repos/asf/incubator-ignite/tree/4902e8f6 Diff: http://git-wip-us.apache.org/repos/asf/incubator-ignite/diff/4902e8f6 Branch: refs/heads/ignite-959-x Commit: 4902e8f657b02531afb72b097a85ffc951e61f9d Parents: 108788b Author: S.Vladykin Authored: Wed Jun 24 18:41:38 2015 +0300 Committer: S.Vladykin Committed: Wed Jun 24 18:41:38 2015 +0300 ---------------------------------------------------------------------- .../processors/cache/GridCacheSwapManager.java | 31 +++++++++++++------- 1 file changed, 20 insertions(+), 11 deletions(-) ---------------------------------------------------------------------- http://git-wip-us.apache.org/repos/asf/incubator-ignite/blob/4902e8f6/modules/core/src/main/java/org/apache/ignite/internal/processors/cache/GridCacheSwapManager.java ---------------------------------------------------------------------- diff --git a/modules/core/src/main/java/org/apache/ignite/internal/processors/cache/GridCacheSwapManager.java b/modules/core/src/main/java/org/apache/ignite/internal/processors/cache/GridCacheSwapManager.java index 7595a1d..9e9c958 100644 --- a/modules/core/src/main/java/org/apache/ignite/internal/processors/cache/GridCacheSwapManager.java +++ b/modules/core/src/main/java/org/apache/ignite/internal/processors/cache/GridCacheSwapManager.java @@ -584,14 +584,14 @@ public class GridCacheSwapManager extends GridCacheManagerAdapter { ClassLoader ldr = cctx.deploy().globalLoader(); - GridCacheQueryManager qryMgr = cctx.queries(); + final GridCacheQueryManager qryMgr = cctx.queries(); if (qryMgr != null && !readSwapBeforeRemove(key, swapKey, ldr)) return null; // Not found. swapMgr.remove(spaceName, swapKey, new CI1() { @Override public void apply(byte[] rmv) { - if (cctx.config().isStatisticsEnabled()) + if (qryMgr == null && cctx.config().isStatisticsEnabled()) cctx.cache().metrics0().onSwapRead(rmv != null); if (rmv != null) { @@ -748,14 +748,14 @@ public class GridCacheSwapManager extends GridCacheManagerAdapter { else { byte[] entryBytes = offheap.remove(spaceName, part, key, keyBytes); - if (entryBytes != null) { - if (cctx.config().isStatisticsEnabled()) - cctx.cache().metrics0().onOffHeapRemove(); + if (cctx.config().isStatisticsEnabled()) { + cctx.cache().metrics0().onOffHeapRead(entryBytes != null); - entry = swapEntry(unmarshalSwapEntry(entryBytes)); + if (entryBytes != null) + cctx.cache().metrics0().onOffHeapRemove(); } - else - entry = null; + + entry = entryBytes == null ? null : swapEntry(unmarshalSwapEntry(entryBytes)); } return entry; @@ -857,6 +857,9 @@ public class GridCacheSwapManager extends GridCacheManagerAdapter { unprocessedKeys, new IgniteBiInClosure() { @Override public void apply(SwapKey swapKey, byte[] rmv) { + if (qryMgr == null && cctx.config().isStatisticsEnabled()) + cctx.cache().metrics0().onSwapRead(rmv != null); + if (rmv != null) { try { GridCacheSwapEntry entry = swapEntry(unmarshalSwapEntry(rmv)); @@ -974,10 +977,13 @@ public class GridCacheSwapManager extends GridCacheManagerAdapter { throws IgniteCheckedException { assert cctx.queries() != null; - byte[] val = offheap.get(spaceName, part, key, keyBytes); + byte[] entryBytes = offheap.get(spaceName, part, key, keyBytes); + + if (cctx.config().isStatisticsEnabled()) + cctx.cache().metrics0().onOffHeapRead(entryBytes != null); - if (val != null) { - GridCacheSwapEntry entry = swapEntry(unmarshalSwapEntry(val)); + if (entryBytes != null) { + GridCacheSwapEntry entry = swapEntry(unmarshalSwapEntry(entryBytes)); if (entry != null) { cctx.queries().onUnswap(key, entry.value()); @@ -1004,6 +1010,9 @@ public class GridCacheSwapManager extends GridCacheManagerAdapter { byte[] entryBytes = swapMgr.read(spaceName, swapKey, ldr); + if (cctx.config().isStatisticsEnabled()) + cctx.cache().metrics0().onSwapRead(entryBytes != null); + if (entryBytes == null) return false;