add isRowCacheEnabled check to getRawCachedRow; checking cache capacity in getCRI is no longer necessary since it is done by isRowCacheEnabled
Project: http://git-wip-us.apache.org/repos/asf/cassandra/repo Commit: http://git-wip-us.apache.org/repos/asf/cassandra/commit/31ba2890 Tree: http://git-wip-us.apache.org/repos/asf/cassandra/tree/31ba2890 Diff: http://git-wip-us.apache.org/repos/asf/cassandra/diff/31ba2890 Branch: refs/heads/trunk Commit: 31ba28909fa3cd195a21e0f6702c522fbd712571 Parents: 2d3ee80 Author: Jonathan Ellis <[email protected]> Authored: Tue Dec 11 12:59:42 2012 -0600 Committer: Jonathan Ellis <[email protected]> Committed: Tue Dec 11 12:59:55 2012 -0600 ---------------------------------------------------------------------- .../org/apache/cassandra/db/ColumnFamilyStore.java | 11 +++-------- 1 files changed, 3 insertions(+), 8 deletions(-) ---------------------------------------------------------------------- http://git-wip-us.apache.org/repos/asf/cassandra/blob/31ba2890/src/java/org/apache/cassandra/db/ColumnFamilyStore.java ---------------------------------------------------------------------- diff --git a/src/java/org/apache/cassandra/db/ColumnFamilyStore.java b/src/java/org/apache/cassandra/db/ColumnFamilyStore.java index 9cb4c66..fa2ae27 100644 --- a/src/java/org/apache/cassandra/db/ColumnFamilyStore.java +++ b/src/java/org/apache/cassandra/db/ColumnFamilyStore.java @@ -741,7 +741,7 @@ public class ColumnFamilyStore implements ColumnFamilyStoreMBean } // invalidate a normal cache value if it's a sentinel, so the read will retry (and include the new update) - IRowCacheEntry cachedRow = getCachedRowInternal(cacheKey); + IRowCacheEntry cachedRow = CacheService.instance.rowCache.getInternal(cacheKey); if (cachedRow != null) { if (cachedRow instanceof RowCacheSentinel) @@ -1653,18 +1653,13 @@ public class ColumnFamilyStore implements ColumnFamilyStoreMBean */ public ColumnFamily getRawCachedRow(DecoratedKey key) { - if (metadata.cfId == null) + if (!isRowCacheEnabled() || metadata.cfId == null) return null; // secondary index - IRowCacheEntry cached = getCachedRowInternal(new RowCacheKey(metadata.cfId, key)); + IRowCacheEntry cached = CacheService.instance.rowCache.getInternal(new RowCacheKey(metadata.cfId, key)); return cached == null || cached instanceof RowCacheSentinel ? null : (ColumnFamily) cached; } - private IRowCacheEntry getCachedRowInternal(RowCacheKey key) - { - return CacheService.instance.rowCache.getCapacity() == 0 ? null : CacheService.instance.rowCache.getInternal(key); - } - /** * @return true if @param key is contained in the row cache */
