Author: shawkins
Date: 2011-05-03 05:43:58 -0400 (Tue, 03 May 2011)
New Revision: 3137
Modified:
trunk/build/kits/jboss-container/teiid-releasenotes.html
trunk/client/src/main/java/org/teiid/jdbc/BaseDataSource.java
trunk/client/src/main/java/org/teiid/jdbc/ExecutionProperties.java
trunk/client/src/main/java/org/teiid/jdbc/StatementImpl.java
trunk/documentation/client-developers-guide/src/main/docbook/en-US/content/jdbc-connection.xml
Log:
TEIID-1573 adding a client property for settting the query timeout.
Modified: trunk/build/kits/jboss-container/teiid-releasenotes.html
===================================================================
--- trunk/build/kits/jboss-container/teiid-releasenotes.html 2011-05-03 02:38:00 UTC (rev
3136)
+++ trunk/build/kits/jboss-container/teiid-releasenotes.html 2011-05-03 09:43:58 UTC (rev
3137)
@@ -47,7 +47,7 @@
<UL>
<LI><B>Improved Planning</B> - the decision to create a dependent
join is now considered earlier in planning and is much more effective for dependent joins
involving multiple unrelated independent tables.
<LI><B>IN predicate splitting</B> - the planner can now split large
dependent IN predicates into multiple IN predicates, which is controlled by the translator
property MaxDepdendentInPredicates. This allows for much larger dependent joins to be
performed as a single query.
- <LI><B>Dependent query parallization</B> - when multiple dependent
queries are still required, then they will be run in parallel (up to
MaxUserSourceRequestConcurrency), rather than sequentially.
+ <LI><B>Dependent query parallelization</B> - when multiple dependent
queries are still required, then they will be run in parallel (up to
MaxUserSourceRequestConcurrency), rather than sequentially.
<LI><B>Cost based back-off</B> - for cost based dependent joins if
the number of independent values is too large, then the join will be performed as normal.
</UL>
<LI><B>Enhanced Sort Join</B> - the partitioned merge join was
replaced with an enhanced sort join. The enhanced sort join will use the actual row
counts from each side of the relation to perform a index based join if one side is small
enough, a partial sort of the larger side and a repeated merge join if the tuples are
unbalanced but one side is not small enough to form an index, or a standard sort merge
join if the tuples are balanced.
@@ -55,7 +55,7 @@
<LI><B>Security Improvements</B> - UDF and pushdown functions can now
be protected with data roles. Also the CommandContext can provide the Subject for custom
security checks in UDFs.
<LI><B>Cache Invalidation</B> - Prepared plan and result set caches
can have a maxStaleness value, which will invalidate entries based upon metadata and data
changes respectively. See the Admin Guide for more.
<LI><B>Runtime-updates of Metadata</B> - Alter statements have been
added to change view/procedure/INSTEAD OF trigger (update procedure) definitions have been
added. A create statement was also added to add INSTEAD OF trigger (update procedures) to
views.
- System procedures were added to set extension metadata and stat values. By default all
effects of metadata updates happen only on running vdbs across the cluster. To make the
changes persistent see the Developers Guide Runtime Updates section.
+ System procedures were added to set extension metadata and stat values. By default all
effects of metadata updates happen only on running vdbs across the cluster. To make the
changes persistent see the Developers Guide Runtime Updates section.
</UL>
<h2><a name="Compatibility">Compatibility
Issues</a></h2>
Modified: trunk/client/src/main/java/org/teiid/jdbc/BaseDataSource.java
===================================================================
--- trunk/client/src/main/java/org/teiid/jdbc/BaseDataSource.java 2011-05-03 02:38:00 UTC
(rev 3136)
+++ trunk/client/src/main/java/org/teiid/jdbc/BaseDataSource.java 2011-05-03 09:43:58 UTC
(rev 3137)
@@ -145,6 +145,8 @@
private boolean ansiQuotedIdentifiers = true;
+ private int queryTimeout;
+
/**
* Reference to the logWriter, which is transient and is therefore not serialized
with the DataSource.
*/
@@ -220,6 +222,10 @@
if(this.getFetchSize() > 0) {
props.setProperty(ExecutionProperties.PROP_FETCH_SIZE,
String.valueOf(this.getFetchSize()));
}
+
+ if (this.getQueryTimeout() > 0) {
+ props.setProperty(ExecutionProperties.QUERYTIMEOUT,
String.valueOf(this.getQueryTimeout()));
+ }
if (this.getResultSetCacheMode() != null &&
this.getResultSetCacheMode().trim().length() != 0) {
props.setProperty(ExecutionProperties.RESULT_SET_CACHE_MODE,
this.getResultSetCacheMode());
@@ -300,6 +306,10 @@
if ( reason != null ) {
throw new SQLException(reason);
}
+
+ if (this.queryTimeout < 0) {
+ throw new
TeiidSQLException(JDBCPlugin.Util.getString("MMStatement.Bad_timeout_value"));
//$NON-NLS-1$
+ }
}
@@ -801,6 +811,14 @@
public boolean isAnsiQuotedIdentifiers() {
return ansiQuotedIdentifiers;
}
+
+ public int getQueryTimeout() {
+ return queryTimeout;
+ }
+
+ public void setQueryTimeout(int queryTimeout) {
+ this.queryTimeout = queryTimeout;
+ }
}
Modified: trunk/client/src/main/java/org/teiid/jdbc/ExecutionProperties.java
===================================================================
--- trunk/client/src/main/java/org/teiid/jdbc/ExecutionProperties.java 2011-05-03 02:38:00
UTC (rev 3136)
+++ trunk/client/src/main/java/org/teiid/jdbc/ExecutionProperties.java 2011-05-03 09:43:58
UTC (rev 3137)
@@ -102,5 +102,7 @@
public static final String NEWINSTANCE = "NEWINSTANCE"; //$NON-NLS-1$
+ public static final String QUERYTIMEOUT = "QUERYTIMEOUT"; //$NON-NLS-1$
+
}
\ No newline at end of file
Modified: trunk/client/src/main/java/org/teiid/jdbc/StatementImpl.java
===================================================================
--- trunk/client/src/main/java/org/teiid/jdbc/StatementImpl.java 2011-05-03 02:38:00 UTC
(rev 3136)
+++ trunk/client/src/main/java/org/teiid/jdbc/StatementImpl.java 2011-05-03 09:43:58 UTC
(rev 3137)
@@ -195,7 +195,15 @@
} catch(Exception e) {
// silently failover to default
}
- }
+ }
+ String queryTimeoutStr =
this.execProps.getProperty(ExecutionProperties.QUERYTIMEOUT);
+ if(queryTimeoutStr != null) {
+ try {
+ this.queryTimeoutMS = Integer.parseInt(fetchSizeStr)*1000;
+ } catch(Exception e) {
+ // silently failover to default
+ }
+ }
}
protected DQP getDQP() {
Modified:
trunk/documentation/client-developers-guide/src/main/docbook/en-US/content/jdbc-connection.xml
===================================================================
---
trunk/documentation/client-developers-guide/src/main/docbook/en-US/content/jdbc-connection.xml 2011-05-03
02:38:00 UTC (rev 3136)
+++
trunk/documentation/client-developers-guide/src/main/docbook/en-US/content/jdbc-connection.xml 2011-05-03
09:43:58 UTC (rev 3137)
@@ -224,7 +224,15 @@
if it finds a different security context on the calling thread,
it switches the identity on the connection,
if the new user is also eligible to log in to Teiid otherwise
connection fails to execute.</entry>
</row>
-
+ <row>
+ <entry>
+ <code>QueryTimeout</code>
+ </entry>
+ <entry>
+ <code>integer</code>
+ </entry>
+ <entry>Default query timeout in seconds. Must be >= 0. 0
indicates no timeout. Can be overriden by
<code>Statement.setQueryTimeout</code>. Default 0.</entry>
+ </row>
</tbody>
</tgroup>
</table>