[teiid-commits] teiid SVN: r2512 - in branches/7.1.x: engine/src/main/java/org/teiid/cache and 1 other directories.

teiid-commits at lists.jboss.org teiid-commits at lists.jboss.org
Tue Aug 31 18:50:55 EDT 2010


Author: rareddy
Date: 2010-08-31 18:50:54 -0400 (Tue, 31 Aug 2010)
New Revision: 2512

Modified:
   branches/7.1.x/cache-jbosscache/src/main/java/org/teiid/cache/jboss/TupleBatchCacheLoader.java
   branches/7.1.x/engine/src/main/java/org/teiid/cache/Cache.java
   branches/7.1.x/engine/src/main/java/org/teiid/dqp/internal/process/SessionAwareCache.java
Log:
TEIID-1104: The tuple batches were also in the resultset cache node, and being counted as extra nodes against the total nodes. Moved batches into a child node under result set. The nodes get created when the batch is loaded from remote vm.

Modified: branches/7.1.x/cache-jbosscache/src/main/java/org/teiid/cache/jboss/TupleBatchCacheLoader.java
===================================================================
--- branches/7.1.x/cache-jbosscache/src/main/java/org/teiid/cache/jboss/TupleBatchCacheLoader.java	2010-08-31 19:10:36 UTC (rev 2511)
+++ branches/7.1.x/cache-jbosscache/src/main/java/org/teiid/cache/jboss/TupleBatchCacheLoader.java	2010-08-31 22:50:54 UTC (rev 2512)
@@ -62,8 +62,9 @@
 				map.put(id, b);
 				return map;
 			}
+			return super.get(fqn);
 		}
-		return super.get(fqn);
+		return null;
 	}
 
 	@Override

Modified: branches/7.1.x/engine/src/main/java/org/teiid/cache/Cache.java
===================================================================
--- branches/7.1.x/engine/src/main/java/org/teiid/cache/Cache.java	2010-08-31 19:10:36 UTC (rev 2511)
+++ branches/7.1.x/engine/src/main/java/org/teiid/cache/Cache.java	2010-08-31 22:50:54 UTC (rev 2512)
@@ -29,6 +29,7 @@
 	
 	public enum Type {SESSION("Session"), //$NON-NLS-1$ 
 						RESULTSET("ResultSet"), //$NON-NLS-1$
+						RESULTSET_BATCHES(RESULTSET, "batches"), //$NON-NLS-1$
 						PREPAREDPLAN("PreparaedPlan"); //$NON-NLS-1$
 		
 		private String location;
@@ -37,6 +38,10 @@
 			this.location = location;
 		}
 		
+		Type(Type base, String location){
+			this.location = base.location+"/"+location; //$NON-NLS-1$
+		}
+		
 		public String location() {
 			return this.location;
 		}

Modified: branches/7.1.x/engine/src/main/java/org/teiid/dqp/internal/process/SessionAwareCache.java
===================================================================
--- branches/7.1.x/engine/src/main/java/org/teiid/dqp/internal/process/SessionAwareCache.java	2010-08-31 19:10:36 UTC (rev 2511)
+++ branches/7.1.x/engine/src/main/java/org/teiid/dqp/internal/process/SessionAwareCache.java	2010-08-31 22:50:54 UTC (rev 2512)
@@ -51,6 +51,7 @@
 
 	private Cache<CacheID, T> localCache;
 	private Cache<CacheID, T> distributedCache;
+	private Cache tupleBatchCache;
 	
 	private int maxSize = DEFAULT_MAX_SIZE_TOTAL;
 	
@@ -79,6 +80,12 @@
 		}
 		else {
 			this.distributedCache = cacheFactory.get(type, config);
+			if (type == Cache.Type.RESULTSET) {
+				this.tupleBatchCache = cacheFactory.get(Cache.Type.RESULTSET_BATCHES, config);
+			}
+			else {
+				this.tupleBatchCache = this.distributedCache;
+			}
 		}
 	}	
 	
@@ -102,7 +109,7 @@
 			
 			if (result != null && result instanceof Cachable) {
 				Cachable c = (Cachable)result;
-				if (!c.restore(this.distributedCache, this.bufferManager)) {
+				if (!c.restore(this.tupleBatchCache, this.bufferManager)) {
 					result = null;
 				}
 			}
@@ -149,7 +156,7 @@
 			
 			if (t instanceof Cachable) {
 				Cachable c = (Cachable)t;
-				insert = c.prepare(this.distributedCache, this.bufferManager);
+				insert = c.prepare(this.tupleBatchCache, this.bufferManager);
 			}
 			
 			if (insert) {



More information about the teiid-commits mailing list