teiid SVN: r3470 - branches/7.1.x/runtime/src/main/java/org/teiid/deployers.
by teiid-commits@lists.jboss.org
Author: loleary
Date: 2011-09-13 18:57:03 -0400 (Tue, 13 Sep 2011)
New Revision: 3470
Modified:
branches/7.1.x/runtime/src/main/java/org/teiid/deployers/PgCatalogMetadataStore.java
Log:
TEIID-1623 - Resolves issue with ODBC precision and scale data for numeric and string types.
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-09-13 22:56:53 UTC (rev 3469)
+++ branches/7.1.x/runtime/src/main/java/org/teiid/deployers/PgCatalogMetadataStore.java 2011-09-13 22:57:03 UTC (rev 3470)
@@ -148,7 +148,8 @@
"pt.oid as atttypid," + //$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$
+ "(CASE WHEN (t1.DataType = 'bigdecimal' OR t1.DataType = 'biginteger' OR t1.DataType = 'float' OR t1.DataType='double') THEN (4+(65536*t1.Precision)+t1.Scale) " + //$NON-NLS-1$
+ "ELSE (4+t1.Length) END) as atttypmod, " + //$NON-NLS-1$
"CASE WHEN (t1.NullType = 'No Nulls') THEN true ELSE false END as attnotnull, " + //$NON-NLS-1$
"false as attisdropped, " + //$NON-NLS-1$
"false as atthasdef " + //$NON-NLS-1$
12 years, 8 months
teiid SVN: r3469 - in branches/7.1.x/engine/src: test/java/org/teiid/query/optimizer and 1 other directory.
by teiid-commits@lists.jboss.org
Author: loleary
Date: 2011-09-13 18:56:53 -0400 (Tue, 13 Sep 2011)
New Revision: 3469
Modified:
branches/7.1.x/engine/src/main/java/org/teiid/query/optimizer/relational/rules/FrameUtil.java
branches/7.1.x/engine/src/test/java/org/teiid/query/optimizer/TestRuleMergeVirtual.java
Log:
TEIID-1571 - Fix for invalid merge
Modified: branches/7.1.x/engine/src/main/java/org/teiid/query/optimizer/relational/rules/FrameUtil.java
===================================================================
--- branches/7.1.x/engine/src/main/java/org/teiid/query/optimizer/relational/rules/FrameUtil.java 2011-09-13 20:05:11 UTC (rev 3468)
+++ branches/7.1.x/engine/src/main/java/org/teiid/query/optimizer/relational/rules/FrameUtil.java 2011-09-13 22:56:53 UTC (rev 3469)
@@ -260,7 +260,7 @@
ExpressionMappingVisitor.mapExpressions(groupBy, symbolMap);
node.setProperty(NodeConstants.Info.GROUP_COLS, groupBy.getSymbols());
if (!singleMapping) {
- GroupsUsedByElementsVisitor.getGroups(groupCols, groups);
+ GroupsUsedByElementsVisitor.getGroups(groupBy, groups);
}
}
} else if (type == NodeConstants.Types.SOURCE || type == NodeConstants.Types.ACCESS) {
Modified: branches/7.1.x/engine/src/test/java/org/teiid/query/optimizer/TestRuleMergeVirtual.java
===================================================================
--- branches/7.1.x/engine/src/test/java/org/teiid/query/optimizer/TestRuleMergeVirtual.java 2011-09-13 20:05:11 UTC (rev 3468)
+++ branches/7.1.x/engine/src/test/java/org/teiid/query/optimizer/TestRuleMergeVirtual.java 2011-09-13 22:56:53 UTC (rev 3469)
@@ -317,5 +317,16 @@
TestOptimizer.checkNodeTypes(plan, TestOptimizer.FULL_PUSHDOWN);
}
+
+ @Test public void testMergeGroupBy() throws Exception {
+ BasicSourceCapabilities caps = TestAggregatePushdown.getAggregateCapabilities();
+ caps.setFunctionSupport("+", true); //$NON-NLS-1$
+ ProcessorPlan plan = TestOptimizer.helpPlan("SELECT x FROM (select c.e1 as x from (select e1 from pm1.g1) as c, pm1.g2 as d) as a group by x", //$NON-NLS-1$
+ FakeMetadataFactory.example1Cached(), null, new DefaultCapabilitiesFinder(caps),
+ new String[] {
+ "SELECT g_0.e1 FROM pm1.g1 AS g_0, pm1.g2 AS g_1 GROUP BY g_0.e1"}, ComparisonMode.EXACT_COMMAND_STRING); //$NON-NLS-1$
+
+ TestOptimizer.checkNodeTypes(plan, TestOptimizer.FULL_PUSHDOWN);
+ }
}
12 years, 8 months
teiid SVN: r3468 - in branches/as7: engine/src/main/java/org/teiid/common/buffer and 9 other directories.
by teiid-commits@lists.jboss.org
Author: rareddy
Date: 2011-09-13 16:05:11 -0400 (Tue, 13 Sep 2011)
New Revision: 3468
Added:
branches/as7/jboss-integration/src/main/java/org/teiid/jboss/VDBDependencyDeployer.java
branches/as7/jboss-integration/src/main/java/org/teiid/jboss/VDBStructureDeployer.java
Removed:
branches/as7/build/kits/jboss-as7/domain/domain-teiid.xml
branches/as7/jboss-integration/src/main/java/org/teiid/jboss/VDBDependencyProcessor.java
branches/as7/jboss-integration/src/main/java/org/teiid/jboss/VDBStructure.java
Modified:
branches/as7/engine/src/main/java/org/teiid/common/buffer/BufferManager.java
branches/as7/engine/src/main/java/org/teiid/common/buffer/impl/BufferManagerImpl.java
branches/as7/engine/src/main/java/org/teiid/dqp/internal/process/CachedResults.java
branches/as7/engine/src/main/resources/org/teiid/query/i18n.properties
branches/as7/jboss-integration/src/main/java/org/teiid/jboss/Element.java
branches/as7/jboss-integration/src/main/java/org/teiid/jboss/JGroupsObjectReplicatorService.java
branches/as7/jboss-integration/src/main/java/org/teiid/jboss/TeiidBootServicesAdd.java
branches/as7/jboss-integration/src/main/java/org/teiid/jboss/TeiidSubsystemParser.java
branches/as7/jboss-integration/src/main/java/org/teiid/jboss/VDBDeployer.java
branches/as7/jboss-integration/src/main/java/org/teiid/jboss/VDBService.java
branches/as7/jboss-integration/src/main/java/org/teiid/jboss/deployers/RuntimeEngineDeployer.java
branches/as7/jboss-integration/src/main/resources/schema/jboss-teiid.xsd
branches/as7/jboss-integration/src/test/java/org/teiid/jboss/TestTeiidConfiguration.java
branches/as7/jboss-integration/src/test/resources/teiid-model-config.txt
branches/as7/jboss-integration/src/test/resources/teiid-sample-config.xml
branches/as7/runtime/src/test/java/org/teiid/dqp/service/buffer/TestLocalBufferService.java
Log:
TEIID-1720: Added Object replication to Buffer Manager for resultset replication; fixed schema file to current code
Deleted: branches/as7/build/kits/jboss-as7/domain/domain-teiid.xml
===================================================================
--- branches/as7/build/kits/jboss-as7/domain/domain-teiid.xml 2011-09-13 18:58:53 UTC (rev 3467)
+++ branches/as7/build/kits/jboss-as7/domain/domain-teiid.xml 2011-09-13 20:05:11 UTC (rev 3468)
@@ -1,702 +0,0 @@
-<!--
- ~ JBoss, Home of Professional Open Source.
- ~ Copyright 2010, Red Hat, Inc., and individual contributors
- ~ as indicated by the @author tags. See the copyright.txt file in the
- ~ distribution for a full listing of individual contributors.
- ~
- ~ This is free software; you can redistribute it and/or modify it
- ~ under the terms of the GNU Lesser General Public License as
- ~ published by the Free Software Foundation; either version 2.1 of
- ~ the License, or (at your option) any later version.
- ~
- ~ This software is distributed in the hope that it will be useful,
- ~ but WITHOUT ANY WARRANTY; without even the implied warranty of
- ~ MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
- ~ Lesser General Public License for more details.
- ~
- ~ You should have received a copy of the GNU Lesser General Public
- ~ License along with this software; if not, write to the Free
- ~ Software Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA
- ~ 02110-1301 USA, or see the FSF site: http://www.fsf.org.
- -->
-
-<domain xmlns="urn:jboss:domain:1.0">
-
- <extensions>
- <extension module="org.jboss.as.clustering.infinispan"/>
- <extension module="org.jboss.as.clustering.jgroups"/>
- <extension module="org.jboss.as.connector"/>
- <extension module="org.jboss.as.ee"/>
- <extension module="org.jboss.as.ejb3"/>
- <extension module="org.jboss.as.jaxrs"/>
- <extension module="org.jboss.as.jmx"/>
- <extension module="org.jboss.as.jpa"/>
- <extension module="org.jboss.as.logging"/>
- <extension module="org.jboss.as.modcluster"/>
- <extension module="org.jboss.as.naming"/>
- <extension module="org.jboss.as.osgi"/>
- <extension module="org.jboss.as.remoting"/>
- <extension module="org.jboss.as.sar"/>
- <extension module="org.jboss.as.security"/>
- <extension module="org.jboss.teiid"/>
- <extension module="org.jboss.as.threads"/>
- <extension module="org.jboss.as.transactions"/>
- <extension module="org.jboss.as.web"/>
- <extension module="org.jboss.as.weld"/>
- </extensions>
-
- <system-properties>
- <!-- IPv4 is not required, but setting this helps avoid unintended use of IPv6 -->
- <property name="java.net.preferIPv4Stack" value="true"/>
- </system-properties>
-
- <profiles>
- <profile name="default">
- <subsystem xmlns="urn:jboss:domain:logging:1.1">
- <console-handler name="CONSOLE">
- <level name="INFO"/>
- <formatter>
- <pattern-formatter pattern="%d{HH:mm:ss,SSS} %-5p [%c] (%t) %s%E%n"/>
- </formatter>
- </console-handler>
-
- <periodic-rotating-file-handler name="FILE">
- <level name="INFO"/>
- <formatter>
- <pattern-formatter pattern="%d{HH:mm:ss,SSS} %-5p [%c] (%t) %s%E%n"/>
- </formatter>
- <file relative-to="jboss.server.log.dir" path="server.log"/>
- <suffix value=".yyyy-MM-dd"/>
- </periodic-rotating-file-handler>
-
- <logger category="com.arjuna">
- <level name="WARN"/>
- </logger>
- <logger category="org.apache.tomcat.util.modeler">
- <level name="WARN"/>
- </logger>
- <logger category="sun.rmi">
- <level name="WARN"/>
- </logger>
-
- <root-logger>
- <level name="INFO"/>
- <handlers>
- <handler name="CONSOLE"/>
- <handler name="FILE"/>
- </handlers>
- </root-logger>
- </subsystem>
- <subsystem xmlns="urn:jboss:domain:datasources:1.0">
- <datasources>
- <datasource jndi-name="java:jboss/datasources/ExampleDS" enabled="true" use-java-context="true" pool-name="H2DS">
- <connection-url>jdbc:h2:mem:test;DB_CLOSE_DELAY=-1</connection-url>
- <driver>h2</driver>
- <pool></pool>
- <security>
- <user-name>sa</user-name>
- <password>sa</password>
- </security>
- </datasource>
- <drivers>
- <driver name="h2" module="com.h2database.h2">
- <xa-datasource-class>org.h2.jdbcx.JdbcDataSource</xa-datasource-class>
- </driver>
- </drivers>
- </datasources>
- </subsystem>
- <subsystem xmlns="urn:jboss:domain:ee:1.0"/>
- <subsystem xmlns="urn:jboss:domain:ejb3:1.1" lite="true">
- <!-- EJB3 pools -->
- <pools>
- <bean-instance-pools>
- <strict-max-pool name="slsb-strict-max-pool" max-pool-size="20" instance-acquisition-timeout="5"
- instance-acquisition-timeout-unit="MINUTES"/>
- </bean-instance-pools>
- </pools>
-
- <!-- Session bean configurations -->
- <session-bean>
- <stateless>
- <bean-instance-pool-ref pool-name="slsb-strict-max-pool"/>
- </stateless>
- </session-bean>
-
- </subsystem>
- <subsystem xmlns="urn:jboss:domain:infinispan:1.0" default-cache-container="hibernate">
- <cache-container name="hibernate" default-cache="local-query">
- <local-cache name="entity">
- <eviction strategy="LRU" max-entries="10000"/>
- <expiration max-idle="100000"/>
- </local-cache>
- <local-cache name="local-query">
- <eviction strategy="LRU" max-entries="10000"/>
- <expiration max-idle="100000"/>
- </local-cache>
- <local-cache name="timestamps">
- <eviction strategy="NONE"/>
- </local-cache>
- </cache-container>
- </subsystem>
- <subsystem xmlns="urn:jboss:domain:jaxrs:1.0"/>
- <subsystem xmlns="urn:jboss:domain:jca:1.0">
- <archive-validation enabled="true"/>
- <bean-validation enabled="true"/>
- <default-workmanager>
- <short-running-threads blocking="true">
- <core-threads count="10" per-cpu="20"/>
- <queue-length count="10" per-cpu="20"/>
- <max-threads count="10" per-cpu="20"/>
- <keepalive-time time="10" unit="seconds"/>
- </short-running-threads>
- <long-running-threads blocking="true">
- <core-threads count="10" per-cpu="20"/>
- <queue-length count="10" per-cpu="20"/>
- <max-threads count="10" per-cpu="20"/>
- <keepalive-time time="10" unit="seconds"/>
- </long-running-threads>
- </default-workmanager>
- </subsystem>
- <subsystem xmlns="urn:jboss:domain:jmx:1.0">
- <jmx-connector registry-binding="jmx-connector-registry" server-binding="jmx-connector-server" />
- </subsystem>
- <subsystem xmlns="urn:jboss:domain:jpa:1.0">
- <jpa default-datasource=""/>
- </subsystem>
- <subsystem xmlns="urn:jboss:domain:naming:1.0"/>
- <subsystem xmlns="urn:jboss:domain:osgi:1.0" activation="lazy">
- <configuration pid="org.apache.felix.webconsole.internal.servlet.OsgiManager">
- <property name="manager.root">jboss-osgi</property>
- </configuration>
- <properties>
- <!--
- A comma seperated list of module identifiers. Each system module
- is added as a dependency to the OSGi framework module. The packages
- from these system modules can be made visible as framework system packages.
- http://www.osgi.org/javadoc/r4v42/org/osgi/framework/Constants.html#FRAME...
- -->
- <property name="org.jboss.osgi.system.modules">
- org.apache.commons.logging,
- org.apache.log4j,
- org.jboss.as.osgi,
- org.slf4j,
- </property>
- <!--
- Framework environment property identifying extra packages which the system bundle
- must export from the current execution environment
- -->
- <property name="org.osgi.framework.system.packages.extra">
- org.apache.commons.logging;version=1.1.1,
- org.apache.log4j;version=1.2,
- org.jboss.as.osgi.service;version=7.0,
- org.jboss.osgi.deployment.interceptor;version=1.0,
- org.jboss.osgi.spi.capability;version=1.0,
- org.jboss.osgi.spi.util;version=1.0,
- org.jboss.osgi.testing;version=1.0,
- org.jboss.osgi.vfs;version=1.0,
- org.slf4j;version=1.5.10,
- </property>
- <!-- Specifies the beginning start level of the framework -->
- <property name="org.osgi.framework.startlevel.beginning">1</property>
- </properties>
- <modules>
- <!-- modules registered with the OSGi layer on startup -->
- <module identifier="javaee.api"/>
- <module identifier="org.jboss.logging"/>
- <!-- bundles installed on startup -->
- <module identifier="org.apache.aries.util"/>
- <module identifier="org.jboss.osgi.webconsole"/>
- <module identifier="org.osgi.compendium"/>
- <!-- bundles started in startlevel 1 -->
- <module identifier="org.apache.felix.log" startlevel="1"/>
- <module identifier="org.jboss.osgi.logging" startlevel="1"/>
- <module identifier="org.apache.felix.configadmin" startlevel="1"/>
- <module identifier="org.jboss.as.osgi.configadmin" startlevel="1"/>
- <!-- bundles started in startlevel 2 -->
- <module identifier="org.apache.aries.jmx" startlevel="2"/>
- <module identifier="org.apache.felix.eventadmin" startlevel="2"/>
- <module identifier="org.apache.felix.metatype" startlevel="2"/>
- <module identifier="org.apache.felix.webconsole" startlevel="2"/>
- <module identifier="org.jboss.osgi.jmx" startlevel="2"/>
- <module identifier="org.jboss.osgi.http" startlevel="2"/>
- <!-- bundles started in startlevel 3 -->
- <module identifier="org.jboss.osgi.blueprint" startlevel="3"/>
- <module identifier="org.jboss.osgi.webapp" startlevel="3"/>
- <module identifier="org.jboss.osgi.xerces" startlevel="3"/>
- </modules>
- </subsystem>
- <subsystem xmlns="urn:jboss:domain:remoting:1.0"/>
- <subsystem xmlns="urn:jboss:domain:resource-adapters:1.0"/>
- <subsystem xmlns="urn:jboss:domain:sar:1.0"/>
- <subsystem xmlns="urn:jboss:domain:security:1.0">
- <security-domains>
- <security-domain name="other">
- <authentication>
- <login-module code="UsersRoles" flag="required"/>
- </authentication>
- </security-domain>
- <security-domain name="teiid-security" cache-type="default">
- <authentication>
- <login-module code="UsersRoles" flag="required">
- <module-option name="usersProperties" value="teiid-security-users.properties"/>
- <module-option name="rolesProperties" value="teiid-security-roles.properties"/>
- </login-module>
- </authentication>
- </security-domain>
- </security-domains>
- </subsystem>
- <subsystem xmlns="urn:jboss:domain:teiid:1.0">
- <async-thread-group>teiid-async</async-thread-group>
-
- <query-engine name = "default">
- <object-replicator-name>teiid/replicator</object-replicator-name>
- <security-domain>teiid-security</security-domain>
- <jdbc socket-binding="teiid-jdbc"/>
- <odbc socket-binding="teiid-odbc"/>
- </query-engine>
-
- <translator name="jdbc-simple" module="org.jboss.teiid.translator.jdbc"/>
- <translator name="jdbc-ansi" module="org.jboss.teiid.translator.jdbc"/>
- <translator name="access" module="org.jboss.teiid.translator.jdbc"/>
- <translator name="db2" module="org.jboss.teiid.translator.jdbc"/>
- <translator name="derby" module="org.jboss.teiid.translator.jdbc"/>
- <translator name="h2" module="org.jboss.teiid.translator.jdbc"/>
- <translator name="hsql" module="org.jboss.teiid.translator.jdbc"/>
- <translator name="informix" module="org.jboss.teiid.translator.jdbc"/>
- <translator name="metamatrix" module="org.jboss.teiid.translator.jdbc"/>
- <translator name="mysql" module="org.jboss.teiid.translator.jdbc"/>
- <translator name="mysql5" module="org.jboss.teiid.translator.jdbc"/>
- <translator name="oracle" module="org.jboss.teiid.translator.jdbc"/>
- <translator name="postgresql" module="org.jboss.teiid.translator.jdbc"/>
- <translator name="sqlserver" module="org.jboss.teiid.translator.jdbc"/>
- <translator name="sybase" module="org.jboss.teiid.translator.jdbc"/>
- <translator name="teiid" module="org.jboss.teiid.translator.jdbc"/>
- <translator name="teradata" module="org.jboss.teiid.translator.jdbc"/>
- <translator name="modeshape" module="org.jboss.teiid.translator.jdbc"/>
- <translator name="ingres" module="org.jboss.teiid.translator.jdbc"/>
- <translator name="ingres93" module="org.jboss.teiid.translator.jdbc"/>
- <translator name="intersystems-cache" module="org.jboss.teiid.translator.jdbc"/>
- <translator name="netezza" module="org.jboss.teiid.translator.jdbc"/>
- <translator name="file" module="org.jboss.teiid.translator.file"/>
- <translator name="ldap" module="org.jboss.teiid.translator.ldap"/>
- <translator name="loopback" module="org.jboss.teiid.translator.loopback"/>
- <translator name="olap" module="org.jboss.teiid.translator.olap"/>
- <translator name="ws" module="org.jboss.teiid.translator.ws"/>
- </subsystem>
-
- <subsystem xmlns="urn:jboss:domain:threads:1.0">
- <queueless-thread-pool name="teiid-async">
- <max-threads count="2" per-cpu="2" />
- </queueless-thread-pool>
- </subsystem>
- <subsystem xmlns="urn:jboss:domain:transactions:1.0">
- <recovery-environment socket-binding="txn-recovery-environment" status-socket-binding="txn-status-manager"/>
- <core-environment>
- <process-id>
- <uuid />
- </process-id>
- </core-environment>
- <coordinator-environment default-timeout="300"/>
- </subsystem>
- <subsystem xmlns="urn:jboss:domain:web:1.0" default-virtual-server="default-host">
- <connector name="http" scheme="http" protocol="HTTP/1.1" socket-binding="http"/>
- <virtual-server name="default-host">
- <alias name="localhost" />
- <alias name="example.com" />
- </virtual-server>
- </subsystem>
- <subsystem xmlns="urn:jboss:domain:weld:1.0"/>
- </profile>
-
- <profile name="ha">
- <subsystem xmlns="urn:jboss:domain:logging:1.1">
- <console-handler name="CONSOLE">
- <level name="INFO"/>
- <formatter>
- <pattern-formatter pattern="%d{HH:mm:ss,SSS} %-5p [%c] (%t) %s%E%n"/>
- </formatter>
- </console-handler>
-
- <periodic-rotating-file-handler name="FILE">
- <level name="INFO"/>
- <formatter>
- <pattern-formatter pattern="%d{HH:mm:ss,SSS} %-5p [%c] (%t) %s%E%n"/>
- </formatter>
- <file relative-to="jboss.server.log.dir" path="server.log"/>
- <suffix value=".yyyy-MM-dd"/>
- </periodic-rotating-file-handler>
-
- <logger category="com.arjuna">
- <level name="WARN"/>
- </logger>
- <logger category="org.apache.tomcat.util.modeler">
- <level name="WARN"/>
- </logger>
- <logger category="sun.rmi">
- <level name="WARN"/>
- </logger>
-
- <root-logger>
- <level name="INFO"/>
- <handlers>
- <handler name="CONSOLE"/>
- <handler name="FILE"/>
- </handlers>
- </root-logger>
- </subsystem>
- <subsystem xmlns="urn:jboss:domain:datasources:1.0">
- <datasources>
- <datasource jndi-name="java:jboss/datasources/ExampleDS" enabled="true" use-java-context="true" pool-name="H2DS">
- <connection-url>jdbc:h2:mem:test;DB_CLOSE_DELAY=-1</connection-url>
- <driver>h2</driver>
- <pool></pool>
- <security>
- <user-name>sa</user-name>
- <password>sa</password>
- </security>
- </datasource>
- <drivers>
- <driver name="h2" module="com.h2database.h2">
- <xa-datasource-class>org.h2.jdbcx.JdbcDataSource</xa-datasource-class>
- </driver>
- </drivers>
- </datasources>
- </subsystem>
- <subsystem xmlns="urn:jboss:domain:ee:1.0"/>
- <subsystem xmlns="urn:jboss:domain:ejb3:1.1" lite="true">
- <!-- EJB3 pools -->
- <pools>
- <bean-instance-pools>
- <strict-max-pool name="slsb-strict-max-pool" max-pool-size="20" instance-acquisition-timeout="5"
- instance-acquisition-timeout-unit="MINUTES"/>
- </bean-instance-pools>
- </pools>
-
- <!-- Session bean configurations -->
- <session-bean>
- <stateless>
- <bean-instance-pool-ref pool-name="slsb-strict-max-pool"/>
- </stateless>
- </session-bean>
-
- </subsystem>
- <subsystem xmlns="urn:jboss:domain:infinispan:1.0" default-cache-container="cluster">
- <cache-container name="cluster" default-cache="default">
- <alias>ha-partition</alias>
- <replicated-cache name="default" mode="SYNC" batching="true">
- <locking isolation="REPEATABLE_READ"/>
- </replicated-cache>
- </cache-container>
- <cache-container name="web" default-cache="repl">
- <alias>standard-session-cache</alias>
- <replicated-cache name="repl" mode="ASYNC" batching="true">
- <locking isolation="REPEATABLE_READ"/>
- <file-store/>
- </replicated-cache>
- <distributed-cache name="dist" mode="ASYNC" batching="true">
- <locking isolation="REPEATABLE_READ"/>
- <file-store/>
- </distributed-cache>
- </cache-container>
- <cache-container name="sfsb" default-cache="repl">
- <alias>sfsb-cache</alias>
- <alias>jboss.cache:service=EJB3SFSBClusteredCache</alias>
- <replicated-cache name="repl" mode="ASYNC" batching="true">
- <locking isolation="REPEATABLE_READ"/>
- <eviction strategy="LRU" max-entries="10000"/>
- <file-store/>
- </replicated-cache>
- </cache-container>
- <cache-container name="hibernate" default-cache="local-query">
- <invalidation-cache name="entity" mode="SYNC">
- <eviction strategy="LRU" max-entries="10000"/>
- <expiration max-idle="100000"/>
- </invalidation-cache>
- <local-cache name="local-query">
- <eviction strategy="LRU" max-entries="10000"/>
- <expiration max-idle="100000"/>
- </local-cache>
- <replicated-cache name="timestamps" mode="ASYNC">
- <eviction strategy="NONE"/>
- </replicated-cache>
- </cache-container>
- </subsystem>
- <subsystem xmlns="urn:jboss:domain:jaxrs:1.0"/>
- <subsystem xmlns="urn:jboss:domain:jca:1.0">
- <archive-validation enabled="true"/>
- <bean-validation enabled="true"/>
- <default-workmanager>
- <short-running-threads blocking="true">
- <core-threads count="10" per-cpu="20"/>
- <queue-length count="10" per-cpu="20"/>
- <max-threads count="10" per-cpu="20"/>
- <keepalive-time time="10" unit="seconds"/>
- </short-running-threads>
- <long-running-threads blocking="true">
- <core-threads count="10" per-cpu="20"/>
- <queue-length count="10" per-cpu="20"/>
- <max-threads count="10" per-cpu="20"/>
- <keepalive-time time="10" unit="seconds"/>
- </long-running-threads>
- </default-workmanager>
- </subsystem>
- <subsystem xmlns="urn:jboss:domain:jgroups:1.0" default-stack="udp">
- <stack name="udp">
- <transport type="UDP" socket-binding="jgroups-udp" diagnostics-socket-binding="jgroups-diagnostics"/>
- <protocol type="PING"/>
- <protocol type="MERGE2"/>
- <protocol type="FD_SOCK" socket-binding="jgroups-udp-fd"/>
- <protocol type="FD"/>
- <protocol type="VERIFY_SUSPECT"/>
- <protocol type="BARRIER"/>
- <protocol type="pbcast.NAKACK"/>
- <protocol type="UNICAST"/>
- <protocol type="pbcast.STABLE"/>
- <protocol type="VIEW_SYNC"/>
- <protocol type="pbcast.GMS"/>
- <protocol type="UFC"/>
- <protocol type="MFC"/>
- <protocol type="FRAG2"/>
- <protocol type="pbcast.STREAMING_STATE_TRANSFER"/>
- <protocol type="pbcast.FLUSH"/>
- </stack>
- <stack name="tcp">
- <transport type="TCP" socket-binding="jgroups-tcp" diagnostics-socket-binding="jgroups-diagnostics"/>
- <protocol type="MPING" socket-binding="jgroups-mping"/>
- <protocol type="MERGE2"/>
- <protocol type="FD_SOCK" socket-binding="jgroups-tcp-fd"/>
- <protocol type="FD"/>
- <protocol type="VERIFY_SUSPECT"/>
- <protocol type="BARRIER"/>
- <protocol type="pbcast.NAKACK"/>
- <protocol type="UNICAST"/>
- <protocol type="pbcast.STABLE"/>
- <protocol type="VIEW_SYNC"/>
- <protocol type="pbcast.GMS"/>
- <protocol type="UFC"/>
- <protocol type="MFC"/>
- <protocol type="FRAG2"/>
- <protocol type="pbcast.STREAMING_STATE_TRANSFER"/>
- <protocol type="pbcast.FLUSH"/>
- </stack>
- </subsystem>
- <subsystem xmlns="urn:jboss:domain:jmx:1.0">
- <jmx-connector registry-binding="jmx-connector-registry" server-binding="jmx-connector-server" />
- </subsystem>
- <subsystem xmlns="urn:jboss:domain:jpa:1.0">
- <jpa default-datasource=""/>
- </subsystem>
- <subsystem xmlns="urn:jboss:domain:modcluster:1.0">
- <mod-cluster-config advertise-socket="modcluster"/>
- </subsystem>
- <subsystem xmlns="urn:jboss:domain:naming:1.0"/>
- <subsystem xmlns="urn:jboss:domain:osgi:1.0" activation="lazy">
- <configuration pid="org.apache.felix.webconsole.internal.servlet.OsgiManager">
- <property name="manager.root">jboss-osgi</property>
- </configuration>
- <properties>
- <!--
- A comma seperated list of module identifiers. Each system module
- is added as a dependency to the OSGi framework module. The packages
- from these system modules can be made visible as framework system packages.
- http://www.osgi.org/javadoc/r4v42/org/osgi/framework/Constants.html#FRAME...
- -->
- <property name="org.jboss.osgi.system.modules">
- org.apache.commons.logging,
- org.apache.log4j,
- org.jboss.as.osgi,
- org.slf4j,
- </property>
- <!--
- Framework environment property identifying extra packages which the system bundle
- must export from the current execution environment
- -->
- <property name="org.osgi.framework.system.packages.extra">
- org.apache.commons.logging;version=1.1.1,
- org.apache.log4j;version=1.2,
- org.jboss.as.osgi.service;version=7.0,
- org.jboss.osgi.deployment.interceptor;version=1.0,
- org.jboss.osgi.spi.capability;version=1.0,
- org.jboss.osgi.spi.util;version=1.0,
- org.jboss.osgi.testing;version=1.0,
- org.jboss.osgi.vfs;version=1.0,
- org.slf4j;version=1.5.10,
- </property>
- <!-- Specifies the beginning start level of the framework -->
- <property name="org.osgi.framework.startlevel.beginning">1</property>
- </properties>
- <modules>
- <!-- modules registered with the OSGi layer on startup -->
- <module identifier="javaee.api"/>
- <module identifier="org.jboss.logging"/>
- <!-- bundles installed on startup -->
- <module identifier="org.apache.aries.util"/>
- <module identifier="org.jboss.osgi.webconsole"/>
- <module identifier="org.osgi.compendium"/>
- <!-- bundles started in startlevel 1 -->
- <module identifier="org.apache.felix.log" startlevel="1"/>
- <module identifier="org.jboss.osgi.logging" startlevel="1"/>
- <module identifier="org.apache.felix.configadmin" startlevel="1"/>
- <module identifier="org.jboss.as.osgi.configadmin" startlevel="1"/>
- <!-- bundles started in startlevel 2 -->
- <module identifier="org.apache.aries.jmx" startlevel="2"/>
- <module identifier="org.apache.felix.eventadmin" startlevel="2"/>
- <module identifier="org.apache.felix.metatype" startlevel="2"/>
- <module identifier="org.apache.felix.webconsole" startlevel="2"/>
- <module identifier="org.jboss.osgi.jmx" startlevel="2"/>
- <module identifier="org.jboss.osgi.http" startlevel="2"/>
- <!-- bundles started in startlevel 3 -->
- <module identifier="org.jboss.osgi.blueprint" startlevel="3"/>
- <module identifier="org.jboss.osgi.webapp" startlevel="3"/>
- <module identifier="org.jboss.osgi.xerces" startlevel="3"/>
- </modules>
- </subsystem>
- <subsystem xmlns="urn:jboss:domain:remoting:1.0"/>
- <subsystem xmlns="urn:jboss:domain:resource-adapters:1.0"/>
- <subsystem xmlns="urn:jboss:domain:sar:1.0"/>
- <subsystem xmlns="urn:jboss:domain:security:1.0">
- <security-domains>
- <security-domain name="other">
- <authentication>
- <login-module code="UsersRoles" flag="required"/>
- </authentication>
- </security-domain>
- <security-domain name="teiid-security" cache-type="default">
- <authentication>
- <login-module code="UsersRoles" flag="required">
- <module-option name="usersProperties" value="teiid-security-users.properties"/>
- <module-option name="rolesProperties" value="teiid-security-roles.properties"/>
- </login-module>
- </authentication>
- </security-domain>
- </security-domains>
- </subsystem>
- <subsystem xmlns="urn:jboss:domain:teiid:1.0">
- <async-thread-group>teiid-async</async-thread-group>
-
- <query-engine name = "default">
- <object-replicator-name>teiid/replicator</object-replicator-name>
- <security-domain>teiid-security</security-domain>
- <jdbc socket-binding="teiid-jdbc"/>
- <odbc socket-binding="teiid-odbc"/>
- </query-engine>
-
- <translator name="jdbc-simple" module="org.jboss.teiid.translator.jdbc"/>
- <translator name="jdbc-ansi" module="org.jboss.teiid.translator.jdbc"/>
- <translator name="access" module="org.jboss.teiid.translator.jdbc"/>
- <translator name="db2" module="org.jboss.teiid.translator.jdbc"/>
- <translator name="derby" module="org.jboss.teiid.translator.jdbc"/>
- <translator name="h2" module="org.jboss.teiid.translator.jdbc"/>
- <translator name="hsql" module="org.jboss.teiid.translator.jdbc"/>
- <translator name="informix" module="org.jboss.teiid.translator.jdbc"/>
- <translator name="metamatrix" module="org.jboss.teiid.translator.jdbc"/>
- <translator name="mysql" module="org.jboss.teiid.translator.jdbc"/>
- <translator name="mysql5" module="org.jboss.teiid.translator.jdbc"/>
- <translator name="oracle" module="org.jboss.teiid.translator.jdbc"/>
- <translator name="postgresql" module="org.jboss.teiid.translator.jdbc"/>
- <translator name="sqlserver" module="org.jboss.teiid.translator.jdbc"/>
- <translator name="sybase" module="org.jboss.teiid.translator.jdbc"/>
- <translator name="teiid" module="org.jboss.teiid.translator.jdbc"/>
- <translator name="teradata" module="org.jboss.teiid.translator.jdbc"/>
- <translator name="modeshape" module="org.jboss.teiid.translator.jdbc"/>
- <translator name="ingres" module="org.jboss.teiid.translator.jdbc"/>
- <translator name="ingres93" module="org.jboss.teiid.translator.jdbc"/>
- <translator name="intersystems-cache" module="org.jboss.teiid.translator.jdbc"/>
- <translator name="netezza" module="org.jboss.teiid.translator.jdbc"/>
- <translator name="file" module="org.jboss.teiid.translator.file"/>
- <translator name="ldap" module="org.jboss.teiid.translator.ldap"/>
- <translator name="loopback" module="org.jboss.teiid.translator.loopback"/>
- <translator name="olap" module="org.jboss.teiid.translator.olap"/>
- <translator name="ws" module="org.jboss.teiid.translator.ws"/>
- </subsystem>
- <subsystem xmlns="urn:jboss:domain:threads:1.0">
- <queueless-thread-pool name="teiid-async">
- <max-threads count="2" per-cpu="2" />
- </queueless-thread-pool>
- </subsystem>
- <subsystem xmlns="urn:jboss:domain:transactions:1.0">
- <recovery-environment socket-binding="txn-recovery-environment" status-socket-binding="txn-status-manager"/>
- <core-environment>
- <process-id>
- <uuid />
- </process-id>
- </core-environment>
- <coordinator-environment default-timeout="300"/>
- </subsystem>
- <subsystem xmlns="urn:jboss:domain:web:1.0" default-virtual-server="default-host">
- <connector name="http" scheme="http" protocol="HTTP/1.1" socket-binding="http"/>
- <virtual-server name="default-host">
- <alias name="localhost" />
- <alias name="example.com" />
- </virtual-server>
- </subsystem>
- <subsystem xmlns="urn:jboss:domain:weld:1.0"/>
- </profile>
- </profiles>
-
-
- <!--
- Named interfaces that can be referenced elsewhere in the configuration. The configuration
- for how to associate these logical names with an actual network interface can either
- be specified here or can be declared on a per-host basis in the equivalent element in host.xml.
-
- These default configurations require the binding specification to be done in host.xml.
- -->
- <interfaces>
- <interface name="management"/>
- <interface name="public"/>
- </interfaces>
-
- <socket-binding-groups>
- <socket-binding-group name="standard-sockets" default-interface="public">
- <socket-binding name="http" port="8080"/>
- <socket-binding name="https" port="8443"/>
- <socket-binding name="jmx-connector-registry" port="1090"/>
- <socket-binding name="jmx-connector-server" port="1091"/>
- <socket-binding name="jndi" port="1099"/>
- <socket-binding name="osgi-http" port="8090"/>
- <socket-binding name="remoting" port="4447"/>
- <socket-binding name="txn-recovery-environment" port="4712"/>
- <socket-binding name="txn-status-manager" port="4713"/>
- <socket-binding name="teiid-jdbc" port="31000"/>
- <socket-binding name="teiid-odbc" port="35432"/>
- </socket-binding-group>
- <socket-binding-group name="ha-sockets" default-interface="public">
- <socket-binding name="http" port="8080"/>
- <socket-binding name="https" port="8443"/>
- <socket-binding name="jgroups-diagnostics" port="0" multicast-address="224.0.75.75" multicast-port="7500"/>
- <socket-binding name="jgroups-mping" port="0" multicast-address="230.0.0.4" multicast-port="45700"/>
- <socket-binding name="jgroups-tcp" port="7600"/>
- <socket-binding name="jgroups-tcp-fd" port="57600"/>
- <socket-binding name="jgroups-udp" port="55200" multicast-address="230.0.0.4" multicast-port="45688"/>
- <socket-binding name="jgroups-udp-fd" port="54200"/>
- <socket-binding name="jmx-connector-registry" port="1090"/>
- <socket-binding name="jmx-connector-server" port="1091"/>
- <socket-binding name="jndi" port="1099"/>
- <socket-binding name="modcluster" port="0" multicast-address="224.0.1.105" multicast-port="23364"/>
- <socket-binding name="osgi-http" port="8090"/>
- <socket-binding name="remoting" port="4447"/>
- <socket-binding name="txn-recovery-environment" port="4712"/>
- <socket-binding name="txn-status-manager" port="4713"/>
- <socket-binding name="teiid-jdbc" port="31000"/>
- <socket-binding name="teiid-odbc" port="35432"/>
- </socket-binding-group>
- </socket-binding-groups>
-
- <server-groups>
- <server-group name="main-server-group" profile="default">
- <jvm name="default">
- <heap size="64m" max-size="512m"/>
- </jvm>
- <socket-binding-group ref="standard-sockets"/>
- </server-group>
-
- <server-group name="other-server-group" profile="ha">
- <jvm name="default">
- <heap size="64m" max-size="512m"/>
- </jvm>
- <socket-binding-group ref="ha-sockets"/>
- </server-group>
- </server-groups>
-
-</domain>
Modified: branches/as7/engine/src/main/java/org/teiid/common/buffer/BufferManager.java
===================================================================
--- branches/as7/engine/src/main/java/org/teiid/common/buffer/BufferManager.java 2011-09-13 18:58:53 UTC (rev 3467)
+++ branches/as7/engine/src/main/java/org/teiid/common/buffer/BufferManager.java 2011-09-13 20:05:11 UTC (rev 3468)
@@ -24,6 +24,7 @@
import java.util.List;
+import org.teiid.Replicated;
import org.teiid.core.TeiidComponentException;
import org.teiid.query.sql.symbol.Expression;
@@ -130,4 +131,7 @@
* @param maxActivePlans
*/
void setMaxActivePlans(int maxActivePlans);
+
+ @Replicated(replicateState=true)
+ void distributeTupleBuffer(String uuid, TupleBuffer tb);
}
Modified: branches/as7/engine/src/main/java/org/teiid/common/buffer/impl/BufferManagerImpl.java
===================================================================
--- branches/as7/engine/src/main/java/org/teiid/common/buffer/impl/BufferManagerImpl.java 2011-09-13 18:58:53 UTC (rev 3467)
+++ branches/as7/engine/src/main/java/org/teiid/common/buffer/impl/BufferManagerImpl.java 2011-09-13 20:05:11 UTC (rev 3468)
@@ -22,25 +22,12 @@
package org.teiid.common.buffer.impl;
-import java.io.BufferedInputStream;
-import java.io.BufferedOutputStream;
-import java.io.IOException;
-import java.io.ObjectInputStream;
-import java.io.ObjectOutputStream;
-import java.io.OutputStream;
+import java.io.*;
import java.lang.ref.Reference;
import java.lang.ref.ReferenceQueue;
import java.lang.ref.SoftReference;
import java.lang.ref.WeakReference;
-import java.util.ArrayList;
-import java.util.Arrays;
-import java.util.Collections;
-import java.util.Comparator;
-import java.util.Iterator;
-import java.util.LinkedHashMap;
-import java.util.List;
-import java.util.Map;
-import java.util.TreeMap;
+import java.util.*;
import java.util.concurrent.ConcurrentHashMap;
import java.util.concurrent.TimeUnit;
import java.util.concurrent.atomic.AtomicLong;
@@ -49,14 +36,7 @@
import java.util.concurrent.locks.ReentrantLock;
import java.util.concurrent.locks.ReentrantReadWriteLock;
-import org.teiid.common.buffer.BatchManager;
-import org.teiid.common.buffer.BufferManager;
-import org.teiid.common.buffer.FileStore;
-import org.teiid.common.buffer.LobManager;
-import org.teiid.common.buffer.STree;
-import org.teiid.common.buffer.StorageManager;
-import org.teiid.common.buffer.TupleBatch;
-import org.teiid.common.buffer.TupleBuffer;
+import org.teiid.common.buffer.*;
import org.teiid.common.buffer.BatchManager.ManagedBatch;
import org.teiid.core.TeiidComponentException;
import org.teiid.core.TeiidRuntimeException;
@@ -67,7 +47,9 @@
import org.teiid.logging.LogManager;
import org.teiid.logging.MessageLevel;
import org.teiid.query.QueryPlugin;
+import org.teiid.query.ReplicatedObject;
import org.teiid.query.processor.relational.ListNestedSortComparator;
+import org.teiid.query.sql.symbol.ElementSymbol;
import org.teiid.query.sql.symbol.Expression;
@@ -87,7 +69,7 @@
* TODO: add detection of pinned batches to prevent unnecessary purging of non-persistent batches
* - this is not necessary for already persistent batches, since we hold a weak reference
*/
-public class BufferManagerImpl implements BufferManager, StorageManager {
+public class BufferManagerImpl implements BufferManager, StorageManager, ReplicatedObject {
private static final int IO_BUFFER_SIZE = 1 << 14;
private static final int COMPACTION_THRESHOLD = 1 << 25; //start checking at 32 megs
@@ -122,7 +104,7 @@
private AtomicLong unusedSpace = new AtomicLong();
private int[] lobIndexes;
private SizeUtility sizeUtility;
-
+
private BatchManagerImpl(String newID, int[] lobIndexes) {
this.id = newID;
this.store = createFileStore(id);
@@ -701,6 +683,12 @@
}
@Override
+ public void distributeTupleBuffer(String uuid, TupleBuffer tb) {
+ tb.setId(uuid);
+ addTupleBuffer(tb);
+ }
+
+ @Override
public TupleBuffer getTupleBuffer(String id) {
cleanDefunctTupleBuffers();
Reference<TupleBuffer> r = this.tupleBufferMap.get(id);
@@ -730,6 +718,130 @@
public void setUseWeakReferences(boolean useWeakReferences) {
this.useWeakReferences = useWeakReferences;
+ }
+
+ @Override
+ public void getState(OutputStream ostream) {
+ try {
+ ObjectOutputStream out = new ObjectOutputStream(ostream);
+ for(String id:this.tupleBufferMap.keySet()) {
+ TupleReference tr = this.tupleBufferMap.get(id);
+ TupleBuffer tb = tr.get();
+ if (tb != null) {
+ out.writeObject(tb.getId());
+ getTupleBufferState(out, tb);
+ }
+ }
+ } catch (TeiidComponentException e) {
+ throw new TeiidRuntimeException(e);
+ } catch (IOException e) {
+ throw new TeiidRuntimeException(e);
+ }
}
+ @Override
+ public void getState(String state_id, OutputStream ostream) {
+ TupleBuffer buffer = this.getTupleBuffer(state_id);
+ if (buffer != null) {
+ try {
+ ObjectOutputStream out = new ObjectOutputStream(ostream);
+ getTupleBufferState(out, buffer);
+ } catch (TeiidComponentException e) {
+ throw new TeiidRuntimeException(e);
+ } catch (IOException e) {
+ throw new TeiidRuntimeException(e);
+ }
+ }
+ }
+
+ private void getTupleBufferState(ObjectOutputStream out, TupleBuffer buffer) throws TeiidComponentException, IOException {
+ out.writeInt(buffer.getRowCount());
+ out.writeInt(buffer.getBatchSize());
+ out.writeObject(buffer.getTypes());
+ out.writeBoolean(buffer.isPrefersMemory());
+ for (int row = 1; row <= buffer.getRowCount(); row+=buffer.getBatchSize()) {
+ TupleBatch b = buffer.getBatch(row);
+ b.preserveTypes();
+ out.writeObject(b);
+ }
+ }
+
+ @Override
+ public void setState(InputStream istream) {
+ try {
+ ObjectInputStream in = new ObjectInputStream(istream);
+ while (true) {
+ String state_id = null;
+ try {
+ state_id = (String)in.readObject();
+ } catch (IOException e) {
+ break;
+ }
+ if (state_id != null) {
+ setTupleBufferState(state_id, in);
+ }
+ }
+ } catch (IOException e) {
+ throw new TeiidRuntimeException(e);
+ } catch(ClassNotFoundException e) {
+ throw new TeiidRuntimeException(e);
+ } catch(TeiidComponentException e) {
+ throw new TeiidRuntimeException(e);
+ }
+
+ }
+
+ @Override
+ public void setState(String state_id, InputStream istream) {
+ TupleBuffer buffer = this.getTupleBuffer(state_id);
+ if (buffer == null) {
+ try {
+ ObjectInputStream in = new ObjectInputStream(istream);
+ setTupleBufferState(state_id, in);
+ } catch (IOException e) {
+ throw new TeiidRuntimeException(e);
+ } catch(ClassNotFoundException e) {
+ throw new TeiidRuntimeException(e);
+ } catch(TeiidComponentException e) {
+ throw new TeiidRuntimeException(e);
+ }
+ }
+ }
+
+ private void setTupleBufferState(String state_id, ObjectInputStream in) throws IOException, ClassNotFoundException, TeiidComponentException {
+ int rowCount = in.readInt();
+ int batchSize = in.readInt();
+ String[] types = (String[])in.readObject();
+ boolean prefersMemory = in.readBoolean();
+
+ List<ElementSymbol> schema = new ArrayList<ElementSymbol>(types.length);
+ for (String type : types) {
+ ElementSymbol es = new ElementSymbol("x"); //$NON-NLS-1$
+ es.setType(DataTypeManager.getDataTypeClass(type));
+ schema.add(es);
+ }
+ TupleBuffer buffer = createTupleBuffer(schema, "cached", TupleSourceType.FINAL); //$NON-NLS-1$
+ buffer.setBatchSize(batchSize);
+ buffer.setId(state_id);
+ buffer.setPrefersMemory(prefersMemory);
+
+ for (int row = 1; row <= rowCount; row+=batchSize) {
+ TupleBatch batch = (TupleBatch)in.readObject();
+ if (batch == null) {
+ buffer.remove();
+ throw new IOException(QueryPlugin.Util.getString("not_found_cache")); //$NON-NLS-1$
+ }
+ buffer.addTupleBatch(batch, true);
+ }
+ buffer.close();
+ addTupleBuffer(buffer);
+ }
+
+ @Override
+ public void setLocalAddress(Serializable address) {
+ }
+
+ @Override
+ public void droppedMembers(Collection<Serializable> addresses) {
+ }
}
Modified: branches/as7/engine/src/main/java/org/teiid/dqp/internal/process/CachedResults.java
===================================================================
--- branches/as7/engine/src/main/java/org/teiid/dqp/internal/process/CachedResults.java 2011-09-13 18:58:53 UTC (rev 3467)
+++ branches/as7/engine/src/main/java/org/teiid/dqp/internal/process/CachedResults.java 2011-09-13 20:05:11 UTC (rev 3468)
@@ -23,20 +23,15 @@
package org.teiid.dqp.internal.process;
import java.io.Serializable;
-import java.util.ArrayList;
-import java.util.List;
import org.teiid.api.exception.query.QueryParserException;
import org.teiid.api.exception.query.QueryResolverException;
import org.teiid.cache.Cachable;
import org.teiid.cache.Cache;
import org.teiid.common.buffer.BufferManager;
-import org.teiid.common.buffer.TupleBatch;
import org.teiid.common.buffer.TupleBuffer;
-import org.teiid.common.buffer.BufferManager.TupleSourceType;
import org.teiid.core.TeiidComponentException;
import org.teiid.core.TeiidException;
-import org.teiid.core.types.DataTypeManager;
import org.teiid.core.util.Assertion;
import org.teiid.logging.LogConstants;
import org.teiid.logging.LogManager;
@@ -48,7 +43,6 @@
import org.teiid.query.resolver.QueryResolver;
import org.teiid.query.sql.lang.CacheHint;
import org.teiid.query.sql.lang.Command;
-import org.teiid.query.sql.symbol.ElementSymbol;
public class CachedResults implements Serializable, Cachable {
@@ -57,11 +51,8 @@
private transient Command command;
private transient TupleBuffer results;
- private String[] types;
private CacheHint hint;
- private int batchSize;
private String uuid;
- private int rowCount;
private boolean hasLobs;
private AccessInfo accessInfo = new AccessInfo();
@@ -76,9 +67,6 @@
public void setResults(TupleBuffer results, ProcessorPlan plan) {
this.results = results;
- this.batchSize = results.getBatchSize();
- this.types = TupleBuffer.getTypeNames(results.getSchema());
- this.rowCount = results.getRowCount();
this.uuid = results.getId();
this.hasLobs = results.isLobs();
this.accessInfo.populate(plan.getContext(), true);
@@ -108,7 +96,7 @@
@Override
public boolean prepare(Cache cache, BufferManager bufferManager) {
Assertion.assertTrue(!this.results.isForwardOnly());
- bufferManager.addTupleBuffer(this.results);
+ bufferManager.distributeTupleBuffer(this.results.getId(), results);
return true;
}
@@ -118,40 +106,15 @@
if (this.hasLobs) {
return false; //the lob store is local only and not distributed
}
- TupleBuffer buffer = null;
+ TupleBuffer buffer = bufferManager.getTupleBuffer(this.uuid);
+ if (buffer != null) {
+ this.results = buffer;
+ }
+
try {
- List<ElementSymbol> schema = new ArrayList<ElementSymbol>(types.length);
- for (String type : types) {
- ElementSymbol es = new ElementSymbol("x"); //$NON-NLS-1$
- es.setType(DataTypeManager.getDataTypeClass(type));
- schema.add(es);
- }
- buffer = bufferManager.createTupleBuffer(schema, "cached", TupleSourceType.FINAL); //$NON-NLS-1$
- buffer.setBatchSize(this.batchSize);
- buffer.setId(this.uuid);
- if (this.hint != null) {
- buffer.setPrefersMemory(this.hint.getPrefersMemory());
- }
-
- for (int row = 1; row <= this.rowCount; row+=this.batchSize) {
- TupleBatch batch = (TupleBatch)cache.get(uuid+","+row); //$NON-NLS-1$
- if (batch == null) {
- LogManager.logInfo(LogConstants.CTX_DQP, QueryPlugin.Util.getString("not_found_cache")); //$NON-NLS-1$
- buffer.remove();
- return false;
- }
- buffer.addTupleBatch(batch, true);
- cache.remove(uuid+","+row); //$NON-NLS-1$
- }
- this.results = buffer;
- bufferManager.addTupleBuffer(this.results);
- this.results.close();
this.accessInfo.restore();
} catch (TeiidException e) {
LogManager.logWarning(LogConstants.CTX_DQP, e, QueryPlugin.Util.getString("unexpected_exception_restoring_results")); //$NON-NLS-1$
- if (buffer != null) {
- buffer.remove();
- }
return false;
}
}
Modified: branches/as7/engine/src/main/resources/org/teiid/query/i18n.properties
===================================================================
--- branches/as7/engine/src/main/resources/org/teiid/query/i18n.properties 2011-09-13 18:58:53 UTC (rev 3467)
+++ branches/as7/engine/src/main/resources/org/teiid/query/i18n.properties 2011-09-13 20:05:11 UTC (rev 3468)
@@ -940,4 +940,5 @@
DdlPlan.event_already_exists={0} already has an INSTEAD OF trigger defined for {1}.
error_refresh=error occurred during refreshing the materialized view entries for view {0}
-support_required=Without required support property {0}, pushdown will not be enabled for {1} on translator {2}.
\ No newline at end of file
+support_required=Without required support property {0}, pushdown will not be enabled for {1} on translator {2}.
+full_state_not_supported=Full state transfer is not supported in the resultset cache distribution
\ No newline at end of file
Modified: branches/as7/jboss-integration/src/main/java/org/teiid/jboss/Element.java
===================================================================
--- branches/as7/jboss-integration/src/main/java/org/teiid/jboss/Element.java 2011-09-13 18:58:53 UTC (rev 3467)
+++ branches/as7/jboss-integration/src/main/java/org/teiid/jboss/Element.java 2011-09-13 20:05:11 UTC (rev 3468)
@@ -87,7 +87,7 @@
CONTAINER_NAME_ELEMENT(CONTAINER_NAME),
//socket config
- MAX_SOCKET_SIZE_ELEMENT(MAX_SOCKET_THREAD_SIZE),
+ MAX_SOCKET_THREAD_SIZE_ELEMENT(MAX_SOCKET_THREAD_SIZE),
IN_BUFFER_SIZE_ELEMENT(IN_BUFFER_SIZE),
OUT_BUFFER_SIZE_ELEMENT(OUT_BUFFER_SIZE),
SOCKET_BINDING_ELEMENT(SOCKET_BINDING),
Modified: branches/as7/jboss-integration/src/main/java/org/teiid/jboss/JGroupsObjectReplicatorService.java
===================================================================
--- branches/as7/jboss-integration/src/main/java/org/teiid/jboss/JGroupsObjectReplicatorService.java 2011-09-13 18:58:53 UTC (rev 3467)
+++ branches/as7/jboss-integration/src/main/java/org/teiid/jboss/JGroupsObjectReplicatorService.java 2011-09-13 20:05:11 UTC (rev 3468)
@@ -27,6 +27,7 @@
import org.jboss.msc.service.StartException;
import org.jboss.msc.service.StopContext;
import org.jboss.msc.value.InjectedValue;
+import org.teiid.common.buffer.BufferManager;
import org.teiid.replication.jboss.JGroupsObjectReplicator;
class JGroupsObjectReplicatorService implements Service<JGroupsObjectReplicator> {
@@ -34,6 +35,7 @@
public final InjectedValue<ChannelFactory> channelFactoryInjector = new InjectedValue<ChannelFactory>();
private JGroupsObjectReplicator replicator;
private String clusterName;
+ private BufferManager buffermanager;
public JGroupsObjectReplicatorService(String clusterName){
this.clusterName = clusterName;
@@ -41,12 +43,18 @@
@Override
public void start(StartContext context) throws StartException {
- replicator = new JGroupsObjectReplicator(this.clusterName) {
+ this.replicator = new JGroupsObjectReplicator(this.clusterName) {
@Override
public ChannelFactory getChannelFactory() {
return channelFactoryInjector.getValue();
}
};
+
+ try {
+ this.replicator.replicate(clusterName, BufferManager.class, this.buffermanager, 0);
+ } catch (Exception e) {
+ throw new StartException(e);
+ }
}
@Override
@@ -57,5 +65,9 @@
public JGroupsObjectReplicator getValue() throws IllegalStateException,IllegalArgumentException {
return replicator;
}
+
+ public void setBufferManager(BufferManager buffermanager) {
+ this.buffermanager = buffermanager;
+ }
}
Modified: branches/as7/jboss-integration/src/main/java/org/teiid/jboss/TeiidBootServicesAdd.java
===================================================================
--- branches/as7/jboss-integration/src/main/java/org/teiid/jboss/TeiidBootServicesAdd.java 2011-09-13 18:58:53 UTC (rev 3467)
+++ branches/as7/jboss-integration/src/main/java/org/teiid/jboss/TeiidBootServicesAdd.java 2011-09-13 20:05:11 UTC (rev 3468)
@@ -153,19 +153,14 @@
newControllers.add(service);
// system function tree
- SystemFunctionManager systemFunctionManager = null;
- try {
- systemFunctionManager = new SystemFunctionManager();
- if (operation.hasDefined(Configuration.ALLOW_ENV_FUNCTION)) {
- systemFunctionManager.setAllowEnvFunction(operation.get(Configuration.ALLOW_ENV_FUNCTION).asBoolean());
- }
- else {
- systemFunctionManager.setAllowEnvFunction(false);
- }
- systemFunctionManager.setClassloader(Module.getCallerModule().getModule(ModuleIdentifier.create("org.jboss.teiid")).getClassLoader()); //$NON-NLS-1$
- } catch (ModuleLoadException e) {
- throw new OperationFailedException(e, operation);
+ SystemFunctionManager systemFunctionManager = new SystemFunctionManager();
+ if (operation.hasDefined(Configuration.ALLOW_ENV_FUNCTION)) {
+ systemFunctionManager.setAllowEnvFunction(operation.get(Configuration.ALLOW_ENV_FUNCTION).asBoolean());
}
+ else {
+ systemFunctionManager.setAllowEnvFunction(false);
+ }
+ systemFunctionManager.setClassloader(Module.getCallerModule().getClassLoader());
// VDB repository
final VDBRepository vdbRepository = new VDBRepository();
@@ -253,6 +248,7 @@
clusterName = node.get(Configuration.CLUSTER_NAME).asString();
}
JGroupsObjectReplicatorService replicatorService = new JGroupsObjectReplicatorService(clusterName);
+ replicatorService.setBufferManager(bufferManager.getBufferManager());
ServiceBuilder<JGroupsObjectReplicator> serviceBuilder = target.addService(TeiidServiceNames.OBJECT_REPLICATOR, replicatorService);
serviceBuilder.addDependency(ServiceName.JBOSS.append("jgroups", stack), ChannelFactory.class, replicatorService.channelFactoryInjector); //$NON-NLS-1$
newControllers.add(serviceBuilder.install());
@@ -263,9 +259,9 @@
context.addStep(new AbstractDeploymentChainStep() {
@Override
public void execute(DeploymentProcessorTarget processorTarget) {
- processorTarget.addDeploymentProcessor(Phase.STRUCTURE, Phase.STRUCTURE_WAR_DEPLOYMENT_INIT|0x0001,new VDBStructure());
+ processorTarget.addDeploymentProcessor(Phase.STRUCTURE, Phase.STRUCTURE_WAR_DEPLOYMENT_INIT|0x0001,new VDBStructureDeployer());
processorTarget.addDeploymentProcessor(Phase.PARSE, Phase.PARSE_WEB_DEPLOYMENT|0x0001, new VDBParserDeployer());
- processorTarget.addDeploymentProcessor(Phase.DEPENDENCIES, Phase.DEPENDENCIES_WAR_MODULE|0x0001, new VDBDependencyProcessor());
+ processorTarget.addDeploymentProcessor(Phase.DEPENDENCIES, Phase.DEPENDENCIES_WAR_MODULE|0x0001, new VDBDependencyDeployer());
processorTarget.addDeploymentProcessor(Phase.INSTALL, Phase.INSTALL_WAR_DEPLOYMENT|0x0001, new VDBDeployer(translatorRepo, asyncThreadPoolName));
}
Modified: branches/as7/jboss-integration/src/main/java/org/teiid/jboss/TeiidSubsystemParser.java
===================================================================
--- branches/as7/jboss-integration/src/main/java/org/teiid/jboss/TeiidSubsystemParser.java 2011-09-13 18:58:53 UTC (rev 3467)
+++ branches/as7/jboss-integration/src/main/java/org/teiid/jboss/TeiidSubsystemParser.java 2011-09-13 20:05:11 UTC (rev 3468)
@@ -155,7 +155,7 @@
private void writeSocketConfiguration(XMLExtendedStreamWriter writer, ModelNode node) throws XMLStreamException {
writeAttribute(writer, Element.SOCKET_BINDING_ELEMENT, node);
- writeElement(writer, Element.MAX_SOCKET_SIZE_ELEMENT, node);
+ writeElement(writer, Element.MAX_SOCKET_THREAD_SIZE_ELEMENT, node);
writeElement(writer, Element.IN_BUFFER_SIZE_ELEMENT, node);
writeElement(writer, Element.OUT_BUFFER_SIZE_ELEMENT, node);
@@ -462,7 +462,7 @@
while (reader.hasNext() && (reader.nextTag() != XMLStreamConstants.END_ELEMENT)) {
Element element = Element.forName(reader.getLocalName());
switch (element) {
- case MAX_SOCKET_SIZE_ELEMENT:
+ case MAX_SOCKET_THREAD_SIZE_ELEMENT:
case IN_BUFFER_SIZE_ELEMENT:
case OUT_BUFFER_SIZE_ELEMENT:
node.get(reader.getLocalName()).set(Integer.parseInt(reader.getElementText()));
Copied: branches/as7/jboss-integration/src/main/java/org/teiid/jboss/VDBDependencyDeployer.java (from rev 3464, branches/as7/jboss-integration/src/main/java/org/teiid/jboss/VDBDependencyProcessor.java)
===================================================================
--- branches/as7/jboss-integration/src/main/java/org/teiid/jboss/VDBDependencyDeployer.java (rev 0)
+++ branches/as7/jboss-integration/src/main/java/org/teiid/jboss/VDBDependencyDeployer.java 2011-09-13 20:05:11 UTC (rev 3468)
@@ -0,0 +1,94 @@
+/*
+ * JBoss, Home of Professional Open Source.
+ * See the COPYRIGHT.txt file distributed with this work for information
+ * regarding copyright ownership. Some portions may be licensed
+ * to Red Hat, Inc. under one or more contributor license agreements.
+ *
+ * This library is free software; you can redistribute it and/or
+ * modify it under the terms of the GNU Lesser General Public
+ * License as published by the Free Software Foundation; either
+ * version 2.1 of the License, or (at your option) any later version.
+ *
+ * This library is distributed in the hope that it will be useful,
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
+ * Lesser General Public License for more details.
+ *
+ * You should have received a copy of the GNU Lesser General Public
+ * License along with this library; if not, write to the Free Software
+ * Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA
+ * 02110-1301 USA.
+ */
+package org.teiid.jboss;
+
+import java.io.Closeable;
+import java.io.IOException;
+import java.util.List;
+
+import org.jboss.as.server.deployment.*;
+import org.jboss.as.server.deployment.module.*;
+import org.jboss.modules.Module;
+import org.jboss.modules.ModuleIdentifier;
+import org.jboss.modules.ModuleLoadException;
+import org.jboss.modules.ModuleLoader;
+import org.jboss.vfs.VFS;
+import org.jboss.vfs.VirtualFile;
+import org.jboss.vfs.VirtualFileFilter;
+import org.jboss.vfs.VisitorAttributes;
+import org.jboss.vfs.util.SuffixMatchFilter;
+import org.teiid.deployers.TeiidAttachments;
+
+class VDBDependencyDeployer implements DeploymentUnitProcessor {
+ public static final String LIB = "/lib"; //$NON-NLS-1$
+ private static final VirtualFileFilter DEFAULT_JAR_LIB_FILTER = new SuffixMatchFilter(".jar", VisitorAttributes.DEFAULT); //$NON-NLS-1$
+
+ @Override
+ public void deploy(DeploymentPhaseContext phaseContext) throws DeploymentUnitProcessingException {
+ DeploymentUnit deploymentUnit = phaseContext.getDeploymentUnit();
+ if (!TeiidAttachments.isVDBDeployment(deploymentUnit)) {
+ return;
+ }
+
+ if (!TeiidAttachments.isDynamicVDB(deploymentUnit)) {
+ final ResourceRoot deploymentResourceRoot = deploymentUnit.getAttachment(Attachments.DEPLOYMENT_ROOT);
+ final VirtualFile deploymentRoot = deploymentResourceRoot.getRoot();
+ if(deploymentRoot == null) {
+ return;
+ }
+
+ try {
+ final VirtualFile libDir = deploymentRoot.getChild(LIB);
+ if (libDir.exists()) {
+ final List<VirtualFile> archives = libDir.getChildren(DEFAULT_JAR_LIB_FILTER);
+ for (final VirtualFile archive : archives) {
+ try {
+ final Closeable closable = VFS.mountZip(archive, archive,TempFileProviderService.provider());
+ final ResourceRoot jarArchiveRoot = new ResourceRoot(archive.getName(), archive, new MountHandle(closable));
+ ModuleRootMarker.mark(jarArchiveRoot);
+ deploymentUnit.addToAttachmentList(Attachments.RESOURCE_ROOTS, jarArchiveRoot);
+ } catch (IOException e) {
+ throw new DeploymentUnitProcessingException("failed to process " + archive, e); //$NON-NLS-1$
+ }
+ }
+ }
+ } catch(IOException e) {
+ throw new DeploymentUnitProcessingException(e);
+ }
+ }
+
+ // add translators as dependent modules to this VDB.
+ try {
+ final ModuleSpecification moduleSpecification = deploymentUnit.getAttachment(Attachments.MODULE_SPECIFICATION);
+ final ModuleLoader moduleLoader = Module.getCallerModule().getModule(ModuleIdentifier.create("org.jboss.teiid")).getModuleLoader(); //$NON-NLS-1$
+ moduleSpecification.addLocalDependency(new ModuleDependency(moduleLoader, ModuleIdentifier.create("org.jboss.teiid.api"), false, false, false)); //$NON-NLS-1$
+ moduleSpecification.addLocalDependency(new ModuleDependency(moduleLoader, ModuleIdentifier.create("org.jboss.teiid.common-core"), false, false, false)); //$NON-NLS-1$
+ moduleSpecification.addLocalDependency(new ModuleDependency(moduleLoader, ModuleIdentifier.create("javax.api"), false, false, false)); //$NON-NLS-1$
+ } catch (ModuleLoadException e) {
+ throw new DeploymentUnitProcessingException(e);
+ }
+ }
+
+ @Override
+ public void undeploy(DeploymentUnit context) {
+ }
+}
Property changes on: branches/as7/jboss-integration/src/main/java/org/teiid/jboss/VDBDependencyDeployer.java
___________________________________________________________________
Added: svn:mime-type
+ text/plain
Deleted: branches/as7/jboss-integration/src/main/java/org/teiid/jboss/VDBDependencyProcessor.java
===================================================================
--- branches/as7/jboss-integration/src/main/java/org/teiid/jboss/VDBDependencyProcessor.java 2011-09-13 18:58:53 UTC (rev 3467)
+++ branches/as7/jboss-integration/src/main/java/org/teiid/jboss/VDBDependencyProcessor.java 2011-09-13 20:05:11 UTC (rev 3468)
@@ -1,94 +0,0 @@
-/*
- * JBoss, Home of Professional Open Source.
- * See the COPYRIGHT.txt file distributed with this work for information
- * regarding copyright ownership. Some portions may be licensed
- * to Red Hat, Inc. under one or more contributor license agreements.
- *
- * This library is free software; you can redistribute it and/or
- * modify it under the terms of the GNU Lesser General Public
- * License as published by the Free Software Foundation; either
- * version 2.1 of the License, or (at your option) any later version.
- *
- * This library is distributed in the hope that it will be useful,
- * but WITHOUT ANY WARRANTY; without even the implied warranty of
- * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
- * Lesser General Public License for more details.
- *
- * You should have received a copy of the GNU Lesser General Public
- * License along with this library; if not, write to the Free Software
- * Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA
- * 02110-1301 USA.
- */
-package org.teiid.jboss;
-
-import java.io.Closeable;
-import java.io.IOException;
-import java.util.List;
-
-import org.jboss.as.server.deployment.*;
-import org.jboss.as.server.deployment.module.*;
-import org.jboss.modules.Module;
-import org.jboss.modules.ModuleIdentifier;
-import org.jboss.modules.ModuleLoadException;
-import org.jboss.modules.ModuleLoader;
-import org.jboss.vfs.VFS;
-import org.jboss.vfs.VirtualFile;
-import org.jboss.vfs.VirtualFileFilter;
-import org.jboss.vfs.VisitorAttributes;
-import org.jboss.vfs.util.SuffixMatchFilter;
-import org.teiid.deployers.TeiidAttachments;
-
-class VDBDependencyProcessor implements DeploymentUnitProcessor {
- public static final String LIB = "/lib"; //$NON-NLS-1$
- private static final VirtualFileFilter DEFAULT_JAR_LIB_FILTER = new SuffixMatchFilter(".jar", VisitorAttributes.DEFAULT); //$NON-NLS-1$
-
- @Override
- public void deploy(DeploymentPhaseContext phaseContext) throws DeploymentUnitProcessingException {
- DeploymentUnit deploymentUnit = phaseContext.getDeploymentUnit();
- if (!TeiidAttachments.isVDBDeployment(deploymentUnit)) {
- return;
- }
-
- if (!TeiidAttachments.isDynamicVDB(deploymentUnit)) {
- final ResourceRoot deploymentResourceRoot = deploymentUnit.getAttachment(Attachments.DEPLOYMENT_ROOT);
- final VirtualFile deploymentRoot = deploymentResourceRoot.getRoot();
- if(deploymentRoot == null) {
- return;
- }
-
- try {
- final VirtualFile libDir = deploymentRoot.getChild(LIB);
- if (libDir.exists()) {
- final List<VirtualFile> archives = libDir.getChildren(DEFAULT_JAR_LIB_FILTER);
- for (final VirtualFile archive : archives) {
- try {
- final Closeable closable = VFS.mountZip(archive, archive,TempFileProviderService.provider());
- final ResourceRoot jarArchiveRoot = new ResourceRoot(archive.getName(), archive, new MountHandle(closable));
- ModuleRootMarker.mark(jarArchiveRoot);
- deploymentUnit.addToAttachmentList(Attachments.RESOURCE_ROOTS, jarArchiveRoot);
- } catch (IOException e) {
- throw new DeploymentUnitProcessingException("failed to process " + archive, e); //$NON-NLS-1$
- }
- }
- }
- } catch(IOException e) {
- throw new DeploymentUnitProcessingException(e);
- }
- }
-
- // add translators as dependent modules to this VDB.
- try {
- final ModuleSpecification moduleSpecification = deploymentUnit.getAttachment(Attachments.MODULE_SPECIFICATION);
- final ModuleLoader moduleLoader = Module.getCallerModule().getModule(ModuleIdentifier.create("org.jboss.teiid")).getModuleLoader(); //$NON-NLS-1$
- moduleSpecification.addLocalDependency(new ModuleDependency(moduleLoader, ModuleIdentifier.create("org.jboss.teiid.api"), false, false, false)); //$NON-NLS-1$
- moduleSpecification.addLocalDependency(new ModuleDependency(moduleLoader, ModuleIdentifier.create("org.jboss.teiid.common-core"), false, false, false)); //$NON-NLS-1$
- moduleSpecification.addLocalDependency(new ModuleDependency(moduleLoader, ModuleIdentifier.create("javax.api"), false, false, false)); //$NON-NLS-1$
- } catch (ModuleLoadException e) {
- throw new DeploymentUnitProcessingException(e);
- }
- }
-
- @Override
- public void undeploy(DeploymentUnit context) {
- }
-}
Modified: branches/as7/jboss-integration/src/main/java/org/teiid/jboss/VDBDeployer.java
===================================================================
--- branches/as7/jboss-integration/src/main/java/org/teiid/jboss/VDBDeployer.java 2011-09-13 18:58:53 UTC (rev 3467)
+++ branches/as7/jboss-integration/src/main/java/org/teiid/jboss/VDBDeployer.java 2011-09-13 20:05:11 UTC (rev 3468)
@@ -25,10 +25,9 @@
import java.util.concurrent.Executor;
import org.jboss.as.server.deployment.*;
-import org.jboss.msc.service.ServiceBuilder;
-import org.jboss.msc.service.ServiceController;
+import org.jboss.msc.service.*;
+import org.jboss.msc.service.ServiceBuilder.DependencyType;
import org.jboss.msc.service.ServiceController.Mode;
-import org.jboss.msc.service.ServiceName;
import org.jboss.vfs.VirtualFile;
import org.teiid.adminapi.Translator;
import org.teiid.adminapi.impl.ModelMetaData;
@@ -41,7 +40,9 @@
import org.teiid.logging.LogConstants;
import org.teiid.logging.LogManager;
import org.teiid.metadata.index.IndexMetadataFactory;
+import org.teiid.query.ObjectReplicator;
import org.teiid.runtime.RuntimePlugin;
+import org.teiid.services.BufferServiceImpl;
class VDBDeployer implements DeploymentUnitProcessor {
@@ -108,7 +109,7 @@
ServiceBuilder<VDBMetaData> vdbService = context.getServiceTarget().addService(TeiidServiceNames.vdbServiceName(deployment.getName(), deployment.getVersion()), vdb);
for (ModelMetaData model:deployment.getModelMetaDatas().values()) {
for (String sourceName:model.getSourceNames()) {
- vdbService.addDependency(ServiceName.JBOSS.append("data-source", model.getSourceConnectionJndiName(sourceName))); //$NON-NLS-1$
+ vdbService.addDependency(DependencyType.OPTIONAL, ServiceName.JBOSS.append("data-source", model.getSourceConnectionJndiName(sourceName))); //$NON-NLS-1$
}
}
@@ -123,6 +124,8 @@
vdbService.addDependency(TeiidServiceNames.TRANSLATOR_REPO, TranslatorRepository.class, vdb.getTranslatorRepositoryInjector());
vdbService.addDependency(TeiidServiceNames.executorServiceName(this.asyncThreadPoolName), Executor.class, vdb.getExecutorInjector());
vdbService.addDependency(TeiidServiceNames.OBJECT_SERIALIZER, ObjectSerializer.class, vdb.getSerializerInjector());
+ vdbService.addDependency(TeiidServiceNames.BUFFER_MGR, BufferServiceImpl.class, vdb.getBufferServiceInjector());
+ vdbService.addDependency(DependencyType.OPTIONAL, TeiidServiceNames.OBJECT_REPLICATOR, ObjectReplicator.class, vdb.getObjectReplicatorInjector());
vdbService.setInitialMode(Mode.PASSIVE).install();
}
@@ -136,6 +139,9 @@
VDBMetaData deployment = deploymentUnit.getAttachment(TeiidAttachments.VDB_METADATA);
final ServiceController<?> controller = deploymentUnit.getServiceRegistry().getService(TeiidServiceNames.vdbServiceName(deployment.getName(), deployment.getVersion()));
if (controller != null) {
+ VDBService vdbService = (VDBService)controller.getService();
+ vdbService.undeployinProgress();
+
controller.setMode(ServiceController.Mode.REMOVE);
}
}
Modified: branches/as7/jboss-integration/src/main/java/org/teiid/jboss/VDBService.java
===================================================================
--- branches/as7/jboss-integration/src/main/java/org/teiid/jboss/VDBService.java 2011-09-13 18:58:53 UTC (rev 3467)
+++ branches/as7/jboss-integration/src/main/java/org/teiid/jboss/VDBService.java 2011-09-13 20:05:11 UTC (rev 3468)
@@ -27,8 +27,10 @@
import java.util.*;
import java.util.concurrent.Executor;
-import org.jboss.msc.service.*;
-import org.jboss.msc.service.ServiceContainer.TerminateListener;
+import org.jboss.msc.service.Service;
+import org.jboss.msc.service.StartContext;
+import org.jboss.msc.service.StartException;
+import org.jboss.msc.service.StopContext;
import org.jboss.msc.value.InjectedValue;
import org.teiid.adminapi.Model;
import org.teiid.adminapi.Translator;
@@ -37,6 +39,7 @@
import org.teiid.adminapi.impl.SourceMappingMetadata;
import org.teiid.adminapi.impl.VDBMetaData;
import org.teiid.adminapi.impl.VDBTranslatorMetaData;
+import org.teiid.common.buffer.BufferManager;
import org.teiid.core.TeiidException;
import org.teiid.deployers.*;
import org.teiid.dqp.internal.datamgr.ConnectorManager;
@@ -46,8 +49,13 @@
import org.teiid.logging.LogManager;
import org.teiid.metadata.MetadataStore;
import org.teiid.metadata.index.IndexMetadataFactory;
+import org.teiid.query.ObjectReplicator;
+import org.teiid.query.metadata.TransformationMetadata;
import org.teiid.query.metadata.TransformationMetadata.Resource;
+import org.teiid.query.tempdata.GlobalTableStore;
+import org.teiid.query.tempdata.GlobalTableStoreImpl;
import org.teiid.runtime.RuntimePlugin;
+import org.teiid.services.BufferServiceImpl;
import org.teiid.translator.DelegatingExecutionFactory;
import org.teiid.translator.ExecutionFactory;
import org.teiid.translator.TranslatorException;
@@ -59,6 +67,9 @@
private final InjectedValue<TranslatorRepository> translatorRepositoryInjector = new InjectedValue<TranslatorRepository>();
private final InjectedValue<Executor> executorInjector = new InjectedValue<Executor>();
private final InjectedValue<ObjectSerializer> serializerInjector = new InjectedValue<ObjectSerializer>();
+ private final InjectedValue<BufferServiceImpl> bufferServiceInjector = new InjectedValue<BufferServiceImpl>();
+ private final InjectedValue<ObjectReplicator> objectReplicatorInjector = new InjectedValue<ObjectReplicator>();
+ private boolean undeployInProgress = false;
public VDBService(VDBMetaData metadata) {
this.vdb = metadata;
@@ -178,24 +189,38 @@
this.vdb.removeAttachment(MetadataStoreGroup.class);
this.vdb.removeAttachment(IndexMetadataFactory.class);
+ // add object replication to temp/matview tables
+ GlobalTableStore gts = new GlobalTableStoreImpl(getBuffermanager(), vdb.getAttachment(TransformationMetadata.class));
+ if (getObjectReplicatorInjector().getValue() != null) {
+ try {
+ gts = getObjectReplicatorInjector().getValue().replicate(vdb.getName() + vdb.getVersion(), GlobalTableStore.class, gts, 300000);
+ } catch (Exception e) {
+ LogManager.logError(LogConstants.CTX_RUNTIME, e, IntegrationPlugin.Util.getString("replication_failed", gts)); //$NON-NLS-1$
+ }
+ }
+ vdb.addAttchment(GlobalTableStore.class, gts);
+
LogManager.logInfo(LogConstants.CTX_RUNTIME, RuntimePlugin.Util.getString("vdb_deployed",vdb, valid?"active":"inactive")); //$NON-NLS-1$ //$NON-NLS-2$ //$NON-NLS-3$
}
@Override
public void stop(StopContext context) {
+ // stop object replication
+ if (getObjectReplicatorInjector().getValue() != null) {
+ GlobalTableStore gts = vdb.getAttachment(GlobalTableStore.class);
+ getObjectReplicatorInjector().getValue().stop(gts);
+ }
+
getVDBRepository().removeVDB(this.vdb.getName(), this.vdb.getVersion());
this.vdb.setRemoved(true);
- context.getController().getServiceContainer().addTerminateListener(new TerminateListener() {
- @Override
- public void handleTermination(Info info) {
- if (info.getShutdownInitiated() < 0) {
- getSerializer().removeAttachments(vdb);
- LogManager.logTrace(LogConstants.CTX_RUNTIME, "VDB "+vdb.getName()+" metadata removed"); //$NON-NLS-1$ //$NON-NLS-2$
- }
- }
- });
+ // service stopped not due to shutdown then clean-up the data files
+ if (undeployInProgress) {
+ getSerializer().removeAttachments(vdb);
+ LogManager.logTrace(LogConstants.CTX_RUNTIME, "VDB "+vdb.getName()+" metadata removed"); //$NON-NLS-1$ //$NON-NLS-2$
+ }
+
LogManager.logInfo(LogConstants.CTX_RUNTIME, RuntimePlugin.Util.getString("vdb_undeployed", this.vdb)); //$NON-NLS-1$
}
@@ -416,4 +441,20 @@
private ObjectSerializer getSerializer() {
return serializerInjector.getValue();
}
+
+ public InjectedValue<BufferServiceImpl> getBufferServiceInjector() {
+ return bufferServiceInjector;
+ }
+
+ private BufferManager getBuffermanager() {
+ return getBufferServiceInjector().getValue().getBufferManager();
+ }
+
+ public InjectedValue<ObjectReplicator> getObjectReplicatorInjector() {
+ return objectReplicatorInjector;
+ }
+
+ public void undeployinProgress() {
+ this.undeployInProgress = true;
+ }
}
Deleted: branches/as7/jboss-integration/src/main/java/org/teiid/jboss/VDBStructure.java
===================================================================
--- branches/as7/jboss-integration/src/main/java/org/teiid/jboss/VDBStructure.java 2011-09-13 18:58:53 UTC (rev 3467)
+++ branches/as7/jboss-integration/src/main/java/org/teiid/jboss/VDBStructure.java 2011-09-13 20:05:11 UTC (rev 3468)
@@ -1,67 +0,0 @@
-/*
- * JBoss, Home of Professional Open Source.
- * See the COPYRIGHT.txt file distributed with this work for information
- * regarding copyright ownership. Some portions may be licensed
- * to Red Hat, Inc. under one or more contributor license agreements.
- *
- * This library is free software; you can redistribute it and/or
- * modify it under the terms of the GNU Lesser General Public
- * License as published by the Free Software Foundation; either
- * version 2.1 of the License, or (at your option) any later version.
- *
- * This library is distributed in the hope that it will be useful,
- * but WITHOUT ANY WARRANTY; without even the implied warranty of
- * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
- * Lesser General Public License for more details.
- *
- * You should have received a copy of the GNU Lesser General Public
- * License along with this library; if not, write to the Free Software
- * Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA
- * 02110-1301 USA.
- */
-package org.teiid.jboss;
-
-import org.jboss.as.server.deployment.*;
-import org.jboss.vfs.VirtualFile;
-import org.teiid.deployers.TeiidAttachments;
-import org.teiid.metadata.VdbConstants;
-
-
-
-class VDBStructure implements DeploymentUnitProcessor {
- private static final String VDB_EXTENSION = ".vdb"; //$NON-NLS-1$
- private static final String DYNAMIC_VDB_STRUCTURE = "-vdb.xml"; //$NON-NLS-1$
-
- @Override
- public void deploy(final DeploymentPhaseContext phaseContext) throws DeploymentUnitProcessingException {
-
- DeploymentUnit deploymentUnit = phaseContext.getDeploymentUnit();
-
- VirtualFile file = deploymentUnit.getAttachment(Attachments.DEPLOYMENT_ROOT).getRoot();
- if (file == null) {
- return;
- }
-
- if(file.getName().toLowerCase().endsWith(VDB_EXTENSION)) {
- VirtualFile metainf = file.getChild("META-INF"); //$NON-NLS-1$
- if (metainf == null) {
- return;
- }
-
- if (metainf.getChild(VdbConstants.DEPLOYMENT_FILE) == null) {
- return;
- }
- // adds a TYPE attachment.
- TeiidAttachments.setAsVDBDeployment(deploymentUnit);
- }
- else if (file.getName().toLowerCase().endsWith(DYNAMIC_VDB_STRUCTURE)) {
- TeiidAttachments.setAsDynamicVDBDeployment(deploymentUnit);
- }
- }
-
-
- @Override
- public void undeploy(final DeploymentUnit context) {
- }
-
-}
Copied: branches/as7/jboss-integration/src/main/java/org/teiid/jboss/VDBStructureDeployer.java (from rev 3464, branches/as7/jboss-integration/src/main/java/org/teiid/jboss/VDBStructure.java)
===================================================================
--- branches/as7/jboss-integration/src/main/java/org/teiid/jboss/VDBStructureDeployer.java (rev 0)
+++ branches/as7/jboss-integration/src/main/java/org/teiid/jboss/VDBStructureDeployer.java 2011-09-13 20:05:11 UTC (rev 3468)
@@ -0,0 +1,67 @@
+/*
+ * JBoss, Home of Professional Open Source.
+ * See the COPYRIGHT.txt file distributed with this work for information
+ * regarding copyright ownership. Some portions may be licensed
+ * to Red Hat, Inc. under one or more contributor license agreements.
+ *
+ * This library is free software; you can redistribute it and/or
+ * modify it under the terms of the GNU Lesser General Public
+ * License as published by the Free Software Foundation; either
+ * version 2.1 of the License, or (at your option) any later version.
+ *
+ * This library is distributed in the hope that it will be useful,
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
+ * Lesser General Public License for more details.
+ *
+ * You should have received a copy of the GNU Lesser General Public
+ * License along with this library; if not, write to the Free Software
+ * Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA
+ * 02110-1301 USA.
+ */
+package org.teiid.jboss;
+
+import org.jboss.as.server.deployment.*;
+import org.jboss.vfs.VirtualFile;
+import org.teiid.deployers.TeiidAttachments;
+import org.teiid.metadata.VdbConstants;
+
+
+
+class VDBStructureDeployer implements DeploymentUnitProcessor {
+ private static final String VDB_EXTENSION = ".vdb"; //$NON-NLS-1$
+ private static final String DYNAMIC_VDB_STRUCTURE = "-vdb.xml"; //$NON-NLS-1$
+
+ @Override
+ public void deploy(final DeploymentPhaseContext phaseContext) throws DeploymentUnitProcessingException {
+
+ DeploymentUnit deploymentUnit = phaseContext.getDeploymentUnit();
+
+ VirtualFile file = deploymentUnit.getAttachment(Attachments.DEPLOYMENT_ROOT).getRoot();
+ if (file == null) {
+ return;
+ }
+
+ if(file.getName().toLowerCase().endsWith(VDB_EXTENSION)) {
+ VirtualFile metainf = file.getChild("META-INF"); //$NON-NLS-1$
+ if (metainf == null) {
+ return;
+ }
+
+ if (metainf.getChild(VdbConstants.DEPLOYMENT_FILE) == null) {
+ return;
+ }
+ // adds a TYPE attachment.
+ TeiidAttachments.setAsVDBDeployment(deploymentUnit);
+ }
+ else if (file.getName().toLowerCase().endsWith(DYNAMIC_VDB_STRUCTURE)) {
+ TeiidAttachments.setAsDynamicVDBDeployment(deploymentUnit);
+ }
+ }
+
+
+ @Override
+ public void undeploy(final DeploymentUnit context) {
+ }
+
+}
Property changes on: branches/as7/jboss-integration/src/main/java/org/teiid/jboss/VDBStructureDeployer.java
___________________________________________________________________
Added: svn:mime-type
+ text/plain
Modified: branches/as7/jboss-integration/src/main/java/org/teiid/jboss/deployers/RuntimeEngineDeployer.java
===================================================================
--- branches/as7/jboss-integration/src/main/java/org/teiid/jboss/deployers/RuntimeEngineDeployer.java 2011-09-13 18:58:53 UTC (rev 3467)
+++ branches/as7/jboss-integration/src/main/java/org/teiid/jboss/deployers/RuntimeEngineDeployer.java 2011-09-13 20:05:11 UTC (rev 3468)
@@ -86,7 +86,6 @@
import org.teiid.query.optimizer.relational.RelationalPlanner;
import org.teiid.query.processor.DdlPlan;
import org.teiid.query.tempdata.GlobalTableStore;
-import org.teiid.query.tempdata.GlobalTableStoreImpl;
import org.teiid.security.SecurityHelper;
import org.teiid.services.BufferServiceImpl;
import org.teiid.services.SessionServiceImpl;
@@ -242,23 +241,10 @@
@Override
public void removed(String name, int version, CompositeVDB vdb) {
recentlyRemoved.add(new VDBKey(name, version));
- if (getObjectReplicatorInjector().getValue() != null) {
- GlobalTableStore gts = vdb.getVDB().getAttachment(GlobalTableStore.class);
- getObjectReplicatorInjector().getValue().stop(gts);
- }
}
@Override
public void added(String name, int version, CompositeVDB vdb) {
- GlobalTableStore gts = new GlobalTableStoreImpl(dqpCore.getBufferManager(), vdb.getVDB().getAttachment(TransformationMetadata.class));
- if (getObjectReplicatorInjector().getValue() != null) {
- try {
- gts = getObjectReplicatorInjector().getValue().replicate(name + version, GlobalTableStore.class, gts, 300000);
- } catch (Exception e) {
- LogManager.logError(LogConstants.CTX_RUNTIME, e, IntegrationPlugin.Util.getString("replication_failed", gts)); //$NON-NLS-1$
- }
- }
- vdb.getVDB().addAttchment(GlobalTableStore.class, gts);
if (!recentlyRemoved.remove(new VDBKey(name, version))) {
return;
}
Modified: branches/as7/jboss-integration/src/main/resources/schema/jboss-teiid.xsd
===================================================================
--- branches/as7/jboss-integration/src/main/resources/schema/jboss-teiid.xsd 2011-09-13 18:58:53 UTC (rev 3467)
+++ branches/as7/jboss-integration/src/main/resources/schema/jboss-teiid.xsd 2011-09-13 20:05:11 UTC (rev 3468)
@@ -61,35 +61,37 @@
</xs:annotation>
</xs:element>
- <xs:element name="resultset-cache" type="xs:string" maxOccurs="1" minOccurs="0">
+ <xs:element name="resultset-cache" maxOccurs="1" minOccurs="0">
<xs:annotation>
- <xs:documentation>Configuration for result set caching.
- There will be 2 caches with these settings.
- One cache holds results that are specific to sessions.
- The other cache holds vdb scoped results and can
- be replicated.</xs:documentation>
+ <xs:documentation>Configuration for result set caching.</xs:documentation>
</xs:annotation>
- <xs:attribute name="container-name" type="xs:string" use="required"/>
- <xs:attribute name="name" type="xs:string" use="required"/>
- <xs:attribute name="enable" type="xs:boolean" default="true"/>
- <xs:attribute name="max-staleness" type="xs:int" default="60"/>
+ <xs:complexType>
+ <xs:attribute name="name" type="xs:string" use="required"/>
+ <xs:attribute name="container-name" type="xs:string" use="required"/>
+ <xs:attribute name="enable" type="xs:boolean" default="true"/>
+ <xs:attribute name="max-staleness" type="xs:int" default="60"/>
+ </xs:complexType>
</xs:element>
- <xs:element name="preparedplan-cache" type="xs:string" maxOccurs="1" minOccurs="0">
+ <xs:element name="preparedplan-cache" maxOccurs="1" minOccurs="0">
<xs:annotation>
<xs:documentation>Configuration for prepared plan caching. (local memory only)</xs:documentation>
</xs:annotation>
- <xs:attribute name="max-entries" type="xs:string"/>
- <xs:attribute name="max-age-in-seconds" type="xs:boolean" default="true"/>
- <xs:attribute name="max-staleness" type="xs:int" default="0"/>
+ <xs:complexType>
+ <xs:attribute name="max-entries" type="xs:int" default="512"/>
+ <xs:attribute name="max-age-in-seconds" type="xs:int" default="28800"/>
+ <xs:attribute name="max-staleness" type="xs:int" default="0"/>
+ </xs:complexType>
</xs:element>
- <xs:element name="object-replicator" type="xs:string" maxOccurs="1" minOccurs="0">
+ <xs:element name="object-replicator" maxOccurs="1" minOccurs="0">
<xs:annotation>
<xs:documentation>Cluster wide results distributor </xs:documentation>
</xs:annotation>
- <xs:attribute name="stack" type="xs:string" use="required"/>
- <xs:attribute name="cluster-name" type="xs:string" use="required"/>
+ <xs:complexType>
+ <xs:attribute name="stack" type="xs:string" use="required"/>
+ <xs:attribute name="cluster-name" type="xs:string" use="required"/>
+ </xs:complexType>
</xs:element>
<xs:element name="query-engine" type="runtime-engine-type" maxOccurs="2" minOccurs="1">
Modified: branches/as7/jboss-integration/src/test/java/org/teiid/jboss/TestTeiidConfiguration.java
===================================================================
--- branches/as7/jboss-integration/src/test/java/org/teiid/jboss/TestTeiidConfiguration.java 2011-09-13 18:58:53 UTC (rev 3467)
+++ branches/as7/jboss-integration/src/test/java/org/teiid/jboss/TestTeiidConfiguration.java 2011-09-13 20:05:11 UTC (rev 3468)
@@ -31,7 +31,6 @@
import java.util.concurrent.CountDownLatch;
import java.util.concurrent.TimeUnit;
-import javax.xml.namespace.NamespaceContext;
import javax.xml.namespace.QName;
import javax.xml.stream.*;
import javax.xml.transform.Source;
@@ -49,21 +48,25 @@
import org.jboss.as.controller.operations.global.GlobalOperationHandlers;
import org.jboss.as.controller.persistence.ConfigurationPersistenceException;
import org.jboss.as.controller.persistence.ConfigurationPersister;
-import org.jboss.as.controller.persistence.ModelMarshallingContext;
import org.jboss.as.controller.persistence.SubsystemMarshallingContext;
import org.jboss.as.controller.registry.ManagementResourceRegistration;
import org.jboss.as.controller.registry.Resource;
import org.jboss.dmr.ModelNode;
import org.jboss.dmr.ModelType;
import org.jboss.dmr.Property;
+import org.jboss.modules.Module;
+import org.jboss.modules.ModuleClassLoader;
+import org.jboss.modules.ModuleIdentifier;
+import org.jboss.modules.ModuleLoader;
import org.jboss.msc.service.*;
import org.jboss.staxmapper.XMLElementWriter;
-import org.jboss.staxmapper.XMLExtendedStreamWriter;
import org.jboss.staxmapper.XMLMapper;
import org.junit.After;
import org.junit.Before;
import org.junit.Test;
import org.mockito.Mockito;
+import org.mockito.MockitoAnnotations.Mock;
+import org.mockito.internal.stubbing.Stubber;
import org.teiid.core.util.ObjectConverterUtil;
import org.xml.sax.ErrorHandler;
import org.xml.sax.SAXException;
@@ -191,7 +194,7 @@
}
}
- static List<ModelNode> createSubSystem(String xmlContent) throws XMLStreamException {
+ static List<ModelNode> createSubSystem(String xmlContent) throws Exception {
final Reader reader = new StringReader(xmlContent);
XMLStreamReader xmlReader = XMLInputFactory.newInstance().createXMLStreamReader(reader);
@@ -211,7 +214,6 @@
}
update.get(OP_ADDR).set(subsystemAddress);
}
-
return updates;
}
Modified: branches/as7/jboss-integration/src/test/resources/teiid-model-config.txt
===================================================================
--- branches/as7/jboss-integration/src/test/resources/teiid-model-config.txt 2011-09-13 18:58:53 UTC (rev 3467)
+++ branches/as7/jboss-integration/src/test/resources/teiid-model-config.txt 2011-09-13 20:05:11 UTC (rev 3468)
@@ -1,11 +1,5 @@
{
"attributes" => {
- "name" => {
- "type" => STRING,
- "description" => "Name of the subsystem",
- "required" => true,
- "max-occurs" => 1
- },
"max-threads" => {
"type" => INT,
"description" => "Process pool maximum thread count. (default 64)",
@@ -76,13 +70,6 @@
"max-occurs" => 1,
"default" => 5242880
},
- "event-distributor-name" => {
- "type" => STRING,
- "description" => "The JNDI name of the Teiid Event Distributor",
- "required" => false,
- "max-occurs" => 1,
- "default" => "teiid/event-distributor"
- },
"detect-change-events" => {
"type" => BOOLEAN,
"description" => "Set to true for the engine to detect local change events. Should be disabled if using external change data capture tools. (default true)",
@@ -92,7 +79,7 @@
},
"security-domain" => {
"type" => LIST,
- "description" => "Comma separated list of domains to be used to login into Teiid",
+ "description" => "List of domains to be used to login into Teiid",
"required" => false,
"max-occurs" => 1
},
@@ -119,28 +106,21 @@
"max-occurs" => 1,
"min-occurs" => 1,
"attributes" => {
- "enabled" => {
- "type" => BOOLEAN,
- "description" => "enabled",
- "required" => false,
- "max-occurs" => 1,
- "default" => true
- },
- "maxSocketThreads" => {
+ "max-socket-threads" => {
"type" => INT,
"description" => "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.",
"required" => false,
"max-occurs" => 1,
"default" => 0
},
- "inputBufferSize" => {
+ "input-buffer-size" => {
"type" => INT,
"description" => "SO_RCVBUF size, 0 indicates that system default should be used (default 0)",
"required" => false,
"max-occurs" => 1,
"default" => 0
},
- "outputBufferSize" => {
+ "output-buffer-size" => {
"type" => INT,
"description" => "SO_SNDBUF size, 0 indicates that system default should be used (default 0)",
"required" => false,
@@ -148,7 +128,7 @@
"default" => 0
},
"socket-binding" => {
- "type" => INT,
+ "type" => STRING,
"description" => "Socket binding for the profile",
"required" => true,
"max-occurs" => 1
@@ -160,52 +140,52 @@
"max-occurs" => 1,
"default" => "login"
},
- "keystoreFilename" => {
+ "keystore-name" => {
"type" => STRING,
"description" => "Keystore File Name",
"required" => false,
"max-occurs" => 1
},
- "keystorePassword" => {
+ "keystore-password" => {
"type" => STRING,
"description" => "Keystore password",
"required" => false,
"max-occurs" => 1
},
- "keystoreType" => {
+ "keystore-type" => {
"type" => STRING,
"description" => "Keystore type",
"required" => false,
"max-occurs" => 1,
"default" => "JKS"
},
- "sslProtocol" => {
+ "ssl-protocol" => {
"type" => BOOLEAN,
"description" => "SSL protocol used",
"required" => false,
"max-occurs" => 1,
"default" => false
},
- "keymanagementAlgorithm" => {
+ "keymanagement-algorithm" => {
"type" => STRING,
"description" => "Use key management algorithm",
"required" => false,
"max-occurs" => 1,
"default" => "false"
},
- "truststoreFilename" => {
+ "truststore-name" => {
"type" => STRING,
"description" => "Truststore Name",
"required" => false,
"max-occurs" => 1
},
- "truststorePassword" => {
+ "truststore-password" => {
"type" => STRING,
"description" => "Truststore Password",
"required" => false,
"max-occurs" => 1
},
- "authenticationMode" => {
+ "authentication-mode" => {
"type" => STRING,
"description" => "Authentication Mode (1-way, 2-way, anonymous)",
"required" => false,
@@ -228,28 +208,21 @@
"max-occurs" => 1,
"min-occurs" => 1,
"attributes" => {
- "enabled" => {
- "type" => BOOLEAN,
- "description" => "enabled",
- "required" => false,
- "max-occurs" => 1,
- "default" => true
- },
- "maxSocketThreads" => {
+ "max-socket-threads" => {
"type" => INT,
"description" => "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.",
"required" => false,
"max-occurs" => 1,
"default" => 0
},
- "inputBufferSize" => {
+ "input-buffer-size" => {
"type" => INT,
"description" => "SO_RCVBUF size, 0 indicates that system default should be used (default 0)",
"required" => false,
"max-occurs" => 1,
"default" => 0
},
- "outputBufferSize" => {
+ "output-buffer-size" => {
"type" => INT,
"description" => "SO_SNDBUF size, 0 indicates that system default should be used (default 0)",
"required" => false,
@@ -257,7 +230,7 @@
"default" => 0
},
"socket-binding" => {
- "type" => INT,
+ "type" => STRING,
"description" => "Socket binding for the profile",
"required" => true,
"max-occurs" => 1
@@ -269,52 +242,52 @@
"max-occurs" => 1,
"default" => "login"
},
- "keystoreFilename" => {
+ "keystore-name" => {
"type" => STRING,
"description" => "Keystore File Name",
"required" => false,
"max-occurs" => 1
},
- "keystorePassword" => {
+ "keystore-password" => {
"type" => STRING,
"description" => "Keystore password",
"required" => false,
"max-occurs" => 1
},
- "keystoreType" => {
+ "keystore-type" => {
"type" => STRING,
"description" => "Keystore type",
"required" => false,
"max-occurs" => 1,
"default" => "JKS"
},
- "sslProtocol" => {
+ "ssl-protocol" => {
"type" => BOOLEAN,
"description" => "SSL protocol used",
"required" => false,
"max-occurs" => 1,
"default" => false
},
- "keymanagementAlgorithm" => {
+ "keymanagement-algorithm" => {
"type" => STRING,
"description" => "Use key management algorithm",
"required" => false,
"max-occurs" => 1,
"default" => "false"
},
- "truststoreFilename" => {
+ "truststore-name" => {
"type" => STRING,
"description" => "Truststore Name",
"required" => false,
"max-occurs" => 1
},
- "truststorePassword" => {
+ "truststore-password" => {
"type" => STRING,
"description" => "Truststore Password",
"required" => false,
"max-occurs" => 1
},
- "authenticationMode" => {
+ "authentication-mode" => {
"type" => STRING,
"description" => "Authentication Mode (1-way, 2-way, anonymous)",
"required" => false,
Modified: branches/as7/jboss-integration/src/test/resources/teiid-sample-config.xml
===================================================================
--- branches/as7/jboss-integration/src/test/resources/teiid-sample-config.xml 2011-09-13 18:58:53 UTC (rev 3467)
+++ branches/as7/jboss-integration/src/test/resources/teiid-sample-config.xml 2011-09-13 20:05:11 UTC (rev 3468)
@@ -16,25 +16,13 @@
<authorization-validator-module>javax.api</authorization-validator-module>
<policy-decider-module>javax.api</policy-decider-module>
-->
- <distributed-cache-factory>
- <cache-service-jndi-name>java:TeiidCacheManager</cache-service-jndi-name>
- <resultsetCacheName>teiid-resultset-cache</resultsetCacheName>
- </distributed-cache-factory>
- <resultset-cache>
- <maxEntries>1024</maxEntries>
- <maxAgeInSeconds>7200</maxAgeInSeconds>
- <maxStaleness>60</maxStaleness>
- <type>EXPIRATION</type>
- <location>resultset</location>
- </resultset-cache>
+ <resultset-cache name="cache" container-name="container" enable="false" max-staleness="90"/>
- <preparedplan-cache>
- <maxEntries>512</maxEntries>
- <maxAgeInSeconds>28800</maxAgeInSeconds>
- <maxStaleness>0</maxStaleness>
- </preparedplan-cache>
-
+ <preparedplan-cache max-entries="512" max-age-in-seconds="28800" max-staleness="90"/>
+
+ <object-replicator stack="stack" cluster-name="cluster"/>
+
<query-engine name="default">
<max-threads>64</max-threads>
<max-active-plans>20</max-active-plans>
@@ -46,25 +34,22 @@
<max-source-rows-allowed>-1</max-source-rows-allowed>
<exception-on-max-source-rows>true</exception-on-max-source-rows>
<max-odbc-lob-size-allowed>5242880</max-odbc-lob-size-allowed>
- <event-distributor-name>teiid/event-distributor</event-distributor-name>
<detect-change-events>true</detect-change-events>
<security-domain>teiid-security</security-domain>
<security-domain>teiid-security2</security-domain>
<max-sessions-allowed>5000</max-sessions-allowed>
<sessions-expiration-timelimit>0</sessions-expiration-timelimit>
- <jdbc>
- <maxSocketThreads>0</maxSocketThreads>
- <inputBufferSize>0</inputBufferSize>
- <outputBufferSize>0</outputBufferSize>
- <socket-binding>teiid-jdbc</socket-binding>
+ <jdbc socket-binding="teiid-jdbc">
+ <max-socket-threads>0</max-socket-threads>
+ <input-buffer-size>0</input-buffer-size>
+ <output-buffer-size>0</output-buffer-size>
</jdbc>
- <odbc>
- <maxSocketThreads>0</maxSocketThreads>
- <inputBufferSize>0</inputBufferSize>
- <outputBufferSize>0</outputBufferSize>
- <socket-binding>teiid-odbc</socket-binding>
+ <odbc socket-binding="teiid-odbc">
+ <max-socket-threads>0</max-socket-threads>
+ <input-buffer-size>0</input-buffer-size>
+ <output-buffer-size>0</output-buffer-size>
</odbc>
</query-engine>
Modified: branches/as7/runtime/src/test/java/org/teiid/dqp/service/buffer/TestLocalBufferService.java
===================================================================
--- branches/as7/runtime/src/test/java/org/teiid/dqp/service/buffer/TestLocalBufferService.java 2011-09-13 18:58:53 UTC (rev 3467)
+++ branches/as7/runtime/src/test/java/org/teiid/dqp/service/buffer/TestLocalBufferService.java 2011-09-13 20:05:11 UTC (rev 3468)
@@ -24,16 +24,24 @@
import static org.junit.Assert.*;
+import java.io.FileInputStream;
+import java.io.FileOutputStream;
import java.util.ArrayList;
+import java.util.Arrays;
import java.util.List;
import org.junit.Test;
import org.teiid.common.buffer.BufferManager;
+import org.teiid.common.buffer.TupleBatch;
+import org.teiid.common.buffer.TupleBuffer;
+import org.teiid.common.buffer.BufferManager.TupleSourceType;
import org.teiid.common.buffer.impl.BufferManagerImpl;
import org.teiid.common.buffer.impl.FileStorageManager;
import org.teiid.core.types.DataTypeManager;
+import org.teiid.core.types.DataTypeManager.DefaultDataTypes;
import org.teiid.core.util.UnitTestUtil;
import org.teiid.query.sql.symbol.Constant;
+import org.teiid.query.sql.symbol.ElementSymbol;
import org.teiid.query.sql.symbol.Expression;
import org.teiid.services.BufferServiceImpl;
@@ -94,4 +102,58 @@
assertEquals(13141, mgr.getSchemaSize(schema));
}
+ @Test
+ public void testStateTransfer() throws Exception {
+ BufferServiceImpl svc = new BufferServiceImpl();
+ svc.setDiskDirectory(UnitTestUtil.getTestScratchPath()+"/teiid/1");
+ svc.setUseDisk(true);
+ svc.start();
+
+ BufferManager mgr = svc.getBufferManager();
+ List<ElementSymbol> schema = new ArrayList<ElementSymbol>(2);
+ ElementSymbol es = new ElementSymbol("x"); //$NON-NLS-1$
+ es.setType(DataTypeManager.getDataTypeClass(DefaultDataTypes.STRING));
+ schema.add(es);
+
+ ElementSymbol es2 = new ElementSymbol("y"); //$NON-NLS-1$
+ es2.setType(DataTypeManager.getDataTypeClass(DefaultDataTypes.INTEGER));
+ schema.add(es2);
+
+ for (int i = 0; i < 5; i++) {
+ TupleBuffer buffer = mgr.createTupleBuffer(schema, "cached", TupleSourceType.FINAL); //$NON-NLS-1$
+ buffer.setBatchSize(50);
+ buffer.setId("state_id"+i);
+
+ for(int batch = 0; batch < 3; batch++) {
+ for (int row = 0; row < 50; row++) {
+ buffer.addTuple(Arrays.asList(new Object[] {"String"+row, new Integer(row)}));
+ }
+ }
+ mgr.distributeTupleBuffer(buffer.getId(), buffer);
+ }
+
+ ((BufferManagerImpl)mgr).getState(new FileOutputStream(UnitTestUtil.getTestScratchPath()+"/teiid/statetest"));
+
+ // now read back
+ BufferServiceImpl svc2 = new BufferServiceImpl();
+ svc2.setDiskDirectory(UnitTestUtil.getTestScratchPath()+"/teiid/1");
+ svc2.setUseDisk(true);
+ svc2.start();
+
+ BufferManager mgr2 = svc2.getBufferManager();
+ ((BufferManagerImpl)mgr2).setState(new FileInputStream(UnitTestUtil.getTestScratchPath()+"/teiid/statetest"));
+
+ for (int i = 0; i < 5; i++) {
+ String id = "state_id"+i;
+ TupleBuffer buffer = mgr.getTupleBuffer(id);
+
+ TupleBatch tb = buffer.getBatch(50);
+ List[] rows = tb.getAllTuples();
+ for (int row = 0; row < 50; row++) {
+ assertEquals("String"+row, rows[row].get(0));
+ assertEquals(row, rows[row].get(1));
+ }
+ }
+ }
+
}
12 years, 8 months
teiid SVN: r3467 - in branches/7.1.x/engine/src: test/java/org/teiid/query/processor and 1 other directory.
by teiid-commits@lists.jboss.org
Author: loleary
Date: 2011-09-13 14:58:53 -0400 (Tue, 13 Sep 2011)
New Revision: 3467
Modified:
branches/7.1.x/engine/src/main/java/org/teiid/query/optimizer/relational/rules/RulePlanJoins.java
branches/7.1.x/engine/src/test/java/org/teiid/query/processor/TestTextTable.java
Log:
TEIID-1706 fix to join planning with nested tables
Modified: branches/7.1.x/engine/src/main/java/org/teiid/query/optimizer/relational/rules/RulePlanJoins.java
===================================================================
--- branches/7.1.x/engine/src/main/java/org/teiid/query/optimizer/relational/rules/RulePlanJoins.java 2011-09-12 21:36:03 UTC (rev 3466)
+++ branches/7.1.x/engine/src/main/java/org/teiid/query/optimizer/relational/rules/RulePlanJoins.java 2011-09-13 18:58:53 UTC (rev 3467)
@@ -470,7 +470,8 @@
}
JoinType jt = (JoinType)root.getProperty(NodeConstants.Info.JOIN_TYPE);
- boolean treatJoinAsSource = jt.isOuter() || root.getProperty(NodeConstants.Info.ACCESS_PATTERNS) != null || root.hasProperty(NodeConstants.Info.MAKE_DEP);
+ boolean treatJoinAsSource = jt.isOuter() || root.getProperty(NodeConstants.Info.ACCESS_PATTERNS) != null
+ || root.hasProperty(NodeConstants.Info.MAKE_DEP) || !root.getExportedCorrelatedReferences().isEmpty();
if (treatJoinAsSource) {
currentRegion.addJoinSourceNode(root);
Modified: branches/7.1.x/engine/src/test/java/org/teiid/query/processor/TestTextTable.java
===================================================================
--- branches/7.1.x/engine/src/test/java/org/teiid/query/processor/TestTextTable.java 2011-09-12 21:36:03 UTC (rev 3466)
+++ branches/7.1.x/engine/src/test/java/org/teiid/query/processor/TestTextTable.java 2011-09-13 18:58:53 UTC (rev 3467)
@@ -22,6 +22,8 @@
package org.teiid.query.processor;
+import static org.junit.Assert.*;
+import static org.teiid.query.optimizer.TestOptimizer.*;
import static org.teiid.query.processor.TestProcessor.*;
import java.util.Arrays;
@@ -34,7 +36,13 @@
import org.teiid.core.types.InputStreamFactory;
import org.teiid.core.util.UnitTestUtil;
import org.teiid.query.optimizer.capabilities.DefaultCapabilitiesFinder;
+import org.teiid.query.optimizer.capabilities.FakeCapabilitiesFinder;
+import org.teiid.query.optimizer.capabilities.SourceCapabilities.Capability;
+import org.teiid.query.processor.relational.JoinNode;
+import org.teiid.query.processor.relational.NestedTableJoinStrategy;
+import org.teiid.query.processor.relational.RelationalPlan;
import org.teiid.query.unittest.FakeMetadataFactory;
+import org.teiid.query.unittest.RealMetadataFactory;
@SuppressWarnings({"unchecked", "nls"})
public class TestTextTable {
@@ -208,8 +216,27 @@
};
process(sql, expected);
- }
+ }
+ @Test public void testTextTableJoin() throws Exception {
+ String sql = "select z.* from (select x.* from (select * from pm1.g1 where e1 = 'c') y, texttable(e1 || '\n' || e2 || '\n' || e3 COLUMNS x string) x) as z, " +
+ "(select x.* from (select * from pm1.g1 where e1 = 'c') y, texttable(e1 || '\n' || e2 || '\n' || e3 COLUMNS x string) x) as z1 where z.x = z1.x order by z.x";
+
+ List[] expected = new List[] {
+ Arrays.asList("1"),
+ Arrays.asList("c"),
+ Arrays.asList("true"),
+ };
+
+ FakeDataManager dataManager = new FakeDataManager();
+ sampleData1(dataManager);
+ RelationalPlan plan = (RelationalPlan)helpGetPlan(helpParse(sql), FakeMetadataFactory.example1Cached());
+ // The root node's child is a sortNode so we want the sortNode's first child
+ JoinNode join = (JoinNode) plan.getRootNode().getChildren()[0].getChildren()[0];
+ assertTrue(!(join.getJoinStrategy() instanceof NestedTableJoinStrategy));
+ helpProcess(plan, createCommandContext(), dataManager, expected);
+ }
+
public static void process(String sql, List[] expectedResults) throws Exception {
FakeDataManager dataManager = new FakeDataManager();
sampleData1(dataManager);
12 years, 8 months
teiid SVN: r3466 - branches/7.4.x.
by teiid-commits@lists.jboss.org
Author: van.halbert
Date: 2011-09-12 17:36:03 -0400 (Mon, 12 Sep 2011)
New Revision: 3466
Modified:
branches/7.4.x/pom.xml
Log:
TEIID-1752 - adjusted the pom.xml to exclude packages that are not exposed for external usage.
Modified: branches/7.4.x/pom.xml
===================================================================
--- branches/7.4.x/pom.xml 2011-09-12 18:23:57 UTC (rev 3465)
+++ branches/7.4.x/pom.xml 2011-09-12 21:36:03 UTC (rev 3466)
@@ -76,6 +76,26 @@
<module>documentation</module>
<module>build</module>
</modules>
+ <build>
+ <plugins>
+ <plugin>
+ <groupId>org.apache.maven.plugins</groupId>
+ <artifactId>maven-javadoc-plugin</artifactId>
+ <version>2.8</version>
+ <configuration>
+ <maxmemory>512m</maxmemory>
+ <excludePackageNames>*.internal,com.*,net.*,org.teiid.cache,org.teiid.common.*,org.teiid.core,org.teiid.deployers,org.teiid.dqp.*,org.teiid.jboss,org.teiid.netty.*,org.teiid.odbc,org.teiid.query,org.teiid.resource.*,org.teiid.rhq.*,org.teiid.runtime,org.teiid.security,org.teiid.services,org.teiid.templates,org.teiid.test.*,org.teiid.transport,org.teiid.vdb.*</excludePackageNames>
+ </configuration>
+ <executions>
+ <execution>
+ <goals>
+ <goal>aggregate-jar</goal>
+ </goals>
+ </execution>
+ </executions>
+ </plugin>
+ </plugins>
+ </build>
</profile>
<profile>
<!--
@@ -178,26 +198,8 @@
</execution>
</executions>
</plugin>
- <plugin>
- <groupId>org.apache.maven.plugins</groupId>
- <artifactId>maven-javadoc-plugin</artifactId>
- <version>2.5</version>
- </plugin>
</plugins>
</build>
- <reporting>
- <plugins>
- <plugin>
- <groupId>org.apache.maven.plugins</groupId>
- <artifactId>maven-javadoc-plugin</artifactId>
- <configuration>
- <aggregate>true</aggregate>
- <maxmemory>512m</maxmemory>
- <excludePackageNames>*.internal</excludePackageNames>
- </configuration>
- </plugin>
- </plugins>
- </reporting>
<repositories>
<repository>
<id>jboss-public-repository</id>
12 years, 8 months
teiid SVN: r3465 - in trunk: engine/src/main/java/org/teiid/common/buffer and 14 other directories.
by teiid-commits@lists.jboss.org
Author: shawkins
Date: 2011-09-12 14:23:57 -0400 (Mon, 12 Sep 2011)
New Revision: 3465
Added:
trunk/engine/src/main/java/org/teiid/common/buffer/impl/SplittableStorageManager.java
trunk/engine/src/test/java/org/teiid/common/buffer/impl/TestSplittableStorageManager.java
Modified:
trunk/api/src/main/java/org/teiid/CommandContext.java
trunk/engine/src/main/java/org/teiid/common/buffer/BufferManager.java
trunk/engine/src/main/java/org/teiid/common/buffer/FileStore.java
trunk/engine/src/main/java/org/teiid/common/buffer/SPage.java
trunk/engine/src/main/java/org/teiid/common/buffer/STree.java
trunk/engine/src/main/java/org/teiid/common/buffer/impl/BufferManagerImpl.java
trunk/engine/src/main/java/org/teiid/common/buffer/impl/FileStorageManager.java
trunk/engine/src/main/java/org/teiid/common/buffer/impl/SizeUtility.java
trunk/engine/src/main/java/org/teiid/dqp/internal/process/Request.java
trunk/engine/src/main/java/org/teiid/query/processor/proc/ProcedurePlan.java
trunk/engine/src/main/java/org/teiid/query/processor/relational/NullNode.java
trunk/engine/src/main/java/org/teiid/query/processor/relational/RelationalNode.java
trunk/engine/src/main/java/org/teiid/query/processor/relational/SortUtility.java
trunk/engine/src/main/java/org/teiid/query/processor/xml/RelationalPlanExecutor.java
trunk/engine/src/main/java/org/teiid/query/tempdata/TempTableDataManager.java
trunk/engine/src/main/java/org/teiid/query/util/CommandContext.java
trunk/engine/src/test/java/org/teiid/common/buffer/TestSTree.java
trunk/engine/src/test/java/org/teiid/common/buffer/impl/TestFileStorageManager.java
trunk/engine/src/test/java/org/teiid/dqp/internal/process/TestDQPCore.java
trunk/engine/src/test/java/org/teiid/query/processor/TestProcessor.java
trunk/engine/src/test/java/org/teiid/query/processor/relational/TestJoinNode.java
trunk/engine/src/test/java/org/teiid/query/processor/relational/TestProjectIntoNode.java
trunk/runtime/src/main/java/org/teiid/services/BufferServiceImpl.java
trunk/runtime/src/test/java/org/teiid/dqp/service/buffer/TestLocalBufferService.java
Log:
TEIID-1750 improvement to batch sizing
Modified: trunk/api/src/main/java/org/teiid/CommandContext.java
===================================================================
--- trunk/api/src/main/java/org/teiid/CommandContext.java 2011-09-12 14:56:06 UTC (rev 3464)
+++ trunk/api/src/main/java/org/teiid/CommandContext.java 2011-09-12 18:23:57 UTC (rev 3465)
@@ -87,7 +87,8 @@
/**
* Get the processor batch size set on the BufferManager
- * @return
+ * @return - the nominal batch size target. actual batch sizes will vary based
+ * upon the column types
*/
int getProcessorBatchSize();
Modified: trunk/engine/src/main/java/org/teiid/common/buffer/BufferManager.java
===================================================================
--- trunk/engine/src/main/java/org/teiid/common/buffer/BufferManager.java 2011-09-12 14:56:06 UTC (rev 3464)
+++ trunk/engine/src/main/java/org/teiid/common/buffer/BufferManager.java 2011-09-12 18:23:57 UTC (rev 3465)
@@ -74,6 +74,12 @@
* Get the batch size to use during query processing.
* @return Batch size (# of rows)
*/
+ int getProcessorBatchSize(List<? extends Expression> schema);
+
+ /**
+ * Get the nominal batch size target
+ * @return
+ */
int getProcessorBatchSize();
/**
Modified: trunk/engine/src/main/java/org/teiid/common/buffer/FileStore.java
===================================================================
--- trunk/engine/src/main/java/org/teiid/common/buffer/FileStore.java 2011-09-12 14:56:06 UTC (rev 3464)
+++ trunk/engine/src/main/java/org/teiid/common/buffer/FileStore.java 2011-09-12 18:23:57 UTC (rev 3465)
@@ -215,7 +215,7 @@
protected abstract void writeDirect(byte[] bytes, int offset, int length) throws TeiidComponentException;
- public void remove() {
+ public synchronized void remove() {
if (!this.removed) {
this.removed = true;
this.removeDirect();
Modified: trunk/engine/src/main/java/org/teiid/common/buffer/SPage.java
===================================================================
--- trunk/engine/src/main/java/org/teiid/common/buffer/SPage.java 2011-09-12 14:56:06 UTC (rev 3464)
+++ trunk/engine/src/main/java/org/teiid/common/buffer/SPage.java 2011-09-12 18:23:57 UTC (rev 3465)
@@ -102,9 +102,9 @@
this.stree = stree;
this.id = counter.getAndIncrement();
stree.pages.put(this.id, this);
- this.values = new TupleBatch(0, new ArrayList(stree.pageSize/4));
+ this.values = new TupleBatch(0, new ArrayList(stree.getPageSize(leaf)/4));
if (!leaf) {
- children = new ArrayList<SPage>(stree.pageSize/4);
+ children = new ArrayList<SPage>(stree.getPageSize(false)/4);
}
}
Modified: trunk/engine/src/main/java/org/teiid/common/buffer/STree.java
===================================================================
--- trunk/engine/src/main/java/org/teiid/common/buffer/STree.java 2011-09-12 14:56:06 UTC (rev 3464)
+++ trunk/engine/src/main/java/org/teiid/common/buffer/STree.java 2011-09-12 18:23:57 UTC (rev 3465)
@@ -62,7 +62,8 @@
protected BatchManager keyManager;
protected BatchManager leafManager;
protected ListNestedSortComparator comparator;
- protected int pageSize;
+ private int pageSize;
+ protected int leafSize;
protected int keyLength;
protected String[] types;
protected String[] keytypes;
@@ -76,6 +77,7 @@
BatchManager leafManager,
final ListNestedSortComparator comparator,
int pageSize,
+ int leafSize,
int keyLength,
String[] types) {
randomSeed = seedGenerator.nextInt() | 0x00000100; // ensure nonzero
@@ -90,6 +92,7 @@
mask <<= 1;
mask++;
}
+ this.leafSize = leafSize;
this.keyLength = keyLength;
this.types = types;
this.keytypes = Arrays.copyOf(types, keyLength);
@@ -276,10 +279,10 @@
} else {
level = randomLevel();
}
- } else if (!places.isEmpty() && places.getLast().values.getTuples().size() == pageSize) {
+ } else if (!places.isEmpty() && places.getLast().values.getTuples().size() == getPageSize(true)) {
int row = rowCount.get();
- while (row != 0 && row%pageSize == 0) {
- row = (row - pageSize + 1)/pageSize;
+ while (row != 0 && row%getPageSize(true) == 0) {
+ row = (row - getPageSize(true) + 1)/getPageSize(true);
level++;
}
}
@@ -312,9 +315,9 @@
return 0;
}
int logSize = 1;
- while (sizeHint > this.pageSize) {
+ while (sizeHint > this.getPageSize(logSize==0)) {
logSize++;
- sizeHint/=this.pageSize;
+ sizeHint/=this.getPageSize(logSize==0);
}
return logSize;
}
@@ -329,8 +332,8 @@
SPage insert(List k, SearchResult result, SearchResult parent, Object value, boolean ordered) throws TeiidComponentException {
SPage page = result.page;
int index = -result.index - 1;
- if (result.values.getTuples().size() == pageSize) {
- boolean leaf = !(value instanceof SPage);
+ boolean leaf = !(value instanceof SPage);
+ if (result.values.getTuples().size() == getPageSize(leaf)) {
SPage nextPage = new SPage(this, leaf);
TupleBatch nextValues = nextPage.getValues();
nextPage.next = page.next;
@@ -342,17 +345,17 @@
boolean inNext = false;
if (!ordered) {
//split the values
- nextValues.getTuples().addAll(result.values.getTuples().subList(pageSize/2, pageSize));
- result.values.getTuples().subList(pageSize/2, pageSize).clear();
+ nextValues.getTuples().addAll(result.values.getTuples().subList(getPageSize(leaf)/2, getPageSize(leaf)));
+ result.values.getTuples().subList(getPageSize(leaf)/2, getPageSize(leaf)).clear();
if (!leaf) {
- nextPage.children.addAll(page.children.subList(pageSize/2, pageSize));
- page.children.subList(pageSize/2, pageSize).clear();
+ nextPage.children.addAll(page.children.subList(getPageSize(leaf)/2, getPageSize(false)));
+ page.children.subList(getPageSize(false)/2, getPageSize(false)).clear();
}
- if (index <= pageSize/2) {
+ if (index <= getPageSize(leaf)/2) {
setValue(index, k, value, result.values, page);
} else {
inNext = true;
- setValue(index - pageSize/2, k, value, nextValues, nextPage);
+ setValue(index - getPageSize(leaf)/2, k, value, nextValues, nextPage);
}
page.setValues(result.values);
if (parent != null) {
@@ -396,7 +399,9 @@
continue;
}
searchResult.values.getTuples().remove(searchResult.index);
+ boolean leaf = true;
if (searchResult.page.children != null) {
+ leaf = false;
searchResult.page.children.remove(searchResult.index);
}
int size = searchResult.values.getTuples().size();
@@ -423,18 +428,18 @@
header[0] = new SPage(this, true);
}
continue;
- } else if (size < pageSize/2) {
+ } else if (size < getPageSize(leaf)/2) {
//check for merge
if (searchResult.page.next != null) {
TupleBatch nextValues = searchResult.page.next.getValues();
- if (nextValues.getTuples().size() < pageSize/4) {
+ if (nextValues.getTuples().size() < getPageSize(leaf)/4) {
SPage.merge(places, nextValues, searchResult.page, searchResult.values);
continue;
}
}
if (searchResult.page.prev != null) {
TupleBatch prevValues = searchResult.page.prev.getValues();
- if (prevValues.getTuples().size() < pageSize/4) {
+ if (prevValues.getTuples().size() < getPageSize(leaf)/4) {
SPage.merge(places, searchResult.values, searchResult.page.prev, prevValues);
continue;
}
@@ -537,4 +542,11 @@
}
}
+ public int getPageSize(boolean leaf) {
+ if (leaf) {
+ return leafSize;
+ }
+ return pageSize;
+ }
+
}
\ No newline at end of file
Modified: trunk/engine/src/main/java/org/teiid/common/buffer/impl/BufferManagerImpl.java
===================================================================
--- trunk/engine/src/main/java/org/teiid/common/buffer/impl/BufferManagerImpl.java 2011-09-12 14:56:06 UTC (rev 3464)
+++ trunk/engine/src/main/java/org/teiid/common/buffer/impl/BufferManagerImpl.java 2011-09-12 18:23:57 UTC (rev 3465)
@@ -83,12 +83,12 @@
*
* TODO: allow for cached stores to use lru - (result set/mat view)
* TODO: account for row/content based sizing (difficult given value sharing)
- * TODO: account for memory based lobs (it would be nice if the approximate buffer size matched at 100kB)
* TODO: add detection of pinned batches to prevent unnecessary purging of non-persistent batches
* - this is not necessary for already persistent batches, since we hold a weak reference
*/
public class BufferManagerImpl implements BufferManager, StorageManager {
+ private static final int TARGET_BYTES_PER_ROW = 1 << 11; //2k bytes per row
private static final int IO_BUFFER_SIZE = 1 << 14;
private static final int COMPACTION_THRESHOLD = 1 << 25; //start checking at 32 megs
@@ -233,7 +233,6 @@
private boolean softCache;
private volatile TupleBatch activeBatch;
private volatile Reference<TupleBatch> batchReference;
- private int beginRow;
private WeakReference<BatchManagerImpl> managerRef;
private Long id;
private LobManager lobManager;
@@ -243,7 +242,6 @@
this.softCache = softCache;
id = batchAdded.incrementAndGet();
this.activeBatch = batch;
- this.beginRow = batch.getBeginRow();
this.managerRef = ref;
BatchManagerImpl batchManager = ref.get();
if (batchManager.lobIndexes != null) {
@@ -355,9 +353,9 @@
Assertion.isNotNull(info, "Invalid batch " + id); //$NON-NLS-1$
ObjectInputStream ois = new ObjectInputStream(new BufferedInputStream(batchManager.store.createInputStream(info[0]), IO_BUFFER_SIZE));
batch = new TupleBatch();
+ batch.setRowOffset(ois.readInt());
batch.setDataTypes(types);
batch.readExternal(ois);
- batch.setRowOffset(this.beginRow);
batch.setDataTypes(null);
if (lobManager != null) {
for (List<?> tuple : batch.getTuples()) {
@@ -404,6 +402,7 @@
offset = batchManager.getOffset();
OutputStream fsos = new BufferedOutputStream(batchManager.store.createOutputStream(), IO_BUFFER_SIZE);
ObjectOutputStream oos = new ObjectOutputStream(fsos);
+ oos.writeInt(batch.getBeginRow());
batch.writeExternal(oos);
oos.close();
long size = batchManager.store.getLength() - offset;
@@ -475,6 +474,7 @@
private int maxActivePlans = DQPConfiguration.DEFAULT_MAX_ACTIVE_PLANS; //used as a hint to set the reserveBatchKB
private boolean useWeakReferences = true;
private boolean inlineLobs = true;
+ private int targetBytesPerRow = TARGET_BYTES_PER_ROW;
private ReentrantLock lock = new ReentrantLock(true);
private Condition batchesFreed = lock.newCondition();
@@ -535,6 +535,10 @@
public void setConnectorBatchSize(int connectorBatchSize) {
this.connectorBatchSize = connectorBatchSize;
}
+
+ public void setTargetBytesPerRow(int targetBytesPerRow) {
+ this.targetBytesPerRow = targetBytesPerRow;
+ }
public void setProcessorBatchSize(int processorBatchSize) {
this.processorBatchSize = processorBatchSize;
@@ -560,7 +564,7 @@
final String newID = String.valueOf(this.tsId.getAndIncrement());
int[] lobIndexes = LobManager.getLobIndexes(elements);
BatchManager batchManager = new BatchManagerImpl(newID, lobIndexes);
- TupleBuffer tupleBuffer = new TupleBuffer(batchManager, newID, elements, lobIndexes, getProcessorBatchSize());
+ TupleBuffer tupleBuffer = new TupleBuffer(batchManager, newID, elements, lobIndexes, getProcessorBatchSize(elements));
if (LogManager.isMessageToBeRecorded(LogConstants.CTX_BUFFER_MGR, MessageLevel.DETAIL)) {
LogManager.logDetail(LogConstants.CTX_BUFFER_MGR, "Creating TupleBuffer:", newID, elements, Arrays.toString(tupleBuffer.getTypes()), "of type", tupleSourceType); //$NON-NLS-1$ //$NON-NLS-2$
}
@@ -595,7 +599,7 @@
if (LogManager.isMessageToBeRecorded(LogConstants.CTX_BUFFER_MGR, MessageLevel.DETAIL)) {
LogManager.logDetail(LogConstants.CTX_BUFFER_MGR, "Creating STree:", newID); //$NON-NLS-1$
}
- return new STree(keyManager, bm, new ListNestedSortComparator(compareIndexes), getProcessorBatchSize(), keyLength, TupleBuffer.getTypeNames(elements));
+ return new STree(keyManager, bm, new ListNestedSortComparator(compareIndexes), getProcessorBatchSize(elements), getProcessorBatchSize(elements.subList(0, keyLength)), keyLength, TupleBuffer.getTypeNames(elements));
}
@Override
@@ -732,7 +736,11 @@
}
@Override
- public int getSchemaSize(List<? extends Expression> elements) {
+ public int getProcessorBatchSize(List<? extends Expression> schema) {
+ return getSizeEstimates(schema)[0];
+ }
+
+ private int[] getSizeEstimates(List<? extends Expression> elements) {
int total = 0;
boolean isValueCacheEnabled = DataTypeManager.isValueCacheEnabled();
//we make a assumption that the average column size under 64bits is approximately 128bytes
@@ -741,10 +749,40 @@
Class<?> type = element.getType();
total += SizeUtility.getSize(isValueCacheEnabled, type);
}
+ //assume 64-bit
total += 8*elements.size() + 36; // column list / row overhead
- total *= processorBatchSize;
- return Math.max(1, total / 1024);
+
+ //nominal targetBytesPerRow but can scale up or down
+
+ int totalCopy = total;
+ boolean less = totalCopy < targetBytesPerRow;
+ int rowCount = processorBatchSize;
+
+ for (int i = 0; i < 2; i++) {
+ if (less) {
+ totalCopy <<= 2;
+ } else {
+ totalCopy >>= 2;
+ }
+ if (less && totalCopy > targetBytesPerRow
+ || !less && totalCopy < targetBytesPerRow) {
+ break;
+ }
+ if (less) {
+ rowCount <<= 1;
+ } else {
+ rowCount >>= 1;
+ }
+ }
+ rowCount = Math.max(1, rowCount);
+ total *= rowCount;
+ return new int[]{rowCount, Math.max(1, total / 1024)};
}
+
+ @Override
+ public int getSchemaSize(List<? extends Expression> elements) {
+ return getSizeEstimates(elements)[1];
+ }
public void shutdown() {
}
Modified: trunk/engine/src/main/java/org/teiid/common/buffer/impl/FileStorageManager.java
===================================================================
--- trunk/engine/src/main/java/org/teiid/common/buffer/impl/FileStorageManager.java 2011-09-12 14:56:06 UTC (rev 3464)
+++ trunk/engine/src/main/java/org/teiid/common/buffer/impl/FileStorageManager.java 2011-09-12 18:23:57 UTC (rev 3465)
@@ -29,13 +29,11 @@
import java.util.Collections;
import java.util.LinkedHashMap;
import java.util.Map;
-import java.util.TreeMap;
import java.util.concurrent.atomic.AtomicLong;
import org.teiid.common.buffer.FileStore;
import org.teiid.common.buffer.StorageManager;
import org.teiid.core.TeiidComponentException;
-import org.teiid.core.util.Assertion;
import org.teiid.logging.LogManager;
import org.teiid.logging.MessageLevel;
import org.teiid.query.QueryPlugin;
@@ -47,7 +45,6 @@
public class FileStorageManager implements StorageManager {
public static final int DEFAULT_MAX_OPEN_FILES = 64;
- public static final long DEFAULT_MAX_FILESIZE = 2L * 1024L;
public static final long DEFAULT_MAX_BUFFERSPACE = 50L * 1024L * 1024L * 1024L;
private static final String FILE_PREFIX = "b_"; //$NON-NLS-1$
@@ -97,7 +94,7 @@
public class DiskStore extends FileStore {
private String name;
- private TreeMap<Long, FileInfo> storageFiles = new TreeMap<Long, FileInfo>();
+ private FileInfo fileInfo;
public DiskStore(String name) {
this.name = name;
@@ -106,20 +103,15 @@
/**
* Concurrent reads are possible, but only after writing is complete.
*/
- public int readDirect(long fileOffset, byte[] b, int offSet, int length) throws TeiidComponentException {
- Map.Entry<Long, FileInfo> entry = storageFiles.floorEntry(fileOffset);
- Assertion.isNotNull(entry);
- FileInfo fileInfo = entry.getValue();
- synchronized (fileInfo) {
- try {
- RandomAccessFile fileAccess = fileInfo.open();
- fileAccess.seek(fileOffset - entry.getKey());
- return fileAccess.read(b, offSet, length);
- } catch (IOException e) {
- throw new TeiidComponentException(e, QueryPlugin.Util.getString("FileStoreageManager.error_reading", fileInfo.file.getAbsoluteFile())); //$NON-NLS-1$
- } finally {
- fileInfo.close();
- }
+ public synchronized int readDirect(long fileOffset, byte[] b, int offSet, int length) throws TeiidComponentException {
+ try {
+ RandomAccessFile fileAccess = fileInfo.open();
+ fileAccess.seek(fileOffset);
+ return fileAccess.read(b, offSet, length);
+ } catch (IOException e) {
+ throw new TeiidComponentException(e, QueryPlugin.Util.getString("FileStoreageManager.error_reading", fileInfo.file.getAbsoluteFile())); //$NON-NLS-1$
+ } finally {
+ fileInfo.close();
}
}
@@ -132,26 +124,14 @@
usedBufferSpace.addAndGet(-length);
throw new TeiidComponentException(QueryPlugin.Util.getString("FileStoreageManager.space_exhausted", maxBufferSpace)); //$NON-NLS-1$
}
- Map.Entry<Long, FileInfo> entry = this.storageFiles.lastEntry();
- boolean createNew = false;
- FileInfo fileInfo = null;
long fileOffset = 0;
- if (entry == null) {
- createNew = true;
- } else {
- fileInfo = entry.getValue();
- fileOffset = entry.getKey();
- createNew = entry.getValue().file.length() + length > getMaxFileSize();
- }
- if (createNew) {
- FileInfo newFileInfo = new FileInfo(createFile(name, storageFiles.size()));
+ if (fileInfo == null) {
+ fileInfo = new FileInfo(createFile(name));
if (fileInfo != null) {
fileOffset += fileInfo.file.length();
}
- storageFiles.put(fileOffset, newFileInfo);
- fileInfo = newFileInfo;
}
- synchronized (fileInfo) {
+ synchronized (this) {
try {
RandomAccessFile fileAccess = fileInfo.open();
long pointer = fileAccess.length();
@@ -168,16 +148,13 @@
public synchronized void removeDirect() {
usedBufferSpace.addAndGet(-len);
- for (FileInfo info : storageFiles.values()) {
- info.delete();
- }
+ fileInfo.delete();
}
}
// Initialization
private int maxOpenFiles = DEFAULT_MAX_OPEN_FILES;
- private long maxFileSize = DEFAULT_MAX_FILESIZE * 1024L * 1024L; // 2GB
private String directory;
private File dirFile;
@@ -216,14 +193,6 @@
}
}
- public void setMaxFileSize(long maxFileSize) {
- this.maxFileSize = maxFileSize * 1024L * 1024L;
- }
-
- void setMaxFileSizeDirect(long maxFileSize) {
- this.maxFileSize = maxFileSize;
- }
-
public void setMaxOpenFiles(int maxOpenFiles) {
this.maxOpenFiles = maxOpenFiles;
}
@@ -232,15 +201,15 @@
this.directory = directory;
}
- File createFile(String name, int fileNumber) throws TeiidComponentException {
+ File createFile(String name) throws TeiidComponentException {
try {
- File storageFile = File.createTempFile(FILE_PREFIX + name + "_" + String.valueOf(fileNumber) + "_", null, this.dirFile); //$NON-NLS-1$ //$NON-NLS-2$
+ File storageFile = File.createTempFile(FILE_PREFIX + name + "_", null, this.dirFile); //$NON-NLS-1$
if (LogManager.isMessageToBeRecorded(org.teiid.logging.LogConstants.CTX_BUFFER_MGR, MessageLevel.DETAIL)) {
LogManager.logDetail(org.teiid.logging.LogConstants.CTX_BUFFER_MGR, "Created temporary storage area file " + storageFile.getAbsoluteFile()); //$NON-NLS-1$
}
return storageFile;
} catch(IOException e) {
- throw new TeiidComponentException(e, QueryPlugin.Util.getString("FileStoreageManager.error_creating", name + "_" + fileNumber)); //$NON-NLS-1$ //$NON-NLS-2$
+ throw new TeiidComponentException(e, QueryPlugin.Util.getString("FileStoreageManager.error_creating", name)); //$NON-NLS-1$
}
}
@@ -248,10 +217,6 @@
return new DiskStore(name);
}
- public long getMaxFileSize() {
- return maxFileSize;
- }
-
public String getDirectory() {
return directory;
}
Modified: trunk/engine/src/main/java/org/teiid/common/buffer/impl/SizeUtility.java
===================================================================
--- trunk/engine/src/main/java/org/teiid/common/buffer/impl/SizeUtility.java 2011-09-12 14:56:06 UTC (rev 3464)
+++ trunk/engine/src/main/java/org/teiid/common/buffer/impl/SizeUtility.java 2011-09-12 18:23:57 UTC (rev 3465)
@@ -25,6 +25,8 @@
import java.lang.reflect.Array;
import java.math.BigDecimal;
import java.math.BigInteger;
+import java.util.HashMap;
+import java.util.Map;
import org.teiid.common.buffer.TupleBatch;
import org.teiid.core.types.DataTypeManager;
@@ -40,6 +42,27 @@
public final class SizeUtility {
public static final int REFERENCE_SIZE = 8;
+ private static Map<Class<?>, int[]> SIZE_ESTIMATES = new HashMap<Class<?>, int[]>(128);
+
+ static {
+ SIZE_ESTIMATES.put(DataTypeManager.DefaultDataClasses.STRING, new int[] {100, 256});
+ SIZE_ESTIMATES.put(DataTypeManager.DefaultDataClasses.DATE, new int[] {20, 28});
+ SIZE_ESTIMATES.put(DataTypeManager.DefaultDataClasses.TIME, new int[] {20, 28});
+ SIZE_ESTIMATES.put(DataTypeManager.DefaultDataClasses.TIMESTAMP, new int[] {20, 28});
+ SIZE_ESTIMATES.put(DataTypeManager.DefaultDataClasses.LONG, new int[] {12, 16});
+ SIZE_ESTIMATES.put(DataTypeManager.DefaultDataClasses.DOUBLE, new int[] {12, 16});
+ SIZE_ESTIMATES.put(DataTypeManager.DefaultDataClasses.INTEGER, new int[] {6, 12});
+ SIZE_ESTIMATES.put(DataTypeManager.DefaultDataClasses.FLOAT, new int[] {6, 12});
+ SIZE_ESTIMATES.put(DataTypeManager.DefaultDataClasses.CHAR, new int[] {4, 10});
+ SIZE_ESTIMATES.put(DataTypeManager.DefaultDataClasses.SHORT, new int[] {4, 10});
+ SIZE_ESTIMATES.put(DataTypeManager.DefaultDataClasses.OBJECT, new int[] {1024, 1024});
+ SIZE_ESTIMATES.put(DataTypeManager.DefaultDataClasses.NULL, new int[] {0, 0});
+ SIZE_ESTIMATES.put(DataTypeManager.DefaultDataClasses.BYTE, new int[] {1, 1});
+ SIZE_ESTIMATES.put(DataTypeManager.DefaultDataClasses.BOOLEAN, new int[] {1, 1});
+ SIZE_ESTIMATES.put(DataTypeManager.DefaultDataClasses.BIG_INTEGER, new int[] {75, 100});
+ SIZE_ESTIMATES.put(DataTypeManager.DefaultDataClasses.BIG_DECIMAL, new int[] {150, 200});
+ }
+
private long bigIntegerEstimate;
private long bigDecimalEstimate;
@@ -85,35 +108,12 @@
static int getSize(boolean isValueCacheEnabled,
Class<?> type) {
- if (type == DataTypeManager.DefaultDataClasses.STRING) {
- return isValueCacheEnabled?100:256; //assumes an "average" string length of approximately 100 chars
- } else if (type == DataTypeManager.DefaultDataClasses.DATE
- || type == DataTypeManager.DefaultDataClasses.TIME
- || type == DataTypeManager.DefaultDataClasses.TIMESTAMP) {
- return isValueCacheEnabled?20:28;
- } else if (type == DataTypeManager.DefaultDataClasses.LONG
- || type == DataTypeManager.DefaultDataClasses.DOUBLE) {
- return isValueCacheEnabled?12:16;
- } else if (type == DataTypeManager.DefaultDataClasses.INTEGER
- || type == DataTypeManager.DefaultDataClasses.FLOAT) {
- return isValueCacheEnabled?6:12;
- } else if (type == DataTypeManager.DefaultDataClasses.CHAR
- || type == DataTypeManager.DefaultDataClasses.SHORT) {
- return isValueCacheEnabled?4:10;
- } else if (type == DataTypeManager.DefaultDataClasses.OBJECT) {
- return 1024;
- } else if (type == DataTypeManager.DefaultDataClasses.NULL) {
- return 0; //it's free
- } else if (type == DataTypeManager.DefaultDataClasses.BYTE
- || type == DataTypeManager.DefaultDataClasses.BOOLEAN) {
- return 1; //should always be value cached, but there's a small chance it's not
- } else if (type == DataTypeManager.DefaultDataClasses.BIG_INTEGER){
- return isValueCacheEnabled?75:100;
- } else if (type == DataTypeManager.DefaultDataClasses.BIG_DECIMAL) {
- return isValueCacheEnabled?150:200;
- }
- return 512; //this is is misleading for lobs
- //most references are not actually removed from memory
+ int[] vals = SIZE_ESTIMATES.get(type);
+ if (vals == null) {
+ return 512; //this is is misleading for lobs
+ //most references are not actually removed from memory
+ }
+ return vals[isValueCacheEnabled?0:1];
}
/**
Added: trunk/engine/src/main/java/org/teiid/common/buffer/impl/SplittableStorageManager.java
===================================================================
--- trunk/engine/src/main/java/org/teiid/common/buffer/impl/SplittableStorageManager.java (rev 0)
+++ trunk/engine/src/main/java/org/teiid/common/buffer/impl/SplittableStorageManager.java 2011-09-12 18:23:57 UTC (rev 3465)
@@ -0,0 +1,113 @@
+/*
+ * JBoss, Home of Professional Open Source.
+ * See the COPYRIGHT.txt file distributed with this work for information
+ * regarding copyright ownership. Some portions may be licensed
+ * to Red Hat, Inc. under one or more contributor license agreements.
+ *
+ * This library is free software; you can redistribute it and/or
+ * modify it under the terms of the GNU Lesser General Public
+ * License as published by the Free Software Foundation; either
+ * version 2.1 of the License, or (at your option) any later version.
+ *
+ * This library is distributed in the hope that it will be useful,
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
+ * Lesser General Public License for more details.
+ *
+ * You should have received a copy of the GNU Lesser General Public
+ * License along with this library; if not, write to the Free Software
+ * Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA
+ * 02110-1301 USA.
+ */
+
+package org.teiid.common.buffer.impl;
+
+import java.util.Map;
+import java.util.concurrent.ConcurrentSkipListMap;
+
+import org.teiid.common.buffer.FileStore;
+import org.teiid.common.buffer.StorageManager;
+import org.teiid.core.TeiidComponentException;
+
+public class SplittableStorageManager implements StorageManager {
+
+ public static final long DEFAULT_MAX_FILESIZE = 2L * 1024L;
+ private long maxFileSize = DEFAULT_MAX_FILESIZE * 1024L * 1024L; // 2GB
+ private StorageManager storageManager;
+
+ public SplittableStorageManager(StorageManager storageManager) {
+ this.storageManager = storageManager;
+ }
+
+ @Override
+ public FileStore createFileStore(String name) {
+ return new SplittableFileStore(name);
+ }
+
+ @Override
+ public void initialize() throws TeiidComponentException {
+ storageManager.initialize();
+ }
+
+ public class SplittableFileStore extends FileStore {
+ private String name;
+ private ConcurrentSkipListMap<Long, FileStore> storageFiles = new ConcurrentSkipListMap<Long, FileStore>();
+
+ public SplittableFileStore(String name) {
+ this.name = name;
+ }
+
+ public int readDirect(long fileOffset, byte[] b, int offSet, int length) throws TeiidComponentException {
+ Map.Entry<Long, FileStore> entry = storageFiles.floorEntry(fileOffset);
+ FileStore fileInfo = entry.getValue();
+ return fileInfo.read(fileOffset - entry.getKey(), b, offSet, length);
+ }
+
+ public void writeDirect(byte[] bytes, int offset, int length) throws TeiidComponentException {
+ Map.Entry<Long, FileStore> entry = this.storageFiles.lastEntry();
+ boolean createNew = false;
+ FileStore fileInfo = null;
+ long fileOffset = 0;
+ if (entry == null) {
+ createNew = true;
+ } else {
+ fileInfo = entry.getValue();
+ fileOffset = entry.getKey();
+ createNew = entry.getValue().getLength() + length > getMaxFileSize();
+ }
+ if (createNew) {
+ FileStore newFileInfo = storageManager.createFileStore(name + "_" + storageFiles.size()); //$NON-NLS-1$
+ if (fileInfo != null) {
+ fileOffset += fileInfo.getLength();
+ }
+ storageFiles.put(fileOffset, newFileInfo);
+ fileInfo = newFileInfo;
+ }
+ fileInfo.write(bytes, offset, length);
+ }
+
+ public void removeDirect() {
+ for (FileStore info : storageFiles.values()) {
+ info.remove();
+ }
+ }
+
+ }
+
+ public long getMaxFileSize() {
+ return maxFileSize;
+ }
+
+ public void setMaxFileSize(long maxFileSize) {
+ this.maxFileSize = maxFileSize * 1024L * 1024L;
+ }
+
+ void setMaxFileSizeDirect(long maxFileSize) {
+ this.maxFileSize = maxFileSize;
+ }
+
+ public StorageManager getStorageManager() {
+ return storageManager;
+ }
+
+}
Property changes on: trunk/engine/src/main/java/org/teiid/common/buffer/impl/SplittableStorageManager.java
___________________________________________________________________
Added: svn:mime-type
+ text/plain
Modified: trunk/engine/src/main/java/org/teiid/dqp/internal/process/Request.java
===================================================================
--- trunk/engine/src/main/java/org/teiid/dqp/internal/process/Request.java 2011-09-12 14:56:06 UTC (rev 3464)
+++ trunk/engine/src/main/java/org/teiid/dqp/internal/process/Request.java 2011-09-12 18:23:57 UTC (rev 3465)
@@ -233,7 +233,6 @@
props,
this.requestMsg.getShowPlan() != ShowPlan.OFF);
this.context.setProcessorBatchSize(bufferManager.getProcessorBatchSize());
- this.context.setConnectorBatchSize(bufferManager.getConnectorBatchSize());
this.context.setGlobalTableStore(this.globalTables);
if (multiSourceModels != null) {
MultiSourcePlanToProcessConverter modifier = new MultiSourcePlanToProcessConverter(
Modified: trunk/engine/src/main/java/org/teiid/query/processor/proc/ProcedurePlan.java
===================================================================
--- trunk/engine/src/main/java/org/teiid/query/processor/proc/ProcedurePlan.java 2011-09-12 14:56:06 UTC (rev 3464)
+++ trunk/engine/src/main/java/org/teiid/query/processor/proc/ProcedurePlan.java 2011-09-12 18:23:57 UTC (rev 3465)
@@ -163,7 +163,7 @@
*/
public void initialize(CommandContext context, ProcessorDataManager dataMgr, BufferManager bufferMgr) {
this.bufferMgr = bufferMgr;
- this.batchSize = bufferMgr.getProcessorBatchSize();
+ this.batchSize = bufferMgr.getProcessorBatchSize(getOutputElements());
setContext(context.clone());
this.dataMgr = new ProcessorDataManager() {
Modified: trunk/engine/src/main/java/org/teiid/query/processor/relational/NullNode.java
===================================================================
--- trunk/engine/src/main/java/org/teiid/query/processor/relational/NullNode.java 2011-09-12 14:56:06 UTC (rev 3464)
+++ trunk/engine/src/main/java/org/teiid/query/processor/relational/NullNode.java 2011-09-12 18:23:57 UTC (rev 3465)
@@ -22,6 +22,9 @@
package org.teiid.query.processor.relational;
+import java.util.Collections;
+import java.util.List;
+
import org.teiid.common.buffer.TupleBatch;
import org.teiid.core.TeiidComponentException;
@@ -38,11 +41,12 @@
this.terminateBatches();
return pullBatch();
}
+
+ @Override
+ public List getOutputElements() {
+ return Collections.emptyList();
+ }
- protected void getNodeString(StringBuffer str) {
- super.getNodeString(str);
- }
-
public Object clone(){
NullNode clonedNode = new NullNode(super.getID());
super.copy(this, clonedNode);
Modified: trunk/engine/src/main/java/org/teiid/query/processor/relational/RelationalNode.java
===================================================================
--- trunk/engine/src/main/java/org/teiid/query/processor/relational/RelationalNode.java 2011-09-12 14:56:06 UTC (rev 3464)
+++ trunk/engine/src/main/java/org/teiid/query/processor/relational/RelationalNode.java 2011-09-12 18:23:57 UTC (rev 3465)
@@ -114,7 +114,11 @@
this.getProcessingState().nodeStatistics = new RelationalNodeStatistics();
}
- this.getProcessingState().batchSize = bufferManager.getProcessorBatchSize();
+ if (getOutputElements() != null) {
+ this.getProcessingState().batchSize = bufferManager.getProcessorBatchSize(getOutputElements());
+ } else {
+ this.getProcessingState().batchSize = bufferManager.getProcessorBatchSize();
+ }
}
public CommandContext getContext() {
Modified: trunk/engine/src/main/java/org/teiid/query/processor/relational/SortUtility.java
===================================================================
--- trunk/engine/src/main/java/org/teiid/query/processor/relational/SortUtility.java 2011-09-12 14:56:06 UTC (rev 3464)
+++ trunk/engine/src/main/java/org/teiid/query/processor/relational/SortUtility.java 2011-09-12 18:23:57 UTC (rev 3465)
@@ -94,6 +94,7 @@
private String groupName;
private List<? extends Expression> schema;
private int schemaSize;
+ private int batchSize;
private ListNestedSortComparator comparator;
private TupleBuffer output;
@@ -164,6 +165,7 @@
this.groupName = groupName;
this.schema = schema;
this.schemaSize = bufferManager.getSchemaSize(this.schema);
+ this.batchSize = bufferManager.getProcessorBatchSize(this.schema);
this.comparator = new ListNestedSortComparator(cols, sortTypes);
int distinctIndex = cols.length - 1;
this.comparator.setDistinctIndex(distinctIndex);
@@ -226,7 +228,7 @@
int totalReservedBuffers = 0;
try {
- int maxRows = this.bufferManager.getProcessorBatchSize();
+ int maxRows = this.batchSize;
while(!doneReading) {
//attempt to reserve more working memory if there are additional rows available before blocking
if (workingTuples.size() >= maxRows) {
@@ -236,7 +238,7 @@
break;
}
totalReservedBuffers += reserved;
- maxRows += bufferManager.getProcessorBatchSize();
+ maxRows += this.batchSize;
}
try {
List<?> tuple = source.nextTuple();
@@ -249,7 +251,7 @@
this.collected++;
}
} catch(BlockedException e) {
- if (workingTuples.size() >= bufferManager.getProcessorBatchSize()) {
+ if (workingTuples.size() >= this.batchSize) {
break;
}
if (mode != Mode.DUP_REMOVE
Modified: trunk/engine/src/main/java/org/teiid/query/processor/xml/RelationalPlanExecutor.java
===================================================================
--- trunk/engine/src/main/java/org/teiid/query/processor/xml/RelationalPlanExecutor.java 2011-09-12 14:56:06 UTC (rev 3464)
+++ trunk/engine/src/main/java/org/teiid/query/processor/xml/RelationalPlanExecutor.java 2011-09-12 18:23:57 UTC (rev 3465)
@@ -144,11 +144,8 @@
if (this.resultInfo.isAutoStaged() && tempTable != null) {
AlterTempTable att = new AlterTempTable(tempTable);
- int size = (Integer)this.currentRow.get(0);
- if (size > this.bufferMgr.getProcessorBatchSize() * 2) {
- //TODO: if the parent is small, then this is not necessary
- att.setIndexColumns(this.resultInfo.getFkColumns());
- }
+ //TODO: if the parent is small, then this is not necessary
+ att.setIndexColumns(this.resultInfo.getFkColumns());
this.dataManager.registerRequest(this.internalProcessor.getContext(), att, TempMetadataAdapter.TEMP_MODEL.getName(), null, 0, -1);
}
Modified: trunk/engine/src/main/java/org/teiid/query/tempdata/TempTableDataManager.java
===================================================================
--- trunk/engine/src/main/java/org/teiid/query/tempdata/TempTableDataManager.java 2011-09-12 14:56:06 UTC (rev 3464)
+++ trunk/engine/src/main/java/org/teiid/query/tempdata/TempTableDataManager.java 2011-09-12 18:23:57 UTC (rev 3465)
@@ -213,7 +213,7 @@
TempTable tt = contextStore.getTempTable(att.getTempTable().toUpperCase());
Assertion.isNotNull(tt, "Table doesn't exist"); //$NON-NLS-1$
tt.setUpdatable(false);
- if (att.getIndexColumns() != null) {
+ if (att.getIndexColumns() != null && tt.getRowCount() > 2*tt.getTree().getPageSize(true)) {
tt.addIndex(att.getIndexColumns(), false);
}
return CollectionTupleSource.createUpdateCountTupleSource(0);
Modified: trunk/engine/src/main/java/org/teiid/query/util/CommandContext.java
===================================================================
--- trunk/engine/src/main/java/org/teiid/query/util/CommandContext.java 2011-09-12 14:56:06 UTC (rev 3464)
+++ trunk/engine/src/main/java/org/teiid/query/util/CommandContext.java 2011-09-12 18:23:57 UTC (rev 3465)
@@ -26,6 +26,7 @@
import java.util.Collections;
import java.util.HashSet;
import java.util.LinkedList;
+import java.util.List;
import java.util.Map;
import java.util.Properties;
import java.util.Random;
@@ -78,8 +79,6 @@
private int processorBatchSize = BufferManager.DEFAULT_PROCESSOR_BATCH_SIZE;
- private int connectorBatchSize = BufferManager.DEFAULT_CONNECTOR_BATCH_SIZE;
-
private String userName;
private Serializable commandPayload;
@@ -312,20 +311,15 @@
return this.globalState.collectNodeStatistics;
}
- public int getConnectorBatchSize() {
- return this.globalState.connectorBatchSize;
- }
-
- public void setConnectorBatchSize(int connectorBatchSize) {
- this.globalState.connectorBatchSize = connectorBatchSize;
- }
-
-
+ @Override
public int getProcessorBatchSize() {
return this.globalState.processorBatchSize;
}
-
+ public int getProcessorBatchSize(List<Expression> schema) {
+ return this.globalState.bufferManager.getProcessorBatchSize(schema);
+ }
+
public void setProcessorBatchSize(int processorBatchSize) {
this.globalState.processorBatchSize = processorBatchSize;
}
Modified: trunk/engine/src/test/java/org/teiid/common/buffer/TestSTree.java
===================================================================
--- trunk/engine/src/test/java/org/teiid/common/buffer/TestSTree.java 2011-09-12 14:56:06 UTC (rev 3464)
+++ trunk/engine/src/test/java/org/teiid/common/buffer/TestSTree.java 2011-09-12 18:23:57 UTC (rev 3465)
@@ -79,7 +79,7 @@
@Test public void testOrderedInsert() throws TeiidComponentException {
BufferManagerImpl bm = BufferManagerFactory.createBufferManager();
- bm.setProcessorBatchSize(16);
+ bm.setProcessorBatchSize(4);
ElementSymbol e1 = new ElementSymbol("x");
e1.setType(Integer.class);
Modified: trunk/engine/src/test/java/org/teiid/common/buffer/impl/TestFileStorageManager.java
===================================================================
--- trunk/engine/src/test/java/org/teiid/common/buffer/impl/TestFileStorageManager.java 2011-09-12 14:56:06 UTC (rev 3464)
+++ trunk/engine/src/test/java/org/teiid/common/buffer/impl/TestFileStorageManager.java 2011-09-12 18:23:57 UTC (rev 3465)
@@ -27,9 +27,7 @@
import java.io.File;
import java.io.InputStream;
import java.io.OutputStream;
-import java.io.RandomAccessFile;
import java.util.Arrays;
-import java.util.Map;
import java.util.Random;
import org.junit.Test;
@@ -41,12 +39,9 @@
@SuppressWarnings("nls")
public class TestFileStorageManager {
- public FileStorageManager getStorageManager(Integer maxFileSize, Integer openFiles, String dir) throws TeiidComponentException {
+ public FileStorageManager getStorageManager(Integer openFiles, String dir) throws TeiidComponentException {
FileStorageManager sm = new FileStorageManager();
sm.setStorageDirectory(UnitTestUtil.getTestScratchPath() + (dir != null ? File.separator + dir : "")); //$NON-NLS-1$
- if (maxFileSize != null) {
- sm.setMaxFileSizeDirect(maxFileSize);
- }
if (openFiles != null) {
sm.setMaxOpenFiles(openFiles);
}
@@ -55,7 +50,7 @@
}
@Test public void testWrite() throws Exception {
- FileStorageManager sm = getStorageManager(null, null, null);
+ FileStorageManager sm = getStorageManager(null, null);
String tsID = "0"; //$NON-NLS-1$
FileStore store = sm.createFileStore(tsID);
writeBytes(store);
@@ -64,27 +59,8 @@
assertEquals(0, sm.getUsedBufferSpace());
}
- @Test public void testCreatesSpillFiles() throws Exception {
- FileStorageManager sm = getStorageManager(1024, null, null); // 1KB
- String tsID = "0"; //$NON-NLS-1$
- // Add one batch
- FileStore store = sm.createFileStore(tsID);
- writeBytes(store);
-
- Map<File, RandomAccessFile> cache = sm.getFileCache();
- assertEquals(1, cache.size());
-
- writeBytes(store);
-
- assertEquals(2, cache.size());
-
- store.remove();
-
- assertEquals(0, cache.size());
- }
-
@Test(expected=TeiidComponentException.class) public void testMaxSpace() throws Exception {
- FileStorageManager sm = getStorageManager(null, null, null);
+ FileStorageManager sm = getStorageManager(null, null);
sm.setMaxBufferSpace(1);
String tsID = "0"; //$NON-NLS-1$
// Add one batch
@@ -93,7 +69,7 @@
}
@Test public void testFlush() throws Exception {
- FileStorageManager sm = getStorageManager(null, null, null);
+ FileStorageManager sm = getStorageManager(null, null);
FileStore store = sm.createFileStore("0");
FileStoreOutputStream fsos = store.createOutputStream(2);
fsos.write(new byte[3]);
@@ -104,7 +80,7 @@
static Random r = new Random();
- private void writeBytes(FileStore store)
+ static void writeBytes(FileStore store)
throws TeiidComponentException {
byte[] bytes = new byte[2048];
r.nextBytes(bytes);
@@ -114,9 +90,8 @@
assertTrue(Arrays.equals(bytes, bytesRead));
}
-
@Test public void testWritingMultipleFiles() throws Exception {
- FileStorageManager sm = getStorageManager(1024, null, null);
+ FileStorageManager sm = getStorageManager(null, null);
String tsID = "0"; //$NON-NLS-1$
// Add one batch
FileStore store = sm.createFileStore(tsID);
Added: trunk/engine/src/test/java/org/teiid/common/buffer/impl/TestSplittableStorageManager.java
===================================================================
--- trunk/engine/src/test/java/org/teiid/common/buffer/impl/TestSplittableStorageManager.java (rev 0)
+++ trunk/engine/src/test/java/org/teiid/common/buffer/impl/TestSplittableStorageManager.java 2011-09-12 18:23:57 UTC (rev 3465)
@@ -0,0 +1,52 @@
+/*
+ * JBoss, Home of Professional Open Source.
+ * See the COPYRIGHT.txt file distributed with this work for information
+ * regarding copyright ownership. Some portions may be licensed
+ * to Red Hat, Inc. under one or more contributor license agreements.
+ *
+ * This library is free software; you can redistribute it and/or
+ * modify it under the terms of the GNU Lesser General Public
+ * License as published by the Free Software Foundation; either
+ * version 2.1 of the License, or (at your option) any later version.
+ *
+ * This library is distributed in the hope that it will be useful,
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
+ * Lesser General Public License for more details.
+ *
+ * You should have received a copy of the GNU Lesser General Public
+ * License along with this library; if not, write to the Free Software
+ * Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA
+ * 02110-1301 USA.
+ */
+
+package org.teiid.common.buffer.impl;
+
+import static org.junit.Assert.*;
+
+import org.junit.Test;
+import org.teiid.common.buffer.FileStore;
+
+public class TestSplittableStorageManager {
+
+ @Test public void testCreatesSpillFiles() throws Exception {
+ MemoryStorageManager msm = new MemoryStorageManager();
+ SplittableStorageManager ssm = new SplittableStorageManager(msm);
+ ssm.setMaxFileSizeDirect(2048);
+ String tsID = "0"; //$NON-NLS-1$
+ // Add one batch
+ FileStore store = ssm.createFileStore(tsID);
+ TestFileStorageManager.writeBytes(store);
+
+ assertEquals(1, msm.getCreated());
+
+ TestFileStorageManager.writeBytes(store);
+
+ assertEquals(2, msm.getCreated());
+
+ store.remove();
+
+ assertEquals(2, msm.getRemoved());
+ }
+
+}
Property changes on: trunk/engine/src/test/java/org/teiid/common/buffer/impl/TestSplittableStorageManager.java
___________________________________________________________________
Added: svn:mime-type
+ text/plain
Modified: trunk/engine/src/test/java/org/teiid/dqp/internal/process/TestDQPCore.java
===================================================================
--- trunk/engine/src/test/java/org/teiid/dqp/internal/process/TestDQPCore.java 2011-09-12 14:56:06 UTC (rev 3464)
+++ trunk/engine/src/test/java/org/teiid/dqp/internal/process/TestDQPCore.java 2011-09-12 18:23:57 UTC (rev 3465)
@@ -302,8 +302,8 @@
}
@Test public void testBufferLimit() throws Exception {
- //the sql should return 100 rows
- String sql = "SELECT A.IntKey FROM BQT1.SmallA as A, BQT1.SmallA as B"; //$NON-NLS-1$
+ //the sql should return 400 rows
+ String sql = "SELECT A.IntKey FROM BQT1.SmallA as A, BQT1.SmallA as B, (select intkey from BQT1.SmallA limit 4) as C"; //$NON-NLS-1$
String userName = "1"; //$NON-NLS-1$
String sessionid = "1"; //$NON-NLS-1$
@@ -315,27 +315,29 @@
Future<ResultsMessage> message = core.executeRequest(reqMsg.getExecutionId(), reqMsg);
ResultsMessage rm = message.get(500000, TimeUnit.MILLISECONDS);
assertNull(rm.getException());
- assertEquals(2, rm.getResults().length);
+
+ int rowsPerBatch = 8;
+ assertEquals(rowsPerBatch, rm.getResults().length);
RequestWorkItem item = core.getRequestWorkItem(DQPWorkContext.getWorkContext().getRequestID(reqMsg.getExecutionId()));
- message = core.processCursorRequest(reqMsg.getExecutionId(), 3, 2);
+ message = core.processCursorRequest(reqMsg.getExecutionId(), 9, rowsPerBatch);
rm = message.get(500000, TimeUnit.MILLISECONDS);
assertNull(rm.getException());
- assertEquals(2, rm.getResults().length);
+ assertEquals(rowsPerBatch, rm.getResults().length);
//ensure that we are idle
for (int i = 0; i < 10 && item.getThreadState() != ThreadState.IDLE; i++) {
Thread.sleep(100);
}
assertEquals(ThreadState.IDLE, item.getThreadState());
- assertTrue(item.resultsBuffer.getManagedRowCount() <= 46);
+ assertTrue(item.resultsBuffer.getManagedRowCount() <= rowsPerBatch*23);
//pull the rest of the results
for (int j = 0; j < 48; j++) {
item = core.getRequestWorkItem(DQPWorkContext.getWorkContext().getRequestID(reqMsg.getExecutionId()));
- message = core.processCursorRequest(reqMsg.getExecutionId(), j * 2 + 5, 2);
+ message = core.processCursorRequest(reqMsg.getExecutionId(), (j + 2) * rowsPerBatch + 1, rowsPerBatch);
rm = message.get(5000, TimeUnit.MILLISECONDS);
assertNull(rm.getException());
- assertEquals(2, rm.getResults().length);
+ assertEquals(rowsPerBatch, rm.getResults().length);
}
}
@@ -353,7 +355,7 @@
Future<ResultsMessage> message = core.executeRequest(reqMsg.getExecutionId(), reqMsg);
ResultsMessage rm = message.get(500000, TimeUnit.MILLISECONDS);
assertNull(rm.getException());
- assertEquals(2, rm.getResults().length);
+ assertEquals(8, rm.getResults().length);
RequestWorkItem item = core.getRequestWorkItem(DQPWorkContext.getWorkContext().getRequestID(reqMsg.getExecutionId()));
assertEquals(100, item.resultsBuffer.getRowCount());
}
Modified: trunk/engine/src/test/java/org/teiid/query/processor/TestProcessor.java
===================================================================
--- trunk/engine/src/test/java/org/teiid/query/processor/TestProcessor.java 2011-09-12 14:56:06 UTC (rev 3464)
+++ trunk/engine/src/test/java/org/teiid/query/processor/TestProcessor.java 2011-09-12 18:23:57 UTC (rev 3465)
@@ -365,7 +365,6 @@
props.setProperty("soap_port", "12345"); //$NON-NLS-1$ //$NON-NLS-2$
CommandContext context = new CommandContext("0", "test", "user", null, "myvdb", 1, props, DEBUG); //$NON-NLS-1$ //$NON-NLS-2$ //$NON-NLS-3$ //$NON-NLS-4$
context.setProcessorBatchSize(BufferManager.DEFAULT_PROCESSOR_BATCH_SIZE);
- context.setConnectorBatchSize(BufferManager.DEFAULT_CONNECTOR_BATCH_SIZE);
context.setBufferManager(BufferManagerFactory.getStandaloneBufferManager());
context.setPreparedPlanCache(new SessionAwareCache<PreparedPlan>());
return context;
@@ -1080,7 +1079,6 @@
CommandContext context = createCommandContext();
context.setProcessorBatchSize(2);
- context.setConnectorBatchSize(2);
context.setMetadata(RealMetadataFactory.example1Cached());
// Plan query
Modified: trunk/engine/src/test/java/org/teiid/query/processor/relational/TestJoinNode.java
===================================================================
--- trunk/engine/src/test/java/org/teiid/query/processor/relational/TestJoinNode.java 2011-09-12 14:56:06 UTC (rev 3464)
+++ trunk/engine/src/test/java/org/teiid/query/processor/relational/TestJoinNode.java 2011-09-12 18:23:57 UTC (rev 3465)
@@ -33,9 +33,9 @@
import org.junit.Before;
import org.junit.Test;
import org.teiid.common.buffer.BlockedException;
-import org.teiid.common.buffer.BufferManager;
import org.teiid.common.buffer.BufferManagerFactory;
import org.teiid.common.buffer.TupleBatch;
+import org.teiid.common.buffer.impl.BufferManagerImpl;
import org.teiid.core.TeiidComponentException;
import org.teiid.core.TeiidProcessingException;
import org.teiid.core.types.DataTypeManager;
@@ -232,7 +232,8 @@
}
public void helpTestJoinDirect(List[] expectedResults, int batchSize, int processingBytes) throws TeiidComponentException, TeiidProcessingException {
- BufferManager mgr = BufferManagerFactory.getTestBufferManager(processingBytes, batchSize);
+ BufferManagerImpl mgr = BufferManagerFactory.getTestBufferManager(processingBytes, batchSize);
+ mgr.setTargetBytesPerRow(100);
CommandContext context = new CommandContext("pid", "test", null, null, 1); //$NON-NLS-1$ //$NON-NLS-2$
join.addChild(leftNode);
Modified: trunk/engine/src/test/java/org/teiid/query/processor/relational/TestProjectIntoNode.java
===================================================================
--- trunk/engine/src/test/java/org/teiid/query/processor/relational/TestProjectIntoNode.java 2011-09-12 14:56:06 UTC (rev 3464)
+++ trunk/engine/src/test/java/org/teiid/query/processor/relational/TestProjectIntoNode.java 2011-09-12 18:23:57 UTC (rev 3465)
@@ -72,10 +72,9 @@
ElementSymbol elementSymbol_2 = new ElementSymbol("myGroup.myElement2"); //$NON-NLS-1$
elementSymbol_1.setType(Integer.class);
elementSymbol_2.setType(String.class);
- ArrayList elements = new ArrayList();
- elements.add(elementSymbol_1);
- elements.add(elementSymbol_2);
+ List<ElementSymbol> elements = Arrays.asList(elementSymbol_1, elementSymbol_2);
node.setIntoElements(elements);
+ child.setElements(elements);
node.setMode(mode);
node.setModelName("myModel"); //$NON-NLS-1$
Modified: trunk/runtime/src/main/java/org/teiid/services/BufferServiceImpl.java
===================================================================
--- trunk/runtime/src/main/java/org/teiid/services/BufferServiceImpl.java 2011-09-12 14:56:06 UTC (rev 3464)
+++ trunk/runtime/src/main/java/org/teiid/services/BufferServiceImpl.java 2011-09-12 18:23:57 UTC (rev 3465)
@@ -34,6 +34,7 @@
import org.teiid.common.buffer.impl.BufferManagerImpl;
import org.teiid.common.buffer.impl.FileStorageManager;
import org.teiid.common.buffer.impl.MemoryStorageManager;
+import org.teiid.common.buffer.impl.SplittableStorageManager;
import org.teiid.core.TeiidComponentException;
import org.teiid.core.TeiidRuntimeException;
import org.teiid.core.util.FileUtils;
@@ -61,7 +62,7 @@
private int processorBatchSize = BufferManager.DEFAULT_PROCESSOR_BATCH_SIZE;
private int connectorBatchSize = BufferManager.DEFAULT_CONNECTOR_BATCH_SIZE;
private int maxOpenFiles = FileStorageManager.DEFAULT_MAX_OPEN_FILES;
- private long maxFileSize = FileStorageManager.DEFAULT_MAX_FILESIZE; // 2GB
+ private long maxFileSize = SplittableStorageManager.DEFAULT_MAX_FILESIZE; // 2GB
private int maxProcessingKb = BufferManager.DEFAULT_MAX_PROCESSING_KB;
private int maxReserveKb = BufferManager.DEFAULT_RESERVE_BUFFER_KB;
private long maxBufferSpace = FileStorageManager.DEFAULT_MAX_BUFFERSPACE;
@@ -100,11 +101,12 @@
// Get the properties for FileStorageManager and create.
fsm = new FileStorageManager();
fsm.setStorageDirectory(bufferDir.getCanonicalPath());
- fsm.setMaxFileSize(maxFileSize);
fsm.setMaxOpenFiles(maxOpenFiles);
fsm.setMaxBufferSpace(maxBufferSpace*MB);
- fsm.initialize();
- this.bufferMgr.setStorageManager(fsm);
+ SplittableStorageManager ssm = new SplittableStorageManager(fsm);
+ ssm.setMaxFileSize(maxFileSize);
+ ssm.initialize();
+ this.bufferMgr.setStorageManager(ssm);
} else {
this.bufferMgr.setStorageManager(new MemoryStorageManager());
}
Modified: trunk/runtime/src/test/java/org/teiid/dqp/service/buffer/TestLocalBufferService.java
===================================================================
--- trunk/runtime/src/test/java/org/teiid/dqp/service/buffer/TestLocalBufferService.java 2011-09-12 14:56:06 UTC (rev 3464)
+++ trunk/runtime/src/test/java/org/teiid/dqp/service/buffer/TestLocalBufferService.java 2011-09-12 18:23:57 UTC (rev 3465)
@@ -31,6 +31,7 @@
import org.teiid.common.buffer.BufferManager;
import org.teiid.common.buffer.impl.BufferManagerImpl;
import org.teiid.common.buffer.impl.FileStorageManager;
+import org.teiid.common.buffer.impl.SplittableStorageManager;
import org.teiid.core.types.DataTypeManager;
import org.teiid.core.util.UnitTestUtil;
import org.teiid.query.sql.symbol.Constant;
@@ -53,7 +54,8 @@
assertTrue(svc.isUseDisk());
BufferManagerImpl mgr = (BufferManagerImpl) svc.getBufferManager();
- assertTrue(((FileStorageManager)mgr.getStorageManager()).getDirectory().endsWith(svc.getBufferDirectory().getName()));
+ SplittableStorageManager ssm = (SplittableStorageManager)mgr.getStorageManager();
+ assertTrue(((FileStorageManager)ssm.getStorageManager()).getDirectory().endsWith(svc.getBufferDirectory().getName()));
}
@Test public void testCheckMemPropertyGotSet2() throws Exception {
@@ -91,7 +93,8 @@
svc.start();
BufferManager mgr = svc.getBufferManager();
- assertEquals(13141, mgr.getSchemaSize(schema));
+ assertEquals(6570, mgr.getSchemaSize(schema));
+ assertEquals(256, mgr.getProcessorBatchSize(schema));
}
}
12 years, 8 months
teiid SVN: r3464 - in branches/as7: build/kits/jboss-as7/domain and 17 other directories.
by teiid-commits@lists.jboss.org
Author: rareddy
Date: 2011-09-12 10:56:06 -0400 (Mon, 12 Sep 2011)
New Revision: 3464
Added:
branches/as7/build/kits/jboss-as7/domain/configuration/
branches/as7/build/kits/jboss-as7/domain/configuration/domain-teiid.xml
branches/as7/jboss-integration/src/main/java/org/teiid/jboss/JGroupsObjectReplicatorService.java
branches/as7/jboss-integration/src/main/java/org/teiid/jboss/TeiidSubsystemDescribe.java
Removed:
branches/as7/cache-jbosscache/src/main/java/org/teiid/cache/jboss/ClusteredTupleBatchCacheLoader.java
branches/as7/cache-jbosscache/src/main/java/org/teiid/cache/jboss/ExpirationAwareCache.java
branches/as7/cache-jbosscache/src/main/java/org/teiid/cache/jboss/JBossCacheListener.java
branches/as7/cache-jbosscache/src/main/java/org/teiid/cache/jboss/TupleBatchCacheLoader.java
branches/as7/cache-jbosscache/src/main/java/org/teiid/cache/jboss/TupleBatchCacheLoaderConfig.java
Modified:
branches/as7/build/kits/jboss-as7/modules/org/jboss/teiid/main/module.xml
branches/as7/build/kits/jboss-as7/standalone/configuration/standalone-teiid.xml
branches/as7/cache-jbosscache/pom.xml
branches/as7/cache-jbosscache/src/main/java/org/teiid/cache/jboss/JBossCache.java
branches/as7/cache-jbosscache/src/main/java/org/teiid/cache/jboss/JBossCacheFactory.java
branches/as7/cache-jbosscache/src/main/java/org/teiid/replication/jboss/JGroupsObjectReplicator.java
branches/as7/jboss-integration/pom.xml
branches/as7/jboss-integration/src/main/java/org/teiid/jboss/BufferManagerService.java
branches/as7/jboss-integration/src/main/java/org/teiid/jboss/Configuration.java
branches/as7/jboss-integration/src/main/java/org/teiid/jboss/Element.java
branches/as7/jboss-integration/src/main/java/org/teiid/jboss/ObjectsSerializerService.java
branches/as7/jboss-integration/src/main/java/org/teiid/jboss/QueryEngineAdd.java
branches/as7/jboss-integration/src/main/java/org/teiid/jboss/QueryEngineOperationHandler.java
branches/as7/jboss-integration/src/main/java/org/teiid/jboss/QueryEngineReferenceFactoryService.java
branches/as7/jboss-integration/src/main/java/org/teiid/jboss/QueryEngineRemove.java
branches/as7/jboss-integration/src/main/java/org/teiid/jboss/SystemVDBService.java
branches/as7/jboss-integration/src/main/java/org/teiid/jboss/TeiidBootServicesAdd.java
branches/as7/jboss-integration/src/main/java/org/teiid/jboss/TeiidExtension.java
branches/as7/jboss-integration/src/main/java/org/teiid/jboss/TeiidServiceNames.java
branches/as7/jboss-integration/src/main/java/org/teiid/jboss/TeiidSubsystemParser.java
branches/as7/jboss-integration/src/main/java/org/teiid/jboss/TranslatorAdd.java
branches/as7/jboss-integration/src/main/java/org/teiid/jboss/TranslatorRemove.java
branches/as7/jboss-integration/src/main/java/org/teiid/jboss/VDBDependencyProcessor.java
branches/as7/jboss-integration/src/main/java/org/teiid/jboss/VDBDeployer.java
branches/as7/jboss-integration/src/main/java/org/teiid/jboss/VDBParserDeployer.java
branches/as7/jboss-integration/src/main/java/org/teiid/jboss/VDBRepositoryService.java
branches/as7/jboss-integration/src/main/java/org/teiid/jboss/VDBService.java
branches/as7/jboss-integration/src/main/java/org/teiid/jboss/VDBStructure.java
branches/as7/jboss-integration/src/main/java/org/teiid/jboss/deployers/RuntimeEngineDeployer.java
branches/as7/jboss-integration/src/main/resources/org/teiid/jboss/i18n.properties
branches/as7/jboss-integration/src/main/resources/schema/jboss-teiid.xsd
branches/as7/pom.xml
branches/as7/runtime/src/main/java/org/teiid/transport/ODBCSocketListener.java
branches/as7/runtime/src/main/java/org/teiid/transport/SocketListener.java
branches/as7/runtime/src/test/java/org/teiid/transport/TestCommSockets.java
branches/as7/runtime/src/test/java/org/teiid/transport/TestFailover.java
branches/as7/test-integration/common/pom.xml
branches/as7/test-integration/common/src/test/java/org/teiid/systemmodel/TestMatViewReplication.java
branches/as7/test-integration/common/src/test/java/org/teiid/transport/TestJDBCSocketTransport.java
branches/as7/test-integration/common/src/test/java/org/teiid/transport/TestODBCSocketTransport.java
branches/as7/test-integration/pom.xml
Log:
TEIID-1720: Configured Object Replicator and Domain Mode
Copied: branches/as7/build/kits/jboss-as7/domain/configuration/domain-teiid.xml (from rev 3454, branches/as7/build/kits/jboss-as7/domain/domain-teiid.xml)
===================================================================
--- branches/as7/build/kits/jboss-as7/domain/configuration/domain-teiid.xml (rev 0)
+++ branches/as7/build/kits/jboss-as7/domain/configuration/domain-teiid.xml 2011-09-12 14:56:06 UTC (rev 3464)
@@ -0,0 +1,749 @@
+<!--
+ ~ JBoss, Home of Professional Open Source.
+ ~ Copyright 2010, Red Hat, Inc., and individual contributors
+ ~ as indicated by the @author tags. See the copyright.txt file in the
+ ~ distribution for a full listing of individual contributors.
+ ~
+ ~ This is free software; you can redistribute it and/or modify it
+ ~ under the terms of the GNU Lesser General Public License as
+ ~ published by the Free Software Foundation; either version 2.1 of
+ ~ the License, or (at your option) any later version.
+ ~
+ ~ This software is distributed in the hope that it will be useful,
+ ~ but WITHOUT ANY WARRANTY; without even the implied warranty of
+ ~ MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
+ ~ Lesser General Public License for more details.
+ ~
+ ~ You should have received a copy of the GNU Lesser General Public
+ ~ License along with this software; if not, write to the Free
+ ~ Software Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA
+ ~ 02110-1301 USA, or see the FSF site: http://www.fsf.org.
+ -->
+
+<domain xmlns="urn:jboss:domain:1.0">
+
+ <extensions>
+ <extension module="org.jboss.as.clustering.infinispan"/>
+ <extension module="org.jboss.as.clustering.jgroups"/>
+ <extension module="org.jboss.as.connector"/>
+ <extension module="org.jboss.as.ee"/>
+ <extension module="org.jboss.as.ejb3"/>
+ <extension module="org.jboss.as.jaxrs"/>
+ <extension module="org.jboss.as.jmx"/>
+ <extension module="org.jboss.as.jpa"/>
+ <extension module="org.jboss.as.logging"/>
+ <extension module="org.jboss.as.modcluster"/>
+ <extension module="org.jboss.as.naming"/>
+ <extension module="org.jboss.as.osgi"/>
+ <extension module="org.jboss.as.remoting"/>
+ <extension module="org.jboss.as.sar"/>
+ <extension module="org.jboss.as.security"/>
+ <extension module="org.jboss.teiid"/>
+ <extension module="org.jboss.as.threads"/>
+ <extension module="org.jboss.as.transactions"/>
+ <extension module="org.jboss.as.web"/>
+ <extension module="org.jboss.as.weld"/>
+ </extensions>
+
+ <system-properties>
+ <!-- IPv4 is not required, but setting this helps avoid unintended use of IPv6 -->
+ <property name="java.net.preferIPv4Stack" value="true"/>
+ </system-properties>
+
+ <profiles>
+ <profile name="default">
+ <subsystem xmlns="urn:jboss:domain:logging:1.1">
+ <console-handler name="CONSOLE">
+ <level name="INFO"/>
+ <formatter>
+ <pattern-formatter pattern="%d{HH:mm:ss,SSS} %-5p [%c] (%t) %s%E%n"/>
+ </formatter>
+ </console-handler>
+
+ <periodic-rotating-file-handler name="FILE">
+ <level name="INFO"/>
+ <formatter>
+ <pattern-formatter pattern="%d{HH:mm:ss,SSS} %-5p [%c] (%t) %s%E%n"/>
+ </formatter>
+ <file relative-to="jboss.server.log.dir" path="server.log"/>
+ <suffix value=".yyyy-MM-dd"/>
+ </periodic-rotating-file-handler>
+
+ <logger category="com.arjuna">
+ <level name="WARN"/>
+ </logger>
+ <logger category="org.apache.tomcat.util.modeler">
+ <level name="WARN"/>
+ </logger>
+ <logger category="sun.rmi">
+ <level name="WARN"/>
+ </logger>
+
+ <root-logger>
+ <level name="INFO"/>
+ <handlers>
+ <handler name="CONSOLE"/>
+ <handler name="FILE"/>
+ </handlers>
+ </root-logger>
+ </subsystem>
+ <subsystem xmlns="urn:jboss:domain:datasources:1.0">
+ <datasources>
+ <datasource jndi-name="java:jboss/datasources/ExampleDS" enabled="true" use-java-context="true" pool-name="H2DS">
+ <connection-url>jdbc:h2:mem:test;DB_CLOSE_DELAY=-1</connection-url>
+ <driver>h2</driver>
+ <pool></pool>
+ <security>
+ <user-name>sa</user-name>
+ <password>sa</password>
+ </security>
+ </datasource>
+ <datasource jndi-name="java:/Oracle11_PushDS" pool-name="OracleDS" enabled="true" jta="true" use-java-context="true" use-ccm="true">
+ <connection-url>jdbc:oracle:thin:@englxdbs11.mw.lab.eng.bos.redhat.com:1521:orcl</connection-url>
+ <driver>oracle</driver>
+ <pool>
+ <prefill>false</prefill>
+ <use-strict-min>false</use-strict-min>
+ <flush-strategy>FailingConnectionOnly</flush-strategy>
+ </pool>
+ <security>
+ <user-name>bqt2_ro</user-name>
+ <password>mm</password>
+ </security>
+ </datasource>
+ <drivers>
+ <driver name="h2" module="com.h2database.h2">
+ <xa-datasource-class>org.h2.jdbcx.JdbcDataSource</xa-datasource-class>
+ </driver>
+ <driver name="oracle" module="com.oracle">
+ <xa-datasource-class>oracle.jdbc.xa.client.OracleXADataSource</xa-datasource-class>
+ </driver>
+ </drivers>
+ </datasources>
+ </subsystem>
+ <subsystem xmlns="urn:jboss:domain:ee:1.0"/>
+ <subsystem xmlns="urn:jboss:domain:ejb3:1.1" lite="true">
+ <!-- EJB3 pools -->
+ <pools>
+ <bean-instance-pools>
+ <strict-max-pool name="slsb-strict-max-pool" max-pool-size="20" instance-acquisition-timeout="5"
+ instance-acquisition-timeout-unit="MINUTES"/>
+ </bean-instance-pools>
+ </pools>
+
+ <!-- Session bean configurations -->
+ <session-bean>
+ <stateless>
+ <bean-instance-pool-ref pool-name="slsb-strict-max-pool"/>
+ </stateless>
+ </session-bean>
+
+ </subsystem>
+ <subsystem xmlns="urn:jboss:domain:infinispan:1.0" default-cache-container="hibernate">
+ <cache-container name="hibernate" default-cache="local-query">
+ <local-cache name="entity">
+ <eviction strategy="LRU" max-entries="10000"/>
+ <expiration max-idle="100000"/>
+ </local-cache>
+ <local-cache name="local-query">
+ <eviction strategy="LRU" max-entries="10000"/>
+ <expiration max-idle="100000"/>
+ </local-cache>
+ <local-cache name="timestamps">
+ <eviction strategy="NONE"/>
+ </local-cache>
+ </cache-container>
+ <cache-container name="teiid" default-cache="resultset">
+ <local-cache name="resultset">
+ <expiration lifespan="7200" />
+ <eviction max-entries="1024" strategy="LRU"/>
+ </local-cache>
+ </cache-container>
+ </subsystem>
+ <subsystem xmlns="urn:jboss:domain:jaxrs:1.0"/>
+ <subsystem xmlns="urn:jboss:domain:jca:1.0">
+ <archive-validation enabled="true"/>
+ <bean-validation enabled="true"/>
+ <default-workmanager>
+ <short-running-threads blocking="true">
+ <core-threads count="10" per-cpu="20"/>
+ <queue-length count="10" per-cpu="20"/>
+ <max-threads count="10" per-cpu="20"/>
+ <keepalive-time time="10" unit="seconds"/>
+ </short-running-threads>
+ <long-running-threads blocking="true">
+ <core-threads count="10" per-cpu="20"/>
+ <queue-length count="10" per-cpu="20"/>
+ <max-threads count="10" per-cpu="20"/>
+ <keepalive-time time="10" unit="seconds"/>
+ </long-running-threads>
+ </default-workmanager>
+ </subsystem>
+ <subsystem xmlns="urn:jboss:domain:jmx:1.0">
+ <jmx-connector registry-binding="jmx-connector-registry" server-binding="jmx-connector-server" />
+ </subsystem>
+ <subsystem xmlns="urn:jboss:domain:jpa:1.0">
+ <jpa default-datasource=""/>
+ </subsystem>
+ <subsystem xmlns="urn:jboss:domain:naming:1.0"/>
+ <subsystem xmlns="urn:jboss:domain:osgi:1.0" activation="lazy">
+ <configuration pid="org.apache.felix.webconsole.internal.servlet.OsgiManager">
+ <property name="manager.root">jboss-osgi</property>
+ </configuration>
+ <properties>
+ <!--
+ A comma seperated list of module identifiers. Each system module
+ is added as a dependency to the OSGi framework module. The packages
+ from these system modules can be made visible as framework system packages.
+ http://www.osgi.org/javadoc/r4v42/org/osgi/framework/Constants.html#FRAME...
+ -->
+ <property name="org.jboss.osgi.system.modules">
+ org.apache.commons.logging,
+ org.apache.log4j,
+ org.jboss.as.osgi,
+ org.slf4j,
+ </property>
+ <!--
+ Framework environment property identifying extra packages which the system bundle
+ must export from the current execution environment
+ -->
+ <property name="org.osgi.framework.system.packages.extra">
+ org.apache.commons.logging;version=1.1.1,
+ org.apache.log4j;version=1.2,
+ org.jboss.as.osgi.service;version=7.0,
+ org.jboss.osgi.deployment.interceptor;version=1.0,
+ org.jboss.osgi.spi.capability;version=1.0,
+ org.jboss.osgi.spi.util;version=1.0,
+ org.jboss.osgi.testing;version=1.0,
+ org.jboss.osgi.vfs;version=1.0,
+ org.slf4j;version=1.5.10,
+ </property>
+ <!-- Specifies the beginning start level of the framework -->
+ <property name="org.osgi.framework.startlevel.beginning">1</property>
+ </properties>
+ <modules>
+ <!-- modules registered with the OSGi layer on startup -->
+ <module identifier="javaee.api"/>
+ <module identifier="org.jboss.logging"/>
+ <!-- bundles installed on startup -->
+ <module identifier="org.apache.aries.util"/>
+ <module identifier="org.jboss.osgi.webconsole"/>
+ <module identifier="org.osgi.compendium"/>
+ <!-- bundles started in startlevel 1 -->
+ <module identifier="org.apache.felix.log" startlevel="1"/>
+ <module identifier="org.jboss.osgi.logging" startlevel="1"/>
+ <module identifier="org.apache.felix.configadmin" startlevel="1"/>
+ <module identifier="org.jboss.as.osgi.configadmin" startlevel="1"/>
+ <!-- bundles started in startlevel 2 -->
+ <module identifier="org.apache.aries.jmx" startlevel="2"/>
+ <module identifier="org.apache.felix.eventadmin" startlevel="2"/>
+ <module identifier="org.apache.felix.metatype" startlevel="2"/>
+ <module identifier="org.apache.felix.webconsole" startlevel="2"/>
+ <module identifier="org.jboss.osgi.jmx" startlevel="2"/>
+ <module identifier="org.jboss.osgi.http" startlevel="2"/>
+ <!-- bundles started in startlevel 3 -->
+ <module identifier="org.jboss.osgi.blueprint" startlevel="3"/>
+ <module identifier="org.jboss.osgi.webapp" startlevel="3"/>
+ <module identifier="org.jboss.osgi.xerces" startlevel="3"/>
+ </modules>
+ </subsystem>
+ <subsystem xmlns="urn:jboss:domain:remoting:1.0"/>
+ <subsystem xmlns="urn:jboss:domain:resource-adapters:1.0"/>
+ <subsystem xmlns="urn:jboss:domain:sar:1.0"/>
+ <subsystem xmlns="urn:jboss:domain:security:1.0">
+ <security-domains>
+ <security-domain name="other">
+ <authentication>
+ <login-module code="UsersRoles" flag="required"/>
+ </authentication>
+ </security-domain>
+ <security-domain name="teiid-security" cache-type="default">
+ <authentication>
+ <login-module code="UsersRoles" flag="required">
+ <module-option name="usersProperties" value="teiid-security-users.properties"/>
+ <module-option name="rolesProperties" value="teiid-security-roles.properties"/>
+ </login-module>
+ </authentication>
+ </security-domain>
+ </security-domains>
+ </subsystem>
+ <subsystem xmlns="urn:jboss:domain:teiid:1.0">
+ <async-thread-group>teiid-async</async-thread-group>
+ <resultset-cache container-name="teiid" name="resultset"/>
+
+ <query-engine name = "default">
+ <security-domain>teiid-security</security-domain>
+ <jdbc socket-binding="teiid-jdbc"/>
+ <odbc socket-binding="teiid-odbc"/>
+ </query-engine>
+
+ <translator name="jdbc-simple" module="org.jboss.teiid.translator.jdbc"/>
+ <translator name="jdbc-ansi" module="org.jboss.teiid.translator.jdbc"/>
+ <translator name="access" module="org.jboss.teiid.translator.jdbc"/>
+ <translator name="db2" module="org.jboss.teiid.translator.jdbc"/>
+ <translator name="derby" module="org.jboss.teiid.translator.jdbc"/>
+ <translator name="h2" module="org.jboss.teiid.translator.jdbc"/>
+ <translator name="hsql" module="org.jboss.teiid.translator.jdbc"/>
+ <translator name="informix" module="org.jboss.teiid.translator.jdbc"/>
+ <translator name="metamatrix" module="org.jboss.teiid.translator.jdbc"/>
+ <translator name="mysql" module="org.jboss.teiid.translator.jdbc"/>
+ <translator name="mysql5" module="org.jboss.teiid.translator.jdbc"/>
+ <translator name="oracle" module="org.jboss.teiid.translator.jdbc"/>
+ <translator name="postgresql" module="org.jboss.teiid.translator.jdbc"/>
+ <translator name="sqlserver" module="org.jboss.teiid.translator.jdbc"/>
+ <translator name="sybase" module="org.jboss.teiid.translator.jdbc"/>
+ <translator name="teiid" module="org.jboss.teiid.translator.jdbc"/>
+ <translator name="teradata" module="org.jboss.teiid.translator.jdbc"/>
+ <translator name="modeshape" module="org.jboss.teiid.translator.jdbc"/>
+ <translator name="ingres" module="org.jboss.teiid.translator.jdbc"/>
+ <translator name="ingres93" module="org.jboss.teiid.translator.jdbc"/>
+ <translator name="intersystems-cache" module="org.jboss.teiid.translator.jdbc"/>
+ <translator name="netezza" module="org.jboss.teiid.translator.jdbc"/>
+ <translator name="file" module="org.jboss.teiid.translator.file"/>
+ <translator name="ldap" module="org.jboss.teiid.translator.ldap"/>
+ <translator name="loopback" module="org.jboss.teiid.translator.loopback"/>
+ <translator name="olap" module="org.jboss.teiid.translator.olap"/>
+ <translator name="ws" module="org.jboss.teiid.translator.ws"/>
+ </subsystem>
+
+ <subsystem xmlns="urn:jboss:domain:threads:1.0">
+ <queueless-thread-pool name="teiid-async">
+ <max-threads count="2" per-cpu="2" />
+ </queueless-thread-pool>
+ </subsystem>
+ <subsystem xmlns="urn:jboss:domain:transactions:1.0">
+ <recovery-environment socket-binding="txn-recovery-environment" status-socket-binding="txn-status-manager"/>
+ <core-environment>
+ <process-id>
+ <uuid />
+ </process-id>
+ </core-environment>
+ <coordinator-environment default-timeout="300"/>
+ </subsystem>
+ <subsystem xmlns="urn:jboss:domain:web:1.0" default-virtual-server="default-host">
+ <connector name="http" scheme="http" protocol="HTTP/1.1" socket-binding="http"/>
+ <virtual-server name="default-host">
+ <alias name="localhost" />
+ <alias name="example.com" />
+ </virtual-server>
+ </subsystem>
+ <subsystem xmlns="urn:jboss:domain:weld:1.0"/>
+ </profile>
+
+ <profile name="ha">
+ <subsystem xmlns="urn:jboss:domain:logging:1.1">
+ <console-handler name="CONSOLE">
+ <level name="INFO"/>
+ <formatter>
+ <pattern-formatter pattern="%d{HH:mm:ss,SSS} %-5p [%c] (%t) %s%E%n"/>
+ </formatter>
+ </console-handler>
+
+ <periodic-rotating-file-handler name="FILE">
+ <level name="INFO"/>
+ <formatter>
+ <pattern-formatter pattern="%d{HH:mm:ss,SSS} %-5p [%c] (%t) %s%E%n"/>
+ </formatter>
+ <file relative-to="jboss.server.log.dir" path="server.log"/>
+ <suffix value=".yyyy-MM-dd"/>
+ </periodic-rotating-file-handler>
+
+ <logger category="com.arjuna">
+ <level name="WARN"/>
+ </logger>
+ <logger category="org.apache.tomcat.util.modeler">
+ <level name="WARN"/>
+ </logger>
+ <logger category="sun.rmi">
+ <level name="WARN"/>
+ </logger>
+
+ <root-logger>
+ <level name="INFO"/>
+ <handlers>
+ <handler name="CONSOLE"/>
+ <handler name="FILE"/>
+ </handlers>
+ </root-logger>
+ </subsystem>
+ <subsystem xmlns="urn:jboss:domain:datasources:1.0">
+ <datasources>
+ <datasource jndi-name="java:jboss/datasources/ExampleDS" enabled="true" use-java-context="true" pool-name="H2DS">
+ <connection-url>jdbc:h2:mem:test;DB_CLOSE_DELAY=-1</connection-url>
+ <driver>h2</driver>
+ <pool></pool>
+ <security>
+ <user-name>sa</user-name>
+ <password>sa</password>
+ </security>
+ </datasource>
+ <datasource jndi-name="java:/Oracle11_PushDS" pool-name="OracleDS" enabled="true" jta="true" use-java-context="true" use-ccm="true">
+ <connection-url>jdbc:oracle:thin:@englxdbs11.mw.lab.eng.bos.redhat.com:1521:orcl</connection-url>
+ <driver>oracle</driver>
+ <pool>
+ <prefill>false</prefill>
+ <use-strict-min>false</use-strict-min>
+ <flush-strategy>FailingConnectionOnly</flush-strategy>
+ </pool>
+ <security>
+ <user-name>bqt2_ro</user-name>
+ <password>mm</password>
+ </security>
+ </datasource>
+ <drivers>
+ <driver name="h2" module="com.h2database.h2">
+ <xa-datasource-class>org.h2.jdbcx.JdbcDataSource</xa-datasource-class>
+ </driver>
+ <driver name="oracle" module="com.oracle">
+ <xa-datasource-class>oracle.jdbc.xa.client.OracleXADataSource</xa-datasource-class>
+ </driver>
+ </drivers>
+ </datasources>
+ </subsystem>
+ <subsystem xmlns="urn:jboss:domain:ee:1.0"/>
+ <subsystem xmlns="urn:jboss:domain:ejb3:1.1" lite="true">
+ <!-- EJB3 pools -->
+ <pools>
+ <bean-instance-pools>
+ <strict-max-pool name="slsb-strict-max-pool" max-pool-size="20" instance-acquisition-timeout="5"
+ instance-acquisition-timeout-unit="MINUTES"/>
+ </bean-instance-pools>
+ </pools>
+
+ <!-- Session bean configurations -->
+ <session-bean>
+ <stateless>
+ <bean-instance-pool-ref pool-name="slsb-strict-max-pool"/>
+ </stateless>
+ </session-bean>
+
+ </subsystem>
+ <subsystem xmlns="urn:jboss:domain:infinispan:1.0" default-cache-container="cluster">
+ <cache-container name="cluster" default-cache="default">
+ <alias>ha-partition</alias>
+ <replicated-cache name="default" mode="SYNC" batching="true">
+ <locking isolation="REPEATABLE_READ"/>
+ </replicated-cache>
+ </cache-container>
+ <cache-container name="web" default-cache="repl">
+ <alias>standard-session-cache</alias>
+ <replicated-cache name="repl" mode="ASYNC" batching="true">
+ <locking isolation="REPEATABLE_READ"/>
+ <file-store/>
+ </replicated-cache>
+ <distributed-cache name="dist" mode="ASYNC" batching="true">
+ <locking isolation="REPEATABLE_READ"/>
+ <file-store/>
+ </distributed-cache>
+ </cache-container>
+ <cache-container name="sfsb" default-cache="repl">
+ <alias>sfsb-cache</alias>
+ <alias>jboss.cache:service=EJB3SFSBClusteredCache</alias>
+ <replicated-cache name="repl" mode="ASYNC" batching="true">
+ <locking isolation="REPEATABLE_READ"/>
+ <eviction strategy="LRU" max-entries="10000"/>
+ <file-store/>
+ </replicated-cache>
+ </cache-container>
+ <cache-container name="hibernate" default-cache="local-query">
+ <invalidation-cache name="entity" mode="SYNC">
+ <eviction strategy="LRU" max-entries="10000"/>
+ <expiration max-idle="100000"/>
+ </invalidation-cache>
+ <local-cache name="local-query">
+ <eviction strategy="LRU" max-entries="10000"/>
+ <expiration max-idle="100000"/>
+ </local-cache>
+ <replicated-cache name="timestamps" mode="ASYNC">
+ <eviction strategy="NONE"/>
+ </replicated-cache>
+ </cache-container>
+ <cache-container name="teiid" default-cache="resultset">
+ <replicated-cache name="resultset" mode="SYNC" batching="true">
+ <locking isolation="READ_COMMITTED"/>
+ <transaction mode="FULL_XA"/>
+ <expiration lifespan="7200" />
+ <eviction max-entries="1024" strategy="LRU"/>
+ </replicated-cache>
+ </cache-container>
+ </subsystem>
+ <subsystem xmlns="urn:jboss:domain:jaxrs:1.0"/>
+ <subsystem xmlns="urn:jboss:domain:jca:1.0">
+ <archive-validation enabled="true"/>
+ <bean-validation enabled="true"/>
+ <default-workmanager>
+ <short-running-threads blocking="true">
+ <core-threads count="10" per-cpu="20"/>
+ <queue-length count="10" per-cpu="20"/>
+ <max-threads count="10" per-cpu="20"/>
+ <keepalive-time time="10" unit="seconds"/>
+ </short-running-threads>
+ <long-running-threads blocking="true">
+ <core-threads count="10" per-cpu="20"/>
+ <queue-length count="10" per-cpu="20"/>
+ <max-threads count="10" per-cpu="20"/>
+ <keepalive-time time="10" unit="seconds"/>
+ </long-running-threads>
+ </default-workmanager>
+ </subsystem>
+ <subsystem xmlns="urn:jboss:domain:jgroups:1.0" default-stack="udp">
+ <stack name="udp">
+ <transport type="UDP" socket-binding="jgroups-udp" diagnostics-socket-binding="jgroups-diagnostics"/>
+ <protocol type="PING"/>
+ <protocol type="MERGE2"/>
+ <protocol type="FD_SOCK" socket-binding="jgroups-udp-fd"/>
+ <protocol type="FD"/>
+ <protocol type="VERIFY_SUSPECT"/>
+ <protocol type="BARRIER"/>
+ <protocol type="pbcast.NAKACK"/>
+ <protocol type="UNICAST"/>
+ <protocol type="pbcast.STABLE"/>
+ <protocol type="VIEW_SYNC"/>
+ <protocol type="pbcast.GMS"/>
+ <protocol type="UFC"/>
+ <protocol type="MFC"/>
+ <protocol type="FRAG2"/>
+ <protocol type="pbcast.STREAMING_STATE_TRANSFER"/>
+ <protocol type="pbcast.FLUSH"/>
+ </stack>
+ <stack name="tcp">
+ <transport type="TCP" socket-binding="jgroups-tcp" diagnostics-socket-binding="jgroups-diagnostics"/>
+ <protocol type="MPING" socket-binding="jgroups-mping"/>
+ <protocol type="MERGE2"/>
+ <protocol type="FD_SOCK" socket-binding="jgroups-tcp-fd"/>
+ <protocol type="FD"/>
+ <protocol type="VERIFY_SUSPECT"/>
+ <protocol type="BARRIER"/>
+ <protocol type="pbcast.NAKACK"/>
+ <protocol type="UNICAST"/>
+ <protocol type="pbcast.STABLE"/>
+ <protocol type="VIEW_SYNC"/>
+ <protocol type="pbcast.GMS"/>
+ <protocol type="UFC"/>
+ <protocol type="MFC"/>
+ <protocol type="FRAG2"/>
+ <protocol type="pbcast.STREAMING_STATE_TRANSFER"/>
+ <protocol type="pbcast.FLUSH"/>
+ </stack>
+ </subsystem>
+ <subsystem xmlns="urn:jboss:domain:jmx:1.0">
+ <jmx-connector registry-binding="jmx-connector-registry" server-binding="jmx-connector-server" />
+ </subsystem>
+ <subsystem xmlns="urn:jboss:domain:jpa:1.0">
+ <jpa default-datasource=""/>
+ </subsystem>
+ <subsystem xmlns="urn:jboss:domain:modcluster:1.0">
+ <mod-cluster-config advertise-socket="modcluster"/>
+ </subsystem>
+ <subsystem xmlns="urn:jboss:domain:naming:1.0"/>
+ <subsystem xmlns="urn:jboss:domain:osgi:1.0" activation="lazy">
+ <configuration pid="org.apache.felix.webconsole.internal.servlet.OsgiManager">
+ <property name="manager.root">jboss-osgi</property>
+ </configuration>
+ <properties>
+ <!--
+ A comma seperated list of module identifiers. Each system module
+ is added as a dependency to the OSGi framework module. The packages
+ from these system modules can be made visible as framework system packages.
+ http://www.osgi.org/javadoc/r4v42/org/osgi/framework/Constants.html#FRAME...
+ -->
+ <property name="org.jboss.osgi.system.modules">
+ org.apache.commons.logging,
+ org.apache.log4j,
+ org.jboss.as.osgi,
+ org.slf4j,
+ </property>
+ <!--
+ Framework environment property identifying extra packages which the system bundle
+ must export from the current execution environment
+ -->
+ <property name="org.osgi.framework.system.packages.extra">
+ org.apache.commons.logging;version=1.1.1,
+ org.apache.log4j;version=1.2,
+ org.jboss.as.osgi.service;version=7.0,
+ org.jboss.osgi.deployment.interceptor;version=1.0,
+ org.jboss.osgi.spi.capability;version=1.0,
+ org.jboss.osgi.spi.util;version=1.0,
+ org.jboss.osgi.testing;version=1.0,
+ org.jboss.osgi.vfs;version=1.0,
+ org.slf4j;version=1.5.10,
+ </property>
+ <!-- Specifies the beginning start level of the framework -->
+ <property name="org.osgi.framework.startlevel.beginning">1</property>
+ </properties>
+ <modules>
+ <!-- modules registered with the OSGi layer on startup -->
+ <module identifier="javaee.api"/>
+ <module identifier="org.jboss.logging"/>
+ <!-- bundles installed on startup -->
+ <module identifier="org.apache.aries.util"/>
+ <module identifier="org.jboss.osgi.webconsole"/>
+ <module identifier="org.osgi.compendium"/>
+ <!-- bundles started in startlevel 1 -->
+ <module identifier="org.apache.felix.log" startlevel="1"/>
+ <module identifier="org.jboss.osgi.logging" startlevel="1"/>
+ <module identifier="org.apache.felix.configadmin" startlevel="1"/>
+ <module identifier="org.jboss.as.osgi.configadmin" startlevel="1"/>
+ <!-- bundles started in startlevel 2 -->
+ <module identifier="org.apache.aries.jmx" startlevel="2"/>
+ <module identifier="org.apache.felix.eventadmin" startlevel="2"/>
+ <module identifier="org.apache.felix.metatype" startlevel="2"/>
+ <module identifier="org.apache.felix.webconsole" startlevel="2"/>
+ <module identifier="org.jboss.osgi.jmx" startlevel="2"/>
+ <module identifier="org.jboss.osgi.http" startlevel="2"/>
+ <!-- bundles started in startlevel 3 -->
+ <module identifier="org.jboss.osgi.blueprint" startlevel="3"/>
+ <module identifier="org.jboss.osgi.webapp" startlevel="3"/>
+ <module identifier="org.jboss.osgi.xerces" startlevel="3"/>
+ </modules>
+ </subsystem>
+ <subsystem xmlns="urn:jboss:domain:remoting:1.0"/>
+ <subsystem xmlns="urn:jboss:domain:resource-adapters:1.0"/>
+ <subsystem xmlns="urn:jboss:domain:sar:1.0"/>
+ <subsystem xmlns="urn:jboss:domain:security:1.0">
+ <security-domains>
+ <security-domain name="other">
+ <authentication>
+ <login-module code="UsersRoles" flag="required"/>
+ </authentication>
+ </security-domain>
+ <security-domain name="teiid-security" cache-type="default">
+ <authentication>
+ <login-module code="UsersRoles" flag="required">
+ <module-option name="usersProperties" value="teiid-security-users.properties"/>
+ <module-option name="rolesProperties" value="teiid-security-roles.properties"/>
+ </login-module>
+ </authentication>
+ </security-domain>
+ </security-domains>
+ </subsystem>
+ <subsystem xmlns="urn:jboss:domain:teiid:1.0">
+ <async-thread-group>teiid-async</async-thread-group>
+ <object-replicator stack="udp" cluster-name="teiid-rep"/>
+ <resultset-cache container-name="teiid" name="resultset"/>
+
+ <query-engine name = "default">
+ <security-domain>teiid-security</security-domain>
+ <jdbc socket-binding="teiid-jdbc"/>
+ <odbc socket-binding="teiid-odbc"/>
+ </query-engine>
+
+ <translator name="jdbc-simple" module="org.jboss.teiid.translator.jdbc"/>
+ <translator name="jdbc-ansi" module="org.jboss.teiid.translator.jdbc"/>
+ <translator name="access" module="org.jboss.teiid.translator.jdbc"/>
+ <translator name="db2" module="org.jboss.teiid.translator.jdbc"/>
+ <translator name="derby" module="org.jboss.teiid.translator.jdbc"/>
+ <translator name="h2" module="org.jboss.teiid.translator.jdbc"/>
+ <translator name="hsql" module="org.jboss.teiid.translator.jdbc"/>
+ <translator name="informix" module="org.jboss.teiid.translator.jdbc"/>
+ <translator name="metamatrix" module="org.jboss.teiid.translator.jdbc"/>
+ <translator name="mysql" module="org.jboss.teiid.translator.jdbc"/>
+ <translator name="mysql5" module="org.jboss.teiid.translator.jdbc"/>
+ <translator name="oracle" module="org.jboss.teiid.translator.jdbc"/>
+ <translator name="postgresql" module="org.jboss.teiid.translator.jdbc"/>
+ <translator name="sqlserver" module="org.jboss.teiid.translator.jdbc"/>
+ <translator name="sybase" module="org.jboss.teiid.translator.jdbc"/>
+ <translator name="teiid" module="org.jboss.teiid.translator.jdbc"/>
+ <translator name="teradata" module="org.jboss.teiid.translator.jdbc"/>
+ <translator name="modeshape" module="org.jboss.teiid.translator.jdbc"/>
+ <translator name="ingres" module="org.jboss.teiid.translator.jdbc"/>
+ <translator name="ingres93" module="org.jboss.teiid.translator.jdbc"/>
+ <translator name="intersystems-cache" module="org.jboss.teiid.translator.jdbc"/>
+ <translator name="netezza" module="org.jboss.teiid.translator.jdbc"/>
+ <translator name="file" module="org.jboss.teiid.translator.file"/>
+ <translator name="ldap" module="org.jboss.teiid.translator.ldap"/>
+ <translator name="loopback" module="org.jboss.teiid.translator.loopback"/>
+ <translator name="olap" module="org.jboss.teiid.translator.olap"/>
+ <translator name="ws" module="org.jboss.teiid.translator.ws"/>
+ </subsystem>
+ <subsystem xmlns="urn:jboss:domain:threads:1.0">
+ <queueless-thread-pool name="teiid-async">
+ <max-threads count="2" per-cpu="2" />
+ </queueless-thread-pool>
+ </subsystem>
+ <subsystem xmlns="urn:jboss:domain:transactions:1.0">
+ <recovery-environment socket-binding="txn-recovery-environment" status-socket-binding="txn-status-manager"/>
+ <core-environment>
+ <process-id>
+ <uuid />
+ </process-id>
+ </core-environment>
+ <coordinator-environment default-timeout="300"/>
+ </subsystem>
+ <subsystem xmlns="urn:jboss:domain:web:1.0" default-virtual-server="default-host">
+ <connector name="http" scheme="http" protocol="HTTP/1.1" socket-binding="http"/>
+ <virtual-server name="default-host">
+ <alias name="localhost" />
+ <alias name="example.com" />
+ </virtual-server>
+ </subsystem>
+ <subsystem xmlns="urn:jboss:domain:weld:1.0"/>
+ </profile>
+ </profiles>
+
+
+ <!--
+ Named interfaces that can be referenced elsewhere in the configuration. The configuration
+ for how to associate these logical names with an actual network interface can either
+ be specified here or can be declared on a per-host basis in the equivalent element in host.xml.
+
+ These default configurations require the binding specification to be done in host.xml.
+ -->
+ <interfaces>
+ <interface name="management"/>
+ <interface name="public"/>
+ </interfaces>
+
+ <socket-binding-groups>
+ <socket-binding-group name="standard-sockets" default-interface="public">
+ <socket-binding name="http" port="8080"/>
+ <socket-binding name="https" port="8443"/>
+ <socket-binding name="jmx-connector-registry" port="1090"/>
+ <socket-binding name="jmx-connector-server" port="1091"/>
+ <socket-binding name="jndi" port="1099"/>
+ <socket-binding name="osgi-http" port="8090"/>
+ <socket-binding name="remoting" port="4447"/>
+ <socket-binding name="txn-recovery-environment" port="4712"/>
+ <socket-binding name="txn-status-manager" port="4713"/>
+ <socket-binding name="teiid-jdbc" port="31000"/>
+ <socket-binding name="teiid-odbc" port="35432"/>
+ </socket-binding-group>
+ <socket-binding-group name="ha-sockets" default-interface="public">
+ <socket-binding name="http" port="8080"/>
+ <socket-binding name="https" port="8443"/>
+ <socket-binding name="jgroups-diagnostics" port="0" multicast-address="224.0.75.75" multicast-port="7500"/>
+ <socket-binding name="jgroups-mping" port="0" multicast-address="230.0.0.4" multicast-port="45700"/>
+ <socket-binding name="jgroups-tcp" port="7600"/>
+ <socket-binding name="jgroups-tcp-fd" port="57600"/>
+ <socket-binding name="jgroups-udp" port="55200" multicast-address="230.0.0.4" multicast-port="45688"/>
+ <socket-binding name="jgroups-udp-fd" port="54200"/>
+ <socket-binding name="jmx-connector-registry" port="1090"/>
+ <socket-binding name="jmx-connector-server" port="1091"/>
+ <socket-binding name="jndi" port="1099"/>
+ <socket-binding name="modcluster" port="0" multicast-address="224.0.1.105" multicast-port="23364"/>
+ <socket-binding name="osgi-http" port="8090"/>
+ <socket-binding name="remoting" port="4447"/>
+ <socket-binding name="txn-recovery-environment" port="4712"/>
+ <socket-binding name="txn-status-manager" port="4713"/>
+ <socket-binding name="teiid-jdbc" port="31000"/>
+ <socket-binding name="teiid-odbc" port="35432"/>
+ </socket-binding-group>
+ </socket-binding-groups>
+
+ <server-groups>
+ <server-group name="main-server-group" profile="default">
+ <jvm name="default">
+ <heap size="64m" max-size="512m"/>
+ </jvm>
+ <socket-binding-group ref="standard-sockets"/>
+ </server-group>
+
+ <server-group name="other-server-group" profile="ha">
+ <jvm name="default">
+ <heap size="64m" max-size="512m"/>
+ </jvm>
+ <socket-binding-group ref="ha-sockets"/>
+ </server-group>
+ </server-groups>
+
+</domain>
Property changes on: branches/as7/build/kits/jboss-as7/domain/configuration/domain-teiid.xml
___________________________________________________________________
Added: svn:mime-type
+ text/plain
Modified: branches/as7/build/kits/jboss-as7/modules/org/jboss/teiid/main/module.xml
===================================================================
--- branches/as7/build/kits/jboss-as7/modules/org/jboss/teiid/main/module.xml 2011-09-12 14:53:12 UTC (rev 3463)
+++ branches/as7/build/kits/jboss-as7/modules/org/jboss/teiid/main/module.xml 2011-09-12 14:56:06 UTC (rev 3464)
@@ -40,6 +40,7 @@
<module name="javax.xml.bind.api"/>
<module name="javax.transaction.api"/>
<module name="javax.activation.api"/>
+ <module name="org.jboss.as.clustering.jgroups"/>
</dependencies>
</module>
\ No newline at end of file
Modified: branches/as7/build/kits/jboss-as7/standalone/configuration/standalone-teiid.xml
===================================================================
--- branches/as7/build/kits/jboss-as7/standalone/configuration/standalone-teiid.xml 2011-09-12 14:53:12 UTC (rev 3463)
+++ branches/as7/build/kits/jboss-as7/standalone/configuration/standalone-teiid.xml 2011-09-12 14:56:06 UTC (rev 3464)
@@ -161,8 +161,14 @@
</local-cache>
<local-cache name="timestamps">
<eviction strategy="NONE"/>
+ </local-cache>
+ </cache-container>
+ <cache-container name="teiid" default-cache="resultset">
+ <local-cache name="resultset">
+ <expiration lifespan="7200" />
+ <eviction max-entries="1024" strategy="LRU"/>
</local-cache>
- </cache-container>
+ </cache-container>
</subsystem>
<subsystem xmlns="urn:jboss:domain:jaxrs:1.0"/>
<subsystem xmlns="urn:jboss:domain:jca:1.0">
@@ -274,6 +280,7 @@
</subsystem>
<subsystem xmlns="urn:jboss:domain:teiid:1.0">
<async-thread-group>teiid-async</async-thread-group>
+ <resultset-cache container-name="teiid" name="resultset"/>
<query-engine name = "default">
<security-domain>teiid-security</security-domain>
Modified: branches/as7/cache-jbosscache/pom.xml
===================================================================
--- branches/as7/cache-jbosscache/pom.xml 2011-09-12 14:53:12 UTC (rev 3463)
+++ branches/as7/cache-jbosscache/pom.xml 2011-09-12 14:56:06 UTC (rev 3464)
@@ -8,7 +8,7 @@
<modelVersion>4.0.0</modelVersion>
<artifactId>teiid-cache-jbosscache</artifactId>
<name>JBoss Cache</name>
- <description>JBossCache provider.</description>
+ <description>Infinispan Provider</description>
<dependencies>
<dependency>
<groupId>org.jboss.teiid</groupId>
@@ -25,15 +25,15 @@
<artifactId>teiid-engine</artifactId>
<scope>provided</scope>
</dependency>
- <dependency>
- <groupId>org.jboss.cache</groupId>
- <artifactId>jbosscache-core</artifactId>
- <scope>provided</scope>
- </dependency>
- <dependency>
- <groupId>commons-logging</groupId>
- <artifactId>commons-logging</artifactId>
- <scope>provided</scope>
- </dependency>
+ <dependency>
+ <groupId>org.infinispan</groupId>
+ <artifactId>infinispan-core</artifactId>
+ <scope>provided</scope>
+ </dependency>
+ <dependency>
+ <groupId>org.jboss.as</groupId>
+ <artifactId>jboss-as-clustering-jgroups</artifactId>
+ <scope>provided</scope>
+ </dependency>
</dependencies>
</project>
\ No newline at end of file
Deleted: branches/as7/cache-jbosscache/src/main/java/org/teiid/cache/jboss/ClusteredTupleBatchCacheLoader.java
===================================================================
--- branches/as7/cache-jbosscache/src/main/java/org/teiid/cache/jboss/ClusteredTupleBatchCacheLoader.java 2011-09-12 14:53:12 UTC (rev 3463)
+++ branches/as7/cache-jbosscache/src/main/java/org/teiid/cache/jboss/ClusteredTupleBatchCacheLoader.java 2011-09-12 14:56:06 UTC (rev 3464)
@@ -1,305 +0,0 @@
-/*
- * JBoss, Home of Professional Open Source.
- * See the COPYRIGHT.txt file distributed with this work for information
- * regarding copyright ownership. Some portions may be licensed
- * to Red Hat, Inc. under one or more contributor license agreements.
- *
- * This library is free software; you can redistribute it and/or
- * modify it under the terms of the GNU Lesser General Public
- * License as published by the Free Software Foundation; either
- * version 2.1 of the License, or (at your option) any later version.
- *
- * This library is distributed in the hope that it will be useful,
- * but WITHOUT ANY WARRANTY; without even the implied warranty of
- * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
- * Lesser General Public License for more details.
- *
- * You should have received a copy of the GNU Lesser General Public
- * License along with this library; if not, write to the Free Software
- * Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA
- * 02110-1301 USA.
- */
-package org.teiid.cache.jboss;
-
-import java.io.ObjectInputStream;
-import java.io.ObjectOutputStream;
-import java.util.ArrayList;
-import java.util.Collections;
-import java.util.List;
-import java.util.Map;
-import java.util.Set;
-
-import org.jboss.cache.CacheStatus;
-import org.jboss.cache.Fqn;
-import org.jboss.cache.Modification;
-import org.jboss.cache.RegionManager;
-import org.jboss.cache.ReplicationException;
-import org.jboss.cache.commands.CommandsFactory;
-import org.jboss.cache.commands.DataCommand;
-import org.jboss.cache.commands.read.ExistsCommand;
-import org.jboss.cache.commands.read.GetDataMapCommand;
-import org.jboss.cache.commands.remote.ClusteredGetCommand;
-import org.jboss.cache.config.CacheLoaderConfig.IndividualCacheLoaderConfig;
-import org.jboss.cache.factories.annotations.Inject;
-import org.jboss.cache.loader.AbstractCacheLoader;
-import org.jboss.cache.lock.StripedLock;
-import org.jgroups.Address;
-import org.jgroups.blocks.GroupRequest;
-import org.jgroups.blocks.RspFilter;
-
-class ClusteredTupleBatchCacheLoader extends AbstractCacheLoader {
- private StripedLock lock = new StripedLock();
- private TupleBatchCacheLoaderConfig config;
- private CommandsFactory commandsFactory;
-
- private boolean init = false;
-
- @Override
- public void start() {
- init();
- }
-
- private void init() {
- if (!this.init) {
- setCommandsFactory(cache.getComponentRegistry().getComponent(CommandsFactory.class));
- this.init = true;
- }
- }
-
- /**
- * A test to check whether the cache is in its started state. If not, calls
- * should not be made as the channel may not have properly started, blocks
- * due to state transfers may be in progress, etc.
- *
- * @return true if the cache is in its STARTED state.
- */
- protected boolean isCacheReady() {
- return cache.getCacheStatus() == CacheStatus.STARTED;
- }
-
- @Inject
- public void setCommandsFactory(CommandsFactory commandsFactory) {
- this.commandsFactory = commandsFactory;
- }
-
- /**
- * Sets the configuration. A property <code>timeout</code> is used as the
- * timeout value.
- */
- public void setConfig(IndividualCacheLoaderConfig base) {
- this.config = (TupleBatchCacheLoaderConfig) base;
- }
-
- public IndividualCacheLoaderConfig getConfig() {
- return config;
- }
-
- public Set getChildrenNames(Fqn fqn) throws Exception {
- return Collections.emptySet();
- }
-
- private List<Object> callRemote(DataCommand dataCommand) throws Exception {
- ClusteredGetCommand clusteredGet = commandsFactory .buildClusteredGetCommand(false, dataCommand);
- List resps;
- // JBCACHE-1186
- resps = cache.getRPCManager().callRemoteMethods(null, clusteredGet, GroupRequest.GET_ALL, config.getTimeout(), new ResponseValidityFilter(cache.getMembers(), cache.getLocalAddress(), dataCommand), false);
-
- if (resps == null) {
- throw new ReplicationException("No replies to call " + dataCommand + ". Perhaps we're alone in the cluster?"); //$NON-NLS-1$ //$NON-NLS-2$
- }
-
- return resps;
- }
-
- public Map get(Fqn name) throws Exception {
- return get0(name);
- }
-
- protected Map get0(Fqn name) throws Exception {
- // DON'T make a remote call if this is a remote call in the first place
- // - leads to deadlocks - JBCACHE-1103
- if (!isCacheReady() || !cache.getInvocationContext().isOriginLocal()) {
- return null;
- }
- // return Collections.emptyMap();
- lock.acquireLock(name, true);
- try {
- init();
- GetDataMapCommand command = commandsFactory.buildGetDataMapCommand(name);
- List resps = callRemote(command);
-
- Map result = Collections.EMPTY_MAP;
- for (Object o:resps) {
- if (o != null && !(o instanceof Exception)) {
- List clusteredGetResp = (List) o;
- if ((Boolean)clusteredGetResp.get(0)) {
- Map resp = (Map)clusteredGetResp.get(1);
- if (!resp.isEmpty()) {
- result = resp;
- }
- }
- }
- }
- return result;
- } finally {
- lock.releaseLock(name);
- }
- }
-
- public boolean exists(Fqn name) throws Exception {
- // DON'T make a remote call if this is a remote call in the first place
- // - leads to deadlocks - JBCACHE-1103
- if (!isCacheReady() || !cache.getInvocationContext().isOriginLocal()) {
- return false;
- }
-
- lock.acquireLock(name, false);
- try {
- init();
- ExistsCommand command = commandsFactory.buildExistsNodeCommand(name);
- List resps = callRemote(command);
- boolean result = false;
- for (Object o:resps) {
- if (o != null && !(o instanceof Exception)) {
- List<Boolean> clusteredGetResp = (List<Boolean>) o;
- if (clusteredGetResp.get(0)) {
- if (clusteredGetResp.get(1)) {
- result = true;
- break;
- }
- }
- }
- }
- return result;
- } finally {
- lock.releaseLock(name);
- }
- }
-
- public Object put(Fqn name, Object key, Object value) throws Exception {
- return null;
- }
-
- /**
- * Does nothing; replication handles put.
- */
- public void put(Fqn name, Map attributes) throws Exception {
- }
-
- /**
- * Does nothing; replication handles put.
- */
- @Override
- public void put(List<Modification> modifications) throws Exception {
- }
-
- /**
- * Fetches the remove value, does not remove. Replication handles removal.
- */
- public Object remove(Fqn name, Object key) throws Exception {
- return null;
- }
-
- /**
- * Does nothing; replication handles removal.
- */
- public void remove(Fqn name) throws Exception {
- // do nothing
- }
-
- /**
- * Does nothing; replication handles removal.
- */
- public void removeData(Fqn name) throws Exception {
- }
-
- /**
- * Does nothing.
- */
- @Override
- public void prepare(Object tx, List modifications, boolean one_phase)
- throws Exception {
- }
-
- /**
- * Does nothing.
- */
- @Override
- public void commit(Object tx) throws Exception {
- }
-
- /**
- * Does nothing.
- */
- @Override
- public void rollback(Object tx) {
- }
-
- @Override
- public void loadEntireState(ObjectOutputStream os) throws Exception {
- // intentional no-op
- }
-
- @Override
- public void loadState(Fqn subtree, ObjectOutputStream os) throws Exception {
- // intentional no-op
- }
-
- @Override
- public void storeEntireState(ObjectInputStream is) throws Exception {
- // intentional no-op
- }
-
- @Override
- public void storeState(Fqn subtree, ObjectInputStream is) throws Exception {
- // intentional no-op
- }
-
- @Override
- public void setRegionManager(RegionManager manager) {
- }
-
- public static class ResponseValidityFilter implements RspFilter {
- private int numValidResponses = 0;
- private List<Address> pendingResponders;
- private DataCommand command;
-
- public ResponseValidityFilter(List<Address> expected,Address localAddress, DataCommand command) {
- this.pendingResponders = new ArrayList<Address>(expected);
- // We'll never get a response from ourself
- this.pendingResponders.remove(localAddress);
- this.command = command;
- }
-
- public boolean isAcceptable(Object object, Address address) {
- pendingResponders.remove(address);
-
- if (object instanceof List) {
- List response = (List) object;
- Boolean foundResult = (Boolean) response.get(0);
- if (foundResult) {
- if (command instanceof ExistsCommand) {
- Boolean resp = (Boolean)response.get(1);
- if (resp) {
- numValidResponses++;
- }
- }
- else if (command instanceof GetDataMapCommand) {
- Map resp = (Map)response.get(1);
- if (!resp.isEmpty()) {
- numValidResponses++;
- }
- }
- }
- }
- // always return true to make sure a response is logged by the
- // JGroups RpcDispatcher.
- return true;
- }
-
- public boolean needMoreResponses() {
- return numValidResponses < 1 && pendingResponders.size() > 0;
- }
-
- }
-}
Deleted: branches/as7/cache-jbosscache/src/main/java/org/teiid/cache/jboss/ExpirationAwareCache.java
===================================================================
--- branches/as7/cache-jbosscache/src/main/java/org/teiid/cache/jboss/ExpirationAwareCache.java 2011-09-12 14:53:12 UTC (rev 3463)
+++ branches/as7/cache-jbosscache/src/main/java/org/teiid/cache/jboss/ExpirationAwareCache.java 2011-09-12 14:56:06 UTC (rev 3464)
@@ -1,75 +0,0 @@
-/*
- * JBoss, Home of Professional Open Source.
- * See the COPYRIGHT.txt file distributed with this work for information
- * regarding copyright ownership. Some portions may be licensed
- * to Red Hat, Inc. under one or more contributor license agreements.
- *
- * This library is free software; you can redistribute it and/or
- * modify it under the terms of the GNU Lesser General Public
- * License as published by the Free Software Foundation; either
- * version 2.1 of the License, or (at your option) any later version.
- *
- * This library is distributed in the hope that it will be useful,
- * but WITHOUT ANY WARRANTY; without even the implied warranty of
- * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
- * Lesser General Public License for more details.
- *
- * You should have received a copy of the GNU Lesser General Public
- * License along with this library; if not, write to the Free Software
- * Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA
- * 02110-1301 USA.
- */
-package org.teiid.cache.jboss;
-
-import java.util.HashSet;
-import java.util.Set;
-
-import org.jboss.cache.Cache;
-import org.jboss.cache.Fqn;
-import org.jboss.cache.Node;
-import org.jboss.cache.eviction.ExpirationAlgorithmConfig;
-import org.teiid.cache.DefaultCache;
-
-public class ExpirationAwareCache<K, V> extends JBossCache<K, V> {
-
- public ExpirationAwareCache(Cache cacheStore, Fqn fqn) {
- super(cacheStore, fqn);
- }
-
- @Override
- protected boolean validateNode(Node node) {
- Long future = (Long) node.get(ExpirationAlgorithmConfig.EXPIRATION_KEY);
- return future == null || future > System.currentTimeMillis();
- }
-
- @Override
- public V put(K key, V value) {
- return this.put(key, value, null);
- }
-
- @Override
- public V put(K key, V value, Long ttl) {
- Node<K, V> node = getRootNode();
- Node child = node.addChild(getFqn(key));
-
- long future = DefaultCache.getExpirationTime(config.getMaxAgeInSeconds()*1000, ttl);
- child.put(ExpirationAlgorithmConfig.EXPIRATION_KEY, future);
- return (V)child.put(key, value);
- }
-
- @Override
- public Set<K> keys() {
- HashSet keys = new HashSet();
- Node<K, V> node = getRootNode();
- Set<Node<K, V>> children = node.getChildren();
- for (Node<K, V> child:children) {
- for (K key:child.getData().keySet()) {
- if ((key instanceof String) && (key.equals(ExpirationAlgorithmConfig.EXPIRATION_KEY))) {
- continue;
- }
- keys.add(key);
- }
- }
- return keys;
- }
-}
Modified: branches/as7/cache-jbosscache/src/main/java/org/teiid/cache/jboss/JBossCache.java
===================================================================
--- branches/as7/cache-jbosscache/src/main/java/org/teiid/cache/jboss/JBossCache.java 2011-09-12 14:53:12 UTC (rev 3463)
+++ branches/as7/cache-jbosscache/src/main/java/org/teiid/cache/jboss/JBossCache.java 2011-09-12 14:56:06 UTC (rev 3464)
@@ -22,138 +22,65 @@
package org.teiid.cache.jboss;
-import java.util.HashSet;
import java.util.Set;
+import java.util.concurrent.TimeUnit;
-import org.jboss.cache.Fqn;
-import org.jboss.cache.Node;
import org.teiid.cache.Cache;
-import org.teiid.cache.CacheConfiguration;
-import org.teiid.cache.CacheListener;
/**
- * Implementation of Cache using JBoss Cache
+ * Implementation of Cache using Infinispan
*/
-public class JBossCache<K, V> implements Cache<K, V> {
+public class JBossCache<K, V> implements Cache<String, V> {
- protected org.jboss.cache.Cache<K, V> cacheStore;
- protected Fqn rootFqn;
- protected JBossCacheListener cacheListener;
- protected CacheConfiguration config;
+ protected org.infinispan.Cache<String, V> cacheStore;
+ private final String name;
- public JBossCache(org.jboss.cache.Cache<K, V> cacheStore, Fqn fqn) {
+ public JBossCache(org.infinispan.Cache<String, V> cacheStore, String cacheName) {
this.cacheStore = cacheStore;
- this.rootFqn = fqn;
+ this.name = cacheName;
}
+ private String fqn(String key) {
+ return this.name+"."+key; //$NON-NLS-1$
+ }
+
@Override
- public V get(K key) {
- Node<K, V> node = getRootNode();
- Node child = node.getChild(getFqn(key));
- if (child != null) {
- if (validateNode(child)) {
- return (V)child.get(key);
- }
- remove(key);
- }
- return null;
+ public V get(String key) {
+ return this.cacheStore.get(fqn(key));
}
- protected boolean validateNode(Node node) {
- return true;
+ public V put(String key, V value) {
+ return this.cacheStore.put(fqn(key), value);
}
-
- protected Fqn<String> getFqn(K key) {
- if (key.getClass().isPrimitive() || key instanceof String) {
- return Fqn.fromString(String.valueOf(key));
- }
- return Fqn.fromString(String.valueOf(key.getClass().getSimpleName()+key.hashCode()));
- }
-
- public V put(K key, V value) {
- Node<K, V> node = getRootNode();
- Node<K, V> child = node.addChild(getFqn(key));
- return child.put(key, value);
- }
@Override
- public V put(K key, V value, Long ttl) {
- return this.put(key, value);
+ public V put(String key, V value, Long ttl) {
+ return this.cacheStore.put(fqn(key), value, ttl, TimeUnit.SECONDS);
}
@Override
- public V remove(K key) {
- Node<K, V> node = getRootNode();
- Fqn<String> fqn = getFqn(key);
- Node child = node.getChild(fqn);
- if (child != null) {
- V value = (V)child.remove(key);
- node.removeChild(fqn);
- return value;
- }
- return null;
+ public V remove(String key) {
+ return this.cacheStore.remove(fqn(key));
}
@Override
public int size() {
- Node<K, V> node = getRootNode();
- int size = 0;
- Set<Node<K,V>> nodes = new HashSet<Node<K, V>>(node.getChildren());
- for (Node<K, V> child : nodes) {
- if (!child.getData().isEmpty()) {
- size++;
- }
- }
- return size;
+ return this.cacheStore.size();
}
@Override
public void clear() {
- Node<K, V> node = getRootNode();
- node.clearData();
- Set<Node<K,V>> nodes = new HashSet<Node<K, V>>(node.getChildren());
- for (Node<K, V> child : nodes) {
- child.clearData();
- node.removeChild(child.getFqn());
- }
+ this.cacheStore.clear();
}
- public synchronized void addListener(CacheListener listener) {
- this.cacheListener = new JBossCacheListener(this.rootFqn, listener);
- this.cacheStore.addCacheListener(this.cacheListener);
- }
-
- public synchronized void removeListener() {
- this.cacheStore.removeCacheListener(this.cacheListener);
- this.cacheListener = null;
- }
-
- protected Node<K, V> getRootNode() {
- Node<K, V> node = this.cacheStore.getNode(this.rootFqn);
- if (node == null) {
- throw new IllegalStateException("Cache Node "+ this.rootFqn +" not found."); //$NON-NLS-1$ //$NON-NLS-2$
- }
- return node;
- }
-
@Override
public String getName() {
- return this.rootFqn.toString();
+ return this.name;
}
- void setCacheConfiguration(CacheConfiguration config) {
- this.config = config;
- }
-
@Override
- public Set<K> keys() {
- HashSet keys = new HashSet();
- Node<K, V> node = getRootNode();
- Set<Node<K, V>> children = node.getChildren();
- for (Node<K, V> child:children) {
- keys.addAll(child.getData().keySet());
- }
- return keys;
+ public Set<String> keys() {
+ return this.cacheStore.keySet();
}
}
Modified: branches/as7/cache-jbosscache/src/main/java/org/teiid/cache/jboss/JBossCacheFactory.java
===================================================================
--- branches/as7/cache-jbosscache/src/main/java/org/teiid/cache/jboss/JBossCacheFactory.java 2011-09-12 14:53:12 UTC (rev 3463)
+++ branches/as7/cache-jbosscache/src/main/java/org/teiid/cache/jboss/JBossCacheFactory.java 2011-09-12 14:56:06 UTC (rev 3464)
@@ -24,31 +24,22 @@
import java.io.Serializable;
-import org.jboss.cache.CacheManager;
-import org.jboss.cache.Fqn;
-import org.jboss.cache.Node;
-import org.jboss.cache.Region;
-import org.jboss.cache.config.EvictionAlgorithmConfig;
-import org.jboss.cache.config.EvictionRegionConfig;
-import org.jboss.cache.eviction.ExpirationAlgorithmConfig;
-import org.jboss.cache.eviction.LRUAlgorithmConfig;
-import org.jboss.cache.eviction.RemoveOnEvictActionPolicy;
+import org.infinispan.manager.CacheContainer;
import org.teiid.cache.Cache;
import org.teiid.cache.CacheConfiguration;
-import org.teiid.cache.CacheConfiguration.Policy;
import org.teiid.cache.CacheFactory;
import org.teiid.core.TeiidRuntimeException;
public class JBossCacheFactory implements CacheFactory, Serializable{
private static final long serialVersionUID = -2767452034178675653L;
- private transient org.jboss.cache.Cache cacheStore;
+ private transient org.infinispan.Cache cacheStore;
private volatile boolean destroyed = false;
public JBossCacheFactory(String name, Object cm) throws Exception {
- CacheManager cachemanager = (CacheManager)cm;
- this.cacheStore = cachemanager.getCache(name, true);
+ CacheContainer cachemanager = (CacheContainer)cm;
+ this.cacheStore = cachemanager.getCache(name);
}
/**
@@ -56,64 +47,15 @@
*/
public Cache get(String location, CacheConfiguration config) {
if (!destroyed) {
-
- if (!this.cacheStore.getCacheStatus().allowInvocations()) {
- this.cacheStore.start();
- if (this.cacheStore.getRegion(this.cacheStore.getRoot().getFqn(), false) != null) {
- this.cacheStore.getRegion(this.cacheStore.getRoot().getFqn(), true).activate();
- }
- }
-
- Node cacheRoot = this.cacheStore.getRoot().addChild(Fqn.fromString("Teiid")); //$NON-NLS-1$
- Node node = cacheRoot.addChild(Fqn.fromString(location));
- node.setResident(true);
-
- Region cacheRegion = this.cacheStore.getRegion(node.getFqn(), true);
- cacheRegion.setEvictionRegionConfig(buildEvictionConfig(node.getFqn(), config));
- cacheRegion.activate();
- cacheRegion = this.cacheStore.getRegion(node.getFqn(), true);
- cacheRegion.setEvictionRegionConfig(buildEvictionConfig(node.getFqn(), config));
-
- JBossCache jc = null;
- if (config != null && config.getPolicy().equals(Policy.EXPIRATION)) {
- jc = new ExpirationAwareCache(this.cacheStore, node.getFqn());
- }
- else {
- jc = new JBossCache(this.cacheStore, node.getFqn());
- }
-
- jc.setCacheConfiguration(config);
- return jc;
+ return new JBossCache(this.cacheStore, config.getLocation());
}
throw new TeiidRuntimeException("Cache system has been shutdown"); //$NON-NLS-1$
}
- private EvictionRegionConfig buildEvictionConfig(Fqn rootFqn, CacheConfiguration config) {
- EvictionAlgorithmConfig evictionConfig = null;
-
- if (config.getPolicy() == Policy.LRU) {
- LRUAlgorithmConfig lru = new LRUAlgorithmConfig();
- lru.setMaxNodes(config.getMaxEntries());
- lru.setMaxAge(config.getMaxAgeInSeconds()*1000);
- lru.setTimeToLive(-1); // -1 no limit
- evictionConfig = lru;
- }
- else if (config.getPolicy() == Policy.EXPIRATION) {
- ExpirationAlgorithmConfig lfu = new ExpirationAlgorithmConfig();
- lfu.setMaxNodes(config.getMaxEntries());
- evictionConfig = lfu;
- }
-
- EvictionRegionConfig erc = new EvictionRegionConfig(rootFqn, evictionConfig);
- erc.setEvictionActionPolicyClassName(RemoveOnEvictActionPolicy.class.getName());
- return erc;
- }
-
public void destroy() {
this.destroyed = true;
}
- // this will be called by microcontainer.
public void stop() {
destroy();
}
Deleted: branches/as7/cache-jbosscache/src/main/java/org/teiid/cache/jboss/JBossCacheListener.java
===================================================================
--- branches/as7/cache-jbosscache/src/main/java/org/teiid/cache/jboss/JBossCacheListener.java 2011-09-12 14:53:12 UTC (rev 3463)
+++ branches/as7/cache-jbosscache/src/main/java/org/teiid/cache/jboss/JBossCacheListener.java 2011-09-12 14:56:06 UTC (rev 3464)
@@ -1,58 +0,0 @@
-/*
- * JBoss, Home of Professional Open Source.
- * See the COPYRIGHT.txt file distributed with this work for information
- * regarding copyright ownership. Some portions may be licensed
- * to Red Hat, Inc. under one or more contributor license agreements.
- *
- * This library is free software; you can redistribute it and/or
- * modify it under the terms of the GNU Lesser General Public
- * License as published by the Free Software Foundation; either
- * version 2.1 of the License, or (at your option) any later version.
- *
- * This library is distributed in the hope that it will be useful,
- * but WITHOUT ANY WARRANTY; without even the implied warranty of
- * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
- * Lesser General Public License for more details.
- *
- * You should have received a copy of the GNU Lesser General Public
- * License along with this library; if not, write to the Free Software
- * Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA
- * 02110-1301 USA.
- */
-package org.teiid.cache.jboss;
-
-import org.jboss.cache.Fqn;
-import org.jboss.cache.notifications.annotation.NodeCreated;
-import org.jboss.cache.notifications.annotation.NodeEvicted;
-import org.jboss.cache.notifications.annotation.NodeLoaded;
-import org.jboss.cache.notifications.annotation.NodeModified;
-import org.jboss.cache.notifications.annotation.NodeMoved;
-import org.jboss.cache.notifications.annotation.NodeRemoved;
-import org.jboss.cache.notifications.event.NodeEvent;
-import org.teiid.cache.CacheListener;
-
-
-(a)org.jboss.cache.notifications.annotation.CacheListener
-public class JBossCacheListener {
-
- private CacheListener listener;
- private Fqn rootFqn;
-
- public JBossCacheListener(Fqn fqn, CacheListener listener) {
- this.rootFqn = fqn;
- this.listener = listener;
- }
-
- @NodeCreated
- @NodeRemoved
- @NodeModified
- @NodeMoved
- @NodeLoaded
- @NodeEvicted
- public synchronized void cacheChanged(NodeEvent ne) {
- Fqn fqn = ne.getFqn();
- if (fqn.isChildOrEquals(rootFqn)) {
- listener.cacheChanged();
- }
- }
-}
Deleted: branches/as7/cache-jbosscache/src/main/java/org/teiid/cache/jboss/TupleBatchCacheLoader.java
===================================================================
--- branches/as7/cache-jbosscache/src/main/java/org/teiid/cache/jboss/TupleBatchCacheLoader.java 2011-09-12 14:53:12 UTC (rev 3463)
+++ branches/as7/cache-jbosscache/src/main/java/org/teiid/cache/jboss/TupleBatchCacheLoader.java 2011-09-12 14:56:06 UTC (rev 3464)
@@ -1,110 +0,0 @@
-/*
- * JBoss, Home of Professional Open Source.
- * See the COPYRIGHT.txt file distributed with this work for information
- * regarding copyright ownership. Some portions may be licensed
- * to Red Hat, Inc. under one or more contributor license agreements.
- *
- * This library is free software; you can redistribute it and/or
- * modify it under the terms of the GNU Lesser General Public
- * License as published by the Free Software Foundation; either
- * version 2.1 of the License, or (at your option) any later version.
- *
- * This library is distributed in the hope that it will be useful,
- * but WITHOUT ANY WARRANTY; without even the implied warranty of
- * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
- * Lesser General Public License for more details.
- *
- * You should have received a copy of the GNU Lesser General Public
- * License along with this library; if not, write to the Free Software
- * Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA
- * 02110-1301 USA.
- */
-package org.teiid.cache.jboss;
-
-import java.util.HashMap;
-import java.util.Map;
-import java.util.Set;
-
-import org.jboss.cache.Fqn;
-import org.jboss.cache.config.CacheLoaderConfig.IndividualCacheLoaderConfig;
-import org.teiid.common.buffer.BufferManager;
-import org.teiid.common.buffer.TupleBatch;
-import org.teiid.common.buffer.TupleBuffer;
-import org.teiid.core.TeiidRuntimeException;
-
-public class TupleBatchCacheLoader extends ClusteredTupleBatchCacheLoader {
-
- private BufferManager bufferMgr;
- private IndividualCacheLoaderConfig config;
-
- @Override
- public boolean exists(Fqn fqn) throws Exception {
- String id = fqn.getLastElementAsString();
- int index = id.indexOf(',');
- if (index != -1) {
- return true;
- }
- return false;
- }
-
- @Override
- public Map<Object, Object> get(Fqn fqn) throws Exception {
- String id = fqn.getLastElementAsString();
- int index = id.indexOf(',');
- if (index != -1) {
- String uuid = id.substring(0, index);
- int row = Integer.parseInt(id.substring(index+1));
- TupleBuffer tb = this.bufferMgr.getTupleBuffer(uuid);
- if (tb != null) {
- Map map = new HashMap();
- TupleBatch b = tb.getBatch(row);
- b.preserveTypes();
- map.put(id, b);
- return map;
- }
- }
- return super.get(fqn);
- }
-
- @Override
- public Set<?> getChildrenNames(Fqn fqn) throws Exception {
- return super.getChildrenNames(fqn);
- }
-
- @Override
- public IndividualCacheLoaderConfig getConfig() {
- return this.config;
- }
-
- @Override
- public Object put(Fqn fqn, Object key, Object value) throws Exception {
- return super.put(fqn, key, value);
- }
-
- @Override
- public void remove(Fqn fqn) throws Exception {
- super.remove(fqn);
- }
-
- @Override
- public Object remove(Fqn fqn, Object key) throws Exception {
- return super.remove(fqn, key);
- }
-
- @Override
- public void removeData(Fqn fqn) throws Exception {
- super.removeData(fqn);
- }
-
- @Override
- public void setConfig(IndividualCacheLoaderConfig config) {
- if (!(config instanceof TupleBatchCacheLoaderConfig)) {
- throw new TeiidRuntimeException("Wrong Configuration"); //$NON-NLS-1$
- }
- this.config = config;
- TupleBatchCacheLoaderConfig bmc = (TupleBatchCacheLoaderConfig)config;
- this.bufferMgr = bmc.getBufferService().getBufferManager();
- super.setConfig(config);
- }
-
-}
Deleted: branches/as7/cache-jbosscache/src/main/java/org/teiid/cache/jboss/TupleBatchCacheLoaderConfig.java
===================================================================
--- branches/as7/cache-jbosscache/src/main/java/org/teiid/cache/jboss/TupleBatchCacheLoaderConfig.java 2011-09-12 14:53:12 UTC (rev 3463)
+++ branches/as7/cache-jbosscache/src/main/java/org/teiid/cache/jboss/TupleBatchCacheLoaderConfig.java 2011-09-12 14:56:06 UTC (rev 3464)
@@ -1,57 +0,0 @@
-/*
- * JBoss, Home of Professional Open Source.
- * See the COPYRIGHT.txt file distributed with this work for information
- * regarding copyright ownership. Some portions may be licensed
- * to Red Hat, Inc. under one or more contributor license agreements.
- *
- * This library is free software; you can redistribute it and/or
- * modify it under the terms of the GNU Lesser General Public
- * License as published by the Free Software Foundation; either
- * version 2.1 of the License, or (at your option) any later version.
- *
- * This library is distributed in the hope that it will be useful,
- * but WITHOUT ANY WARRANTY; without even the implied warranty of
- * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
- * Lesser General Public License for more details.
- *
- * You should have received a copy of the GNU Lesser General Public
- * License along with this library; if not, write to the Free Software
- * Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA
- * 02110-1301 USA.
- */
-package org.teiid.cache.jboss;
-
-import org.jboss.cache.config.CacheLoaderConfig.IndividualCacheLoaderConfig;
-import org.teiid.dqp.service.BufferService;
-
-public class TupleBatchCacheLoaderConfig extends IndividualCacheLoaderConfig {
- private static final long serialVersionUID = -5926642610388245871L;
- private BufferService service;
- private long timeout;
-
- public long getTimeout() {
- return timeout;
- }
-
- public void setTimeout(long timeout) {
- this.timeout = timeout;
- }
-
- public TupleBatchCacheLoaderConfig() {
- setClassName(TupleBatchCacheLoader.class.getName());
- }
-
- public TupleBatchCacheLoaderConfig(IndividualCacheLoaderConfig config) {
- setClassName(TupleBatchCacheLoader.class.getName());
- populateFromBaseConfig(config);
- }
-
-
- public void setBufferService(BufferService service) {
- this.service = service;
- }
-
- public BufferService getBufferService() {
- return this.service;
- }
-}
Modified: branches/as7/cache-jbosscache/src/main/java/org/teiid/replication/jboss/JGroupsObjectReplicator.java
===================================================================
--- branches/as7/cache-jbosscache/src/main/java/org/teiid/replication/jboss/JGroupsObjectReplicator.java 2011-09-12 14:53:12 UTC (rev 3463)
+++ branches/as7/cache-jbosscache/src/main/java/org/teiid/replication/jboss/JGroupsObjectReplicator.java 2011-09-12 14:56:06 UTC (rev 3464)
@@ -34,6 +34,7 @@
import java.util.concurrent.Executor;
import java.util.concurrent.Executors;
+import org.jboss.as.clustering.jgroups.ChannelFactory;
import org.jgroups.*;
import org.jgroups.blocks.GroupRequest;
import org.jgroups.blocks.MethodCall;
@@ -48,7 +49,7 @@
import org.teiid.query.ObjectReplicator;
import org.teiid.query.ReplicatedObject;
-public class JGroupsObjectReplicator implements ObjectReplicator, Serializable {
+public abstract class JGroupsObjectReplicator implements ObjectReplicator, Serializable {
private static final long serialVersionUID = -6851804958313095166L;
private static final String CREATE_STATE = "createState"; //$NON-NLS-1$
@@ -221,53 +222,17 @@
void finishState(String id);
}
- private transient ChannelFactory channelFactory;
- private String multiplexerStack;
+
private String clusterName;
- private String jndiName;
//TODO: this should be configurable, or use a common executor
private transient Executor executor = Executors.newCachedThreadPool();
- public ChannelFactory getChannelFactory() {
- return channelFactory;
- }
-
- public void setJndiName(String jndiName) {
- this.jndiName = jndiName;
- }
-
- public String getJndiName() {
- return jndiName;
- }
-
- public String getMultiplexerStack() {
- return multiplexerStack;
- }
-
- public String getClusterName() {
- return clusterName;
- }
-
- public void setChannelFactory(ChannelFactory channelFactory) {
- this.channelFactory = channelFactory;
- }
-
- public void setClusterName(String clusterName) {
+ public JGroupsObjectReplicator(String clusterName) {
this.clusterName = clusterName;
}
- public void setMultiplexerStack(String multiplexerStack) {
- this.multiplexerStack = multiplexerStack;
- }
+ public abstract ChannelFactory getChannelFactory();
- public void start() throws Exception {
- if (this.channelFactory == null) {
- return; //no need to distribute events
- }
- }
-
- public void stop() {
- }
public void stop(Object object) {
ReplicatedInvocationHandler<?> handler = (ReplicatedInvocationHandler<?>) Proxy.getInvocationHandler(object);
@@ -280,7 +245,7 @@
@Override
public <T, S> T replicate(String mux_id,
Class<T> iface, final S object, long startTimeout) throws Exception {
- Channel channel = this.channelFactory.createMultiplexerChannel(this.multiplexerStack, mux_id);
+ Channel channel = getChannelFactory().createChannel(mux_id);
Method[] methods = iface.getMethods();
final HashMap<Method, Short> methodMap = new HashMap<Method, Short>();
Modified: branches/as7/jboss-integration/pom.xml
===================================================================
--- branches/as7/jboss-integration/pom.xml 2011-09-12 14:53:12 UTC (rev 3463)
+++ branches/as7/jboss-integration/pom.xml 2011-09-12 14:56:06 UTC (rev 3464)
@@ -51,6 +51,11 @@
<scope>provided</scope>
</dependency>
<dependency>
+ <groupId>org.jboss.as</groupId>
+ <artifactId>jboss-as-clustering-jgroups</artifactId>
+ <scope>provided</scope>
+ </dependency>
+ <dependency>
<groupId>org.jboss</groupId>
<artifactId>staxmapper</artifactId>
<scope>provided</scope>
Modified: branches/as7/jboss-integration/src/main/java/org/teiid/jboss/BufferManagerService.java
===================================================================
--- branches/as7/jboss-integration/src/main/java/org/teiid/jboss/BufferManagerService.java 2011-09-12 14:53:12 UTC (rev 3463)
+++ branches/as7/jboss-integration/src/main/java/org/teiid/jboss/BufferManagerService.java 2011-09-12 14:56:06 UTC (rev 3464)
@@ -28,7 +28,7 @@
import org.jboss.msc.value.InjectedValue;
import org.teiid.services.BufferServiceImpl;
-public class BufferManagerService implements Service<BufferServiceImpl> {
+class BufferManagerService implements Service<BufferServiceImpl> {
private BufferServiceImpl bufferMgr;
public final InjectedValue<String> pathInjector = new InjectedValue<String>();
Modified: branches/as7/jboss-integration/src/main/java/org/teiid/jboss/Configuration.java
===================================================================
--- branches/as7/jboss-integration/src/main/java/org/teiid/jboss/Configuration.java 2011-09-12 14:53:12 UTC (rev 3463)
+++ branches/as7/jboss-integration/src/main/java/org/teiid/jboss/Configuration.java 2011-09-12 14:56:06 UTC (rev 3464)
@@ -28,9 +28,8 @@
class Configuration {
public static final String BUFFER_SERVICE = "buffer-service";//$NON-NLS-1$
+ public static final String PREPAREDPLAN_CACHE = "preparedplan-cache";//$NON-NLS-1$
public static final String RESULTSET_CACHE = "resultset-cache";//$NON-NLS-1$
- public static final String PREPAREDPLAN_CACHE = "preparedplan-cache";//$NON-NLS-1$
- public static final String CACHE_FACORY = "distributed-cache-factory";//$NON-NLS-1$
public static final String QUERY_ENGINE = "query-engine";//$NON-NLS-1$
public static final String JDBC = "jdbc";//$NON-NLS-1$
public static final String ODBC = "odbc"; //$NON-NLS-1$
@@ -48,7 +47,7 @@
public static final String MAX_SOURCE_ROWS = "max-source-rows-allowed";//$NON-NLS-1$
public static final String EXCEPTION_ON_MAX_SOURCE_ROWS = "exception-on-max-source-rows";//$NON-NLS-1$
public static final String MAX_ODBC_LOB_SIZE_ALLOWED = "max-odbc-lob-size-allowed";//$NON-NLS-1$
- public static final String OBJECT_REPLICATOR_NAME = "object-replicator-name";//$NON-NLS-1$
+ public static final String OBJECT_REPLICATOR = "object-replicator";//$NON-NLS-1$
public static final String DETECTING_CHANGE_EVENTS = "detect-change-events";//$NON-NLS-1$
public static final String SECURITY_DOMAIN = "security-domain";//$NON-NLS-1$
public static final String MAX_SESSIONS_ALLOWED = "max-sessions-allowed";//$NON-NLS-1$
@@ -72,33 +71,35 @@
public static final String MAX_ENTRIES = "max-entries";//$NON-NLS-1$
public static final String MAX_AGE_IN_SECS = "max-age-in-seconds";//$NON-NLS-1$
public static final String MAX_STALENESS = "max-staleness";//$NON-NLS-1$
- public static final String CACHE_TYPE = "type";//$NON-NLS-1$
public static final String ENABLE = "enable";//$NON-NLS-1$
- // cache-factory
- public static final String CACHE_SERVICE_JNDI_NAME = "cache-manager-jndi-name";//$NON-NLS-1$
- public static final String RESULTSET_CACHE_NAME = "resultsetCacheName";//$NON-NLS-1$
+ // cache-container
+ public static final String NAME = "name";//$NON-NLS-1$
+ public static final String CONTAINER_NAME = "container-name";//$NON-NLS-1$
//socket config
- public static final String MAX_SOCKET_THREAD_SIZE = "maxSocketThreads";//$NON-NLS-1$
- public static final String IN_BUFFER_SIZE = "inputBufferSize";//$NON-NLS-1$
- public static final String OUT_BUFFER_SIZE = "outputBufferSize";//$NON-NLS-1$
+ public static final String MAX_SOCKET_THREAD_SIZE = "max-socket-threads";//$NON-NLS-1$
+ public static final String IN_BUFFER_SIZE = "input-buffer-size";//$NON-NLS-1$
+ public static final String OUT_BUFFER_SIZE = "output-buffer-size";//$NON-NLS-1$
public static final String SOCKET_BINDING = "socket-binding";//$NON-NLS-1$
public static final String SOCKET_ENABLED = "enabled";//$NON-NLS-1$
public static final String SSL_MODE = "mode";//$NON-NLS-1$
- public static final String KEY_STORE_FILE = "keystoreFilename";//$NON-NLS-1$
- public static final String KEY_STORE_PASSWD = "keystorePassword";//$NON-NLS-1$
- public static final String KEY_STORE_TYPE = "keystoreType";//$NON-NLS-1$
- public static final String SSL_PROTOCOL = "sslProtocol";//$NON-NLS-1$
- public static final String KEY_MANAGEMENT_ALG = "keymanagementAlgorithm";//$NON-NLS-1$
- public static final String TRUST_FILE = "truststoreFilename";//$NON-NLS-1$
- public static final String TRUST_PASSWD = "truststorePassword";//$NON-NLS-1$
- public static final String AUTH_MODE = "authenticationMode";//$NON-NLS-1$
+ public static final String KEY_STORE_FILE = "keystore-name";//$NON-NLS-1$
+ public static final String KEY_STORE_PASSWD = "keystore-password";//$NON-NLS-1$
+ public static final String KEY_STORE_TYPE = "keystore-type";//$NON-NLS-1$
+ public static final String SSL_PROTOCOL = "ssl-protocol";//$NON-NLS-1$
+ public static final String KEY_MANAGEMENT_ALG = "keymanagement-algorithm";//$NON-NLS-1$
+ public static final String TRUST_FILE = "truststore-name";//$NON-NLS-1$
+ public static final String TRUST_PASSWD = "truststore-password";//$NON-NLS-1$
+ public static final String AUTH_MODE = "authentication-mode";//$NON-NLS-1$
public static final String SSL = "ssl";//$NON-NLS-1$
public static final String TRANSLATOR_NAME = "name";//$NON-NLS-1$
public static final String TRANSLATOR_MODULE = "module";//$NON-NLS-1$
+ public static final String STACK = "stack";//$NON-NLS-1$
+ public static final String CLUSTER_NAME = "cluster-name";//$NON-NLS-1$
+
public static final String ENGINE_NAME = "name";//$NON-NLS-1$
public static final String DESC = ".describe"; //$NON-NLS-1$
Modified: branches/as7/jboss-integration/src/main/java/org/teiid/jboss/Element.java
===================================================================
--- branches/as7/jboss-integration/src/main/java/org/teiid/jboss/Element.java 2011-09-12 14:53:12 UTC (rev 3463)
+++ branches/as7/jboss-integration/src/main/java/org/teiid/jboss/Element.java 2011-09-12 14:56:06 UTC (rev 3464)
@@ -29,11 +29,14 @@
enum Element {
// must be first
UNKNOWN(null),
+
+ // VM wide elements
QUERY_ENGINE_ELEMENT(QUERY_ENGINE),
+ ASYNC_THREAD_GROUP_ELEMENT(ASYNC_THREAD_GROUP),
+ OBJECT_REPLICATOR_ELEMENT(OBJECT_REPLICATOR),
// Query-ENGINE
ENGINE_NAME_ATTRIBUTE(ENGINE_NAME),
- ASYNC_THREAD_GROUP_ELEMENT(ASYNC_THREAD_GROUP),
MAX_THREADS_ELEMENT(MAX_THREADS),
MAX_ACTIVE_PLANS_ELEMENT(MAX_ACTIVE_PLANS),
USER_REQUEST_SOURCE_CONCURRENCY_ELEMENT(USER_REQUEST_SOURCE_CONCURRENCY),
@@ -46,7 +49,6 @@
MAX_SOURCE_ROWS_ELEMENT(MAX_SOURCE_ROWS),
EXCEPTION_ON_MAX_SOURCE_ROWS_ELEMENT(EXCEPTION_ON_MAX_SOURCE_ROWS),
MAX_ODBC_LOB_SIZE_ALLOWED_ELEMENT(MAX_ODBC_LOB_SIZE_ALLOWED),
- OBJECT_REPLICATOR_NAME_ELEMENT(OBJECT_REPLICATOR_NAME),
DETECTING_CHANGE_EVENTS_ELEMENT(DETECTING_CHANGE_EVENTS),
MAX_SESSIONS_ALLOWED_ELEMENT(MAX_SESSIONS_ALLOWED),
SESSION_EXPIRATION_TIME_LIMIT_ELEMENT(SESSION_EXPIRATION_TIME_LIMIT),
@@ -55,9 +57,8 @@
//children
BUFFER_SERVICE_ELEMENT(BUFFER_SERVICE),
+ PREPAREDPLAN_CACHE_ELEMENT(PREPAREDPLAN_CACHE),
RESULTSET_CACHE_ELEMENT(RESULTSET_CACHE),
- PREPAREDPLAN_CACHE_ELEMENT(PREPAREDPLAN_CACHE),
- CACHE_FACORY_ELEMENT(CACHE_FACORY),
JDBC_ELEMENT(JDBC),
ODBC_ELEMENT(ODBC),
@@ -71,23 +72,25 @@
MAX_BUFFER_SPACE_ELEMENT(MAX_BUFFER_SPACE),
MAX_OPEN_FILES_ELEMENT(MAX_OPEN_FILES),
- //cache-config
+ //prepared-plan-cache-config
MAX_ENTRIES_ELEMENT(MAX_ENTRIES),
MAX_AGE_IN_SECS_ELEMENT(MAX_AGE_IN_SECS),
MAX_STALENESS_ELEMENT(MAX_STALENESS),
- CACHE_TYPE_ELEMENT(CACHE_TYPE),
ENABLE_ATTRIBUTE(ENABLE),
- // cache-factory
- CACHE_SERVICE_JNDI_NAME_ELEMENT(CACHE_SERVICE_JNDI_NAME),
- RESULTSET_CACHE_NAME_ELEMENT(RESULTSET_CACHE_NAME),
+ // Object Replicator
+ STACK_ATTRIBUTE(STACK),
+ CLUSTER_NAME_ATTRIBUTE(CLUSTER_NAME),
+ // cache-container
+ NAME_ELEMENT(NAME),
+ CONTAINER_NAME_ELEMENT(CONTAINER_NAME),
+
//socket config
MAX_SOCKET_SIZE_ELEMENT(MAX_SOCKET_THREAD_SIZE),
IN_BUFFER_SIZE_ELEMENT(IN_BUFFER_SIZE),
OUT_BUFFER_SIZE_ELEMENT(OUT_BUFFER_SIZE),
SOCKET_BINDING_ELEMENT(SOCKET_BINDING),
- SOCKET_ENABLED_ELEMENT(SOCKET_ENABLED),
SSL_MODE_ELEMENT(SSL_MODE),
KEY_STORE_FILE_ELEMENT(KEY_STORE_FILE),
KEY_STORE_PASSWD_ELEMENT(KEY_STORE_PASSWD),
Added: branches/as7/jboss-integration/src/main/java/org/teiid/jboss/JGroupsObjectReplicatorService.java
===================================================================
--- branches/as7/jboss-integration/src/main/java/org/teiid/jboss/JGroupsObjectReplicatorService.java (rev 0)
+++ branches/as7/jboss-integration/src/main/java/org/teiid/jboss/JGroupsObjectReplicatorService.java 2011-09-12 14:56:06 UTC (rev 3464)
@@ -0,0 +1,61 @@
+/*
+ * JBoss, Home of Professional Open Source.
+ * See the COPYRIGHT.txt file distributed with this work for information
+ * regarding copyright ownership. Some portions may be licensed
+ * to Red Hat, Inc. under one or more contributor license agreements.
+ *
+ * This library is free software; you can redistribute it and/or
+ * modify it under the terms of the GNU Lesser General Public
+ * License as published by the Free Software Foundation; either
+ * version 2.1 of the License, or (at your option) any later version.
+ *
+ * This library is distributed in the hope that it will be useful,
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
+ * Lesser General Public License for more details.
+ *
+ * You should have received a copy of the GNU Lesser General Public
+ * License along with this library; if not, write to the Free Software
+ * Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA
+ * 02110-1301 USA.
+ */
+package org.teiid.jboss;
+
+import org.jboss.as.clustering.jgroups.ChannelFactory;
+import org.jboss.msc.service.Service;
+import org.jboss.msc.service.StartContext;
+import org.jboss.msc.service.StartException;
+import org.jboss.msc.service.StopContext;
+import org.jboss.msc.value.InjectedValue;
+import org.teiid.replication.jboss.JGroupsObjectReplicator;
+
+class JGroupsObjectReplicatorService implements Service<JGroupsObjectReplicator> {
+
+ public final InjectedValue<ChannelFactory> channelFactoryInjector = new InjectedValue<ChannelFactory>();
+ private JGroupsObjectReplicator replicator;
+ private String clusterName;
+
+ public JGroupsObjectReplicatorService(String clusterName){
+ this.clusterName = clusterName;
+ }
+
+ @Override
+ public void start(StartContext context) throws StartException {
+ replicator = new JGroupsObjectReplicator(this.clusterName) {
+ @Override
+ public ChannelFactory getChannelFactory() {
+ return channelFactoryInjector.getValue();
+ }
+ };
+ }
+
+ @Override
+ public void stop(StopContext context) {
+ }
+
+ @Override
+ public JGroupsObjectReplicator getValue() throws IllegalStateException,IllegalArgumentException {
+ return replicator;
+ }
+
+}
Property changes on: branches/as7/jboss-integration/src/main/java/org/teiid/jboss/JGroupsObjectReplicatorService.java
___________________________________________________________________
Added: svn:mime-type
+ text/plain
Modified: branches/as7/jboss-integration/src/main/java/org/teiid/jboss/ObjectsSerializerService.java
===================================================================
--- branches/as7/jboss-integration/src/main/java/org/teiid/jboss/ObjectsSerializerService.java 2011-09-12 14:53:12 UTC (rev 3463)
+++ branches/as7/jboss-integration/src/main/java/org/teiid/jboss/ObjectsSerializerService.java 2011-09-12 14:56:06 UTC (rev 3464)
@@ -27,7 +27,7 @@
import org.jboss.msc.service.StopContext;
import org.jboss.msc.value.InjectedValue;
-public class ObjectsSerializerService implements Service<ObjectSerializer> {
+class ObjectsSerializerService implements Service<ObjectSerializer> {
private InjectedValue<String> pathInjector = new InjectedValue<String>();
private ObjectSerializer serializer;
Modified: branches/as7/jboss-integration/src/main/java/org/teiid/jboss/QueryEngineAdd.java
===================================================================
--- branches/as7/jboss-integration/src/main/java/org/teiid/jboss/QueryEngineAdd.java 2011-09-12 14:53:12 UTC (rev 3463)
+++ branches/as7/jboss-integration/src/main/java/org/teiid/jboss/QueryEngineAdd.java 2011-09-12 14:56:06 UTC (rev 3464)
@@ -45,6 +45,7 @@
import org.jboss.dmr.ModelType;
import org.jboss.msc.inject.ConcurrentMapInjector;
import org.jboss.msc.service.*;
+import org.jboss.msc.service.ServiceBuilder.DependencyType;
import org.jboss.msc.value.InjectedValue;
import org.teiid.deployers.SystemVDBDeployer;
import org.teiid.deployers.VDBRepository;
@@ -54,6 +55,7 @@
import org.teiid.jboss.deployers.RuntimeEngineDeployer;
import org.teiid.logging.LogConstants;
import org.teiid.logging.LogManager;
+import org.teiid.query.ObjectReplicator;
import org.teiid.services.BufferServiceImpl;
import org.teiid.transport.ClientServiceRegistry;
import org.teiid.transport.LocalServerConnection;
@@ -68,7 +70,7 @@
final ModelNode node = new ModelNode();
node.get(OPERATION_NAME).set(ADD);
- node.get(DESCRIPTION).set("engine.add"); //$NON-NLS-1$
+ node.get(DESCRIPTION).set("engine.add"); //$NON-NLS-1$
ModelNode engine = node.get(REQUEST_PROPERTIES, Configuration.QUERY_ENGINE);
describeQueryEngine(engine, ATTRIBUTES, bundle);
@@ -81,7 +83,7 @@
final PathAddress pathAddress = PathAddress.pathAddress(address);
final String engineName = pathAddress.getLastElement().getValue();
- populateQueryEngine(engineName, operation, model);
+ populate(engineName, operation, model);
}
@Override
@@ -124,6 +126,7 @@
engineBuilder.addDependency(TeiidServiceNames.AUTHORIZATION_VALIDATOR, AuthorizationValidator.class, engine.getAuthorizationValidatorInjector());
engineBuilder.addDependency(TeiidServiceNames.CACHE_RESULTSET, SessionAwareCache.class, engine.getResultSetCacheInjector());
engineBuilder.addDependency(TeiidServiceNames.CACHE_PREPAREDPLAN, SessionAwareCache.class, engine.getPreparedPlanCacheInjector());
+ engineBuilder.addDependency(DependencyType.OPTIONAL, TeiidServiceNames.OBJECT_REPLICATOR, ObjectReplicator.class, engine.getObjectReplicatorInjector());
if (jdbc != null) {
engineBuilder.addDependency(ServiceName.JBOSS.append("binding", jdbc.getSocketBinding()), SocketBinding.class, engine.getJdbcSocketBindingInjector()); //$NON-NLS-1$
@@ -200,9 +203,6 @@
if (node.hasDefined(Configuration.MAX_ODBC_LOB_SIZE_ALLOWED)) {
engine.setMaxODBCLobSizeAllowed(node.get(Configuration.MAX_ODBC_LOB_SIZE_ALLOWED).asInt());
}
- if (node.hasDefined(Configuration.OBJECT_REPLICATOR_NAME)) {
- engine.setObjectReplicatorName(node.get(Configuration.OBJECT_REPLICATOR_NAME).asString());
- }
if (node.hasDefined(Configuration.DETECTING_CHANGE_EVENTS)) {
engine.setDetectingChangeEvents(node.get(Configuration.DETECTING_CHANGE_EVENTS).asBoolean());
}
@@ -295,8 +295,7 @@
addAttribute(node, Configuration.QUERY_THRESHOLD_IN_SECS, type, bundle.getString(Configuration.QUERY_THRESHOLD_IN_SECS+DESC), ModelType.INT, false, "600"); //$NON-NLS-1$
addAttribute(node, Configuration.MAX_SOURCE_ROWS, type, bundle.getString(Configuration.MAX_SOURCE_ROWS+DESC), ModelType.INT, false, "-1"); //$NON-NLS-1$
addAttribute(node, Configuration.EXCEPTION_ON_MAX_SOURCE_ROWS, type, bundle.getString(Configuration.EXCEPTION_ON_MAX_SOURCE_ROWS+DESC), ModelType.BOOLEAN, false, "true"); //$NON-NLS-1$
- addAttribute(node, Configuration.MAX_ODBC_LOB_SIZE_ALLOWED, type, bundle.getString(Configuration.MAX_ODBC_LOB_SIZE_ALLOWED+DESC), ModelType.INT, false, "5242880"); //$NON-NLS-1$
- addAttribute(node, Configuration.OBJECT_REPLICATOR_NAME, type, bundle.getString(Configuration.OBJECT_REPLICATOR_NAME+DESC), ModelType.STRING, false, "teiid/event-distributor"); //$NON-NLS-1$
+ addAttribute(node, Configuration.MAX_ODBC_LOB_SIZE_ALLOWED, type, bundle.getString(Configuration.MAX_ODBC_LOB_SIZE_ALLOWED+DESC), ModelType.INT, false, "5242880"); //$NON-NLS-1$
addAttribute(node, Configuration.DETECTING_CHANGE_EVENTS, type, bundle.getString(Configuration.DETECTING_CHANGE_EVENTS+DESC), ModelType.BOOLEAN, false, "true"); //$NON-NLS-1$
//session stuff
@@ -325,11 +324,10 @@
private static void describeSocketConfig(ModelNode node, String type, ResourceBundle bundle) {
- addAttribute(node, Configuration.SOCKET_ENABLED, type, bundle.getString(Configuration.SOCKET_ENABLED+DESC), ModelType.BOOLEAN, false, "true"); //$NON-NLS-1$
addAttribute(node, Configuration.MAX_SOCKET_THREAD_SIZE, type, bundle.getString(Configuration.MAX_SOCKET_THREAD_SIZE+DESC), ModelType.INT, false, "0"); //$NON-NLS-1$
addAttribute(node, Configuration.IN_BUFFER_SIZE, type, bundle.getString(Configuration.IN_BUFFER_SIZE+DESC), ModelType.INT, false, "0"); //$NON-NLS-1$
addAttribute(node, Configuration.OUT_BUFFER_SIZE, type, bundle.getString(Configuration.OUT_BUFFER_SIZE+DESC), ModelType.INT, false, "0"); //$NON-NLS-1$
- addAttribute(node, Configuration.SOCKET_BINDING, type, bundle.getString(Configuration.SOCKET_BINDING+DESC), ModelType.INT, true, null);
+ addAttribute(node, Configuration.SOCKET_BINDING, type, bundle.getString(Configuration.SOCKET_BINDING+DESC), ModelType.STRING, true, null);
ModelNode sslNode = node.get(CHILDREN, Configuration.SSL);
sslNode.get(TYPE).set(ModelType.OBJECT);
@@ -348,7 +346,7 @@
addAttribute(node, Configuration.AUTH_MODE, type, bundle.getString(Configuration.AUTH_MODE+DESC), ModelType.STRING, false, "anonymous"); //$NON-NLS-1$
}
- private void populateQueryEngine(String engineName, ModelNode operation, ModelNode model) {
+ static void populate(String engineName, ModelNode operation, ModelNode model) {
model.get(Configuration.ENGINE_NAME).set(engineName);
if (operation.hasDefined(Configuration.MAX_THREADS)) {
@@ -381,9 +379,6 @@
if (operation.hasDefined(Configuration.MAX_ODBC_LOB_SIZE_ALLOWED)) {
model.get(Configuration.MAX_ODBC_LOB_SIZE_ALLOWED).set(operation.get(Configuration.MAX_ODBC_LOB_SIZE_ALLOWED).asInt());
}
- if (operation.hasDefined(Configuration.OBJECT_REPLICATOR_NAME)) {
- model.get(Configuration.OBJECT_REPLICATOR_NAME).set(operation.get(Configuration.OBJECT_REPLICATOR_NAME).asString());
- }
if (operation.hasDefined(Configuration.SECURITY_DOMAIN)) {
List<ModelNode> domains = operation.get(Configuration.SECURITY_DOMAIN).asList();
for (ModelNode domain: domains) {
@@ -409,7 +404,7 @@
}
}
- private void populateSocketConfiguration(ModelNode operation, ModelNode model) {
+ private static void populateSocketConfiguration(ModelNode operation, ModelNode model) {
if (operation.hasDefined(Configuration.SOCKET_BINDING)) {
model.get(Configuration.SOCKET_BINDING).set(operation.get(Configuration.SOCKET_BINDING).asString());
}
Modified: branches/as7/jboss-integration/src/main/java/org/teiid/jboss/QueryEngineOperationHandler.java
===================================================================
--- branches/as7/jboss-integration/src/main/java/org/teiid/jboss/QueryEngineOperationHandler.java 2011-09-12 14:53:12 UTC (rev 3463)
+++ branches/as7/jboss-integration/src/main/java/org/teiid/jboss/QueryEngineOperationHandler.java 2011-09-12 14:56:06 UTC (rev 3464)
@@ -577,7 +577,7 @@
protected void executeOperation(VDBRepository repo, ModelNode operation, ModelNode node) throws OperationFailedException {
List<VDBMetaData> vdbs = repo.getVDBs();
for (VDBMetaData vdb:vdbs) {
- node.add(MetadataMapper.wrap(vdb, node.add()));
+ MetadataMapper.wrap(vdb, node.add());
}
}
protected void describeParameters(ModelNode operationNode, ResourceBundle bundle) {
@@ -595,7 +595,7 @@
protected void executeOperation(TranslatorRepository repo, ModelNode operation, ModelNode node) throws OperationFailedException {
List<VDBTranslatorMetaData> translators = repo.getTranslators();
for (VDBTranslatorMetaData t:translators) {
- node.add(MetadataMapper.VDBTranslatorMetaDataMapper.wrap(t, node.add()));
+ MetadataMapper.VDBTranslatorMetaDataMapper.wrap(t, node.add());
}
}
Modified: branches/as7/jboss-integration/src/main/java/org/teiid/jboss/QueryEngineReferenceFactoryService.java
===================================================================
--- branches/as7/jboss-integration/src/main/java/org/teiid/jboss/QueryEngineReferenceFactoryService.java 2011-09-12 14:53:12 UTC (rev 3463)
+++ branches/as7/jboss-integration/src/main/java/org/teiid/jboss/QueryEngineReferenceFactoryService.java 2011-09-12 14:56:06 UTC (rev 3464)
@@ -35,7 +35,7 @@
import org.teiid.jboss.deployers.RuntimeEngineDeployer;
-public class QueryEngineReferenceFactoryService implements Service<ManagedReferenceFactory>, ManagedReferenceFactory {
+class QueryEngineReferenceFactoryService implements Service<ManagedReferenceFactory>, ManagedReferenceFactory {
private final InjectedValue<RuntimeEngineDeployer> engineInjector = new InjectedValue<RuntimeEngineDeployer>();
private ManagedReference reference;
Modified: branches/as7/jboss-integration/src/main/java/org/teiid/jboss/QueryEngineRemove.java
===================================================================
--- branches/as7/jboss-integration/src/main/java/org/teiid/jboss/QueryEngineRemove.java 2011-09-12 14:53:12 UTC (rev 3463)
+++ branches/as7/jboss-integration/src/main/java/org/teiid/jboss/QueryEngineRemove.java 2011-09-12 14:56:06 UTC (rev 3464)
@@ -37,7 +37,7 @@
import org.jboss.msc.service.ServiceRegistry;
import org.teiid.transport.LocalServerConnection;
-public class QueryEngineRemove extends AbstractRemoveStepHandler implements DescriptionProvider {
+class QueryEngineRemove extends AbstractRemoveStepHandler implements DescriptionProvider {
@Override
protected void performRuntime(OperationContext context, ModelNode operation, ModelNode model) {
Modified: branches/as7/jboss-integration/src/main/java/org/teiid/jboss/SystemVDBService.java
===================================================================
--- branches/as7/jboss-integration/src/main/java/org/teiid/jboss/SystemVDBService.java 2011-09-12 14:53:12 UTC (rev 3463)
+++ branches/as7/jboss-integration/src/main/java/org/teiid/jboss/SystemVDBService.java 2011-09-12 14:56:06 UTC (rev 3464)
@@ -27,7 +27,7 @@
import org.jboss.msc.service.StopContext;
import org.teiid.deployers.SystemVDBDeployer;
-public class SystemVDBService implements Service<SystemVDBDeployer> {
+class SystemVDBService implements Service<SystemVDBDeployer> {
private SystemVDBDeployer deployer;
public SystemVDBService(SystemVDBDeployer deployer){
Modified: branches/as7/jboss-integration/src/main/java/org/teiid/jboss/TeiidBootServicesAdd.java
===================================================================
--- branches/as7/jboss-integration/src/main/java/org/teiid/jboss/TeiidBootServicesAdd.java 2011-09-12 14:53:12 UTC (rev 3463)
+++ branches/as7/jboss-integration/src/main/java/org/teiid/jboss/TeiidBootServicesAdd.java 2011-09-12 14:56:06 UTC (rev 3464)
@@ -31,6 +31,7 @@
import java.util.ResourceBundle;
import java.util.ServiceLoader;
+import org.jboss.as.clustering.jgroups.ChannelFactory;
import org.jboss.as.controller.AbstractAddStepHandler;
import org.jboss.as.controller.OperationContext;
import org.jboss.as.controller.OperationFailedException;
@@ -45,14 +46,11 @@
import org.jboss.modules.Module;
import org.jboss.modules.ModuleIdentifier;
import org.jboss.modules.ModuleLoadException;
-import org.jboss.msc.service.ServiceBuilder;
-import org.jboss.msc.service.ServiceController;
-import org.jboss.msc.service.ServiceTarget;
-import org.jboss.msc.service.ValueService;
+import org.jboss.msc.service.*;
import org.teiid.PolicyDecider;
import org.teiid.cache.CacheConfiguration;
import org.teiid.cache.CacheConfiguration.Policy;
-import org.teiid.cache.CacheFactory;
+import org.teiid.cache.DefaultCacheFactory;
import org.teiid.cache.jboss.ClusterableCacheFactory;
import org.teiid.common.buffer.BufferManager;
import org.teiid.deployers.SystemVDBDeployer;
@@ -60,9 +58,11 @@
import org.teiid.dqp.internal.datamgr.TranslatorRepository;
import org.teiid.dqp.internal.process.*;
import org.teiid.query.function.SystemFunctionManager;
+import org.teiid.replication.jboss.JGroupsObjectReplicator;
import org.teiid.services.BufferServiceImpl;
-public class TeiidBootServicesAdd extends AbstractAddStepHandler implements DescriptionProvider {
+class TeiidBootServicesAdd extends AbstractAddStepHandler implements DescriptionProvider {
+
@Override
public ModelNode getModelDescription(Locale locale) {
final ResourceBundle bundle = IntegrationPlugin.getResourceBundle(locale);
@@ -81,6 +81,7 @@
addAttribute(node, Configuration.AUTHORIZATION_VALIDATOR_MODULE, type, bundle.getString(Configuration.AUTHORIZATION_VALIDATOR_MODULE+DESC), ModelType.BOOLEAN, false, "false"); //$NON-NLS-1$
addAttribute(node, Configuration.POLICY_DECIDER_MODULE, type, bundle.getString(Configuration.POLICY_DECIDER_MODULE+DESC), ModelType.STRING, false, "teiid-async-threads"); //$NON-NLS-1$
+ addAttribute(node, Configuration.OBJECT_REPLICATOR, type, bundle.getString(Configuration.OBJECT_REPLICATOR+DESC), ModelType.STRING, false, "teiid/event-distributor"); //$NON-NLS-1$
ModelNode bufferNode = node.get(CHILDREN, Configuration.BUFFER_SERVICE);
bufferNode.get(TYPE).set(ModelType.OBJECT);
@@ -88,13 +89,6 @@
bufferNode.get(REQUIRED).set(false);
describeBufferManager(bufferNode, ATTRIBUTES, bundle);
- // result-set-cache
- ModelNode rsCacheNode = node.get(CHILDREN, Configuration.RESULTSET_CACHE);
- rsCacheNode.get(TYPE).set(ModelType.OBJECT);
- rsCacheNode.get(DESCRIPTION).set(bundle.getString(Configuration.RESULTSET_CACHE+DESC));
- rsCacheNode.get(REQUIRED).set(false);
- describeResultsetcache(rsCacheNode, ATTRIBUTES, bundle);
-
// preparedplan-set-cache
ModelNode preparedPlanCacheNode = node.get(CHILDREN, Configuration.PREPAREDPLAN_CACHE);
preparedPlanCacheNode.get(TYPE).set(ModelType.OBJECT);
@@ -102,16 +96,20 @@
preparedPlanCacheNode.get(REQUIRED).set(false);
describePreparedPlanCache(preparedPlanCacheNode, ATTRIBUTES, bundle);
- //distributed-cache
- ModelNode distributedCacheNode = node.get(CHILDREN, Configuration.CACHE_FACORY);
+ // result-set-cache
+ ModelNode distributedCacheNode = node.get(CHILDREN, Configuration.RESULTSET_CACHE);
distributedCacheNode.get(TYPE).set(ModelType.OBJECT);
- distributedCacheNode.get(DESCRIPTION).set(bundle.getString(Configuration.CACHE_FACORY+DESC));
+ distributedCacheNode.get(DESCRIPTION).set(bundle.getString(Configuration.RESULTSET_CACHE+DESC));
distributedCacheNode.get(REQUIRED).set(false);
- describeCacheFactory(preparedPlanCacheNode, ATTRIBUTES, bundle);
+ describeResultsetCache(preparedPlanCacheNode, ATTRIBUTES, bundle);
}
@Override
protected void populateModel(ModelNode operation, ModelNode model) throws OperationFailedException {
+ populate(operation, model);
+ }
+
+ static void populate(ModelNode operation, ModelNode model) {
if (operation.hasDefined(Configuration.ALLOW_ENV_FUNCTION)) {
model.get(Configuration.ALLOW_ENV_FUNCTION).set(operation.get(Configuration.ALLOW_ENV_FUNCTION).asString());
}
@@ -129,9 +127,13 @@
model.get(Configuration.AUTHORIZATION_VALIDATOR_MODULE).set(operation.get(Configuration.AUTHORIZATION_VALIDATOR_MODULE).asString());
}
- populateCache(operation, model);
+ populateResultsetCache(operation, model);
+ populatePreparedPlanCache(operation, model);
+ populateObjectReplicator(operation, model);
}
+
+
@Override
protected void performRuntime(final OperationContext context, final ModelNode operation, final ModelNode model,
final ServiceVerificationHandler verificationHandler, final List<ServiceController<?>> newControllers) throws OperationFailedException {
@@ -222,18 +224,8 @@
});
newControllers.add(target.addService(TeiidServiceNames.AUTHORIZATION_VALIDATOR, authValidatorService).install());
- //cache factory
- final CacheFactory cacheFactory = buildCacheFactory(operation.get(Configuration.CACHE_FACORY));
- ValueService<CacheFactory> cacheFactoryService = new ValueService<CacheFactory>(new org.jboss.msc.value.Value<CacheFactory>() {
- @Override
- public CacheFactory getValue() throws IllegalStateException, IllegalArgumentException {
- return cacheFactory;
- }
- });
- newControllers.add(target.addService(TeiidServiceNames.CACHE_FACTORY, cacheFactoryService).install());
-
// resultset cache
- final SessionAwareCache<CachedResults> resultsetCache = buildResultsetCache(operation.get(Configuration.RESULTSET_CACHE), cacheFactory, bufferManager.getBufferManager());
+ final SessionAwareCache<CachedResults> resultsetCache = buildResultsetCache(operation, bufferManager.getBufferManager());
ValueService<SessionAwareCache<CachedResults>> resultSetService = new ValueService<SessionAwareCache<CachedResults>>(new org.jboss.msc.value.Value<SessionAwareCache<CachedResults>>() {
@Override
public SessionAwareCache<CachedResults> getValue() throws IllegalStateException, IllegalArgumentException {
@@ -243,7 +235,7 @@
newControllers.add(target.addService(TeiidServiceNames.CACHE_RESULTSET, resultSetService).install());
// prepared-plan cache
- final SessionAwareCache<PreparedPlan> preparedPlanCache = buildPreparedPlanCache(operation.get(Configuration.PREPAREDPLAN_CACHE), cacheFactory, bufferManager.getBufferManager());
+ final SessionAwareCache<PreparedPlan> preparedPlanCache = buildPreparedPlanCache(operation.get(Configuration.PREPAREDPLAN_CACHE), bufferManager.getBufferManager());
ValueService<SessionAwareCache<PreparedPlan>> preparedPlanService = new ValueService<SessionAwareCache<PreparedPlan>>(new org.jboss.msc.value.Value<SessionAwareCache<PreparedPlan>>() {
@Override
public SessionAwareCache<PreparedPlan> getValue() throws IllegalStateException, IllegalArgumentException {
@@ -252,7 +244,21 @@
});
newControllers.add(target.addService(TeiidServiceNames.CACHE_PREPAREDPLAN, preparedPlanService).install());
+ // Object Replicator
+ if (operation.hasDefined(Configuration.OBJECT_REPLICATOR)) {
+ ModelNode node = operation.get(Configuration.OBJECT_REPLICATOR);
+ String stack = node.get(Configuration.STACK).asString();
+ String clusterName = "teiid-rep"; //$NON-NLS-1$
+ if (node.hasDefined(Configuration.CLUSTER_NAME)) {
+ clusterName = node.get(Configuration.CLUSTER_NAME).asString();
+ }
+ JGroupsObjectReplicatorService replicatorService = new JGroupsObjectReplicatorService(clusterName);
+ ServiceBuilder<JGroupsObjectReplicator> serviceBuilder = target.addService(TeiidServiceNames.OBJECT_REPLICATOR, replicatorService);
+ serviceBuilder.addDependency(ServiceName.JBOSS.append("jgroups", stack), ChannelFactory.class, replicatorService.channelFactoryInjector); //$NON-NLS-1$
+ newControllers.add(serviceBuilder.install());
+ }
+
// Register VDB deployer
context.addStep(new AbstractDeploymentChainStep() {
@Override
@@ -325,7 +331,7 @@
return bufferManger;
}
- private void populateBufferManager(ModelNode operation, ModelNode model) {
+ private static void populateBufferManager(ModelNode operation, ModelNode model) {
ModelNode childNode = operation.get(CHILDREN, Configuration.BUFFER_SERVICE);
if (!childNode.isDefined()) {
@@ -361,121 +367,118 @@
}
}
- private void populateCache(ModelNode operation, ModelNode model) {
- if (operation.hasDefined(Configuration.CACHE_FACORY)) {
- ModelNode cacheFactory = operation.get(Configuration.CACHE_FACORY);
- if (cacheFactory.hasDefined(Configuration.CACHE_SERVICE_JNDI_NAME)) {
- model.get(Configuration.CACHE_FACORY, Configuration.CACHE_SERVICE_JNDI_NAME).set(cacheFactory.get(Configuration.CACHE_SERVICE_JNDI_NAME).asString());
- }
- if (cacheFactory.hasDefined(Configuration.RESULTSET_CACHE_NAME)) {
- model.get(Configuration.CACHE_FACORY, Configuration.RESULTSET_CACHE_NAME).set(cacheFactory.get(Configuration.RESULTSET_CACHE_NAME).asString());
- }
- }
-
+ private static void populateResultsetCache(ModelNode operation, ModelNode model) {
if (operation.hasDefined(Configuration.RESULTSET_CACHE)) {
ModelNode cache = operation.get(Configuration.RESULTSET_CACHE);
- populateCacheConfig(cache, model.get(Configuration.RESULTSET_CACHE));
+ if (cache.hasDefined(Configuration.NAME)) {
+ model.get(Configuration.RESULTSET_CACHE, Configuration.NAME).set(cache.get(Configuration.NAME).asString());
+ }
+
+ if (cache.hasDefined(Configuration.CONTAINER_NAME)) {
+ model.get(Configuration.RESULTSET_CACHE, Configuration.CONTAINER_NAME).set(cache.get(Configuration.CONTAINER_NAME).asString());
+ }
+
+ if (cache.hasDefined(Configuration.ENABLE)) {
+ model.get(Configuration.RESULTSET_CACHE, Configuration.ENABLE).set(cache.get(Configuration.ENABLE).asBoolean());
+ }
+
+ if (cache.hasDefined(Configuration.MAX_STALENESS)) {
+ model.get(Configuration.RESULTSET_CACHE, Configuration.MAX_STALENESS).set(cache.get(Configuration.MAX_STALENESS).asInt());
+ }
}
-
+ }
+
+ private static void populateObjectReplicator(ModelNode operation, ModelNode model) {
+ if (operation.hasDefined(Configuration.OBJECT_REPLICATOR)) {
+ ModelNode replicator = operation.get(Configuration.OBJECT_REPLICATOR);
+ if (replicator.hasDefined(Configuration.STACK)) {
+ model.get(Configuration.OBJECT_REPLICATOR, Configuration.STACK).set(replicator.get(Configuration.STACK).asString());
+ }
+
+ if (replicator.hasDefined(Configuration.CLUSTER_NAME)) {
+ model.get(Configuration.OBJECT_REPLICATOR, Configuration.CLUSTER_NAME).set(replicator.get(Configuration.CLUSTER_NAME).asString());
+ }
+ }
+ }
+
+ private static void populatePreparedPlanCache(ModelNode operation, ModelNode model) {
if (operation.hasDefined(Configuration.PREPAREDPLAN_CACHE)) {
ModelNode cache = operation.get(Configuration.PREPAREDPLAN_CACHE);
- populateCacheConfig(cache, model.get(Configuration.PREPAREDPLAN_CACHE));
+ if (cache.hasDefined(Configuration.MAX_ENTRIES)) {
+ model.get(Configuration.MAX_ENTRIES).set(cache.get(Configuration.MAX_ENTRIES).asInt());
+ }
+ if (cache.hasDefined(Configuration.MAX_AGE_IN_SECS)) {
+ model.get(Configuration.MAX_AGE_IN_SECS).set(cache.get(Configuration.MAX_AGE_IN_SECS).asInt());
+ }
+ if (cache.hasDefined(Configuration.MAX_STALENESS)) {
+ model.get(Configuration.MAX_STALENESS).set(cache.get(Configuration.MAX_STALENESS).asInt());
+ }
}
- }
-
- private void populateCacheConfig(ModelNode operation, ModelNode model) {
- if (operation.hasDefined(Configuration.ENABLE)) {
- model.get(Configuration.ENABLE).set(operation.get(Configuration.ENABLE).asBoolean());
- }
- if (operation.hasDefined(Configuration.MAX_ENTRIES)) {
- model.get(Configuration.MAX_ENTRIES).set(operation.get(Configuration.MAX_ENTRIES).asInt());
- }
- if (operation.hasDefined(Configuration.MAX_AGE_IN_SECS)) {
- model.get(Configuration.MAX_AGE_IN_SECS).set(operation.get(Configuration.MAX_AGE_IN_SECS).asInt());
- }
- if (operation.hasDefined(Configuration.MAX_STALENESS)) {
- model.get(Configuration.MAX_STALENESS).set(operation.get(Configuration.MAX_STALENESS).asInt());
- }
- if (operation.hasDefined(Configuration.CACHE_TYPE)) {
- model.get(Configuration.CACHE_TYPE).set(operation.get(Configuration.CACHE_TYPE).asString());
- }
}
- private static void describeCacheFactory(ModelNode node, String type, ResourceBundle bundle) {
- addAttribute(node, Configuration.CACHE_SERVICE_JNDI_NAME, type, bundle.getString(Configuration.CACHE_SERVICE_JNDI_NAME+DESC), ModelType.STRING, false, "java:TeiidCacheManager"); //$NON-NLS-1$
- addAttribute(node, Configuration.RESULTSET_CACHE_NAME, type, bundle.getString(Configuration.RESULTSET_CACHE_NAME+DESC), ModelType.STRING, false, "teiid-resultset-cache"); //$NON-NLS-1$
- }
-
- private static void describeResultsetcache(ModelNode node, String type, ResourceBundle bundle) {
- addAttribute(node, Configuration.MAX_ENTRIES, type, bundle.getString(Configuration.MAX_ENTRIES+DESC), ModelType.INT, false, "1024"); //$NON-NLS-1$
- addAttribute(node, Configuration.MAX_AGE_IN_SECS, type, bundle.getString(Configuration.MAX_AGE_IN_SECS+DESC), ModelType.INT, false, "7200");//$NON-NLS-1$
+ private static void describeResultsetCache(ModelNode node, String type, ResourceBundle bundle) {
+ addAttribute(node, Configuration.NAME, type, bundle.getString(Configuration.NAME+DESC), ModelType.STRING, false, "resultset"); //$NON-NLS-1$
addAttribute(node, Configuration.MAX_STALENESS, type, bundle.getString(Configuration.MAX_STALENESS+DESC), ModelType.INT, false, "60");//$NON-NLS-1$
- addAttribute(node, Configuration.CACHE_TYPE, type, bundle.getString(Configuration.CACHE_TYPE+DESC), ModelType.STRING, false, "EXPIRATION"); //$NON-NLS-1$
+ addAttribute(node, Configuration.ENABLE, type, bundle.getString(Configuration.ENABLE+DESC), ModelType.BOOLEAN, false, null);
+ addAttribute(node, Configuration.CONTAINER_NAME, type, bundle.getString(Configuration.CONTAINER_NAME+DESC), ModelType.STRING, false, null);
}
private static void describePreparedPlanCache(ModelNode node, String type, ResourceBundle bundle) {
addAttribute(node, Configuration.MAX_ENTRIES, type, bundle.getString(Configuration.MAX_ENTRIES+DESC), ModelType.INT, false, "512"); //$NON-NLS-1$
addAttribute(node, Configuration.MAX_AGE_IN_SECS, type, bundle.getString(Configuration.MAX_AGE_IN_SECS+DESC), ModelType.INT, false, "28800");//$NON-NLS-1$
addAttribute(node, Configuration.MAX_STALENESS, type, bundle.getString(Configuration.MAX_STALENESS+DESC), ModelType.INT, false, "0");//$NON-NLS-1$
- addAttribute(node, Configuration.CACHE_TYPE, type, bundle.getString(Configuration.CACHE_TYPE+DESC), ModelType.STRING, false, "LRU"); //$NON-NLS-1$
}
-
- private CacheFactory buildCacheFactory(ModelNode node) {
- ClusterableCacheFactory cacheFactory = new ClusterableCacheFactory();
- if (node.hasDefined(Configuration.CACHE_SERVICE_JNDI_NAME)) {
- cacheFactory.setCacheManager(node.get(Configuration.CACHE_SERVICE_JNDI_NAME).asString());
- }
- if (node.hasDefined(Configuration.RESULTSET_CACHE_NAME)) {
- cacheFactory.setResultsetCacheName(node.get(Configuration.RESULTSET_CACHE_NAME).asString());
- }
- return cacheFactory;
- }
- private SessionAwareCache<CachedResults> buildResultsetCache(ModelNode node, CacheFactory cacheFactory, BufferManager bufferManager) {
- if (node.hasDefined(Configuration.ENABLE)) {
- if (!node.get(Configuration.ENABLE).asBoolean()) {
- return null;
- }
+ private SessionAwareCache<CachedResults> buildResultsetCache(ModelNode operation, BufferManager bufferManager) throws OperationFailedException {
+
+ CacheConfiguration cacheConfig = new CacheConfiguration();
+ // these settings are not really used; they are defined by infinispan
+ cacheConfig.setMaxEntries(1024);
+ cacheConfig.setMaxAgeInSeconds(7200);
+ cacheConfig.setType(Policy.EXPIRATION.name());
+ cacheConfig.setLocation("resultset"); //$NON-NLS-1$
+ cacheConfig.setMaxStaleness(60);
+
+ if (!operation.hasDefined(Configuration.RESULTSET_CACHE)) {
+ SessionAwareCache<CachedResults> resultsetCache = new SessionAwareCache<CachedResults>(new DefaultCacheFactory(), SessionAwareCache.Type.RESULTSET, cacheConfig);
+ resultsetCache.setBufferManager(bufferManager);
+ return resultsetCache;
}
- CacheConfiguration cacheConfig = new CacheConfiguration();
- if (node.hasDefined(Configuration.MAX_ENTRIES)) {
- cacheConfig.setMaxEntries(node.get(Configuration.MAX_ENTRIES).asInt());
+ ModelNode node = operation.get(Configuration.RESULTSET_CACHE);
+ ClusterableCacheFactory cacheFactory = new ClusterableCacheFactory();
+
+ if (node.hasDefined(Configuration.CONTAINER_NAME)) {
+ cacheFactory.setCacheManager(node.get(Configuration.CONTAINER_NAME).asString());
}
else {
- cacheConfig.setMaxEntries(1024);
+ throw new OperationFailedException(new ModelNode().set(IntegrationPlugin.Util.getString("cache-container-name-required"))); //$NON-NLS-1$
}
- if (node.hasDefined(Configuration.MAX_AGE_IN_SECS)) {
- cacheConfig.setMaxAgeInSeconds(node.get(Configuration.MAX_AGE_IN_SECS).asInt());
- }
+ if (node.hasDefined(Configuration.NAME)) {
+ cacheFactory.setResultsetCacheName(node.get(Configuration.NAME).asString());
+ }
else {
- cacheConfig.setMaxAgeInSeconds(7200);
+ cacheFactory.setResultsetCacheName("resultset"); //$NON-NLS-1$
}
- if (node.hasDefined(Configuration.MAX_STALENESS)) {
+ if (node.hasDefined(Configuration.ENABLE)) {
+ if (!node.get(Configuration.ENABLE).asBoolean()) {
+ return null;
+ }
+ }
+
+ if (node.hasDefined(Configuration.MAX_STALENESS)) {
cacheConfig.setMaxStaleness(node.get(Configuration.MAX_STALENESS).asInt());
}
- else {
- cacheConfig.setMaxStaleness(60);
- }
- if (node.hasDefined(Configuration.CACHE_TYPE)) {
- cacheConfig.setType(node.get(Configuration.CACHE_TYPE).asString());
- }
- else {
- cacheConfig.setType(Policy.EXPIRATION.name());
- }
-
- cacheConfig.setLocation("resultset"); //$NON-NLS-1$
- SessionAwareCache<CachedResults> resultsetCache = new SessionAwareCache<CachedResults>(cacheFactory, SessionAwareCache.Type.RESULTSET, cacheConfig);
+
+ SessionAwareCache<CachedResults> resultsetCache = new SessionAwareCache<CachedResults>(cacheFactory, SessionAwareCache.Type.RESULTSET, cacheConfig);
resultsetCache.setBufferManager(bufferManager);
-
return resultsetCache;
}
- private SessionAwareCache<PreparedPlan> buildPreparedPlanCache(ModelNode node, CacheFactory cacheFactory, BufferManager bufferManager) {
-
+ private SessionAwareCache<PreparedPlan> buildPreparedPlanCache(ModelNode node, BufferManager bufferManager) {
CacheConfiguration cacheConfig = new CacheConfiguration();
if (node.hasDefined(Configuration.MAX_ENTRIES)) {
cacheConfig.setMaxEntries(node.get(Configuration.MAX_ENTRIES).asInt());
@@ -497,15 +500,10 @@
else {
cacheConfig.setMaxStaleness(0);
}
- if (node.hasDefined(Configuration.CACHE_TYPE)) {
- cacheConfig.setType(node.get(Configuration.CACHE_TYPE).asString());
- }
- else {
- cacheConfig.setType(Policy.LRU.name());
- }
+ cacheConfig.setType(Policy.LRU.name());
cacheConfig.setLocation("prepared"); //$NON-NLS-1$
- SessionAwareCache<PreparedPlan> cache = new SessionAwareCache<PreparedPlan>(cacheFactory, SessionAwareCache.Type.PREPAREDPLAN, cacheConfig);
+ SessionAwareCache<PreparedPlan> cache = new SessionAwareCache<PreparedPlan>(new DefaultCacheFactory(), SessionAwareCache.Type.PREPAREDPLAN, cacheConfig);
cache.setBufferManager(bufferManager);
return cache;
Modified: branches/as7/jboss-integration/src/main/java/org/teiid/jboss/TeiidExtension.java
===================================================================
--- branches/as7/jboss-integration/src/main/java/org/teiid/jboss/TeiidExtension.java 2011-09-12 14:53:12 UTC (rev 3463)
+++ branches/as7/jboss-integration/src/main/java/org/teiid/jboss/TeiidExtension.java 2011-09-12 14:56:06 UTC (rev 3464)
@@ -32,10 +32,9 @@
import org.jboss.as.controller.PathElement;
import org.jboss.as.controller.SubsystemRegistration;
import org.jboss.as.controller.descriptions.DescriptionProvider;
-import org.jboss.as.controller.descriptions.ModelDescriptionConstants;
import org.jboss.as.controller.parsing.ExtensionParsingContext;
-import org.jboss.as.controller.registry.ManagementResourceRegistration;
import org.jboss.as.controller.registry.AttributeAccess.Storage;
+import org.jboss.as.controller.registry.ManagementResourceRegistration;
import org.jboss.dmr.ModelNode;
import org.jboss.dmr.ModelType;
import org.teiid.logging.Log4jListener;
@@ -53,6 +52,7 @@
private static TranslatorAdd TRANSLATOR_ADD = new TranslatorAdd();
private static TranslatorRemove TRANSLATOR_REMOVE = new TranslatorRemove();
private static TeiidBootServicesAdd TEIID_BOOT_ADD = new TeiidBootServicesAdd();
+ private static TeiidSubsystemDescribe TEIID_DESCRIBE = new TeiidSubsystemDescribe();
@Override
public void initialize(ExtensionContext context) {
@@ -63,29 +63,10 @@
registration.registerXMLElementWriter(parser);
// Main Teiid system, with children query engine and translators.
- final ManagementResourceRegistration teiidSubsystem = registration.registerSubsystemModel(new DescriptionProvider() {
- @Override
- public ModelNode getModelDescription(Locale locale) {
- final ResourceBundle bundle = IntegrationPlugin.getResourceBundle(locale);
-
- ModelNode node = new ModelNode();
- node.get(ModelDescriptionConstants.DESCRIPTION).set("teiid subsystem"); //$NON-NLS-1$
- node.get(ModelDescriptionConstants.HEAD_COMMENT_ALLOWED).set(true);
- node.get(ModelDescriptionConstants.TAIL_COMMENT_ALLOWED).set(true);
- node.get(ModelDescriptionConstants.NAMESPACE).set(Namespace.CURRENT.getUri());
-
- TeiidBootServicesAdd.describeTeiidRoot(bundle, ATTRIBUTES, node);
- node.get(CHILDREN, Configuration.QUERY_ENGINE, DESCRIPTION).set(bundle.getString(Configuration.QUERY_ENGINE+Configuration.DESC));
- node.get(CHILDREN, Configuration.QUERY_ENGINE, REQUIRED).set(true);
-
- node.get(CHILDREN, Configuration.TRANSLATOR, DESCRIPTION).set(bundle.getString(Configuration.TRANSLATOR+Configuration.DESC));
- node.get(CHILDREN, Configuration.TRANSLATOR, REQUIRED).set(true);
-
- return node;
- }
- });
+
+ final ManagementResourceRegistration teiidSubsystem = registration.registerSubsystemModel(TEIID_DESCRIBE);
teiidSubsystem.registerOperationHandler(ADD, TEIID_BOOT_ADD, TEIID_BOOT_ADD, false);
- //teiidSubsystem.registerOperationHandler(REMOVE, ENGINE_REMOVE, ENGINE_REMOVE, false);
+ teiidSubsystem.registerOperationHandler(DESCRIBE, TEIID_DESCRIBE, TEIID_DESCRIBE, false);
// Translator Subsystem
final ManagementResourceRegistration translatorSubsystem = teiidSubsystem.registerSubModel(PathElement.pathElement(Configuration.TRANSLATOR), new DescriptionProvider() {
Modified: branches/as7/jboss-integration/src/main/java/org/teiid/jboss/TeiidServiceNames.java
===================================================================
--- branches/as7/jboss-integration/src/main/java/org/teiid/jboss/TeiidServiceNames.java 2011-09-12 14:53:12 UTC (rev 3463)
+++ branches/as7/jboss-integration/src/main/java/org/teiid/jboss/TeiidServiceNames.java 2011-09-12 14:56:06 UTC (rev 3464)
@@ -35,9 +35,9 @@
public static ServiceName AUTHORIZATION_VALIDATOR = ServiceName.JBOSS.append("teiid", "authorization-validator");//$NON-NLS-1$ //$NON-NLS-2$
private static ServiceName VDB_SVC_BASE = ServiceName.JBOSS.append("teiid", "vdb"); //$NON-NLS-1$ //$NON-NLS-2$
public static ServiceName OBJECT_SERIALIZER = ServiceName.JBOSS.append("teiid", "object-serializer"); //$NON-NLS-1$ //$NON-NLS-2$
- public static ServiceName CACHE_FACTORY = ServiceName.JBOSS.append("teiid", "cache-factory"); //$NON-NLS-1$ //$NON-NLS-2$
public static ServiceName CACHE_RESULTSET = ServiceName.JBOSS.append("teiid", "cache", "resultset"); //$NON-NLS-1$ //$NON-NLS-2$ //$NON-NLS-3$
public static ServiceName CACHE_PREPAREDPLAN = ServiceName.JBOSS.append("teiid", "cache", "prepared-plan"); //$NON-NLS-1$ //$NON-NLS-2$ //$NON-NLS-3$
+ public static ServiceName OBJECT_REPLICATOR = ServiceName.JBOSS.append("teiid", "object-replicator"); //$NON-NLS-1$ //$NON-NLS-2$
public static ServiceName translatorServiceName(String name) {
Added: branches/as7/jboss-integration/src/main/java/org/teiid/jboss/TeiidSubsystemDescribe.java
===================================================================
--- branches/as7/jboss-integration/src/main/java/org/teiid/jboss/TeiidSubsystemDescribe.java (rev 0)
+++ branches/as7/jboss-integration/src/main/java/org/teiid/jboss/TeiidSubsystemDescribe.java 2011-09-12 14:56:06 UTC (rev 3464)
@@ -0,0 +1,107 @@
+/*
+ * JBoss, Home of Professional Open Source.
+ * Copyright 2011, Red Hat, Inc., and individual contributors
+ * as indicated by the @author tags. See the copyright.txt file in the
+ * distribution for a full listing of individual contributors.
+ *
+ * This is free software; you can redistribute it and/or modify it
+ * under the terms of the GNU Lesser General Public License as
+ * published by the Free Software Foundation; either version 2.1 of
+ * the License, or (at your option) any later version.
+ *
+ * This software is distributed in the hope that it will be useful,
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
+ * Lesser General Public License for more details.
+ *
+ * You should have received a copy of the GNU Lesser General Public
+ * License along with this software; if not, write to the Free
+ * Software Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA
+ * 02110-1301 USA, or see the FSF site: http://www.fsf.org.
+ */
+
+package org.teiid.jboss;
+
+import static org.jboss.as.controller.descriptions.ModelDescriptionConstants.*;
+
+import java.util.Locale;
+import java.util.ResourceBundle;
+
+import org.jboss.as.controller.OperationContext;
+import org.jboss.as.controller.OperationFailedException;
+import org.jboss.as.controller.OperationStepHandler;
+import org.jboss.as.controller.PathAddress;
+import org.jboss.as.controller.descriptions.DescriptionProvider;
+import org.jboss.as.controller.descriptions.ModelDescriptionConstants;
+import org.jboss.as.controller.registry.Resource;
+import org.jboss.dmr.ModelNode;
+import org.jboss.dmr.Property;
+
+public class TeiidSubsystemDescribe implements OperationStepHandler, DescriptionProvider {
+
+ @Override
+ public ModelNode getModelDescription(Locale locale) {
+ final ResourceBundle bundle = IntegrationPlugin.getResourceBundle(locale);
+
+ ModelNode node = new ModelNode();
+ node.get(ModelDescriptionConstants.DESCRIPTION).set("teiid subsystem"); //$NON-NLS-1$
+ node.get(ModelDescriptionConstants.HEAD_COMMENT_ALLOWED).set(true);
+ node.get(ModelDescriptionConstants.TAIL_COMMENT_ALLOWED).set(true);
+ node.get(ModelDescriptionConstants.NAMESPACE).set(Namespace.CURRENT.getUri());
+
+ TeiidBootServicesAdd.describeTeiidRoot(bundle, ATTRIBUTES, node);
+ node.get(CHILDREN, Configuration.QUERY_ENGINE, DESCRIPTION).set(bundle.getString(Configuration.QUERY_ENGINE+Configuration.DESC));
+ node.get(CHILDREN, Configuration.QUERY_ENGINE, REQUIRED).set(true);
+
+ node.get(CHILDREN, Configuration.TRANSLATOR, DESCRIPTION).set(bundle.getString(Configuration.TRANSLATOR+Configuration.DESC));
+ node.get(CHILDREN, Configuration.TRANSLATOR, REQUIRED).set(true);
+
+ return node;
+ }
+
+ public void execute(OperationContext context, ModelNode operation) throws OperationFailedException {
+ ModelNode result = context.getResult();
+
+ PathAddress rootAddress = PathAddress.pathAddress(PathAddress.pathAddress(operation.require(ModelDescriptionConstants.OP_ADDR)).getLastElement());
+ ModelNode subModel = Resource.Tools.readModel(context.readResource(PathAddress.EMPTY_ADDRESS));
+
+ final ModelNode subsystemAdd = new ModelNode();
+ subsystemAdd.get(OP).set(ADD);
+ subsystemAdd.get(OP_ADDR).set(rootAddress.toModelNode());
+
+ TeiidBootServicesAdd.populate(subModel, subsystemAdd);
+ result.add(subsystemAdd);
+
+ if (subModel.hasDefined(Configuration.QUERY_ENGINE)) {
+ for (Property container : subModel.get(Configuration.QUERY_ENGINE).asPropertyList()) {
+ ModelNode address = rootAddress.toModelNode();
+ address.add(Configuration.QUERY_ENGINE, container.getName());
+
+ final ModelNode addOperation = new ModelNode();
+ addOperation.get(OP).set(ADD);
+ addOperation.get(OP_ADDR).set(address);
+
+ QueryEngineAdd.populate(container.getName(), container.getValue(), addOperation);
+
+ result.add(addOperation);
+ }
+ }
+
+ if (subModel.hasDefined(Configuration.TRANSLATOR)) {
+ for (Property container : subModel.get(Configuration.TRANSLATOR).asPropertyList()) {
+ ModelNode address = rootAddress.toModelNode();
+ address.add(Configuration.TRANSLATOR, container.getName());
+
+ final ModelNode addOperation = new ModelNode();
+ addOperation.get(OP).set(ADD);
+ addOperation.get(OP_ADDR).set(address);
+
+ TranslatorAdd.populate(container.getName(), container.getValue(), addOperation);
+
+ result.add(addOperation);
+ }
+ }
+
+ context.completeStep();
+ }
+}
Property changes on: branches/as7/jboss-integration/src/main/java/org/teiid/jboss/TeiidSubsystemDescribe.java
___________________________________________________________________
Added: svn:mime-type
+ text/plain
Modified: branches/as7/jboss-integration/src/main/java/org/teiid/jboss/TeiidSubsystemParser.java
===================================================================
--- branches/as7/jboss-integration/src/main/java/org/teiid/jboss/TeiidSubsystemParser.java 2011-09-12 14:53:12 UTC (rev 3463)
+++ branches/as7/jboss-integration/src/main/java/org/teiid/jboss/TeiidSubsystemParser.java 2011-09-12 14:56:06 UTC (rev 3464)
@@ -62,21 +62,21 @@
writer.writeEndElement();
}
- if (has(node, Element.CACHE_FACORY_ELEMENT.getLocalName())){
- writer.writeStartElement(Element.CACHE_FACORY_ELEMENT.getLocalName());
- writeCacheFactoryConfiguration(writer, node.get(Element.CACHE_FACORY_ELEMENT.getLocalName()));
+ if (has(node, Element.RESULTSET_CACHE_ELEMENT.getLocalName())){
+ writer.writeStartElement(Element.RESULTSET_CACHE_ELEMENT.getLocalName());
+ writeResultsetCacheConfiguration(writer, node.get(Element.RESULTSET_CACHE_ELEMENT.getLocalName()));
writer.writeEndElement();
}
- if (has(node, Element.RESULTSET_CACHE_ELEMENT.getLocalName())){
- writer.writeStartElement(Element.RESULTSET_CACHE_ELEMENT.getLocalName());
- writeCacheConfiguration(writer, node.get(Element.RESULTSET_CACHE_ELEMENT.getLocalName()));
+ if (has(node, Element.PREPAREDPLAN_CACHE_ELEMENT.getLocalName())){
+ writer.writeStartElement(Element.PREPAREDPLAN_CACHE_ELEMENT.getLocalName());
+ writePreparedPlanCacheConfiguration(writer, node.get(Element.PREPAREDPLAN_CACHE_ELEMENT.getLocalName()));
writer.writeEndElement();
}
- if (has(node, Element.PREPAREDPLAN_CACHE_ELEMENT.getLocalName())){
- writer.writeStartElement(Element.RESULTSET_CACHE_ELEMENT.getLocalName());
- writeCacheConfiguration(writer, node.get(Element.PREPAREDPLAN_CACHE_ELEMENT.getLocalName()));
+ if (has(node, Element.OBJECT_REPLICATOR_ELEMENT.getLocalName())){
+ writer.writeStartElement(Element.OBJECT_REPLICATOR_ELEMENT.getLocalName());
+ writeObjectReplicatorConfiguration(writer, node.get(Element.OBJECT_REPLICATOR_ELEMENT.getLocalName()));
writer.writeEndElement();
}
@@ -100,7 +100,12 @@
writer.writeEndElement(); // End of subsystem element
}
- private void writeTranslator(XMLExtendedStreamWriter writer, ModelNode node) throws XMLStreamException {
+ private void writeObjectReplicatorConfiguration(XMLExtendedStreamWriter writer, ModelNode node) throws XMLStreamException {
+ writeAttribute(writer, Element.STACK_ATTRIBUTE, node);
+ writeAttribute(writer, Element.CLUSTER_NAME_ATTRIBUTE, node);
+ }
+
+ private void writeTranslator(XMLExtendedStreamWriter writer, ModelNode node) throws XMLStreamException {
writeAttribute(writer, Element.TRANSLATOR_NAME_ATTRIBUTE, node);
writeAttribute(writer, Element.TRANSLATOR_MODULE_ATTRIBUTE, node);
}
@@ -121,7 +126,7 @@
writeElement(writer, Element.MAX_SOURCE_ROWS_ELEMENT, node);
writeElement(writer, Element.EXCEPTION_ON_MAX_SOURCE_ROWS_ELEMENT, node);
writeElement(writer, Element.MAX_ODBC_LOB_SIZE_ALLOWED_ELEMENT, node);
- writeElement(writer, Element.OBJECT_REPLICATOR_NAME_ELEMENT, node);
+ writeElement(writer, Element.OBJECT_REPLICATOR_ELEMENT, node);
writeElement(writer, Element.DETECTING_CHANGE_EVENTS_ELEMENT, node);
if (node.hasDefined(Element.SECURITY_DOMAIN_ELEMENT.getLocalName())) {
@@ -184,17 +189,17 @@
writeElement(writer, Element.MAX_OPEN_FILES_ELEMENT, node);
}
- private void writeCacheFactoryConfiguration(XMLExtendedStreamWriter writer, ModelNode node) throws XMLStreamException {
- writeElement(writer, Element.CACHE_SERVICE_JNDI_NAME_ELEMENT, node);
- writeElement(writer, Element.RESULTSET_CACHE_NAME_ELEMENT, node);
+ private void writeResultsetCacheConfiguration(XMLExtendedStreamWriter writer, ModelNode node) throws XMLStreamException {
+ writeAttribute(writer, Element.NAME_ELEMENT, node);
+ writeAttribute(writer, Element.CONTAINER_NAME_ELEMENT, node);
+ writeAttribute(writer, Element.ENABLE_ATTRIBUTE, node);
+ writeAttribute(writer, Element.MAX_STALENESS_ELEMENT, node);
}
- private void writeCacheConfiguration(XMLExtendedStreamWriter writer, ModelNode node) throws XMLStreamException {
- writeAttribute(writer, Element.ENABLE_ATTRIBUTE, node);
- writeElement(writer, Element.MAX_ENTRIES_ELEMENT, node);
- writeElement(writer, Element.MAX_AGE_IN_SECS_ELEMENT, node);
- writeElement(writer, Element.MAX_STALENESS_ELEMENT, node);
- writeElement(writer, Element.CACHE_TYPE_ELEMENT, node);
+ private void writePreparedPlanCacheConfiguration(XMLExtendedStreamWriter writer, ModelNode node) throws XMLStreamException {
+ writeAttribute(writer, Element.MAX_ENTRIES_ELEMENT, node);
+ writeAttribute(writer, Element.MAX_AGE_IN_SECS_ELEMENT, node);
+ writeAttribute(writer, Element.MAX_STALENESS_ELEMENT, node);
}
private boolean has(ModelNode node, String name) {
@@ -252,19 +257,20 @@
case ASYNC_THREAD_GROUP_ELEMENT:
bootServices.get(reader.getLocalName()).set(reader.getElementText());
break;
+
+ case OBJECT_REPLICATOR_ELEMENT:
+ bootServices.get(reader.getLocalName()).set(parseObjectReplicator(reader));
+ break;
// complex types
case BUFFER_SERVICE_ELEMENT:
bootServices.get(reader.getLocalName()).set(parseBufferConfiguration(reader));
break;
- case RESULTSET_CACHE_ELEMENT:
- bootServices.get(reader.getLocalName()).set(parseCacheConfiguration(reader));
- break;
case PREPAREDPLAN_CACHE_ELEMENT:
- bootServices.get(reader.getLocalName()).set(parseCacheConfiguration(reader));
+ bootServices.get(reader.getLocalName()).set(parsePreparedPlanCacheConfiguration(reader));
break;
- case CACHE_FACORY_ELEMENT:
- bootServices.get(reader.getLocalName()).set(parseCacheFacoryConfiguration(reader));
+ case RESULTSET_CACHE_ELEMENT:
+ bootServices.get(reader.getLocalName()).set(parseResultsetCacheConfiguration(reader));
break;
case QUERY_ENGINE_ELEMENT:
@@ -304,7 +310,20 @@
}
}
- private ModelNode parseQueryEngine(XMLExtendedStreamReader reader, ModelNode node) throws XMLStreamException {
+ private ModelNode parseObjectReplicator(XMLExtendedStreamReader reader) throws XMLStreamException {
+ ModelNode node = new ModelNode();
+ if (reader.getAttributeCount() > 0) {
+ for(int i=0; i<reader.getAttributeCount(); i++) {
+ String attrName = reader.getAttributeLocalName(i);
+ String attrValue = reader.getAttributeValue(i);
+ node.get(attrName).set(attrValue);
+ }
+ }
+ while (reader.hasNext() && (reader.nextTag() != XMLStreamConstants.END_ELEMENT));
+ return node;
+ }
+
+ private ModelNode parseQueryEngine(XMLExtendedStreamReader reader, ModelNode node) throws XMLStreamException {
if (reader.getAttributeCount() > 0) {
for(int i=0; i<reader.getAttributeCount(); i++) {
@@ -335,15 +354,9 @@
// booleans
case EXCEPTION_ON_MAX_SOURCE_ROWS_ELEMENT:
case DETECTING_CHANGE_EVENTS_ELEMENT:
- case ALLOW_ENV_FUNCTION_ELEMENT:
node.get(reader.getLocalName()).set(Boolean.parseBoolean(reader.getElementText()));
break;
- //Strings
- case OBJECT_REPLICATOR_NAME_ELEMENT:
- node.get(reader.getLocalName()).set(reader.getElementText());
- break;
-
//List
case SECURITY_DOMAIN_ELEMENT:
node.get(reader.getLocalName()).add(reader.getElementText());
@@ -390,14 +403,14 @@
return node;
}
- private ModelNode parseCacheConfiguration(XMLExtendedStreamReader reader) throws XMLStreamException {
+ private ModelNode parsePreparedPlanCacheConfiguration(XMLExtendedStreamReader reader) throws XMLStreamException {
ModelNode node = new ModelNode();
if (reader.getAttributeCount() > 0) {
for(int i=0; i<reader.getAttributeCount(); i++) {
String attrName = reader.getAttributeLocalName(i);
String attrValue = reader.getAttributeValue(i);
- node.get(attrName).set(Boolean.parseBoolean(attrValue));
+ node.get(attrName).set(attrValue);
}
}
@@ -409,9 +422,6 @@
case MAX_STALENESS_ELEMENT:
node.get(reader.getLocalName()).set(Integer.parseInt(reader.getElementText()));
break;
- case CACHE_TYPE_ELEMENT:
- node.get(reader.getLocalName()).set(reader.getElementText());
- break;
default:
throw ParseUtils.unexpectedElement(reader);
}
@@ -419,20 +429,22 @@
return node;
}
- private ModelNode parseCacheFacoryConfiguration(XMLExtendedStreamReader reader) throws XMLStreamException {
+ private ModelNode parseResultsetCacheConfiguration(XMLExtendedStreamReader reader) throws XMLStreamException {
ModelNode node = new ModelNode();
-
- while (reader.hasNext() && (reader.nextTag() != XMLStreamConstants.END_ELEMENT)) {
- Element element = Element.forName(reader.getLocalName());
- switch (element) {
- case CACHE_SERVICE_JNDI_NAME_ELEMENT:
- case RESULTSET_CACHE_NAME_ELEMENT:
- node.get(reader.getLocalName()).set(reader.getElementText());
- break;
- default:
- throw ParseUtils.unexpectedElement(reader);
- }
- }
+
+ if (reader.getAttributeCount() > 0) {
+ for(int i=0; i<reader.getAttributeCount(); i++) {
+ String attrName = reader.getAttributeLocalName(i);
+ String attrValue = reader.getAttributeValue(i);
+ if (attrName.equals(Element.ENABLE_ATTRIBUTE.getLocalName())) {
+ node.get(attrName).set(Boolean.parseBoolean(attrValue));
+ }
+ else {
+ node.get(attrName).set(attrValue);
+ }
+ }
+ }
+ while (reader.hasNext() && (reader.nextTag() != XMLStreamConstants.END_ELEMENT));
return node;
}
@@ -443,7 +455,7 @@
for(int i=0; i<reader.getAttributeCount(); i++) {
String attrName = reader.getAttributeLocalName(i);
String attrValue = reader.getAttributeValue(i);
- node.get(attrName).set(Boolean.parseBoolean(attrValue));
+ node.get(attrName).set(attrValue);
}
}
@@ -455,9 +467,6 @@
case OUT_BUFFER_SIZE_ELEMENT:
node.get(reader.getLocalName()).set(Integer.parseInt(reader.getElementText()));
break;
- case SOCKET_BINDING_ELEMENT:
- node.get(reader.getLocalName()).set(reader.getElementText());
- break;
case SSL_ELEMENT:
node.get(reader.getLocalName()).set(parseSSLConfiguration(reader));
break;
Modified: branches/as7/jboss-integration/src/main/java/org/teiid/jboss/TranslatorAdd.java
===================================================================
--- branches/as7/jboss-integration/src/main/java/org/teiid/jboss/TranslatorAdd.java 2011-09-12 14:53:12 UTC (rev 3463)
+++ branches/as7/jboss-integration/src/main/java/org/teiid/jboss/TranslatorAdd.java 2011-09-12 14:56:06 UTC (rev 3464)
@@ -46,7 +46,7 @@
import org.teiid.logging.LogManager;
import org.teiid.translator.ExecutionFactory;
-public class TranslatorAdd extends AbstractAddStepHandler implements DescriptionProvider {
+class TranslatorAdd extends AbstractAddStepHandler implements DescriptionProvider {
@Override
public ModelNode getModelDescription(final Locale locale) {
@@ -64,12 +64,15 @@
final ModelNode address = operation.require(OP_ADDR);
final PathAddress pathAddress = PathAddress.pathAddress(address);
- final String moduleName = operation.require(Configuration.TRANSLATOR_MODULE).asString();
-
- model.get(NAME).set(pathAddress.getLastElement().getValue());
- model.get(Configuration.TRANSLATOR_MODULE).set(moduleName);
+ populate(pathAddress.getLastElement().getValue(), operation, model);
}
+ static void populate(String name, ModelNode operation, ModelNode model) {
+ final String moduleName = operation.require(Configuration.TRANSLATOR_MODULE).asString();
+ model.get(NAME).set(name);
+ model.get(Configuration.TRANSLATOR_MODULE).set(moduleName);
+ }
+
@Override
protected void performRuntime(final OperationContext context, final ModelNode operation, final ModelNode model,
final ServiceVerificationHandler verificationHandler, final List<ServiceController<?>> newControllers) throws OperationFailedException {
@@ -83,11 +86,9 @@
final ServiceTarget target = context.getServiceTarget();
- final ModuleIdentifier moduleId;
final Module module;
try {
- moduleId = ModuleIdentifier.create(moduleName);
- module = Module.getCallerModuleLoader().loadModule(moduleId);
+ module = Module.getCallerModuleLoader().loadModule(ModuleIdentifier.create(moduleName));
} catch (ModuleLoadException e) {
throw new OperationFailedException(e, new ModelNode().set(IntegrationPlugin.Util.getString("failed_load_module", moduleName, translatorName))); //$NON-NLS-1$
}
Modified: branches/as7/jboss-integration/src/main/java/org/teiid/jboss/TranslatorRemove.java
===================================================================
--- branches/as7/jboss-integration/src/main/java/org/teiid/jboss/TranslatorRemove.java 2011-09-12 14:53:12 UTC (rev 3463)
+++ branches/as7/jboss-integration/src/main/java/org/teiid/jboss/TranslatorRemove.java 2011-09-12 14:56:06 UTC (rev 3464)
@@ -40,7 +40,7 @@
import org.teiid.logging.LogConstants;
import org.teiid.logging.LogManager;
-public class TranslatorRemove extends AbstractRemoveStepHandler implements DescriptionProvider {
+class TranslatorRemove extends AbstractRemoveStepHandler implements DescriptionProvider {
@Override
public ModelNode getModelDescription(Locale locale) {
Modified: branches/as7/jboss-integration/src/main/java/org/teiid/jboss/VDBDependencyProcessor.java
===================================================================
--- branches/as7/jboss-integration/src/main/java/org/teiid/jboss/VDBDependencyProcessor.java 2011-09-12 14:53:12 UTC (rev 3463)
+++ branches/as7/jboss-integration/src/main/java/org/teiid/jboss/VDBDependencyProcessor.java 2011-09-12 14:56:06 UTC (rev 3464)
@@ -36,11 +36,9 @@
import org.jboss.vfs.VirtualFileFilter;
import org.jboss.vfs.VisitorAttributes;
import org.jboss.vfs.util.SuffixMatchFilter;
-import org.teiid.adminapi.impl.ModelMetaData;
-import org.teiid.adminapi.impl.VDBMetaData;
import org.teiid.deployers.TeiidAttachments;
-public class VDBDependencyProcessor implements DeploymentUnitProcessor {
+class VDBDependencyProcessor implements DeploymentUnitProcessor {
public static final String LIB = "/lib"; //$NON-NLS-1$
private static final VirtualFileFilter DEFAULT_JAR_LIB_FILTER = new SuffixMatchFilter(".jar", VisitorAttributes.DEFAULT); //$NON-NLS-1$
Modified: branches/as7/jboss-integration/src/main/java/org/teiid/jboss/VDBDeployer.java
===================================================================
--- branches/as7/jboss-integration/src/main/java/org/teiid/jboss/VDBDeployer.java 2011-09-12 14:53:12 UTC (rev 3463)
+++ branches/as7/jboss-integration/src/main/java/org/teiid/jboss/VDBDeployer.java 2011-09-12 14:56:06 UTC (rev 3464)
@@ -44,7 +44,7 @@
import org.teiid.runtime.RuntimePlugin;
-public class VDBDeployer implements DeploymentUnitProcessor {
+class VDBDeployer implements DeploymentUnitProcessor {
private TranslatorRepository translatorRepository;
private String asyncThreadPoolName;
Modified: branches/as7/jboss-integration/src/main/java/org/teiid/jboss/VDBParserDeployer.java
===================================================================
--- branches/as7/jboss-integration/src/main/java/org/teiid/jboss/VDBParserDeployer.java 2011-09-12 14:53:12 UTC (rev 3463)
+++ branches/as7/jboss-integration/src/main/java/org/teiid/jboss/VDBParserDeployer.java 2011-09-12 14:56:06 UTC (rev 3464)
@@ -44,7 +44,7 @@
/**
* This file loads the "vdb.xml" file inside a ".vdb" file, along with all the metadata in the .INDEX files
*/
-public class VDBParserDeployer implements DeploymentUnitProcessor {
+class VDBParserDeployer implements DeploymentUnitProcessor {
public VDBParserDeployer() {
}
Modified: branches/as7/jboss-integration/src/main/java/org/teiid/jboss/VDBRepositoryService.java
===================================================================
--- branches/as7/jboss-integration/src/main/java/org/teiid/jboss/VDBRepositoryService.java 2011-09-12 14:53:12 UTC (rev 3463)
+++ branches/as7/jboss-integration/src/main/java/org/teiid/jboss/VDBRepositoryService.java 2011-09-12 14:56:06 UTC (rev 3464)
@@ -27,7 +27,7 @@
import org.jboss.msc.service.StopContext;
import org.teiid.deployers.VDBRepository;
-public class VDBRepositoryService implements Service<VDBRepository> {
+class VDBRepositoryService implements Service<VDBRepository> {
private VDBRepository repo;
public VDBRepositoryService(VDBRepository repo) {
Modified: branches/as7/jboss-integration/src/main/java/org/teiid/jboss/VDBService.java
===================================================================
--- branches/as7/jboss-integration/src/main/java/org/teiid/jboss/VDBService.java 2011-09-12 14:53:12 UTC (rev 3463)
+++ branches/as7/jboss-integration/src/main/java/org/teiid/jboss/VDBService.java 2011-09-12 14:56:06 UTC (rev 3464)
@@ -52,7 +52,7 @@
import org.teiid.translator.ExecutionFactory;
import org.teiid.translator.TranslatorException;
-public class VDBService implements Service<VDBMetaData> {
+class VDBService implements Service<VDBMetaData> {
public static final String VDB_LASTMODIFIED_TIME = "VDB_LASTMODIFIED_TIME"; //$NON-NLS-1$
private VDBMetaData vdb;
private final InjectedValue<VDBRepository> vdbRepositoryInjector = new InjectedValue<VDBRepository>();
Modified: branches/as7/jboss-integration/src/main/java/org/teiid/jboss/VDBStructure.java
===================================================================
--- branches/as7/jboss-integration/src/main/java/org/teiid/jboss/VDBStructure.java 2011-09-12 14:53:12 UTC (rev 3463)
+++ branches/as7/jboss-integration/src/main/java/org/teiid/jboss/VDBStructure.java 2011-09-12 14:56:06 UTC (rev 3464)
@@ -28,7 +28,7 @@
-public class VDBStructure implements DeploymentUnitProcessor {
+class VDBStructure implements DeploymentUnitProcessor {
private static final String VDB_EXTENSION = ".vdb"; //$NON-NLS-1$
private static final String DYNAMIC_VDB_STRUCTURE = "-vdb.xml"; //$NON-NLS-1$
Modified: branches/as7/jboss-integration/src/main/java/org/teiid/jboss/deployers/RuntimeEngineDeployer.java
===================================================================
--- branches/as7/jboss-integration/src/main/java/org/teiid/jboss/deployers/RuntimeEngineDeployer.java 2011-09-12 14:53:12 UTC (rev 3463)
+++ branches/as7/jboss-integration/src/main/java/org/teiid/jboss/deployers/RuntimeEngineDeployer.java 2011-09-12 14:56:06 UTC (rev 3464)
@@ -26,6 +26,7 @@
import java.lang.reflect.InvocationTargetException;
import java.lang.reflect.Method;
import java.lang.reflect.Proxy;
+import java.net.InetSocketAddress;
import java.sql.Blob;
import java.sql.Clob;
import java.sql.SQLException;
@@ -33,8 +34,6 @@
import java.util.*;
import java.util.concurrent.*;
-import javax.naming.InitialContext;
-import javax.naming.NamingException;
import javax.resource.spi.XATerminator;
import javax.resource.spi.work.WorkManager;
import javax.security.auth.login.LoginException;
@@ -113,8 +112,6 @@
private long sessionMaxLimit = SessionService.DEFAULT_MAX_SESSIONS;
private long sessionExpirationTimeLimit = SessionService.DEFAULT_SESSION_EXPIRATION;
- private transient ObjectReplicator objectReplicator;
- private String objectReplicatorName;
private transient EventDistributor eventDistributor;
private transient EventDistributor eventDistributorProxy;
@@ -129,6 +126,7 @@
private final InjectedValue<AuthorizationValidator> authorizationValidatorInjector = new InjectedValue<AuthorizationValidator>();
private final InjectedValue<SessionAwareCache> preparedPlanCacheInjector = new InjectedValue<SessionAwareCache>();
private final InjectedValue<SessionAwareCache> resultSetCacheInjector = new InjectedValue<SessionAwareCache>();
+ private final InjectedValue<ObjectReplicator> objectReplicatorInjector = new InjectedValue<ObjectReplicator>();
public final ConcurrentMap<String, SecurityDomainContext> securityDomains = new ConcurrentHashMap<String, SecurityDomainContext>();
private LinkedList<String> securityDomainNames = new LinkedList<String>();
@@ -175,32 +173,19 @@
this.setBufferService(bufferServiceInjector.getValue());
- if (this.jdbcSocketConfiguration != null) {
- this.jdbcSocketConfiguration.setHostAddress(this.jdbcSocketBindingInjector.getValue().getAddress());
- this.jdbcSocketConfiguration.setPortNumber(this.jdbcSocketBindingInjector.getValue().getPort());
- }
-
- if (this.odbcSocketConfiguration != null) {
- this.odbcSocketConfiguration.setHostAddress(this.odbcSocketBindingInjector.getValue().getAddress());
- this.odbcSocketConfiguration.setPortNumber(this.odbcSocketBindingInjector.getValue().getPort());
- }
-
dqpCore.setTransactionService((TransactionService)LogManager.createLoggingProxy(LogConstants.CTX_TXN_LOG, transactionServerImpl, new Class[] {TransactionService.class}, MessageLevel.DETAIL, Module.getCallerModule().getClassLoader()));
- if (this.objectReplicatorName != null) {
+ if (getObjectReplicatorInjector().getValue() != null) {
try {
- InitialContext ic = new InitialContext();
- this.objectReplicator = (ObjectReplicator) ic.lookup(this.objectReplicatorName);
- try {
- this.eventDistributor = this.objectReplicator.replicate(LocalServerConnection.TEIID_RUNTIME_CONTEXT+getName(), EventDistributor.class, this, 0);
- } catch (Exception e) {
- LogManager.logError(LogConstants.CTX_RUNTIME, e, IntegrationPlugin.Util.getString("replication_failed", this)); //$NON-NLS-1$
- }
- } catch (NamingException ne) {
- //log at a detail level since we may not be in the all profile
- LogManager.logDetail(LogConstants.CTX_RUNTIME, ne, IntegrationPlugin.Util.getString("jndi_failed", this.objectReplicatorName)); //$NON-NLS-1$
+ this.eventDistributor = getObjectReplicatorInjector().getValue().replicate(LocalServerConnection.TEIID_RUNTIME_CONTEXT+getName(), EventDistributor.class, this, 0);
+ } catch (Exception e) {
+ LogManager.logError(LogConstants.CTX_RUNTIME, e, IntegrationPlugin.Util.getString("replication_failed", this)); //$NON-NLS-1$
}
}
+ else {
+ LogManager.logDetail(LogConstants.CTX_RUNTIME, IntegrationPlugin.Util.getString("distributed_cache_not_enabled")); //$NON-NLS-1$
+ }
+
this.dqpCore.setMetadataRepository(this.vdbRepository.getMetadataRepository());
this.dqpCore.setEventDistributor(this.eventDistributor);
this.dqpCore.setResultsetCache(getResultSetCacheInjector().getValue());
@@ -221,21 +206,6 @@
// create the necessary services
createClientServices();
- int offset = 0;
- String portBinding = System.getProperty("jboss.service.binding.set"); //$NON-NLS-1$
- if (portBinding != null && portBinding.startsWith("ports-")) { //$NON-NLS-1$
- if (portBinding.equals("ports-default")) { //$NON-NLS-1$
- offset = 0;
- }
- else {
- try {
- offset = Integer.parseInt(portBinding.substring(portBinding.length()-2))*100;
- } catch (NumberFormatException e) {
- offset = 0;
- }
- }
- }
-
this.csr.registerClientService(ILogon.class, logon, LogConstants.CTX_SECURITY);
DQP dqpProxy = proxyService(DQP.class, this.dqpCore, LogConstants.CTX_DQP);
this.csr.registerClientService(DQP.class, dqpProxy, LogConstants.CTX_DQP);
@@ -245,18 +215,20 @@
jdbcCsr.registerClientService(DQP.class, dqpProxy, LogConstants.CTX_DQP);
if (this.jdbcSocketConfiguration != null) {
- this.jdbcSocket = new SocketListener(this.jdbcSocketConfiguration, jdbcCsr, this.dqpCore.getBufferManager(), offset);
- LogManager.logInfo(LogConstants.CTX_RUNTIME, IntegrationPlugin.Util.getString("socket_enabled","Teiid JDBC = ",(this.jdbcSocketConfiguration.getSSLConfiguration().isSslEnabled()?"mms://":"mm://")+this.jdbcSocketConfiguration.getHostAddress().getHostName()+":"+(this.jdbcSocketConfiguration.getPortNumber()+offset))); //$NON-NLS-1$ //$NON-NLS-2$ //$NON-NLS-3$ //$NON-NLS-4$ //$NON-NLS-5$
+ InetSocketAddress address = getJdbcSocketBindingInjector().getValue().getSocketAddress();
+ this.jdbcSocket = new SocketListener(address, this.jdbcSocketConfiguration, jdbcCsr, this.dqpCore.getBufferManager());
+ LogManager.logInfo(LogConstants.CTX_RUNTIME, IntegrationPlugin.Util.getString("socket_enabled","Teiid JDBC = ",(this.jdbcSocketConfiguration.getSSLConfiguration().isSslEnabled()?"mms://":"mm://")+address.getHostName()+":"+address.getPort())); //$NON-NLS-1$ //$NON-NLS-2$ //$NON-NLS-3$ //$NON-NLS-4$ //$NON-NLS-5$
} else {
LogManager.logInfo(LogConstants.CTX_RUNTIME, IntegrationPlugin.Util.getString("socket_not_enabled", "jdbc connections")); //$NON-NLS-1$ //$NON-NLS-2$
}
if (this.odbcSocketConfiguration != null) {
this.vdbRepository.odbcEnabled();
- ODBCSocketListener odbc = new ODBCSocketListener(this.odbcSocketConfiguration, this.dqpCore.getBufferManager(), offset, getMaxODBCLobSizeAllowed(), this.logon);
+ InetSocketAddress address = getOdbcSocketBindingInjector().getValue().getSocketAddress();
+ ODBCSocketListener odbc = new ODBCSocketListener(address, this.odbcSocketConfiguration, this.dqpCore.getBufferManager(), getMaxODBCLobSizeAllowed(), this.logon);
odbc.setAuthenticationType(sessionService.getAuthType());
this.odbcSocket = odbc;
- LogManager.logInfo(LogConstants.CTX_RUNTIME, IntegrationPlugin.Util.getString("odbc_enabled","Teiid ODBC - SSL=", (this.odbcSocketConfiguration.getSSLConfiguration().isSslEnabled()?"ON":"OFF")+" Host = "+this.odbcSocketConfiguration.getHostAddress().getHostName()+" Port = "+(this.odbcSocketConfiguration.getPortNumber()+offset))); //$NON-NLS-1$ //$NON-NLS-2$ //$NON-NLS-3$ //$NON-NLS-4$ //$NON-NLS-5$ //$NON-NLS-6$
+ LogManager.logInfo(LogConstants.CTX_RUNTIME, IntegrationPlugin.Util.getString("odbc_enabled","Teiid ODBC - SSL=", (this.odbcSocketConfiguration.getSSLConfiguration().isSslEnabled()?"ON":"OFF")+" Host = "+address.getHostName()+" Port = "+address.getPort())); //$NON-NLS-1$ //$NON-NLS-2$ //$NON-NLS-3$ //$NON-NLS-4$ //$NON-NLS-5$ //$NON-NLS-6$
} else {
LogManager.logInfo(LogConstants.CTX_RUNTIME, IntegrationPlugin.Util.getString("odbc_not_enabled")); //$NON-NLS-1$
}
@@ -270,18 +242,18 @@
@Override
public void removed(String name, int version, CompositeVDB vdb) {
recentlyRemoved.add(new VDBKey(name, version));
- if (objectReplicator != null) {
+ if (getObjectReplicatorInjector().getValue() != null) {
GlobalTableStore gts = vdb.getVDB().getAttachment(GlobalTableStore.class);
- objectReplicator.stop(gts);
+ getObjectReplicatorInjector().getValue().stop(gts);
}
}
@Override
public void added(String name, int version, CompositeVDB vdb) {
GlobalTableStore gts = new GlobalTableStoreImpl(dqpCore.getBufferManager(), vdb.getVDB().getAttachment(TransformationMetadata.class));
- if (objectReplicator != null) {
+ if (getObjectReplicatorInjector().getValue() != null) {
try {
- gts = objectReplicator.replicate(name + version, GlobalTableStore.class, gts, 300000);
+ gts = getObjectReplicatorInjector().getValue().replicate(name + version, GlobalTableStore.class, gts, 300000);
} catch (Exception e) {
LogManager.logError(LogConstants.CTX_RUNTIME, e, IntegrationPlugin.Util.getString("replication_failed", gts)); //$NON-NLS-1$
}
@@ -337,8 +309,8 @@
LogManager.logInfo(LogConstants.CTX_RUNTIME, IntegrationPlugin.Util.getString("engine_stopped", new Date(System.currentTimeMillis()).toString())); //$NON-NLS-1$
- if (this.objectReplicator != null && this.eventDistributor != null) {
- this.objectReplicator.stop(this.eventDistributor);
+ if (getObjectReplicatorInjector().getValue() != null && this.eventDistributor != null) {
+ getObjectReplicatorInjector().getValue().stop(this.eventDistributor);
}
}
@@ -611,14 +583,6 @@
return newResults;
}
- public String getObjectReplicatorName() {
- return objectReplicatorName;
- }
-
- public void setObjectReplicatorName(String eventDistributorName) {
- this.objectReplicatorName = eventDistributorName;
- }
-
@Override
public void updateMatViewRow(String vdbName, int vdbVersion, String schema,
String viewName, List<?> tuple, boolean delete) {
@@ -825,5 +789,9 @@
public InjectedValue<SocketBinding> getOdbcSocketBindingInjector() {
return odbcSocketBindingInjector;
+ }
+
+ public InjectedValue<ObjectReplicator> getObjectReplicatorInjector() {
+ return objectReplicatorInjector;
}
}
Modified: branches/as7/jboss-integration/src/main/resources/org/teiid/jboss/i18n.properties
===================================================================
--- branches/as7/jboss-integration/src/main/resources/org/teiid/jboss/i18n.properties 2011-09-12 14:53:12 UTC (rev 3463)
+++ branches/as7/jboss-integration/src/main/resources/org/teiid/jboss/i18n.properties 2011-09-12 14:56:06 UTC (rev 3464)
@@ -45,6 +45,7 @@
datasource_exists=Data source with name {0} already exists!
datasource_template_not_found=Template {0} for creating the data source is not found.
jndi_failed=JNDI lookup failed {0}.
+distributed_cache_not_enabled= object replication not enabled for distributed cache. Missing "object-replicator" property in the configuration or running in standalone mode.
replication_failed=Could not replicate object {0}
distribute_failed=Deploy of the archive failed {0}
template_not_found=Template not found for {0}
@@ -112,17 +113,18 @@
type.describe=Allowed values are LRU, EXPIRATION. \
Setting this value to LRU will cause cache hint TTL values \
to be ignored. (default EXPIRATION)
+container-name.describe=Infinispan cache container name
-#cache-factory
-cache-service-jndi-name.describe=cache service for the distributed cache
-resultsetCacheName.describe=resultset cache node name
+#cache
+resultset-cache.describe=Resultset cache
+preparedplan-cache.describe=Prepared Plan cache
#socket config
-maxSocketThreads.describe=Max number of threads dedicated to initial request processing. \
+max-socket-threads.describe=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.
-inputBufferSize.describe=SO_RCVBUF size, 0 indicates that system default should be used (default 0)
-outputBufferSize.describe=SO_SNDBUF size, 0 indicates that system default should be used (default 0)
+input-buffer-size.describe=SO_RCVBUF size, 0 indicates that system default should be used (default 0)
+output-buffer-size.describe=SO_SNDBUF size, 0 indicates that system default should be used (default 0)
socket-binding.describe=Socket binding for the profile
enabled.describe=enabled
mode.describe=can be one of disabled, login, or enabled \
@@ -131,14 +133,14 @@
using 128 bit AES with an ephemerial DH key exchange. \
No other config values are needed in this mode; \
enabled = traffic will be secured using this configuration,if the client supports SSL
-keystoreFilename.describe=Keystore File Name
-keystorePassword.describe=Keystore password
-keystoreType.describe=Keystore type
-sslProtocol.describe=SSL protocol used
-keymanagementAlgorithm.describe=Use key management algorithm
-truststoreFilename.describe=Truststore Name
-truststorePassword.describe=Truststore Password
-authenticationMode.describe=Authentication Mode (1-way, 2-way, anonymous)
+keystore-name.describe=Keystore File Name
+keystore-password.describe=Keystore password
+keystore-type.describe=Keystore type
+ssl-protocol.describe=SSL protocol used
+keymanagement-algorithm.describe=Use key management algorithm
+truststore-name.describe=Truststore Name
+truststore-password.describe=Truststore Password
+authentication-mode.describe=Authentication Mode (1-way, 2-way, anonymous)
ssl.describe=SSL
@@ -231,4 +233,5 @@
translator-name.missing=Parameter "translator-name" is required
engine_service_not_found= Query Engine Service with name {0} is not found
translator.removed = Translator "{0}" removed
-translator.failed-to-load = Translator "{0}" not found in the module "{1}"
\ No newline at end of file
+translator.failed-to-load = Translator "{0}" not found in the module "{1}"
+cache-container-name-required=container-name required for the resultset cache configuration
Modified: branches/as7/jboss-integration/src/main/resources/schema/jboss-teiid.xsd
===================================================================
--- branches/as7/jboss-integration/src/main/resources/schema/jboss-teiid.xsd 2011-09-12 14:53:12 UTC (rev 3463)
+++ branches/as7/jboss-integration/src/main/resources/schema/jboss-teiid.xsd 2011-09-12 14:56:06 UTC (rev 3464)
@@ -61,27 +61,36 @@
</xs:annotation>
</xs:element>
-
- <xs:element name="distributed-cache-factory" type="cache-factory-type" maxOccurs="1" minOccurs="1">
+ <xs:element name="resultset-cache" type="xs:string" maxOccurs="1" minOccurs="0">
<xs:annotation>
- <xs:documentation>Cache Factory</xs:documentation>
- </xs:annotation>
- </xs:element>
-
- <xs:element name="resultset-cache" type="cache-config" maxOccurs="1" minOccurs="0">
- <xs:annotation>
<xs:documentation>Configuration for result set caching.
There will be 2 caches with these settings.
One cache holds results that are specific to sessions.
The other cache holds vdb scoped results and can
be replicated.</xs:documentation>
</xs:annotation>
+ <xs:attribute name="container-name" type="xs:string" use="required"/>
+ <xs:attribute name="name" type="xs:string" use="required"/>
+ <xs:attribute name="enable" type="xs:boolean" default="true"/>
+ <xs:attribute name="max-staleness" type="xs:int" default="60"/>
</xs:element>
- <xs:element name="preparedplan-cache" type="cache-config" maxOccurs="1" minOccurs="0">
+
+ <xs:element name="preparedplan-cache" type="xs:string" maxOccurs="1" minOccurs="0">
<xs:annotation>
<xs:documentation>Configuration for prepared plan caching. (local memory only)</xs:documentation>
</xs:annotation>
+ <xs:attribute name="max-entries" type="xs:string"/>
+ <xs:attribute name="max-age-in-seconds" type="xs:boolean" default="true"/>
+ <xs:attribute name="max-staleness" type="xs:int" default="0"/>
</xs:element>
+
+ <xs:element name="object-replicator" type="xs:string" maxOccurs="1" minOccurs="0">
+ <xs:annotation>
+ <xs:documentation>Cluster wide results distributor </xs:documentation>
+ </xs:annotation>
+ <xs:attribute name="stack" type="xs:string" use="required"/>
+ <xs:attribute name="cluster-name" type="xs:string" use="required"/>
+ </xs:element>
<xs:element name="query-engine" type="runtime-engine-type" maxOccurs="2" minOccurs="1">
<xs:annotation>
@@ -136,50 +145,6 @@
</xs:sequence>
</xs:complexType>
- <xs:complexType name="cache-factory-type">
- <xs:sequence>
- <xs:element name="cache-service-jndi-name" type="xs:string" minOccurs="1" maxOccurs="1">
- <xs:annotation>
- <xs:documentation>JNDI Name of the Cache manager</xs:documentation>
- </xs:annotation>
- </xs:element>
- <xs:element name="resultsetCacheName" type="xs:string" minOccurs="1" maxOccurs="1">
- <xs:annotation>
- <xs:documentation>Name of the resultset cache name</xs:documentation>
- </xs:annotation>
- </xs:element>
- </xs:sequence>
- </xs:complexType>
- <xs:complexType name="cache-config">
- <xs:sequence>
- <xs:element name="max-entries" type="xs:string" minOccurs="0" maxOccurs="1" default="1024">
- <xs:annotation>
- <xs:documentation>Max Entries allowed (default 1024)</xs:documentation>
- </xs:annotation>
- </xs:element>
- <xs:element name="max-age-in-seconds" type="xs:int" minOccurs="0" maxOccurs="1" default="7200">
- <xs:annotation>
- <xs:documentation>Max age in seconds (default 7200 - 2 hours)</xs:documentation>
- </xs:annotation>
- </xs:element>
- <xs:element name="max-staleness" type="xs:int" minOccurs="0" maxOccurs="1" default="-1">
- <xs:annotation>
- <xs:documentation>Max staleness in seconds. Modifications are based upon data updates -1 indicates no max. (default 60 - 1 minute)</xs:documentation>
- </xs:annotation>
- </xs:element>
- <xs:element name="type" minOccurs="0" maxOccurs="1" default="LRU">
- <xs:annotation>
- <xs:documentation>Allowed values are LRU, EXPIRATION. Setting this value to LRU will cause cache hint TTL values to be ignored. (default EXPIRATION)</xs:documentation>
- </xs:annotation>
- <xs:simpleType>
- <xs:restriction base="xs:string">
- <xs:enumeration value="LRU" />
- <xs:enumeration value="EXPIRATION" />
- </xs:restriction>
- </xs:simpleType>
- </xs:element>
- </xs:sequence>
- </xs:complexType>
<xs:complexType name="runtime-engine-type">
<xs:sequence>
<xs:element name="max-threads" type="xs:int" minOccurs="0" maxOccurs="1" default="64">
@@ -274,34 +239,21 @@
<xs:attribute name="name" type="xs:string" use="required"/>
</xs:complexType>
- <xs:complexType name="authorization-validator-type">
- <xs:sequence>
- <xs:element name="maxSocketThreads" type="xs:int" minOccurs="0" maxOccurs="1">
- <xs:annotation>
- <xs:documentation>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.</xs:documentation>
- </xs:annotation>
- </xs:element>
- </xs:sequence>
- </xs:complexType>
-
-
<xs:complexType name="socket-config">
<xs:sequence>
- <xs:element name="maxSocketThreads" type="xs:int" minOccurs="0" maxOccurs="1" default="0">
+ <xs:element name="max-socket-threads" type="xs:int" minOccurs="0" maxOccurs="1" default="0">
<xs:annotation>
<xs:documentation>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.</xs:documentation>
</xs:annotation>
</xs:element>
- <xs:element name="inputBufferSize" type="xs:int" minOccurs="0" maxOccurs="1" default="0">
+ <xs:element name="input-buffer-size" type="xs:int" minOccurs="0" maxOccurs="1" default="0">
<xs:annotation>
<xs:documentation>SO_RCVBUF size, 0 indicates that system default should be used (default 0) </xs:documentation>
</xs:annotation>
</xs:element>
- <xs:element name="outputBufferSize" type="xs:int" minOccurs="0" maxOccurs="1" default="0">
+ <xs:element name="output-buffer-size" type="xs:int" minOccurs="0" maxOccurs="1" default="0">
<xs:annotation>
<xs:documentation>SO_SNDBUF size, 0 indicates that system default should be used (default 0)</xs:documentation>
</xs:annotation>
@@ -334,14 +286,14 @@
</xs:restriction>
</xs:simpleType>
</xs:element>
- <xs:element name="keystoreFilename" type="xs:string" minOccurs="0" maxOccurs="1" />
- <xs:element name="keystorePassword" type="xs:string" minOccurs="0" maxOccurs="1" />
- <xs:element name="keystoreType" type="xs:string" minOccurs="0" maxOccurs="1" />
- <xs:element name="sslProtocol" type="xs:string" minOccurs="0" maxOccurs="1" />
- <xs:element name="keymanagementAlgorithm" type="xs:boolean" minOccurs="0" maxOccurs="1" />
- <xs:element name="truststoreFilename" type="xs:string" minOccurs="0" maxOccurs="1" />
- <xs:element name="truststorePassword" type="xs:string" minOccurs="0" maxOccurs="1" />
- <xs:element name="authenticationMode" minOccurs="0" maxOccurs="1" default="anonymous">
+ <xs:element name="keystore-name" type="xs:string" minOccurs="0" maxOccurs="1" />
+ <xs:element name="keystore-password" type="xs:string" minOccurs="0" maxOccurs="1" />
+ <xs:element name="keystore-type" type="xs:string" minOccurs="0" maxOccurs="1" />
+ <xs:element name="ssl-protocol" type="xs:string" minOccurs="0" maxOccurs="1" />
+ <xs:element name="keymanagement-algorithm" type="xs:boolean" minOccurs="0" maxOccurs="1" />
+ <xs:element name="truststore-name" type="xs:string" minOccurs="0" maxOccurs="1" />
+ <xs:element name="truststore-password" type="xs:string" minOccurs="0" maxOccurs="1" />
+ <xs:element name="authentication-mode" minOccurs="0" maxOccurs="1" default="anonymous">
<xs:annotation>
<xs:documentation>1-way, 2-way, anonymous</xs:documentation>
</xs:annotation>
Modified: branches/as7/pom.xml
===================================================================
--- branches/as7/pom.xml 2011-09-12 14:53:12 UTC (rev 3463)
+++ branches/as7/pom.xml 2011-09-12 14:56:06 UTC (rev 3464)
@@ -449,36 +449,19 @@
<dependency>
<groupId>org.jboss.logging</groupId>
<artifactId>jboss-logging</artifactId>
- <version>3.0.0.CR1</version>
+ <version>3.0.0.GA</version>
</dependency>
-
+ <dependency>
+ <groupId>org.jboss.as</groupId>
+ <artifactId>jboss-as-clustering-jgroups</artifactId>
+ <version>${jbossas-version}</version>
+ </dependency>
+ <dependency>
+ <groupId>org.infinispan</groupId>
+ <artifactId>infinispan-core</artifactId>
+ <version>5.0.0.FINAL</version>
+ </dependency>
<dependency>
- <groupId>jgroups</groupId>
- <artifactId>jgroups</artifactId>
- <version>2.6.15.GA</version>
- <scope>provided</scope>
- </dependency>
- <dependency>
- <groupId>org.jboss.cache</groupId>
- <artifactId>jbosscache-core</artifactId>
- <version>3.2.5.GA</version>
- <exclusions>
- <exclusion>
- <groupId>javax.transaction</groupId>
- <artifactId>jta</artifactId>
- </exclusion>
- <exclusion>
- <groupId>commons-logging</groupId>
- <artifactId>commons-logging</artifactId>
- </exclusion>
- <exclusion>
- <groupId>org.jboss</groupId>
- <artifactId>jboss-common-core</artifactId>
- </exclusion>
- </exclusions>
- <scope>provided</scope>
- </dependency>
- <dependency>
<groupId>net.sourceforge.saxon</groupId>
<artifactId>saxonhe</artifactId>
<version>9.2.1.5</version>
Modified: branches/as7/runtime/src/main/java/org/teiid/transport/ODBCSocketListener.java
===================================================================
--- branches/as7/runtime/src/main/java/org/teiid/transport/ODBCSocketListener.java 2011-09-12 14:53:12 UTC (rev 3463)
+++ branches/as7/runtime/src/main/java/org/teiid/transport/ODBCSocketListener.java 2011-09-12 14:56:06 UTC (rev 3464)
@@ -21,6 +21,7 @@
*/
package org.teiid.transport;
+import java.net.InetSocketAddress;
import java.util.Properties;
import org.jboss.netty.channel.ChannelPipeline;
@@ -41,9 +42,9 @@
private TeiidDriver driver;
private ILogon logonService;
- public ODBCSocketListener(SocketConfiguration config, StorageManager storageManager, int portOffset, int maxLobSize, ILogon logon) {
+ public ODBCSocketListener(InetSocketAddress address, SocketConfiguration config, StorageManager storageManager, int maxLobSize, ILogon logon) {
//the clientserviceregistry isn't actually used by ODBC
- super(config, new ClientServiceRegistryImpl(ClientServiceRegistry.Type.ODBC), storageManager, portOffset);
+ super(address, config, new ClientServiceRegistryImpl(ClientServiceRegistry.Type.ODBC), storageManager);
this.maxLobSize = maxLobSize;
this.driver = new TeiidDriver();
this.driver.setEmbeddedProfile(new EmbeddedProfile() {
Modified: branches/as7/runtime/src/main/java/org/teiid/transport/SocketListener.java
===================================================================
--- branches/as7/runtime/src/main/java/org/teiid/transport/SocketListener.java 2011-09-12 14:53:12 UTC (rev 3463)
+++ branches/as7/runtime/src/main/java/org/teiid/transport/SocketListener.java 2011-09-12 14:56:06 UTC (rev 3464)
@@ -50,9 +50,8 @@
private ExecutorService nettyPool;
private ClientServiceRegistryImpl csr;
- public SocketListener(SocketConfiguration config, ClientServiceRegistryImpl csr, StorageManager storageManager, int portOffset) {
- this(config.getPortNumber()+portOffset, config.getHostAddress().getHostAddress(), config.getInputBufferSize(), config.getOutputBufferSize(), config.getMaxSocketThreads(), config.getSSLConfiguration(), csr, storageManager);
-
+ public SocketListener(InetSocketAddress address, SocketConfiguration config, ClientServiceRegistryImpl csr, StorageManager storageManager) {
+ this(address, config.getInputBufferSize(), config.getOutputBufferSize(), config.getMaxSocketThreads(), config.getSSLConfiguration(), csr, storageManager);
LogManager.logDetail(LogConstants.CTX_TRANSPORT, RuntimePlugin.Util.getString("SocketTransport.1", new Object[] {config.getHostAddress().getHostAddress(), String.valueOf(config.getPortNumber())})); //$NON-NLS-1$
}
@@ -65,17 +64,14 @@
* @param bindaddress
* @param server
*/
- public SocketListener(int port, String bindAddress, int inputBufferSize,
+ public SocketListener(InetSocketAddress address, int inputBufferSize,
int outputBufferSize, int maxWorkers, SSLConfiguration config, ClientServiceRegistryImpl csr, StorageManager storageManager) {
this.isClientEncryptionEnabled = config.isClientEncryptionEnabled();
this.csr = csr;
- if (port < 0 || port > 0xFFFF) {
- throw new IllegalArgumentException("port out of range:" + port); //$NON-NLS-1$
- }
this.nettyPool = Executors.newCachedThreadPool(new NamedThreadFactory("NIO")); //$NON-NLS-1$
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$
+ LogManager.logDetail(LogConstants.CTX_TRANSPORT, "server = " + address.getAddress() + "binding to port:" + address.getPort()); //$NON-NLS-1$ //$NON-NLS-2$
}
if (maxWorkers == 0) {
@@ -95,7 +91,7 @@
}
bootstrap.setOption("keepAlive", Boolean.TRUE); //$NON-NLS-1$
- this.serverChanel = bootstrap.bind(new InetSocketAddress(bindAddress, port));
+ this.serverChanel = bootstrap.bind(address);
}
public int getPort() {
Modified: branches/as7/runtime/src/test/java/org/teiid/transport/TestCommSockets.java
===================================================================
--- branches/as7/runtime/src/test/java/org/teiid/transport/TestCommSockets.java 2011-09-12 14:53:12 UTC (rev 3463)
+++ branches/as7/runtime/src/test/java/org/teiid/transport/TestCommSockets.java 2011-09-12 14:56:06 UTC (rev 3464)
@@ -77,7 +77,7 @@
@Test(expected=CommunicationException.class) public void testFailedConnect() throws Exception {
SSLConfiguration config = new SSLConfiguration();
- listener = new SocketListener(addr.getPort(), addr.getAddress().getHostAddress(),1024, 1024, 1, config, null, BufferManagerFactory.getStandaloneBufferManager());
+ listener = new SocketListener(addr,1024, 1024, 1, config, null, BufferManagerFactory.getStandaloneBufferManager());
Properties p = new Properties();
String url = new TeiidURL(addr.getHostName(), listener.getPort() - 1, false).getAppServerURL();
@@ -182,7 +182,7 @@
}, null);
server.registerClientService(FakeService.class, new TestSocketRemoting.FakeServiceImpl(), null);
storageManager = new MemoryStorageManager();
- listener = new SocketListener(addr.getPort(), addr.getAddress().getHostAddress(), 1024, 1024, 1, config, server, storageManager);
+ listener = new SocketListener(addr, 1024, 1024, 1, config, server, storageManager);
SocketListenerStats stats = listener.getStats();
assertEquals(0, stats.maxSockets);
Modified: branches/as7/runtime/src/test/java/org/teiid/transport/TestFailover.java
===================================================================
--- branches/as7/runtime/src/test/java/org/teiid/transport/TestFailover.java 2011-09-12 14:53:12 UTC (rev 3463)
+++ branches/as7/runtime/src/test/java/org/teiid/transport/TestFailover.java 2011-09-12 14:56:06 UTC (rev 3464)
@@ -112,7 +112,7 @@
}, null);
server.registerClientService(FakeService.class, new TestSocketRemoting.FakeServiceImpl(), null);
- return new SocketListener(address.getPort(), address.getAddress().getHostAddress(), 1024, 1024, 1, config, server, BufferManagerFactory.getStandaloneBufferManager());
+ return new SocketListener(new InetSocketAddress(address.getAddress().getHostAddress(),address.getPort()), 1024, 1024, 1, config, server, BufferManagerFactory.getStandaloneBufferManager());
}
@Test public void testFailover() throws Exception {
Modified: branches/as7/test-integration/common/pom.xml
===================================================================
--- branches/as7/test-integration/common/pom.xml 2011-09-12 14:53:12 UTC (rev 3463)
+++ branches/as7/test-integration/common/pom.xml 2011-09-12 14:56:06 UTC (rev 3464)
@@ -20,15 +20,16 @@
<artifactId>h2</artifactId>
<version>1.2.147</version>
</dependency>
+ <dependency>
+ <groupId>org.jboss.as</groupId>
+ <artifactId>jboss-as-clustering-jgroups</artifactId>
+ <scope>provided</scope>
+ </dependency>
<dependency>
<artifactId>teiid-cache-jbosscache</artifactId>
<groupId>org.jboss.teiid</groupId>
</dependency>
<dependency>
- <groupId>jgroups</groupId>
- <artifactId>jgroups</artifactId>
- </dependency>
- <dependency>
<groupId>commons-logging</groupId>
<artifactId>commons-logging</artifactId>
</dependency>
Modified: branches/as7/test-integration/common/src/test/java/org/teiid/systemmodel/TestMatViewReplication.java
===================================================================
--- branches/as7/test-integration/common/src/test/java/org/teiid/systemmodel/TestMatViewReplication.java 2011-09-12 14:53:12 UTC (rev 3463)
+++ branches/as7/test-integration/common/src/test/java/org/teiid/systemmodel/TestMatViewReplication.java 2011-09-12 14:56:06 UTC (rev 3464)
@@ -34,6 +34,8 @@
import java.util.logging.Level;
import java.util.logging.Logger;
+import org.jboss.as.clustering.jgroups.ChannelFactory;
+import org.jgroups.Channel;
import org.jgroups.JChannelFactory;
import org.junit.BeforeClass;
import org.junit.Test;
@@ -124,12 +126,20 @@
private FakeServer createServer() throws Exception {
FakeServer server = new FakeServer();
- JGroupsObjectReplicator jor = new JGroupsObjectReplicator();
- jor.setClusterName("demo");
- jor.setMultiplexerStack("tcp");
- JChannelFactory jcf = new JChannelFactory();
- jcf.setMultiplexerConfig(this.getClass().getClassLoader().getResource("stacks.xml")); //$NON-NLS-1$
- jor.setChannelFactory(jcf);
+ JGroupsObjectReplicator jor = new JGroupsObjectReplicator("demo") {
+ @Override
+ public ChannelFactory getChannelFactory() {
+ return new ChannelFactory() {
+ @Override
+ public Channel createChannel(String id) throws Exception {
+ JChannelFactory jcf = new JChannelFactory();
+ jcf.setMultiplexerConfig(this.getClass().getClassLoader().getResource("stacks.xml")); //$NON-NLS-1$
+ return jcf.createMultiplexerChannel("tcp", id);
+ }
+ };
+ }
+
+ };
server.setReplicator(jor);
HashMap<String, Collection<FunctionMethod>> udfs = new HashMap<String, Collection<FunctionMethod>>();
Modified: branches/as7/test-integration/common/src/test/java/org/teiid/transport/TestJDBCSocketTransport.java
===================================================================
--- branches/as7/test-integration/common/src/test/java/org/teiid/transport/TestJDBCSocketTransport.java 2011-09-12 14:53:12 UTC (rev 3463)
+++ branches/as7/test-integration/common/src/test/java/org/teiid/transport/TestJDBCSocketTransport.java 2011-09-12 14:56:06 UTC (rev 3464)
@@ -57,7 +57,7 @@
server.setUseCallingThread(false);
server.deployVDB("parts", UnitTestUtil.getTestDataPath() + "/PartsSupplier.vdb");
- jdbcTransport = new SocketListener(config, server, BufferManagerFactory.getStandaloneBufferManager(), 0);
+ jdbcTransport = new SocketListener(addr, config, server, BufferManagerFactory.getStandaloneBufferManager());
}
@AfterClass public static void oneTimeTearDown() throws Exception {
Modified: branches/as7/test-integration/common/src/test/java/org/teiid/transport/TestODBCSocketTransport.java
===================================================================
--- branches/as7/test-integration/common/src/test/java/org/teiid/transport/TestODBCSocketTransport.java 2011-09-12 14:53:12 UTC (rev 3463)
+++ branches/as7/test-integration/common/src/test/java/org/teiid/transport/TestODBCSocketTransport.java 2011-09-12 14:56:06 UTC (rev 3464)
@@ -129,7 +129,7 @@
addr = new InetSocketAddress(0);
config.setBindAddress(addr.getHostName());
config.setPortNumber(0);
- odbcTransport = new ODBCSocketListener(config, BufferManagerFactory.getStandaloneBufferManager(), 0, 100000, Mockito.mock(ILogon.class));
+ odbcTransport = new ODBCSocketListener(addr, config, BufferManagerFactory.getStandaloneBufferManager(), 100000, Mockito.mock(ILogon.class));
odbcTransport.setMaxBufferSize(1000); //set to a small size to ensure buffering over the limit works
FakeServer server = new FakeServer();
server.setUseCallingThread(false);
Modified: branches/as7/test-integration/pom.xml
===================================================================
--- branches/as7/test-integration/pom.xml 2011-09-12 14:53:12 UTC (rev 3463)
+++ branches/as7/test-integration/pom.xml 2011-09-12 14:56:06 UTC (rev 3464)
@@ -89,20 +89,6 @@
<groupId>javax.transaction</groupId>
<artifactId>jta</artifactId>
</dependency>
- <!--
- <dependency>
- <groupId>org.jboss.deployers</groupId>
- <artifactId>jboss-deployers-vfs-spi</artifactId>
- <scope>provided</scope>
- </dependency>
-
- <dependency>
- <groupId>org.jboss.deployers</groupId>
- <artifactId>jboss-deployers-vfs</artifactId>
- <scope>provided</scope>
- </dependency>
- -->
-
<dependency>
<groupId>org.jboss</groupId>
<artifactId>jboss-vfs</artifactId>
12 years, 8 months
teiid SVN: r3463 - branches/7.4.x/documentation/reference/src/main/docbook/en-US/content.
by teiid-commits@lists.jboss.org
Author: shawkins
Date: 2011-09-12 10:53:12 -0400 (Mon, 12 Sep 2011)
New Revision: 3463
Modified:
branches/7.4.x/documentation/reference/src/main/docbook/en-US/content/scalar_functions.xml
Log:
TEIID-1751 correcting xmlelement example
Modified: branches/7.4.x/documentation/reference/src/main/docbook/en-US/content/scalar_functions.xml
===================================================================
--- branches/7.4.x/documentation/reference/src/main/docbook/en-US/content/scalar_functions.xml 2011-09-09 19:04:45 UTC (rev 3462)
+++ branches/7.4.x/documentation/reference/src/main/docbook/en-US/content/scalar_functions.xml 2011-09-12 14:53:12 UTC (rev 3463)
@@ -1997,10 +1997,13 @@
<para id="xmlnamespaces">XMLNAMESPACES is used provide namespace information. NO DEFAULT is equivalent to defining the default namespace to the null uri - xmlns="".
Only one DEFAULT or NO DEFAULT namespace item may be specified. The namespace prefixes xmlns and xml are reserved.</para>
<para>If a attribute name is not supplied, the expression must be a column reference, in which case the attribute name will be the column name. Null attribute values are ignored.</para>
- <para>Name, prefix are identifiers. uri is a string literal. content can be any type. Return value is xml. The return value is valid for use in places where a document is expected.</para>
- <para><emphasis>Example</emphasis>: with an xml_value of <doc/>, <programlisting>xmlelement('elem', 1, '<2/>', xml_value)</programlisting>
+ <para>Name, prefix are identifiers. uri is a string literal. content can be any type. Return value is xml. The return value is valid for use in places where a document is expected.</para>
+ <example>
+ <title>XMLELEMENT of mixed values</title>
+ <para>with an xml_value of <doc/>, <programlisting>XMLELEMENT(NAME "elem", 1, '<2/>', xml_value)</programlisting>
Returns: <code><elem>1&lt;2/&gt;<doc/><elem/></code>
</para>
+ </example>
</section>
<section>
<title>XMLFOREST</title>
12 years, 8 months
teiid SVN: r3462 - in trunk: build/kits/jboss-container/deploy/teiid and 11 other directories.
by teiid-commits@lists.jboss.org
Author: shawkins
Date: 2011-09-09 15:04:45 -0400 (Fri, 09 Sep 2011)
New Revision: 3462
Modified:
trunk/build/kits/jboss-container/deploy/teiid/teiid-jboss-beans.xml
trunk/build/kits/jboss-container/teiid-releasenotes.html
trunk/common-core/src/main/java/org/teiid/core/types/BaseLob.java
trunk/common-core/src/main/java/org/teiid/core/types/BlobImpl.java
trunk/common-core/src/main/java/org/teiid/core/types/BlobType.java
trunk/common-core/src/main/java/org/teiid/core/types/ClobType.java
trunk/common-core/src/main/java/org/teiid/core/types/InputStreamFactory.java
trunk/common-core/src/main/java/org/teiid/core/types/SQLXMLImpl.java
trunk/common-core/src/main/java/org/teiid/core/types/Streamable.java
trunk/common-core/src/main/java/org/teiid/core/types/XMLType.java
trunk/common-core/src/main/resources/org/teiid/core/util/application.properties
trunk/common-core/src/test/java/org/teiid/core/types/TestBlobValue.java
trunk/common-core/src/test/java/org/teiid/core/types/TestClobValue.java
trunk/common-core/src/test/java/org/teiid/core/types/TestXMLValue.java
trunk/documentation/caching-guide/src/main/docbook/en-US/content/hint-option.xml
trunk/engine/src/main/java/org/teiid/common/buffer/FileStoreInputStreamFactory.java
trunk/engine/src/main/java/org/teiid/common/buffer/LobManager.java
trunk/engine/src/main/java/org/teiid/common/buffer/TupleBuffer.java
trunk/engine/src/main/java/org/teiid/common/buffer/impl/BufferManagerImpl.java
trunk/engine/src/main/java/org/teiid/common/buffer/impl/SizeUtility.java
trunk/engine/src/main/java/org/teiid/dqp/internal/process/RequestWorkItem.java
trunk/engine/src/main/java/org/teiid/query/metadata/TransformationMetadata.java
trunk/engine/src/test/java/org/teiid/common/buffer/TestLobManager.java
trunk/engine/src/test/java/org/teiid/common/buffer/TestTupleBuffer.java
trunk/engine/src/test/java/org/teiid/dqp/internal/process/TestDQPCore.java
trunk/runtime/src/main/java/org/teiid/services/BufferServiceImpl.java
Log:
TEIID-1750 adding more memory tracking for soft references and allowing for lob inlining.
Modified: trunk/build/kits/jboss-container/deploy/teiid/teiid-jboss-beans.xml
===================================================================
--- trunk/build/kits/jboss-container/deploy/teiid/teiid-jboss-beans.xml 2011-09-09 17:10:27 UTC (rev 3461)
+++ trunk/build/kits/jboss-container/deploy/teiid/teiid-jboss-beans.xml 2011-09-09 19:04:45 UTC (rev 3462)
@@ -43,7 +43,11 @@
<!-- Max storage space, in MB, to be used for buffer files (default 50G) -->
<property name="maxBufferSpace">51200</property>
<!-- Max open buffer files (default 64) -->
- <property name="maxOpenFiles">64</property>
+ <property name="maxOpenFiles">64</property>
+ <!-- Set to true to allow inlining of memory based and small lobs into results.
+ However inline lob values are not supported by pre-7.6 clients, so disable this
+ property if using older clients utilizing lobs. (default true) -->
+ <property name="inlineLobs">true</property>
</bean>
<bean name="CacheFactory" class="org.teiid.cache.jboss.ClusterableCacheFactory">
Modified: trunk/build/kits/jboss-container/teiid-releasenotes.html
===================================================================
--- trunk/build/kits/jboss-container/teiid-releasenotes.html 2011-09-09 17:10:27 UTC (rev 3461)
+++ trunk/build/kits/jboss-container/teiid-releasenotes.html 2011-09-09 19:04:45 UTC (rev 3462)
@@ -30,6 +30,7 @@
<LI><B>File Enhancements</B> - the file translator can now optionally (via the ExceptionIfFileNotFound property) throw an exception if the path refers to a file that doesn't exist. The file resource adapter can be configured to map file names and can prevent parent path .. references. See the Admin Guide or the file-ds.xml template for more.
<LI><B>TEXTTABLE Enhancements</B> - TEXTTABLE can now parse fixed width files that do not use a row delimiter and can optionally produce fixed values that haven't been trimmed.
<LI><B>Temp table transactions</B> - Internal materialized views and temp table usage from a session and within procedures can take advantage of greater transaction support.
+ <LI><B>Buffering Improvements</B> - Added the ability to inline memory based or small lobs and added tracking of the memory held by soft references.
</UL>
<h2><a name="Compatibility">Compatibility Issues</a></h2>
@@ -39,9 +40,10 @@
<li>Support for using the FROM clause post item hints MAKEDEP/MAKENOTDEP has been deprecated. Use the pre item comment hint syntax instead, e.g. /*+ MAKEDEP */ tbl
</ul>
-<h4>from 7.4</h4>
+<h4>from 7.5</h4>
<ul>
- <li>Leave was added as a reserved word.
+ <li>Leave was added as a reserved word.
+ <li>Lob inlining is incompatible with clients older than 7.6. If a 7.6 server will have older clients that use lobs connect to it, then the BufferService property inlineLobs should be set to false in the teiid-jboss-beans.xml file.
</ul>
<h4>from 7.4</h4>
Modified: trunk/common-core/src/main/java/org/teiid/core/types/BaseLob.java
===================================================================
--- trunk/common-core/src/main/java/org/teiid/core/types/BaseLob.java 2011-09-09 17:10:27 UTC (rev 3461)
+++ trunk/common-core/src/main/java/org/teiid/core/types/BaseLob.java 2011-09-09 19:04:45 UTC (rev 3462)
@@ -22,6 +22,7 @@
package org.teiid.core.types;
+import java.io.BufferedInputStream;
import java.io.Externalizable;
import java.io.IOException;
import java.io.InputStream;
@@ -75,17 +76,8 @@
this.charset = charset;
}
- public void free() throws SQLException {
- if (this.streamFactory != null) {
- try {
- this.streamFactory.free();
- this.streamFactory = null;
- } catch (IOException e) {
- SQLException ex = new SQLException(e.getMessage());
- ex.initCause(e);
- throw ex;
- }
- }
+ public void free() {
+ this.streamFactory = null;
}
public Reader getCharacterStream() throws SQLException {
@@ -126,5 +118,35 @@
public void writeExternal(ObjectOutput out) throws IOException {
out.writeObject(streamFactory);
}
+
+ /**
+ * Returns the number of bytes.
+ */
+ public long length() throws SQLException{
+ if (getStreamFactory().getLength() == -1) {
+ getStreamFactory().setLength(length(getBinaryStream()));
+ }
+ return getStreamFactory().getLength();
+ }
+ static long length(InputStream is) throws SQLException {
+ if (!(is instanceof BufferedInputStream)) {
+ is = new BufferedInputStream(is);
+ }
+ try {
+ long length = 0;
+ while (is.read() != -1) {
+ length++;
+ }
+ return length;
+ } catch (IOException e) {
+ throw new SQLException(e);
+ } finally {
+ try {
+ is.close();
+ } catch (IOException e) {
+ }
+ }
+ }
+
}
Modified: trunk/common-core/src/main/java/org/teiid/core/types/BlobImpl.java
===================================================================
--- trunk/common-core/src/main/java/org/teiid/core/types/BlobImpl.java 2011-09-09 17:10:27 UTC (rev 3461)
+++ trunk/common-core/src/main/java/org/teiid/core/types/BlobImpl.java 2011-09-09 19:04:45 UTC (rev 3462)
@@ -22,7 +22,6 @@
package org.teiid.core.types;
-import java.io.BufferedInputStream;
import java.io.IOException;
import java.io.InputStream;
import java.io.OutputStream;
@@ -109,32 +108,6 @@
}
/**
- * Returns the number of bytes in the <code>BLOB</code> value
- * designated by this <code>Blob</code> object.
- * @return length of the <code>BLOB</code> in bytes
- */
- public long length() throws SQLException{
- if (getStreamFactory().getLength() == -1) {
- InputStream is = new BufferedInputStream(getBinaryStream());
- try {
- long length = 0;
- while (is.read() != -1) {
- length++;
- }
- getStreamFactory().setLength(length);
- } catch (IOException e) {
- throw new SQLException(e);
- } finally {
- try {
- is.close();
- } catch (IOException e) {
- }
- }
- }
- return getStreamFactory().getLength();
- }
-
- /**
* Determines the byte position in the <code>BLOB</code> value
* designated by this <code>Blob</code> object at which
* <code>pattern</code> begins. The search begins at position
Modified: trunk/common-core/src/main/java/org/teiid/core/types/BlobType.java
===================================================================
--- trunk/common-core/src/main/java/org/teiid/core/types/BlobType.java 2011-09-09 17:10:27 UTC (rev 3461)
+++ trunk/common-core/src/main/java/org/teiid/core/types/BlobType.java 2011-09-09 19:04:45 UTC (rev 3462)
@@ -24,6 +24,7 @@
import java.io.IOException;
import java.io.InputStream;
+import java.io.ObjectInput;
import java.io.ObjectOutput;
import java.io.OutputStream;
import java.sql.Blob;
@@ -32,6 +33,7 @@
import javax.sql.rowset.serial.SerialBlob;
import org.teiid.core.TeiidRuntimeException;
+import org.teiid.core.util.ObjectConverterUtil;
/**
@@ -61,18 +63,10 @@
public byte[] getBytes(long pos, int length) throws SQLException {
return this.reference.getBytes(pos, length);
}
-
- /**
- * @see java.sql.Blob#length()
- */
- public long length() throws SQLException {
- //caching the length
- if (this.length != -1) {
- return this.length;
- }
- // if did not find before then do it again.
- this.length = this.reference.length();
- return length;
+
+ @Override
+ long computeLength() throws SQLException {
+ return this.reference.length();
}
/**
@@ -142,12 +136,38 @@
}
@Override
- public void writeExternal(ObjectOutput out) throws IOException {
+ protected void readReference(ObjectInput in) throws IOException {
+ byte[] bytes = new byte[(int)getLength()];
+ in.readFully(bytes);
try {
- length();
+ this.reference = new SerialBlob(bytes);
} catch (SQLException e) {
+ throw new IOException(e);
}
- super.writeExternal(out);
}
+ @Override
+ protected void writeReference(final ObjectOutput out) throws IOException {
+ try {
+ writeBinary(out, getBinaryStream(), (int)length);
+ } catch (SQLException e) {
+ throw new IOException();
+ }
+ }
+
+ static void writeBinary(final ObjectOutput out, InputStream is, int length) throws IOException {
+ OutputStream os = new OutputStream() {
+
+ @Override
+ public void write(int b) throws IOException {
+ out.write(b);
+ }
+ };
+ try {
+ ObjectConverterUtil.write(os, is, length, false);
+ } finally {
+ is.close();
+ }
+ }
+
}
Modified: trunk/common-core/src/main/java/org/teiid/core/types/ClobType.java
===================================================================
--- trunk/common-core/src/main/java/org/teiid/core/types/ClobType.java 2011-09-09 17:10:27 UTC (rev 3461)
+++ trunk/common-core/src/main/java/org/teiid/core/types/ClobType.java 2011-09-09 19:04:45 UTC (rev 3462)
@@ -24,6 +24,7 @@
import java.io.IOException;
import java.io.InputStream;
+import java.io.ObjectInput;
import java.io.ObjectOutput;
import java.io.OutputStream;
import java.io.Reader;
@@ -35,6 +36,7 @@
import javax.sql.rowset.serial.SerialClob;
import org.teiid.core.TeiidRuntimeException;
+import org.teiid.core.util.ObjectConverterUtil;
/**
@@ -72,17 +74,10 @@
public String getSubString(long pos, int length) throws SQLException {
return this.reference.getSubString(pos, length);
}
-
- /**
- * @see java.sql.Clob#length()
- */
- public long length() throws SQLException {
- if (this.length != -1) {
- return this.length;
- }
-
- this.length = this.reference.length();
- return length;
+
+ @Override
+ long computeLength() throws SQLException {
+ return this.reference.length();
}
/**
@@ -218,12 +213,52 @@
}
@Override
- public void writeExternal(ObjectOutput out) throws IOException {
+ protected void readReference(ObjectInput in) throws IOException {
+ char[] chars = new char[(int)length];
+ for (int i = 0; i < chars.length; i++) {
+ chars[i] = in.readChar();
+ }
try {
- length();
+ this.reference = new SerialClob(chars);
} catch (SQLException e) {
+ throw new IOException(e);
}
- super.writeExternal(out);
}
+
+ /**
+ * Since we have the length in chars we'll just write out in double byte format.
+ * These clobs should be small, so the wasted space should be minimal.
+ */
+ @Override
+ protected void writeReference(final ObjectOutput out) throws IOException {
+ Writer w = new Writer() {
+
+ @Override
+ public void write(char[] cbuf, int off, int len) throws IOException {
+ for (int i = off; i < len; i++) {
+ out.writeShort(cbuf[i]);
+ }
+ }
+
+ @Override
+ public void flush() throws IOException {
+ }
+
+ @Override
+ public void close() throws IOException {
+ }
+ };
+ Reader r;
+ try {
+ r = getCharacterStream();
+ } catch (SQLException e) {
+ throw new IOException(e);
+ }
+ try {
+ ObjectConverterUtil.write(w, r, (int)length, false);
+ } finally {
+ r.close();
+ }
+ }
}
Modified: trunk/common-core/src/main/java/org/teiid/core/types/InputStreamFactory.java
===================================================================
--- trunk/common-core/src/main/java/org/teiid/core/types/InputStreamFactory.java 2011-09-09 17:10:27 UTC (rev 3461)
+++ trunk/common-core/src/main/java/org/teiid/core/types/InputStreamFactory.java 2011-09-09 19:04:45 UTC (rev 3462)
@@ -36,12 +36,21 @@
import java.sql.SQLXML;
import javax.activation.DataSource;
+import javax.sql.rowset.serial.SerialBlob;
+import javax.sql.rowset.serial.SerialClob;
import javax.xml.transform.Source;
import org.teiid.core.util.ReaderInputStream;
public abstract class InputStreamFactory implements Source {
+ public enum StorageMode {
+ MEMORY, //TODO: sources may return Serial values that are much too large and we should convert them to persistent.
+ PERSISTENT,
+ FREE,
+ OTHER
+ }
+
public interface StreamFactoryReference {
void setStreamFactory(InputStreamFactory inputStreamFactory);
@@ -49,7 +58,7 @@
}
private String systemId;
- private long length = -1;
+ protected long length = -1;
/**
* Get a new InputStream
@@ -67,10 +76,17 @@
this.systemId = systemId;
}
+ /**
+ * @throws IOException
+ */
public void free() throws IOException {
}
+ /**
+ * Length in bytes of the {@link InputStream}
+ * @return the length or -1 if the length is not known
+ */
public long getLength() {
return length;
}
@@ -79,12 +95,15 @@
this.length = length;
}
+ /**
+ * @throws IOException
+ */
public Reader getCharacterStream() throws IOException {
return null;
}
- public boolean isPersistent() {
- return false;
+ public StorageMode getStorageMode() {
+ return StorageMode.OTHER;
}
public static class FileInputStreamFactory extends InputStreamFactory {
@@ -107,8 +126,8 @@
}
@Override
- public boolean isPersistent() {
- return true;
+ public StorageMode getStorageMode() {
+ return StorageMode.PERSISTENT;
}
}
@@ -162,6 +181,11 @@
public OutputStream getOutputStream() throws IOException {
throw new UnsupportedOperationException();
}
+
+ @Override
+ public StorageMode getStorageMode() {
+ return getStorageMode(clob);
+ }
}
@@ -184,11 +208,13 @@
@Override
public long getLength() {
- try {
- return blob.length();
- } catch (SQLException e) {
- return -1;
- }
+ if (length == -1) {
+ try {
+ length = blob.length();
+ } catch (SQLException e) {
+ }
+ }
+ return length;
}
@Override
@@ -205,9 +231,35 @@
public OutputStream getOutputStream() throws IOException {
throw new UnsupportedOperationException();
}
+
+ @Override
+ public StorageMode getStorageMode() {
+ return getStorageMode(blob);
+ }
}
+ public static StorageMode getStorageMode(Object lob) {
+ if (lob instanceof Streamable<?>) {
+ return getStorageMode(((Streamable<?>)lob).getReference());
+ }
+ if (lob instanceof SerialClob) {
+ return StorageMode.MEMORY;
+ }
+ if (lob instanceof SerialBlob) {
+ return StorageMode.MEMORY;
+ }
+ if (lob instanceof BaseLob) {
+ BaseLob baseLob = (BaseLob)lob;
+ try {
+ return baseLob.getStreamFactory().getStorageMode();
+ } catch (SQLException e) {
+ return StorageMode.FREE;
+ }
+ }
+ return StorageMode.OTHER;
+ }
+
public static class SQLXMLInputStreamFactory extends InputStreamFactory implements DataSource {
private SQLXML sqlxml;
@@ -248,6 +300,11 @@
public OutputStream getOutputStream() throws IOException {
throw new UnsupportedOperationException();
}
+
+ @Override
+ public StorageMode getStorageMode() {
+ return getStorageMode(sqlxml);
+ }
}
Modified: trunk/common-core/src/main/java/org/teiid/core/types/SQLXMLImpl.java
===================================================================
--- trunk/common-core/src/main/java/org/teiid/core/types/SQLXMLImpl.java 2011-09-09 17:10:27 UTC (rev 3461)
+++ trunk/common-core/src/main/java/org/teiid/core/types/SQLXMLImpl.java 2011-09-09 19:04:45 UTC (rev 3462)
@@ -71,6 +71,16 @@
public InputStream getInputStream() throws IOException {
return new ByteArrayInputStream(bytes);
}
+
+ @Override
+ public StorageMode getStorageMode() {
+ return StorageMode.MEMORY;
+ }
+
+ @Override
+ public long getLength() {
+ return bytes.length;
+ }
});
setEncoding(Streamable.ENCODING);
}
Modified: trunk/common-core/src/main/java/org/teiid/core/types/Streamable.java
===================================================================
--- trunk/common-core/src/main/java/org/teiid/core/types/Streamable.java 2011-09-09 17:10:27 UTC (rev 3461)
+++ trunk/common-core/src/main/java/org/teiid/core/types/Streamable.java 2011-09-09 19:04:45 UTC (rev 3462)
@@ -27,7 +27,8 @@
import java.io.ObjectInput;
import java.io.ObjectOutput;
import java.nio.charset.Charset;
-import java.util.concurrent.atomic.AtomicInteger;
+import java.sql.SQLException;
+import java.util.concurrent.atomic.AtomicLong;
import org.teiid.core.CorePlugin;
@@ -44,7 +45,7 @@
private static final long serialVersionUID = -8252488562134729374L;
- private static AtomicInteger counter = new AtomicInteger();
+ private static AtomicLong counter = new AtomicLong();
public static final String ENCODING = "UTF-8"; //$NON-NLS-1$
public static final Charset CHARSET = Charset.forName(ENCODING);
@@ -66,10 +67,23 @@
this.reference = reference;
}
+ /**
+ * Returns the cached length. May be binary or character based.
+ * @return
+ */
public long getLength() {
return length;
}
+ abstract long computeLength() throws SQLException;
+
+ public long length() throws SQLException {
+ if (length == -1) {
+ length = computeLength();
+ }
+ return length;
+ }
+
public T getReference() {
return reference;
}
@@ -82,9 +96,9 @@
return this.referenceStreamId;
}
- /*public void setReferenceStreamId(String id) {
+ public void setReferenceStreamId(String id) {
this.referenceStreamId = id;
- }*/
+ }
@Override
public String toString() {
@@ -99,12 +113,27 @@
ClassNotFoundException {
length = in.readLong();
referenceStreamId = (String)in.readObject();
+ if (referenceStreamId == null) {
+ //we expect the data inline
+ readReference(in);
+ }
}
+ protected abstract void readReference(ObjectInput in) throws IOException;
+
@Override
public void writeExternal(ObjectOutput out) throws IOException {
+ try {
+ length();
+ } catch (SQLException e) {
+ }
out.writeLong(length);
out.writeObject(referenceStreamId);
+ if (referenceStreamId == null) {
+ writeReference(out);
+ }
}
-
+
+ protected abstract void writeReference(ObjectOutput out) throws IOException;
+
}
Modified: trunk/common-core/src/main/java/org/teiid/core/types/XMLType.java
===================================================================
--- trunk/common-core/src/main/java/org/teiid/core/types/XMLType.java 2011-09-09 17:10:27 UTC (rev 3461)
+++ trunk/common-core/src/main/java/org/teiid/core/types/XMLType.java 2011-09-09 19:04:45 UTC (rev 3462)
@@ -189,4 +189,29 @@
}
}
}
+
+ @Override
+ long computeLength() throws SQLException {
+ if (this.reference instanceof SQLXMLImpl) {
+ SQLXMLImpl impl = (SQLXMLImpl)this.reference;
+ return impl.length();
+ }
+ return BaseLob.length(getBinaryStream());
+ }
+
+ @Override
+ protected void readReference(ObjectInput in) throws IOException {
+ byte[] bytes = new byte[(int)getLength()];
+ in.readFully(bytes);
+ this.reference = new SQLXMLImpl(bytes);
+ }
+
+ @Override
+ protected void writeReference(final ObjectOutput out) throws IOException {
+ try {
+ BlobType.writeBinary(out, getBinaryStream(), (int)length);
+ } catch (SQLException e) {
+ throw new IOException();
+ }
+ }
}
Modified: trunk/common-core/src/main/resources/org/teiid/core/util/application.properties
===================================================================
--- trunk/common-core/src/main/resources/org/teiid/core/util/application.properties 2011-09-09 17:10:27 UTC (rev 3461)
+++ trunk/common-core/src/main/resources/org/teiid/core/util/application.properties 2011-09-09 19:04:45 UTC (rev 3462)
@@ -1,5 +1,5 @@
-build.releaseNumber=${pom.version}
-build.number=${pom.version}
+build.releaseNumber=${project.version}
+build.number=${project.version}
build.date=@build-date@
copyright=Copyright (C) 2008-2009 Red Hat, Inc
url=${site.url}
\ No newline at end of file
Modified: trunk/common-core/src/test/java/org/teiid/core/types/TestBlobValue.java
===================================================================
--- trunk/common-core/src/test/java/org/teiid/core/types/TestBlobValue.java 2011-09-09 17:10:27 UTC (rev 3461)
+++ trunk/common-core/src/test/java/org/teiid/core/types/TestBlobValue.java 2011-09-09 19:04:45 UTC (rev 3462)
@@ -22,21 +22,14 @@
package org.teiid.core.types;
-import java.io.File;
-import java.io.FileInputStream;
-import java.io.FileOutputStream;
-import java.io.ObjectInputStream;
-import java.io.ObjectOutputStream;
-
import javax.sql.rowset.serial.SerialBlob;
-import org.teiid.core.types.BlobType;
-import org.teiid.core.util.UnitTestUtil;
-
-
import junit.framework.TestCase;
+import org.junit.Test;
+import org.teiid.core.util.UnitTestUtil;
+
public class TestBlobValue extends TestCase {
public void testBlobValue() throws Exception {
@@ -55,22 +48,27 @@
String key = bv.getReferenceStreamId();
// now force to serialize
- File saved = new File(UnitTestUtil.getTestScratchPath()+"/blobassaved.bin"); //$NON-NLS-1$
- ObjectOutputStream out = new ObjectOutputStream(new FileOutputStream(saved));
- out.writeObject(bv);
- out.close();
-
- // now read back the object from serilized state
- ObjectInputStream in = new ObjectInputStream(new FileInputStream(saved));
- BlobType read = (BlobType)in.readObject();
+ BlobType read = UnitTestUtil.helpSerialize(bv);
// make sure we have kept the reference stream id
assertEquals(key, read.getReferenceStreamId());
// and lost the original object
assertNull(read.getReference());
+ }
+
+ @Test public void testReferencePersistence() throws Exception {
+ String testString = "this is test clob"; //$NON-NLS-1$
+ SerialBlob blob = new SerialBlob(testString.getBytes());
- saved.delete();
+ BlobType bv = new BlobType(blob);
+ bv.setReferenceStreamId(null);
+ // now force to serialize
+ BlobType read = UnitTestUtil.helpSerialize(bv);
+
+ assertNull(read.getReferenceStreamId());
+
+ assertEquals(testString, new String(read.getBytes(1, (int)blob.length())));
}
}
Modified: trunk/common-core/src/test/java/org/teiid/core/types/TestClobValue.java
===================================================================
--- trunk/common-core/src/test/java/org/teiid/core/types/TestClobValue.java 2011-09-09 17:10:27 UTC (rev 3461)
+++ trunk/common-core/src/test/java/org/teiid/core/types/TestClobValue.java 2011-09-09 19:04:45 UTC (rev 3462)
@@ -24,12 +24,7 @@
import static org.junit.Assert.*;
-import java.io.File;
-import java.io.FileInputStream;
-import java.io.FileOutputStream;
import java.io.IOException;
-import java.io.ObjectInputStream;
-import java.io.ObjectOutputStream;
import java.io.Reader;
import javax.sql.rowset.serial.SerialClob;
@@ -56,15 +51,8 @@
String key = cv.getReferenceStreamId();
// now force to serialize
- File saved = new File(UnitTestUtil.getTestScratchPath()+"/clobassaved.bin"); //$NON-NLS-1$
- ObjectOutputStream out = new ObjectOutputStream(new FileOutputStream(saved));
- out.writeObject(cv);
- out.close();
+ ClobType read = UnitTestUtil.helpSerialize(cv);
- // now read back the object from serilized state
- ObjectInputStream in = new ObjectInputStream(new FileInputStream(saved));
- ClobType read = (ClobType)in.readObject();
-
assertTrue(read.length() > 0);
// make sure we have kept the reference stream id
@@ -72,8 +60,21 @@
// and lost the original object
assertNull(read.getReference());
+ }
+
+ @Test public void testReferencePersistence() throws Exception {
+ String testString = "this is test clob"; //$NON-NLS-1$
+ SerialClob clob = new SerialClob(testString.toCharArray());
- saved.delete();
+ ClobType cv = new ClobType(clob);
+ cv.setReferenceStreamId(null);
+
+ // now force to serialize
+ ClobType read = UnitTestUtil.helpSerialize(cv);
+
+ assertTrue(read.length() > 0);
+
+ assertEquals(testString, read.getSubString(1, testString.length()));
}
@Test public void testClobSubstring() throws Exception {
Modified: trunk/common-core/src/test/java/org/teiid/core/types/TestXMLValue.java
===================================================================
--- trunk/common-core/src/test/java/org/teiid/core/types/TestXMLValue.java 2011-09-09 17:10:27 UTC (rev 3461)
+++ trunk/common-core/src/test/java/org/teiid/core/types/TestXMLValue.java 2011-09-09 19:04:45 UTC (rev 3462)
@@ -22,20 +22,11 @@
package org.teiid.core.types;
-import java.io.File;
-import java.io.FileInputStream;
-import java.io.FileOutputStream;
-import java.io.ObjectInputStream;
-import java.io.ObjectOutputStream;
+import junit.framework.TestCase;
-import org.teiid.core.types.SQLXMLImpl;
-import org.teiid.core.types.XMLType;
import org.teiid.core.util.UnitTestUtil;
-import junit.framework.TestCase;
-
-
public class TestXMLValue extends TestCase {
public void testXMLValue() throws Exception {
@@ -55,22 +46,26 @@
String key = xv.getReferenceStreamId();
// now force to serialize
- File saved = new File(UnitTestUtil.getTestScratchPath()+"/xmlsaved.bin"); //$NON-NLS-1$
- ObjectOutputStream out = new ObjectOutputStream(new FileOutputStream(saved));
- out.writeObject(xv);
- out.close();
-
- // now read back the object from serilized state
- ObjectInputStream in = new ObjectInputStream(new FileInputStream(saved));
- XMLType read = (XMLType)in.readObject();
+ XMLType read = UnitTestUtil.helpSerialize(xv);
// make sure we have kept the reference stream id
assertEquals(key, read.getReferenceStreamId());
// and lost the original object
assertNull(read.getReference());
+ }
+
+ public void testReferencePersistence() throws Exception {
+ String testString = "<foo>this is an xml value test</foo>"; //$NON-NLS-1$
+ SQLXMLImpl xml = new SQLXMLImpl(testString);
- saved.delete();
+ XMLType xv = new XMLType(xml);
+ xv.setReferenceStreamId(null);
+
+ // now force to serialize
+ XMLType read = UnitTestUtil.helpSerialize(xv);
+
+ assertEquals(testString, read.getString());
}
}
Modified: trunk/documentation/caching-guide/src/main/docbook/en-US/content/hint-option.xml
===================================================================
--- trunk/documentation/caching-guide/src/main/docbook/en-US/content/hint-option.xml 2011-09-09 17:10:27 UTC (rev 3461)
+++ trunk/documentation/caching-guide/src/main/docbook/en-US/content/hint-option.xml 2011-09-09 19:04:45 UTC (rev 3462)
@@ -19,6 +19,9 @@
<itemizedlist>
<listitem><para>The cache hint should appear at the beginning of the SQL. It will not have any affect on INSERT/UPDATE/DELETE statements or virtual update procedure definitions.</para></listitem>
<listitem><para><emphasis>pref_mem</emphasis> - if present indicates that the cached results should prefer to remain in memory. They are not however required to be memory only.
+ <note><para>Care should be taken to not over use the pref_mem option.
+ The memory preference is implemented with Java soft references. While soft references are effective at preventing out of memory conditions.
+ Too much memory held by soft references can limit the effective working memory. Consult your JVM options for clearing soft references if you need to tune their behavior.</para></note>
</para></listitem>
<listitem><para><emphasis>ttl:n</emphasis> - if present n indicates the time to live value in milliseconds.
</para></listitem>
Modified: trunk/engine/src/main/java/org/teiid/common/buffer/FileStoreInputStreamFactory.java
===================================================================
--- trunk/engine/src/main/java/org/teiid/common/buffer/FileStoreInputStreamFactory.java 2011-09-09 17:10:27 UTC (rev 3461)
+++ trunk/engine/src/main/java/org/teiid/common/buffer/FileStoreInputStreamFactory.java 2011-09-09 19:04:45 UTC (rev 3462)
@@ -56,6 +56,9 @@
@Override
public long getLength() {
+ if (fsos != null && !fsos.bytesWritten()) {
+ return fsos.getCount();
+ }
return lobBuffer.getLength();
}
@@ -86,7 +89,10 @@
}
@Override
- public boolean isPersistent() {
- return fsos == null || fsos.bytesWritten();
+ public StorageMode getStorageMode() {
+ if (fsos == null) {
+ return StorageMode.PERSISTENT;
+ }
+ return StorageMode.MEMORY;
}
}
\ No newline at end of file
Modified: trunk/engine/src/main/java/org/teiid/common/buffer/LobManager.java
===================================================================
--- trunk/engine/src/main/java/org/teiid/common/buffer/LobManager.java 2011-09-09 17:10:27 UTC (rev 3461)
+++ trunk/engine/src/main/java/org/teiid/common/buffer/LobManager.java 2011-09-09 19:04:45 UTC (rev 3462)
@@ -45,6 +45,10 @@
import org.teiid.core.types.SQLXMLImpl;
import org.teiid.core.types.Streamable;
import org.teiid.core.types.XMLType;
+import org.teiid.core.types.InputStreamFactory.BlobInputStreamFactory;
+import org.teiid.core.types.InputStreamFactory.ClobInputStreamFactory;
+import org.teiid.core.types.InputStreamFactory.SQLXMLInputStreamFactory;
+import org.teiid.core.types.InputStreamFactory.StorageMode;
import org.teiid.core.util.ObjectConverterUtil;
import org.teiid.query.QueryPlugin;
import org.teiid.query.sql.symbol.Expression;
@@ -55,6 +59,16 @@
*/
public class LobManager {
private Map<String, Streamable<?>> lobReferences = new ConcurrentHashMap<String, Streamable<?>>();
+ private boolean inlineLobs = true;
+ private int maxMemoryBytes = DataTypeManager.MAX_LOB_MEMORY_BYTES;
+
+ public void setInlineLobs(boolean trackMemoryLobs) {
+ this.inlineLobs = trackMemoryLobs;
+ }
+
+ public void setMaxMemoryBytes(int maxMemoryBytes) {
+ this.maxMemoryBytes = maxMemoryBytes;
+ }
public void updateReferences(int[] lobIndexes, List<?> tuple)
throws TeiidComponentException {
@@ -64,6 +78,16 @@
continue;
}
Streamable lob = (Streamable) anObj;
+ try {
+ if (inlineLobs
+ && (InputStreamFactory.getStorageMode(lob) == StorageMode.MEMORY
+ || lob.length()*(lob instanceof ClobType?2:1) <= maxMemoryBytes)) {
+ lob.setReferenceStreamId(null);
+ continue;
+ }
+ } catch (SQLException e) {
+ //presumably the lob is bad, but let it slide for now
+ }
if (lob.getReference() == null) {
lob.setReference(getLobReference(lob.getReferenceStreamId()).getReference());
} else {
@@ -81,14 +105,14 @@
return lob;
}
- public static int[] getLobIndexes(List expressions) {
+ public static int[] getLobIndexes(List<? extends Expression> expressions) {
if (expressions == null) {
return null;
}
int[] result = new int[expressions.size()];
int resultIndex = 0;
for (int i = 0; i < expressions.size(); i++) {
- Expression expr = (Expression) expressions.get(i);
+ Expression expr = expressions.get(i);
if (DataTypeManager.isLOB(expr.getType()) || expr.getType() == DataTypeManager.DefaultDataClasses.OBJECT) {
result[resultIndex++] = i;
}
@@ -115,7 +139,7 @@
try {
BaseLob baseLob = (BaseLob)lob.getReference();
InputStreamFactory isf = baseLob.getStreamFactory();
- if (isf.isPersistent()) {
+ if (isf.getStorageMode() == StorageMode.PERSISTENT) {
return lob;
}
} catch (SQLException e) {
@@ -127,19 +151,15 @@
Streamable<?> persistedLob;
try {
- InputStreamFactory isf = new InputStreamFactory() {
- @Override
- public InputStream getInputStream() throws IOException {
- if (lob instanceof BlobType) {
- return new BlobInputStreamFactory((Blob)lob).getInputStream();
- }
- else if (lob instanceof ClobType) {
- return new ClobInputStreamFactory((Clob)lob).getInputStream();
- }
- return new SQLXMLInputStreamFactory((SQLXML)lob).getInputStream();
- }
- };
- InputStream is = isf.getInputStream();
+ InputStream is = null;
+ if (lob instanceof BlobType) {
+ is = new BlobInputStreamFactory((Blob)lob).getInputStream();
+ }
+ else if (lob instanceof ClobType) {
+ is = new ClobInputStreamFactory((Clob)lob).getInputStream();
+ } else {
+ is = new SQLXMLInputStreamFactory((SQLXML)lob).getInputStream();
+ }
OutputStream fsos = store.createOutputStream();
length = ObjectConverterUtil.write(fsos, is, bytes, -1);
} catch (IOException e) {
@@ -156,8 +176,8 @@
}
@Override
- public boolean isPersistent() {
- return true;
+ public StorageMode getStorageMode() {
+ return StorageMode.PERSISTENT;
}
};
@@ -178,4 +198,8 @@
}
return persistedLob;
}
+
+ public int getLobCount() {
+ return this.lobReferences.size();
+ }
}
Modified: trunk/engine/src/main/java/org/teiid/common/buffer/TupleBuffer.java
===================================================================
--- trunk/engine/src/main/java/org/teiid/common/buffer/TupleBuffer.java 2011-09-09 17:10:27 UTC (rev 3461)
+++ trunk/engine/src/main/java/org/teiid/common/buffer/TupleBuffer.java 2011-09-09 19:04:45 UTC (rev 3462)
@@ -94,6 +94,12 @@
this.batchSize = batchSize;
}
+ public void setInlineLobs(boolean inline) {
+ if (this.lobManager != null) {
+ this.lobManager.setInlineLobs(inline);
+ }
+ }
+
public String getId() {
if (this.uuid == null) {
this.uuid = java.util.UUID.randomUUID().toString();
@@ -373,4 +379,11 @@
return types;
}
+ public int getLobCount() {
+ if (this.lobManager == null) {
+ return 0;
+ }
+ return this.lobManager.getLobCount();
+ }
+
}
Modified: trunk/engine/src/main/java/org/teiid/common/buffer/impl/BufferManagerImpl.java
===================================================================
--- trunk/engine/src/main/java/org/teiid/common/buffer/impl/BufferManagerImpl.java 2011-09-09 17:10:27 UTC (rev 3461)
+++ trunk/engine/src/main/java/org/teiid/common/buffer/impl/BufferManagerImpl.java 2011-09-09 19:04:45 UTC (rev 3462)
@@ -94,12 +94,12 @@
private final class CleanupHook implements org.teiid.common.buffer.BatchManager.CleanupHook {
- private long id;
+ private Long id;
private WeakReference<BatchManagerImpl> ref;
- CleanupHook(long id, BatchManagerImpl batchManager) {
+ CleanupHook(Long id, WeakReference<BatchManagerImpl> batchManager) {
this.id = id;
- this.ref = new WeakReference<BatchManagerImpl>(batchManager);
+ this.ref = batchManager;
}
public void cleanup() {
@@ -120,6 +120,7 @@
private AtomicLong unusedSpace = new AtomicLong();
private int[] lobIndexes;
private SizeUtility sizeUtility;
+ private WeakReference<BatchManagerImpl> ref = new WeakReference<BatchManagerImpl>(this);
private BatchManagerImpl(String newID, int[] lobIndexes) {
this.id = newID;
@@ -136,7 +137,7 @@
@Override
public ManagedBatch createManagedBatch(TupleBatch batch, boolean softCache)
throws TeiidComponentException {
- ManagedBatchImpl mbi = new ManagedBatchImpl(batch, this, softCache);
+ ManagedBatchImpl mbi = new ManagedBatchImpl(batch, ref, softCache);
mbi.addToCache(false);
persistBatchReferences();
return mbi;
@@ -196,6 +197,11 @@
public void remove() {
this.store.remove();
}
+
+ @Override
+ public String toString() {
+ return id;
+ }
}
/**
@@ -205,10 +211,18 @@
TreeMap<Long, ManagedBatchImpl> batches = new TreeMap<Long, ManagedBatchImpl>();
Long lastUsed = null;
- ManagedBatchImpl removeBatch(long row) {
+ ManagedBatchImpl removeBatch(Long row) {
ManagedBatchImpl result = batches.remove(row);
if (result != null) {
activeBatchKB -= result.sizeEstimate;
+ if (result.softCache) {
+ BatchSoftReference ref = (BatchSoftReference)result.batchReference;
+ if (ref != null) {
+ maxReserveKB += ref.sizeEstimate;
+ ref.sizeEstimate = 0;
+ ref.clear();
+ }
+ }
}
return result;
}
@@ -220,21 +234,22 @@
private volatile TupleBatch activeBatch;
private volatile Reference<TupleBatch> batchReference;
private int beginRow;
- private BatchManagerImpl batchManager;
- private long id;
+ private WeakReference<BatchManagerImpl> managerRef;
+ private Long id;
private LobManager lobManager;
private int sizeEstimate;
- public ManagedBatchImpl(TupleBatch batch, BatchManagerImpl manager, boolean softCache) {
+ public ManagedBatchImpl(TupleBatch batch, WeakReference<BatchManagerImpl> ref, boolean softCache) {
this.softCache = softCache;
id = batchAdded.incrementAndGet();
this.activeBatch = batch;
this.beginRow = batch.getBeginRow();
- this.batchManager = manager;
- if (this.batchManager.lobIndexes != null) {
+ this.managerRef = ref;
+ BatchManagerImpl batchManager = ref.get();
+ if (batchManager.lobIndexes != null) {
this.lobManager = new LobManager();
}
- sizeEstimate = (int) Math.max(1, manager.sizeUtility.getBatchSize(batch) / 1024);
+ sizeEstimate = (int) Math.max(1, batchManager.sizeUtility.getBatchSize(batch) / 1024);
if (LogManager.isMessageToBeRecorded(LogConstants.CTX_BUFFER_MGR, MessageLevel.TRACE)) {
LogManager.logTrace(LogConstants.CTX_BUFFER_MGR, "Add batch to BufferManager", id, "with size estimate", sizeEstimate); //$NON-NLS-1$ //$NON-NLS-2$
}
@@ -247,6 +262,11 @@
}
private void addToCache(boolean update) {
+ BatchManagerImpl batchManager = managerRef.get();
+ if (batchManager == null) {
+ remove();
+ return;
+ }
synchronized (activeBatches) {
TupleBatch batch = this.activeBatch;
if (batch == null) {
@@ -272,11 +292,25 @@
@Override
public TupleBatch getBatch(boolean cache, String[] types) throws TeiidComponentException {
+ BatchManagerImpl batchManager = managerRef.get();
+ if (batchManager == null) {
+ remove();
+ throw new AssertionError("Already removed"); //$NON-NLS-1$
+ }
long reads = readAttempts.incrementAndGet();
if (LogManager.isMessageToBeRecorded(LogConstants.CTX_BUFFER_MGR, MessageLevel.TRACE)) {
LogManager.logTrace(LogConstants.CTX_BUFFER_MGR, batchManager.id, "getting batch", reads, "reference hits", referenceHit.get()); //$NON-NLS-1$ //$NON-NLS-2$
}
synchronized (activeBatches) {
+ for (int i = 0; i < 10; i++) {
+ BatchSoftReference ref = (BatchSoftReference)SOFT_QUEUE.poll();
+ if (ref == null) {
+ break;
+ }
+ maxReserveKB += ref.sizeEstimate;
+ ref.sizeEstimate = 0;
+ ref.clear();
+ }
TupleBufferInfo tbi = activeBatches.remove(batchManager.id);
if (tbi != null) {
boolean put = true;
@@ -316,7 +350,7 @@
LogManager.logDetail(LogConstants.CTX_BUFFER_MGR, batchManager.id, id, "reading batch from disk, total reads:", count); //$NON-NLS-1$
}
try {
- this.batchManager.compactionLock.readLock().lock();
+ batchManager.compactionLock.readLock().lock();
long[] info = batchManager.physicalMapping.get(this.id);
Assertion.isNotNull(info, "Invalid batch " + id); //$NON-NLS-1$
ObjectInputStream ois = new ObjectInputStream(new BufferedInputStream(batchManager.store.createInputStream(info[0]), IO_BUFFER_SIZE));
@@ -340,12 +374,17 @@
} catch (ClassNotFoundException e) {
throw new TeiidComponentException(e, QueryPlugin.Util.getString("FileStoreageManager.error_reading", batchManager.id)); //$NON-NLS-1$
} finally {
- this.batchManager.compactionLock.readLock().unlock();
+ batchManager.compactionLock.readLock().unlock();
}
}
}
public synchronized void persist() throws TeiidComponentException {
+ BatchManagerImpl batchManager = managerRef.get();
+ if (batchManager == null) {
+ remove();
+ return;
+ }
boolean lockheld = false;
try {
TupleBatch batch = activeBatch;
@@ -376,7 +415,10 @@
}
}
if (softCache) {
- this.batchReference = new SoftReference<TupleBatch>(batch);
+ this.batchReference = new BatchSoftReference(batch, SOFT_QUEUE, sizeEstimate);
+ synchronized (activeBatches) {
+ maxReserveKB -= sizeEstimate;
+ }
} else if (useWeakReferences) {
this.batchReference = new WeakReference<TupleBatch>(batch);
}
@@ -389,26 +431,39 @@
persistent = true;
activeBatch = null;
if (lockheld) {
- this.batchManager.compactionLock.writeLock().unlock();
+ batchManager.compactionLock.writeLock().unlock();
}
}
}
public void remove() {
- cleanupManagedBatch(batchManager, id);
+ cleanupManagedBatch(managerRef.get(), id);
}
@Override
public CleanupHook getCleanupHook() {
- return new CleanupHook(id, batchManager);
+ return new CleanupHook(id, managerRef);
}
@Override
public String toString() {
- return "ManagedBatch " + batchManager.id + " " + this.id + " " + activeBatch; //$NON-NLS-1$ //$NON-NLS-2$ //$NON-NLS-3$
+ return "ManagedBatch " + managerRef.get() + " " + this.id + " " + activeBatch; //$NON-NLS-1$ //$NON-NLS-2$ //$NON-NLS-3$
}
}
+ private static class BatchSoftReference extends SoftReference<TupleBatch> {
+
+ private int sizeEstimate;
+
+ public BatchSoftReference(TupleBatch referent,
+ ReferenceQueue<? super TupleBatch> q, int sizeEstimate) {
+ super(referent, q);
+ this.sizeEstimate = sizeEstimate;
+ }
+ }
+
+ private static ReferenceQueue<? super TupleBatch> SOFT_QUEUE = new ReferenceQueue<TupleBatch>();
+
// Configuration
private int connectorBatchSize = BufferManager.DEFAULT_CONNECTOR_BATCH_SIZE;
private int processorBatchSize = BufferManager.DEFAULT_PROCESSOR_BATCH_SIZE;
@@ -419,6 +474,7 @@
private volatile int reserveBatchKB;
private int maxActivePlans = DQPConfiguration.DEFAULT_MAX_ACTIVE_PLANS; //used as a hint to set the reserveBatchKB
private boolean useWeakReferences = true;
+ private boolean inlineLobs = true;
private ReentrantLock lock = new ReentrantLock(true);
private Condition batchesFreed = lock.newCondition();
@@ -508,10 +564,11 @@
if (LogManager.isMessageToBeRecorded(LogConstants.CTX_BUFFER_MGR, MessageLevel.DETAIL)) {
LogManager.logDetail(LogConstants.CTX_BUFFER_MGR, "Creating TupleBuffer:", newID, elements, Arrays.toString(tupleBuffer.getTypes()), "of type", tupleSourceType); //$NON-NLS-1$ //$NON-NLS-2$
}
+ tupleBuffer.setInlineLobs(inlineLobs);
return tupleBuffer;
}
- private void cleanupManagedBatch(BatchManagerImpl batchManager, long id) {
+ private void cleanupManagedBatch(BatchManagerImpl batchManager, Long id) {
synchronized (activeBatches) {
TupleBufferInfo tbi = activeBatches.get(batchManager.id);
if (tbi != null && tbi.removeBatch(id) != null) {
@@ -730,4 +787,8 @@
this.useWeakReferences = useWeakReferences;
}
+ public void setInlineLobs(boolean inlineLobs) {
+ this.inlineLobs = inlineLobs;
+ }
+
}
Modified: trunk/engine/src/main/java/org/teiid/common/buffer/impl/SizeUtility.java
===================================================================
--- trunk/engine/src/main/java/org/teiid/common/buffer/impl/SizeUtility.java 2011-09-09 17:10:27 UTC (rev 3461)
+++ trunk/engine/src/main/java/org/teiid/common/buffer/impl/SizeUtility.java 2011-09-09 19:04:45 UTC (rev 3462)
@@ -112,9 +112,8 @@
} else if (type == DataTypeManager.DefaultDataClasses.BIG_DECIMAL) {
return isValueCacheEnabled?150:200;
}
- return 512; //assumes buffer overhead in the case of lobs
- //however the account for lobs is misleading as the lob
- //references are not actually removed from memory
+ return 512; //this is is misleading for lobs
+ //most references are not actually removed from memory
}
/**
Modified: trunk/engine/src/main/java/org/teiid/dqp/internal/process/RequestWorkItem.java
===================================================================
--- trunk/engine/src/main/java/org/teiid/dqp/internal/process/RequestWorkItem.java 2011-09-09 17:10:27 UTC (rev 3461)
+++ trunk/engine/src/main/java/org/teiid/dqp/internal/process/RequestWorkItem.java 2011-09-09 19:04:45 UTC (rev 3462)
@@ -872,6 +872,12 @@
private void doneProducingBatches() {
this.doneProducingBatches = true;
+ //TODO: we could perform more tracking to know what source lobs are in use
+ if (this.resultsBuffer.getLobCount() == 0) {
+ for (DataTierTupleSource connectorRequest : this.connectorInfo.values()) {
+ connectorRequest.fullyCloseSource();
+ }
+ }
dqpCore.finishProcessing(this);
}
Modified: trunk/engine/src/main/java/org/teiid/query/metadata/TransformationMetadata.java
===================================================================
--- trunk/engine/src/main/java/org/teiid/query/metadata/TransformationMetadata.java 2011-09-09 17:10:27 UTC (rev 3461)
+++ trunk/engine/src/main/java/org/teiid/query/metadata/TransformationMetadata.java 2011-09-09 19:04:45 UTC (rev 3462)
@@ -125,8 +125,8 @@
}
@Override
- public void free() throws IOException {
- f.close();
+ public StorageMode getStorageMode() {
+ return StorageMode.PERSISTENT;
}
}
Modified: trunk/engine/src/test/java/org/teiid/common/buffer/TestLobManager.java
===================================================================
--- trunk/engine/src/test/java/org/teiid/common/buffer/TestLobManager.java 2011-09-09 17:10:27 UTC (rev 3461)
+++ trunk/engine/src/test/java/org/teiid/common/buffer/TestLobManager.java 2011-09-09 19:04:45 UTC (rev 3462)
@@ -66,6 +66,7 @@
}));
LobManager lobManager = new LobManager();
+ lobManager.setMaxMemoryBytes(4);
lobManager.updateReferences(new int[] {0,1}, Arrays.asList(clob, blob));
lobManager.persist(fs);
Modified: trunk/engine/src/test/java/org/teiid/common/buffer/TestTupleBuffer.java
===================================================================
--- trunk/engine/src/test/java/org/teiid/common/buffer/TestTupleBuffer.java 2011-09-09 17:10:27 UTC (rev 3461)
+++ trunk/engine/src/test/java/org/teiid/common/buffer/TestTupleBuffer.java 2011-09-09 19:04:45 UTC (rev 3462)
@@ -107,6 +107,7 @@
x.setType(DataTypeManager.DefaultDataClasses.CLOB);
List<ElementSymbol> schema = Arrays.asList(x);
TupleBuffer tb = new TupleBuffer(new FakeBatchManager(), "x", schema, LobManager.getLobIndexes(schema), 32); //$NON-NLS-1$
+ tb.setInlineLobs(false);
ClobType c = new ClobType(new SerialClob(new char[0]));
TupleBatch batch = new TupleBatch(1, new List[] {Arrays.asList(c)});
tb.addTupleBatch(batch, false);
Modified: trunk/engine/src/test/java/org/teiid/dqp/internal/process/TestDQPCore.java
===================================================================
--- trunk/engine/src/test/java/org/teiid/dqp/internal/process/TestDQPCore.java 2011-09-09 17:10:27 UTC (rev 3461)
+++ trunk/engine/src/test/java/org/teiid/dqp/internal/process/TestDQPCore.java 2011-09-09 19:04:45 UTC (rev 3462)
@@ -120,7 +120,9 @@
@Override
public BufferManager getBufferManager() {
- return BufferManagerFactory.createBufferManager();
+ BufferManagerImpl bm = BufferManagerFactory.createBufferManager();
+ bm.setInlineLobs(false);
+ return bm;
}
});
core.setCacheFactory(new DefaultCacheFactory());
Modified: trunk/runtime/src/main/java/org/teiid/services/BufferServiceImpl.java
===================================================================
--- trunk/runtime/src/main/java/org/teiid/services/BufferServiceImpl.java 2011-09-09 17:10:27 UTC (rev 3461)
+++ trunk/runtime/src/main/java/org/teiid/services/BufferServiceImpl.java 2011-09-09 19:04:45 UTC (rev 3462)
@@ -65,6 +65,7 @@
private int maxProcessingKb = BufferManager.DEFAULT_MAX_PROCESSING_KB;
private int maxReserveKb = BufferManager.DEFAULT_RESERVE_BUFFER_KB;
private long maxBufferSpace = FileStorageManager.DEFAULT_MAX_BUFFERSPACE;
+ private boolean inlineLobs = true;
private FileStorageManager fsm;
/**
@@ -144,6 +145,10 @@
public void setConnectorBatchSize(int size) {
this.connectorBatchSize = size;
}
+
+ public void setInlineLobs(boolean inlineLobs) {
+ this.inlineLobs = inlineLobs;
+ }
public File getBufferDirectory() {
return bufferDir;
@@ -152,6 +157,10 @@
public boolean isUseDisk() {
return this.useDisk;
}
+
+ public boolean isInlineLobs() {
+ return inlineLobs;
+ }
@ManagementProperty(description="The max row count of a batch sent internally within the query processor. Should be <= the connectorBatchSize. (default 256)")
public int getProcessorBatchSize() {
12 years, 8 months
teiid SVN: r3461 - branches/7.4.x/documentation/reference/src/main/docbook/en-US/content.
by teiid-commits@lists.jboss.org
Author: shawkins
Date: 2011-09-09 13:10:27 -0400 (Fri, 09 Sep 2011)
New Revision: 3461
Modified:
branches/7.4.x/documentation/reference/src/main/docbook/en-US/content/scalar_functions.xml
Log:
TEIID-1747 clarified the meaning of role name.
Modified: branches/7.4.x/documentation/reference/src/main/docbook/en-US/content/scalar_functions.xml
===================================================================
--- branches/7.4.x/documentation/reference/src/main/docbook/en-US/content/scalar_functions.xml 2011-09-09 17:05:51 UTC (rev 3460)
+++ branches/7.4.x/documentation/reference/src/main/docbook/en-US/content/scalar_functions.xml 2011-09-09 17:10:27 UTC (rev 3461)
@@ -2083,10 +2083,12 @@
with the security system.</para>
<section>
<title>HASROLE</title>
- <para>Whether the current caller has the role roleName.</para>
+ <para>Whether the current caller has the Teiid data role roleName.</para>
<para><synopsis>hasRole([roleType,] roleName)</synopsis></para>
<para>roleName must be a string, the return type is boolean.</para>
- <para>The two argument form is provided for backwards compatibility. roleType is a string and must be 'data'</para>
+ <para>The two argument form is provided for backwards compatibility. roleType is a string and must be 'data'.</para>
+ <para>Role names are case-sensitive and only match Teiid <xref linkend="dataroles"/>.
+ JAAS roles/groups names are not valid for this function - unless there is corresponding data role with the same name.</para>
</section>
</section>
<section>
12 years, 8 months