You are viewing a plain text version of this content. The canonical link for it is here.
Posted to derby-commits@db.apache.org by bp...@apache.org on 2006/04/28 19:31:09 UTC
svn commit: r397963 - in /db/derby/code/branches/10.1/java:
drda/org/apache/derby/impl/drda/
testing/org/apache/derbyTesting/functionTests/master/
testing/org/apache/derbyTesting/functionTests/master/DerbyNet/jdk15/
testing/org/apache/derbyTesting/func...
Author: bpendleton
Date: Fri Apr 28 10:31:07 2006
New Revision: 397963
URL: http://svn.apache.org/viewcvs?rev=397963&view=rev
Log:
DERBY-170: Inserting large string into non-existing table causes comm failure
This change moves the fix for DERBY-170 from the trunk to the 10.1 branch.
The merge was straightforward, and testing was successful.
Modified:
db/derby/code/branches/10.1/java/drda/org/apache/derby/impl/drda/DDMReader.java
db/derby/code/branches/10.1/java/testing/org/apache/derbyTesting/functionTests/master/DerbyNet/jdk15/prepStmt.out
db/derby/code/branches/10.1/java/testing/org/apache/derbyTesting/functionTests/master/DerbyNetClient/jdk15/prepStmt.out
db/derby/code/branches/10.1/java/testing/org/apache/derbyTesting/functionTests/master/prepStmt.out
db/derby/code/branches/10.1/java/testing/org/apache/derbyTesting/functionTests/tests/derbynet/prepStmt.java
Modified: db/derby/code/branches/10.1/java/drda/org/apache/derby/impl/drda/DDMReader.java
URL: http://svn.apache.org/viewcvs/db/derby/code/branches/10.1/java/drda/org/apache/derby/impl/drda/DDMReader.java?rev=397963&r1=397962&r2=397963&view=diff
==============================================================================
--- db/derby/code/branches/10.1/java/drda/org/apache/derby/impl/drda/DDMReader.java (original)
+++ db/derby/code/branches/10.1/java/drda/org/apache/derby/impl/drda/DDMReader.java Fri Apr 28 10:31:07 2006
@@ -1387,6 +1387,11 @@
*/
protected void skipDss() throws DRDAProtocolException
{
+ while (dssIsContinued)
+ {
+ skipBytes((int)dssLength);
+ readDSSContinuationHeader();
+ }
skipBytes((int)dssLength);
topDdmCollectionStack = EMPTY_STACK;
ddmScalarLen = 0;
@@ -1497,6 +1502,7 @@
private void ensureBLayerDataInBuffer (int desiredDataSize, boolean adjustLen)
throws DRDAProtocolException
{
+ ensureALayerDataInBuffer (desiredDataSize);
if (dssIsContinued)
{
if (desiredDataSize > dssLength)
@@ -1506,10 +1512,6 @@
compressBLayerData (continueDssHeaderCount);
}
}
- else
- {
- ensureALayerDataInBuffer (desiredDataSize);
- }
if (adjustLen)
adjustLengths(desiredDataSize);
}
@@ -1749,8 +1751,11 @@
"fill",
5);
}
- count += actualBytesRead;
- totalBytesRead += actualBytesRead;
+ if (actualBytesRead != -1)
+ {
+ count += actualBytesRead;
+ totalBytesRead += actualBytesRead;
+ }
}
while ((totalBytesRead < minimumBytesNeeded) && (actualBytesRead != -1));
Modified: db/derby/code/branches/10.1/java/testing/org/apache/derbyTesting/functionTests/master/DerbyNet/jdk15/prepStmt.out
URL: http://svn.apache.org/viewcvs/db/derby/code/branches/10.1/java/testing/org/apache/derbyTesting/functionTests/master/DerbyNet/jdk15/prepStmt.out?rev=397963&r1=397962&r2=397963&view=diff
==============================================================================
--- db/derby/code/branches/10.1/java/testing/org/apache/derbyTesting/functionTests/master/DerbyNet/jdk15/prepStmt.out (original)
+++ db/derby/code/branches/10.1/java/testing/org/apache/derbyTesting/functionTests/master/DerbyNet/jdk15/prepStmt.out Fri Apr 28 10:31:07 2006
@@ -76,4 +76,5 @@
Negative test setString with Invalid Timestamp:20
SQLState: 22007 message: The syntax of the string representation of a datetime value is incorrect.
Test jira614 completed successfully -- no Distributed Protocol Exception occurred
+Jira170: caught expected table not found
prepStmt Test Ends
Modified: db/derby/code/branches/10.1/java/testing/org/apache/derbyTesting/functionTests/master/DerbyNetClient/jdk15/prepStmt.out
URL: http://svn.apache.org/viewcvs/db/derby/code/branches/10.1/java/testing/org/apache/derbyTesting/functionTests/master/DerbyNetClient/jdk15/prepStmt.out?rev=397963&r1=397962&r2=397963&view=diff
==============================================================================
--- db/derby/code/branches/10.1/java/testing/org/apache/derbyTesting/functionTests/master/DerbyNetClient/jdk15/prepStmt.out (original)
+++ db/derby/code/branches/10.1/java/testing/org/apache/derbyTesting/functionTests/master/DerbyNetClient/jdk15/prepStmt.out Fri Apr 28 10:31:07 2006
@@ -76,4 +76,5 @@
Negative test setString with Invalid Timestamp:20
SQLState: 22007 message: The syntax of the string representation of a datetime value is incorrect.
Test jira614 completed successfully -- no Distributed Protocol Exception occurred
+Jira170: caught expected table not found
prepStmt Test Ends
Modified: db/derby/code/branches/10.1/java/testing/org/apache/derbyTesting/functionTests/master/prepStmt.out
URL: http://svn.apache.org/viewcvs/db/derby/code/branches/10.1/java/testing/org/apache/derbyTesting/functionTests/master/prepStmt.out?rev=397963&r1=397962&r2=397963&view=diff
==============================================================================
--- db/derby/code/branches/10.1/java/testing/org/apache/derbyTesting/functionTests/master/prepStmt.out (original)
+++ db/derby/code/branches/10.1/java/testing/org/apache/derbyTesting/functionTests/master/prepStmt.out Fri Apr 28 10:31:07 2006
@@ -76,4 +76,5 @@
Negative test setString with Invalid Timestamp:20
SQLState: 22007 message: The syntax of the string representation of a datetime value is incorrect.
Test jira614 completed successfully -- no Distributed Protocol Exception occurred
+Jira170: caught expected table not found
prepStmt Test Ends
Modified: db/derby/code/branches/10.1/java/testing/org/apache/derbyTesting/functionTests/tests/derbynet/prepStmt.java
URL: http://svn.apache.org/viewcvs/db/derby/code/branches/10.1/java/testing/org/apache/derbyTesting/functionTests/tests/derbynet/prepStmt.java?rev=397963&r1=397962&r2=397963&view=diff
==============================================================================
--- db/derby/code/branches/10.1/java/testing/org/apache/derbyTesting/functionTests/tests/derbynet/prepStmt.java (original)
+++ db/derby/code/branches/10.1/java/testing/org/apache/derbyTesting/functionTests/tests/derbynet/prepStmt.java Fri Apr 28 10:31:07 2006
@@ -303,6 +303,7 @@
test5172(conn);
jira614Test(conn);
jira614Test_a(conn);
+ jira170Test(conn);
conn.close();
System.out.println("prepStmt Test Ends");
}
@@ -775,5 +776,47 @@
stmt.close();
}
+ // Jira-170 has to do with how the server handles re-synchronization of
+ // the data stream when an enormous parameter value follows a failed
+ // prepare statement. Note that it is deliberate here that we are preparing
+ // a statement referring to a non-existing table.
+ private static void jira170Test(Connection conn)
+ throws Exception
+ {
+ Statement stmt = conn.createStatement();
+ PreparedStatement ps = null ;
+ try {
+ stmt.execute("drop table jira170");
+ } catch (Throwable t) { }
+ // Create a huge array of chars to be used as the input parameter
+ char []cData = new char[1000000];
+ for (int i = 0; i < cData.length; i++)
+ cData[i] = Character.forDigit(i%10, 10);
+ // The behavior of this test program depends on how the JDBC driver
+ // handles statement prepares. The DB2 Universal JDBC driver implements
+ // something called "deferred prepares" by default. This means that it
+ // doesn't do the prepare of the statement until the statement is
+ // actually executed. Other drivers, such as the standard Derby client
+ // driver, do the prepare at the time of the prepare. This means that,
+ // depending on which driver we're using and what the driver's
+ // configuration is, we'll get the "table not found" error either on
+ // the prepare or on the execute. It doesn't really matter for the
+ // purposes of the test, because the whole point is that we *dont*
+ // get a DRDA Protocol Exception, but rather a table-not-found
+ // exception.
+ try {
+ ps = conn.prepareStatement("insert into jira170 values (?)");
+ ps.setString(1, new String(cData));
+ ps.execute();
+ System.out.println("Test Jira170 failed: no exception when trying to execute a failed prepare with an enormous parameter");
+ }
+ catch (SQLException e)
+ {
+ if (e.getSQLState().equals("42X05"))
+ System.out.println("Jira170: caught expected table not found");
+ else
+ e.printStackTrace();
+ }
+ }
}