[teiid-commits] teiid SVN: r2996 - in branches/7.1.x: runtime/src/main/java/org/teiid/deployers and 2 other directories.

teiid-commits at lists.jboss.org teiid-commits at lists.jboss.org
Wed Mar 16 23:33:14 EDT 2011


Author: rareddy
Date: 2011-03-16 23:33:13 -0400 (Wed, 16 Mar 2011)
New Revision: 2996

Modified:
   branches/7.1.x/build/kits/jboss-container/deploy/teiid/teiid-jboss-beans.xml
   branches/7.1.x/runtime/src/main/java/org/teiid/deployers/PgCatalogMetadataStore.java
   branches/7.1.x/runtime/src/main/java/org/teiid/odbc/ODBCServerRemoteImpl.java
   branches/7.1.x/runtime/src/main/java/org/teiid/transport/PgBackendProtocol.java
   branches/7.1.x/runtime/src/main/java/org/teiid/transport/SSLAwareChannelHandler.java
   branches/7.1.x/runtime/src/main/java/org/teiid/transport/SocketListener.java
Log:
TEIID-1506: Adding fix ODBC data types for bigint and bigdecimal and byte. Also added the ODBC thread sizing fix.

Modified: branches/7.1.x/build/kits/jboss-container/deploy/teiid/teiid-jboss-beans.xml
===================================================================
--- branches/7.1.x/build/kits/jboss-container/deploy/teiid/teiid-jboss-beans.xml	2011-03-16 21:22:50 UTC (rev 2995)
+++ branches/7.1.x/build/kits/jboss-container/deploy/teiid/teiid-jboss-beans.xml	2011-03-17 03:33:13 UTC (rev 2996)
@@ -27,7 +27,8 @@
         <!-- 
             The number of batch columns to allow in memory (default 16384).  
             This value should be set lower or higher depending on the available memory to Teiid in the VM.  
-            16384 is considered a good default for a dedicated 32-bit VM running Teiid with a 1 gig heap.        
+            16384 is considered a good default for a dedicated 32-bit VM running Teiid with a 1 gig heap.
+            See the admin guide for more.          
          -->
         <property name="maxReserveBatchColumns">16384</property>
         <!-- 
@@ -116,8 +117,10 @@
         <property name="enabled">true</property>
         <property name="bindAddress">${jboss.bind.address}</property>
         <property name="portNumber">31000</property>
-        <!-- Max number of threads dedicated to initial request processing (default 15) -->
-        <property name="maxSocketThreads">15</property>
+        <!-- Max number of threads dedicated to initial request processing.
+             Zero indicates the system default of max available processors. (default 0) 
+             Setting this value above the max available processors is not recommended. -->
+        <property name="maxSocketThreads">0</property>
         <!-- SO_RCVBUF size, 0 indicates that system default should be used (default 0) -->
         <property name="inputBufferSize">0</property>
         <!-- SO_SNDBUF size, 0 indicates that system default should be used (default 0) -->
@@ -151,7 +154,8 @@
         <property name="enabled">true</property>
         <property name="bindAddress">${jboss.bind.address}</property>
         <property name="portNumber">31443</property>
-        <!-- Max number of threads dedicated to Admin and initial request processing (default 4) -->
+        <!-- Max number of threads dedicated to Admin request processing.
+             Zero indicates the system default of max available processors. (default 4) -->
         <property name="maxSocketThreads">4</property>
         <!-- SO_RCVBUF size, 0 indicates that system default should be used (default 0) -->
         <property name="inputBufferSize">0</property>
@@ -186,7 +190,10 @@
         <property name="enabled">true</property>
         <property name="bindAddress">${jboss.bind.address}</property>
         <property name="portNumber">35432</property>
-        <!-- Max number of threads dedicated to initial request processing (default 15) -->
+        <!-- Max number of threads dedicated to ODBC request processing.
+             Zero indicates the system default of max available processors. (default 15)
+             ODBC queries are currently blocking on IO operations, so this value
+             should be set the expected number of concurrent ODBC queries -->
         <property name="maxSocketThreads">15</property>
         <!-- SO_RCVBUF size, 0 indicates that system default should be used (default 0) -->
         <property name="inputBufferSize">0</property>

Modified: branches/7.1.x/runtime/src/main/java/org/teiid/deployers/PgCatalogMetadataStore.java
===================================================================
--- branches/7.1.x/runtime/src/main/java/org/teiid/deployers/PgCatalogMetadataStore.java	2011-03-16 21:22:50 UTC (rev 2995)
+++ branches/7.1.x/runtime/src/main/java/org/teiid/deployers/PgCatalogMetadataStore.java	2011-03-17 03:33:13 UTC (rev 2996)
@@ -145,7 +145,7 @@
 				"st.oid as attrelid, " + //$NON-NLS-1$
 				"t1.Name as attname, " + //$NON-NLS-1$
 				"pt.oid as atttypid," + //$NON-NLS-1$
-				"convert(t1.Length, short) as attlen, " + //$NON-NLS-1$
+				"pt.typlen as attlen, " + //$NON-NLS-1$
 				"convert(t1.Position, short) as attnum, " + //$NON-NLS-1$
 				"t1.Length as atttypmod, " + //$NON-NLS-1$
 				"false as attnotnull, " + //$NON-NLS-1$
@@ -153,7 +153,13 @@
 				"false as atthasdef " + //$NON-NLS-1$
 				"FROM SYS.Columns as t1 LEFT OUTER JOIN " + //$NON-NLS-1$
 				"SYS.Tables st ON (st.Name = t1.TableName AND st.SchemaName = t1.SchemaName) LEFT OUTER JOIN " + //$NON-NLS-1$
-				"pg_catalog.pg_type pt ON (CASE WHEN (t1.DataType = 'clob' OR t1.DataType = 'blob') THEN 'lo' ELSE t1.DataType END = pt.typname)"; //$NON-NLS-1$
+				"pg_catalog.pg_type pt ON (CASE " +//$NON-NLS-1$
+				"WHEN (t1.DataType = 'clob' OR t1.DataType = 'blob') THEN 'lo' " +//$NON-NLS-1$
+				"WHEN (t1.DataType = 'byte' ) THEN 'short' " + //$NON-NLS-1$
+				"WHEN (t1.DataType = 'time' ) THEN 'datetime' " + //$NON-NLS-1$
+				"WHEN (t1.DataType = 'biginteger' ) THEN 'decimal' " + //$NON-NLS-1$
+				"WHEN (t1.DataType = 'bigdecimal' ) THEN 'decimal' " + //$NON-NLS-1$
+				"ELSE t1.DataType END = pt.typname)"; //$NON-NLS-1$
 		t.setSelectTransformation(transformation);
 		t.setMaterialized(true);
 		return t;		

Modified: branches/7.1.x/runtime/src/main/java/org/teiid/odbc/ODBCServerRemoteImpl.java
===================================================================
--- branches/7.1.x/runtime/src/main/java/org/teiid/odbc/ODBCServerRemoteImpl.java	2011-03-16 21:22:50 UTC (rev 2995)
+++ branches/7.1.x/runtime/src/main/java/org/teiid/odbc/ODBCServerRemoteImpl.java	2011-03-17 03:33:13 UTC (rev 2996)
@@ -53,7 +53,7 @@
 	
 	private static Pattern pkPattern = Pattern.compile("select ta.attname, ia.attnum, ic.relname, n.nspname, tc.relname " +//$NON-NLS-1$
 			"from pg_catalog.pg_attribute ta, pg_catalog.pg_attribute ia, pg_catalog.pg_class tc, pg_catalog.pg_index i, " +//$NON-NLS-1$
-			"pg_catalog.pg_namespace n, pg_catalog.pg_class ic where tc.relname = E'(\\w+)' AND n.nspname = E'(\\w+)'.*" );//$NON-NLS-1$
+			"pg_catalog.pg_namespace n, pg_catalog.pg_class ic where tc.relname = E?'(\\w+)' AND n.nspname = E?'(\\w+)'.*" );//$NON-NLS-1$
 	
 
 	private static Pattern pkKeyPattern = Pattern.compile("select ta.attname, ia.attnum, ic.relname, n.nspname, NULL .*"); //$NON-NLS-1$
@@ -101,9 +101,9 @@
 			"\\s+pg_catalog.pg_namespace n" +  //$NON-NLS-1$
 			"\\s+where contype = 'f' " +  //$NON-NLS-1$
 			"\\s+and  conrelid = c.oid" +  //$NON-NLS-1$
-			"\\s+and  relname = E'(\\w+)'" +  //$NON-NLS-1$
+			"\\s+and  relname = E?'(\\w+)'" +  //$NON-NLS-1$
 			"\\s+and  n.oid = c.relnamespace" +  //$NON-NLS-1$
-			"\\s+and  n.nspname = E'(\\w+)'" +  //$NON-NLS-1$
+			"\\s+and  n.nspname = E?'(\\w+)'" +  //$NON-NLS-1$
 			"\\s+\\) ref" +  //$NON-NLS-1$
 			"\\s+inner join pg_catalog.pg_class c1" +  //$NON-NLS-1$
 			"\\s+on c1.oid = ref.conrelid\\)" +  //$NON-NLS-1$
@@ -128,8 +128,8 @@
 			"nspname, p.oid, atttypid, attname, proargnames, proargmodes, proallargtypes from ((pg_catalog.pg_namespace n inner join " + //$NON-NLS-1$
 			"pg_catalog.pg_proc p on p.pronamespace = n.oid) inner join pg_type t on t.oid = p.prorettype) left outer join " + //$NON-NLS-1$
 			"pg_attribute a on a.attrelid = t.typrelid  and attnum > 0 and not attisdropped " + //$NON-NLS-1$
-			"where has_function_privilege(p.oid, 'EXECUTE') and nspname like E'(\\w+)' " + //$NON-NLS-1$
-			"and proname like E'(\\w+)' " + //$NON-NLS-1$
+			"where has_function_privilege(p.oid, 'EXECUTE') and nspname like E?'(\\w+)' " + //$NON-NLS-1$
+			"and proname like E?'(\\w+)' " + //$NON-NLS-1$
 			"order by nspname, proname, p.oid, attnum"); //$NON-NLS-1$
 	
 	

Modified: branches/7.1.x/runtime/src/main/java/org/teiid/transport/PgBackendProtocol.java
===================================================================
--- branches/7.1.x/runtime/src/main/java/org/teiid/transport/PgBackendProtocol.java	2011-03-16 21:22:50 UTC (rev 2995)
+++ branches/7.1.x/runtime/src/main/java/org/teiid/transport/PgBackendProtocol.java	2011-03-17 03:33:13 UTC (rev 2996)
@@ -547,6 +547,7 @@
 	
     private static int convertType(final int type) {
         switch (type) {
+        case Types.BIT:
         case Types.BOOLEAN:
             return PG_TYPE_BOOL;
         case Types.VARCHAR:
@@ -555,14 +556,17 @@
             return PG_TYPE_TEXT;
         case Types.CHAR:
             return PG_TYPE_BPCHAR;
+        case Types.TINYINT:
         case Types.SMALLINT:
-            return PG_TYPE_INT2;
+        	return PG_TYPE_INT2;
         case Types.INTEGER:
             return PG_TYPE_INT4;
         case Types.BIGINT:
             return PG_TYPE_INT8;
+        case Types.NUMERIC:
         case Types.DECIMAL:
             return PG_TYPE_NUMERIC;
+        case Types.FLOAT:
         case Types.REAL:
             return PG_TYPE_FLOAT4;
         case Types.DOUBLE:
@@ -573,12 +577,16 @@
             return PG_TYPE_DATE;
         case Types.TIMESTAMP:
             return PG_TYPE_TIMESTAMP_NO_TMZONE;
+        case Types.BINARY:
         case Types.VARBINARY:
+        case Types.LONGVARBINARY:
             return PG_TYPE_BYTEA;
         case Types.BLOB:
             return PG_TYPE_OID;
         case Types.ARRAY:
             return PG_TYPE_TEXTARRAY;
+        case Types.LONGVARCHAR:
+        	return PG_TYPE_TEXT;
         default:
             return PG_TYPE_UNKNOWN;
         }

Modified: branches/7.1.x/runtime/src/main/java/org/teiid/transport/SSLAwareChannelHandler.java
===================================================================
--- branches/7.1.x/runtime/src/main/java/org/teiid/transport/SSLAwareChannelHandler.java	2011-03-16 21:22:50 UTC (rev 2995)
+++ branches/7.1.x/runtime/src/main/java/org/teiid/transport/SSLAwareChannelHandler.java	2011-03-17 03:33:13 UTC (rev 2996)
@@ -173,7 +173,7 @@
 		maxChannels = Math.max(maxChannels, this.listeners.size());
 		SslHandler sslHandler = ctx.getPipeline().get(SslHandler.class);
 		if (sslHandler != null) {
-	        sslHandler.handshake(e.getChannel()).addListener(new ChannelFutureListener() {
+	        sslHandler.handshake().addListener(new ChannelFutureListener() {
 	        	public void operationComplete(ChannelFuture arg0)
 	        			throws Exception {
 	        		onConnection(e.getChannel());

Modified: branches/7.1.x/runtime/src/main/java/org/teiid/transport/SocketListener.java
===================================================================
--- branches/7.1.x/runtime/src/main/java/org/teiid/transport/SocketListener.java	2011-03-16 21:22:50 UTC (rev 2995)
+++ branches/7.1.x/runtime/src/main/java/org/teiid/transport/SocketListener.java	2011-03-17 03:33:13 UTC (rev 2996)
@@ -77,8 +77,12 @@
         if (LogManager.isMessageToBeRecorded(LogConstants.CTX_TRANSPORT, MessageLevel.DETAIL)) { 
             LogManager.logDetail(LogConstants.CTX_TRANSPORT, "server = " + bindAddress + "binding to port:" + port); //$NON-NLS-1$ //$NON-NLS-2$
 		}
+        
+        if (maxWorkers == 0) {
+        	maxWorkers = Runtime.getRuntime().availableProcessors();
+        }
 		
-        ChannelFactory factory = new NioServerSocketChannelFactory(this.nettyPool, this.nettyPool, Math.min(Runtime.getRuntime().availableProcessors(), maxWorkers));
+        ChannelFactory factory = new NioServerSocketChannelFactory(this.nettyPool, this.nettyPool, maxWorkers);
         
         ServerBootstrap bootstrap = new ServerBootstrap(factory);
         this.channelHandler = createChannelPipelineFactory(config, storageManager);



More information about the teiid-commits mailing list