accumulo-commits mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From dlmar...@apache.org
Subject accumulo git commit: More IGNITE changes
Date Mon, 22 May 2017 13:56:14 GMT
Repository: accumulo
Updated Branches:
  refs/heads/IGNITE 7b5aaeeaf -> 0084d0b8c


More IGNITE changes


Project: http://git-wip-us.apache.org/repos/asf/accumulo/repo
Commit: http://git-wip-us.apache.org/repos/asf/accumulo/commit/0084d0b8
Tree: http://git-wip-us.apache.org/repos/asf/accumulo/tree/0084d0b8
Diff: http://git-wip-us.apache.org/repos/asf/accumulo/diff/0084d0b8

Branch: refs/heads/IGNITE
Commit: 0084d0b8cba42eb20a518ec55a4ddb86618bdf2e
Parents: 7b5aaee
Author: Dave Marion <dlmarion@apache.org>
Authored: Mon May 22 09:55:52 2017 -0400
Committer: Dave Marion <dlmarion@apache.org>
Committed: Mon May 22 09:55:52 2017 -0400

----------------------------------------------------------------------
 .../file/blockfile/cache/tiered/TieredBlockCache.java |  8 ++++++--
 .../cache/tiered/TieredBlockCacheConfiguration.java   | 14 +++++++++++++-
 .../cache/tiered/TieredBlockCacheManager.java         |  2 +-
 .../file/blockfile/cache/TestTieredBlockCache.java    | 10 +++++++++-
 4 files changed, 29 insertions(+), 5 deletions(-)
----------------------------------------------------------------------


http://git-wip-us.apache.org/repos/asf/accumulo/blob/0084d0b8/core/src/main/java/org/apache/accumulo/core/file/blockfile/cache/tiered/TieredBlockCache.java
----------------------------------------------------------------------
diff --git a/core/src/main/java/org/apache/accumulo/core/file/blockfile/cache/tiered/TieredBlockCache.java
b/core/src/main/java/org/apache/accumulo/core/file/blockfile/cache/tiered/TieredBlockCache.java
index 13803cb..d2fe190 100644
--- a/core/src/main/java/org/apache/accumulo/core/file/blockfile/cache/tiered/TieredBlockCache.java
+++ b/core/src/main/java/org/apache/accumulo/core/file/blockfile/cache/tiered/TieredBlockCache.java
@@ -70,12 +70,16 @@ public class TieredBlockCache implements BlockCache {
 		this.cache.destroy();
 	}
 	
+	public IgniteCache<String,Block> getInternalCache() {
+		return this.cache;
+	}
+	
 	public long getOnHeapEntryCount() {
-		return this.cache.sizeLong(CachePeekMode.ONHEAP);
+		return this.cache.localSizeLong(CachePeekMode.ONHEAP);
 	}
 
 	public long getOffHeapEntryCount() {
-		return this.cache.sizeLong(CachePeekMode.OFFHEAP);
+		return this.cache.localSizeLong(CachePeekMode.OFFHEAP);
 	}
 
 	@Override

http://git-wip-us.apache.org/repos/asf/accumulo/blob/0084d0b8/core/src/main/java/org/apache/accumulo/core/file/blockfile/cache/tiered/TieredBlockCacheConfiguration.java
----------------------------------------------------------------------
diff --git a/core/src/main/java/org/apache/accumulo/core/file/blockfile/cache/tiered/TieredBlockCacheConfiguration.java
b/core/src/main/java/org/apache/accumulo/core/file/blockfile/cache/tiered/TieredBlockCacheConfiguration.java
index 6b813e4..f90d04c 100644
--- a/core/src/main/java/org/apache/accumulo/core/file/blockfile/cache/tiered/TieredBlockCacheConfiguration.java
+++ b/core/src/main/java/org/apache/accumulo/core/file/blockfile/cache/tiered/TieredBlockCacheConfiguration.java
@@ -1,5 +1,8 @@
 package org.apache.accumulo.core.file.blockfile.cache.tiered;
 
+import java.util.Optional;
+import java.util.concurrent.TimeUnit;
+
 import javax.cache.expiry.AccessedExpiryPolicy;
 import javax.cache.expiry.Duration;
 
@@ -13,11 +16,20 @@ import org.apache.ignite.configuration.CacheConfiguration;
 
 public class TieredBlockCacheConfiguration extends BlockCacheConfiguration {
 	
+	public static final String CACHE_EXPIRATION_TIME = TieredBlockCacheManager.TIERED_PROPERTY_BASE
+ "expiration.time";
+	public static final String CACHE_EXPIRATION_TIME_UNITS = TieredBlockCacheManager.TIERED_PROPERTY_BASE
+ "expiration.time_units";
+	
+	private static final String DEFAULT_CACHE_EXPIRATION_TIME_UNITS = "HOURS";
+	private static final long DEFAULT_CACHE_EXPIRATION_TIME = 1;
+	
 	private final CacheConfiguration<String, Block> configuration;
 
 	public TieredBlockCacheConfiguration(AccumuloConfiguration conf, CacheType type) {
 	  super(conf, type, TieredBlockCacheManager.PROPERTY_PREFIX);
 
+	  String unit = Optional.ofNullable(conf.get(CACHE_EXPIRATION_TIME_UNITS)).orElse(DEFAULT_CACHE_EXPIRATION_TIME_UNITS);
+	  long time = Optional.ofNullable(conf.get(CACHE_EXPIRATION_TIME)).map(Long::valueOf).filter(f
-> f > 0).orElse(DEFAULT_CACHE_EXPIRATION_TIME);
+	  
 	  configuration = new CacheConfiguration<>();
 	  configuration.setName(type.name());
 	  configuration.setCacheMode(CacheMode.LOCAL);
@@ -26,7 +38,7 @@ public class TieredBlockCacheConfiguration extends BlockCacheConfiguration
{
 	  ePolicy.setMaxSize((int) (0.75 * this.getMaxSize()));
 	  ePolicy.setMaxMemorySize(this.getMaxSize());
 	  configuration.setEvictionPolicy(ePolicy);
-	  configuration.setExpiryPolicyFactory(AccessedExpiryPolicy.factoryOf(Duration.ONE_HOUR));
+	  configuration.setExpiryPolicyFactory(AccessedExpiryPolicy.factoryOf(new Duration(TimeUnit.valueOf(unit),
time)));
 	  configuration.setStatisticsEnabled(true);
 	}
 

http://git-wip-us.apache.org/repos/asf/accumulo/blob/0084d0b8/core/src/main/java/org/apache/accumulo/core/file/blockfile/cache/tiered/TieredBlockCacheManager.java
----------------------------------------------------------------------
diff --git a/core/src/main/java/org/apache/accumulo/core/file/blockfile/cache/tiered/TieredBlockCacheManager.java
b/core/src/main/java/org/apache/accumulo/core/file/blockfile/cache/tiered/TieredBlockCacheManager.java
index b72e394..7910327 100644
--- a/core/src/main/java/org/apache/accumulo/core/file/blockfile/cache/tiered/TieredBlockCacheManager.java
+++ b/core/src/main/java/org/apache/accumulo/core/file/blockfile/cache/tiered/TieredBlockCacheManager.java
@@ -29,7 +29,7 @@ public class TieredBlockCacheManager extends BlockCacheManager {
 	static final int STAT_INTERVAL = 60;
 	
 	public static final String PROPERTY_PREFIX = "tiered";
-	private static final String TIERED_PROPERTY_BASE = BlockCacheConfiguration.CACHE_PROPERTY_BASE
+ PROPERTY_PREFIX + ".";
+	public static final String TIERED_PROPERTY_BASE = BlockCacheConfiguration.CACHE_PROPERTY_BASE
+ PROPERTY_PREFIX + ".";
 	
 	public static final String OFF_HEAP_MAX_SIZE_PROPERTY = TIERED_PROPERTY_BASE + "off-heap.max.size";
 	public static final String OFF_HEAP_BLOCK_SIZE_PROPERTY = TIERED_PROPERTY_BASE + "off-heap.block.size";

http://git-wip-us.apache.org/repos/asf/accumulo/blob/0084d0b8/core/src/test/java/org/apache/accumulo/core/file/blockfile/cache/TestTieredBlockCache.java
----------------------------------------------------------------------
diff --git a/core/src/test/java/org/apache/accumulo/core/file/blockfile/cache/TestTieredBlockCache.java
b/core/src/test/java/org/apache/accumulo/core/file/blockfile/cache/TestTieredBlockCache.java
index f5bc2f7..b7a1ac8 100644
--- a/core/src/test/java/org/apache/accumulo/core/file/blockfile/cache/TestTieredBlockCache.java
+++ b/core/src/test/java/org/apache/accumulo/core/file/blockfile/cache/TestTieredBlockCache.java
@@ -1,10 +1,15 @@
 package org.apache.accumulo.core.file.blockfile.cache;
 
+
+import javax.cache.Cache.Entry;
+
 import org.apache.accumulo.core.conf.ConfigurationCopy;
 import org.apache.accumulo.core.conf.DefaultConfiguration;
 import org.apache.accumulo.core.conf.Property;
 import org.apache.accumulo.core.file.blockfile.cache.tiered.TieredBlockCache;
+import org.apache.accumulo.core.file.blockfile.cache.tiered.TieredBlockCache.Block;
 import org.apache.accumulo.core.file.blockfile.cache.tiered.TieredBlockCacheManager;
+import org.apache.ignite.cache.CachePeekMode;
 import org.junit.Assert;
 import org.junit.Test;
 
@@ -65,7 +70,7 @@ public class TestTieredBlockCache {
 	    ConfigurationCopy cc = new ConfigurationCopy(dc);
 	    cc.set(Property.TSERV_CACHE_MANAGER_IMPL, TieredBlockCacheManager.class.getName());
 	    cc.set("general.custom.cache.block.tiered.off-heap.max.size", Long.toString(10*1024*1024));
-	    cc.set("general.custom.cache.block.tiered.off-heap.block.sizee", Long.toString(BLOCKSIZE));
+	    cc.set("general.custom.cache.block.tiered.off-heap.block.size", Long.toString(BLOCKSIZE));
 	    BlockCacheManager manager = BlockCacheManager.getInstance(cc);
 	    cc.set(Property.TSERV_DEFAULT_BLOCKSIZE, Long.toString(BLOCKSIZE));
 	    cc.set(Property.TSERV_DATACACHE_SIZE, "2048");
@@ -94,6 +99,9 @@ public class TestTieredBlockCache {
 	    Assert.assertEquals(1024, cache.getCacheMetrics().getCachePuts());
 	    Assert.assertEquals(0, cache.getCacheMetrics().getOffHeapPuts());
 	    
+	    for (Entry<String,Block> entry : cache.getInternalCache().localEntries(CachePeekMode.ONHEAP,
CachePeekMode.PRIMARY)) {
+	    	System.out.println("on heap: " + entry.getKey());
+	    }
 	    manager.stop();
 
 	}


Mime
View raw message