Author: shawkins
Date: 2011-11-15 12:40:20 -0500 (Tue, 15 Nov 2011)
New Revision: 3650
Modified:
trunk/client/src/main/java/org/teiid/jdbc/BatchResults.java
trunk/engine/src/main/java/org/teiid/dqp/internal/process/RequestWorkItem.java
trunk/test-integration/common/src/test/java/org/teiid/transport/TestODBCSocketTransport.java
Log:
TEIID-1830 correcting the asynch submitNext logic
Modified: trunk/client/src/main/java/org/teiid/jdbc/BatchResults.java
===================================================================
--- trunk/client/src/main/java/org/teiid/jdbc/BatchResults.java 2011-11-15 03:38:35 UTC
(rev 3649)
+++ trunk/client/src/main/java/org/teiid/jdbc/BatchResults.java 2011-11-15 17:40:20 UTC
(rev 3650)
@@ -251,8 +251,21 @@
}
requestNextBatch();
}
-
- return (this.currentRowNumber + next <= highestRowNumber);
+ boolean result = this.currentRowNumber + next <= highestRowNumber;
+ if (result && !wait) {
+ for (int i = 0; i < batches.size(); i++) {
+ Batch batch = batches.get(i);
+ if (this.currentRowNumber + next < batch.getBeginRow()) {
+ continue;
+ }
+ if (this.currentRowNumber + next> batch.getEndRow()) {
+ continue;
+ }
+ return Boolean.TRUE;
+ }
+ return null; //needs to be fetched
+ }
+ return result;
}
public int getFinalRowNumber() {
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-11-15
03:38:35 UTC (rev 3649)
+++
trunk/engine/src/main/java/org/teiid/dqp/internal/process/RequestWorkItem.java 2011-11-15
17:40:20 UTC (rev 3650)
@@ -533,6 +533,7 @@
//restrict the buffer size for forward only results
if (add && !processor.hasFinalBuffer()
&& !batch.getTerminationFlag()
+ && transactionState != TransactionState.ACTIVE
&& this.getTupleBuffer().getManagedRowCount() >=
OUTPUT_BUFFER_MAX_BATCHES * this.getTupleBuffer().getBatchSize()) {
if (!dqpCore.hasWaitingPlans(RequestWorkItem.this)) {
//requestMore will trigger more processing
Modified:
trunk/test-integration/common/src/test/java/org/teiid/transport/TestODBCSocketTransport.java
===================================================================
---
trunk/test-integration/common/src/test/java/org/teiid/transport/TestODBCSocketTransport.java 2011-11-15
03:38:35 UTC (rev 3649)
+++
trunk/test-integration/common/src/test/java/org/teiid/transport/TestODBCSocketTransport.java 2011-11-15
17:40:20 UTC (rev 3650)
@@ -181,6 +181,18 @@
TestMMDatabaseMetaData.compareResultSet(s.getResultSet());
}
+ @Test public void testTransactionalMultibatch() throws Exception {
+ Statement s = conn.createStatement();
+ conn.setAutoCommit(false);
+ assertTrue(s.execute("select tables.name from tables, columns limit 1025"));
+ int count = 0;
+ while (s.getResultSet().next()) {
+ count++;
+ }
+ assertEquals(1025, count);
+ conn.setAutoCommit(true);
+ }
+
@Test public void testMultibatchSelect() throws Exception {
Statement s = conn.createStatement();
assertTrue(s.execute("select * from tables, columns"));
Show replies by date