Index: java/drda/org/apache/derby/impl/drda/DDMReader.java
===================================================================
--- java/drda/org/apache/derby/impl/drda/DDMReader.java (revision 179619)
+++ java/drda/org/apache/derby/impl/drda/DDMReader.java (working copy)
@@ -537,11 +537,11 @@
switch (numberOfExtendedLenBytes) {
case 8:
ddmScalarLen =
- ((buffer[pos++] & 0xff) << 64) +
((buffer[pos++] & 0xff) << 56) +
((buffer[pos++] & 0xff) << 48) +
((buffer[pos++] & 0xff) << 40) +
((buffer[pos++] & 0xff) << 32) +
+ ((buffer[pos++] & 0xff) << 24) +
((buffer[pos++] & 0xff) << 16) +
((buffer[pos++] & 0xff) << 8) +
((buffer[pos++] & 0xff) << 0);
@@ -549,9 +549,9 @@
break;
case 6:
ddmScalarLen =
- ((buffer[pos++] & 0xff) << 48) +
((buffer[pos++] & 0xff) << 40) +
((buffer[pos++] & 0xff) << 32) +
+ ((buffer[pos++] & 0xff) << 24) +
((buffer[pos++] & 0xff) << 16) +
((buffer[pos++] & 0xff) << 8) +
((buffer[pos++] & 0xff) << 0);
@@ -559,7 +559,7 @@
break;
case 4:
ddmScalarLen =
- ((buffer[pos++] & 0xff) << 32) +
+ ((buffer[pos++] & 0xff) << 24) +
((buffer[pos++] & 0xff) << 16) +
((buffer[pos++] & 0xff) << 8) +
((buffer[pos++] & 0xff) << 0);
Index: java/testing/README.htm
===================================================================
--- java/testing/README.htm (revision 179619)
+++ java/testing/README.htm (working copy)
@@ -452,8 +452,26 @@
- - tested on a variety of hardware takes from 3.00 - 6.00 hours
+ - tested on a variety of hardware takes from 3.00 - 6.00 hours
+ largeData
+
+
+ - Contains tests that deal with large amounts of data and thus
+require more machine resources. This suite is NOT run as part of
+'derbyall' because the tests it contains require either 1) more machine
+resources than what the typical Derby developer might have, and/or 2) a
+significant amount of time to run, and thus shouldn't be run every
+night.
+
+
+
+ - As tests are added to this quite, it could require more and
+more
+time to run (several minutes to several hours to several days), which
+is why it is NOT included as part of the derbyall suite.
+
+
See Note2
@@ -1187,12 +1205,15 @@
-DTestSpecialProps=derby.infolog.append=true
org.apache.derbyTesting.functionTests.RunTest lang/arithmetic.sql
jvmflags
- sets specific jvm properties for the jvm used in the test harness, for
-instance initial memory, and heap size, or properties normally passed on with a -D. For instance:
-
+ sets specific jvm properties for the jvm used in the
+test harness, for
+instance initial memory, and heap size, or properties normally passed
+on with a -D. For instance:
+
java
-Djvmflags=ms32M -mx128M
-org.apache.derbyTesting.functionTests.RunTest lang/streamingColumn.java
+org.apache.derbyTesting.functionTests.RunTest lang/streamingColumn.java
+
excludeJCC
See above section 4.10
Index: java/testing/org/apache/derbyTesting/functionTests/tests/largedata/lobLengthTests.java
===================================================================
--- java/testing/org/apache/derbyTesting/functionTests/tests/largedata/lobLengthTests.java (revision 0)
+++ java/testing/org/apache/derbyTesting/functionTests/tests/largedata/lobLengthTests.java (revision 0)
@@ -0,0 +1,142 @@
+/*
+
+ Derby - Class org.apache.derbyTesting.functionTests.tests.largedata.lobLengthTests
+
+ Copyright 2003, 2005 The Apache Software Foundation or its licensors, as applicable.
+
+ Licensed under the Apache License, Version 2.0 (the "License");
+ you may not use this file except in compliance with the License.
+ You may obtain a copy of the License at
+
+ http://www.apache.org/licenses/LICENSE-2.0
+
+ Unless required by applicable law or agreed to in writing, software
+ distributed under the License is distributed on an "AS IS" BASIS,
+ WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+ See the License for the specific language governing permissions and
+ limitations under the License.
+
+ */
+
+package org.apache.derbyTesting.functionTests.tests.largedata;
+
+import java.sql.Connection;
+import java.sql.PreparedStatement;
+import java.sql.Statement;
+import java.sql.SQLException;
+
+import java.io.ByteArrayInputStream;
+
+import org.apache.derby.tools.ij;
+import org.apache.derby.tools.JDBCDisplayUtil;
+
+/**
+ * This test is part of the "largedata" suite because the use of
+ * very large LOBs can require extra memory for the server JVM.
+ * If this test was run as part of the normal 'derbyall' suite,
+ * it would require that any developer running the derbyall suite
+ * have a machine with a good deal of memory. And since _every_
+ * developer is encouraged to run 'derbyall' before submitting
+ * any patches, that would mean that _every_ developer would
+ * need a machine with lots of memory--and that's something we
+ * do NOT want to require.
+ *
+ * The specific JVM memory requirements for this test are set in the
+ * properties file for this test (lobLengthTests_app.properties).
+ * It started out as -mx128M -ms128M, but that could change in the
+ * future as more test cases are added to this class. If it's not
+ * at least 128M, the result will be OutOfMemory exceptions when
+ * running against Network Server.
+ */
+
+public class lobLengthTests {
+
+ /**
+ * Create an instance of this class and do the test.
+ */
+ public static void main(String [] args)
+ {
+ new lobLengthTests().go(args);
+ }
+
+ /**
+ * Create a JDBC connection using the arguments passed
+ * in from the harness, and then run the LOB length
+ * tests.
+ * @param args Arguments from the harness.
+ */
+ public void go(String [] args)
+ {
+ try {
+
+ // use the ij utility to read the property file and
+ // make the initial connection.
+ ij.getPropertyArg(args);
+ Connection conn = ij.startJBMS();
+
+ // Add additional tests here.
+ derby_121Test(conn);
+
+ } catch (Exception e) {
+
+ System.out.println("FAIL -- Unexpected exception:");
+ e.printStackTrace(System.out);
+
+ }
+ }
+
+ /**
+ * There was a defect (DERBY-121) where the server and client
+ * were processing lob lengths incorrectly. For lob lengths
+ * that are represented by 24 or more bits, the server and
+ * Derby client were doing incorrect bit-shifting. This
+ * test makes sure that problem no longer occurs.
+ */
+ private static void derby_121Test(Connection conn)
+ throws SQLException
+ {
+ System.out.println("Testing server read of lob length > 2^24 bytes.");
+
+ boolean autoc = conn.getAutoCommit();
+ conn.setAutoCommit(false);
+
+ // Create a test table.
+ Statement st = conn.createStatement();
+ st.execute("create table lobTable100M(bl blob(100M))");
+
+ PreparedStatement pSt = conn.prepareStatement(
+ "insert into lobTable100M(bl) values (?)");
+
+ // The error we're testing occurs when the server
+ // is shifting bits 24 and higher of the lob's
+ // length (in bytes). This means that, in order
+ // to check for the error, we have to specify a
+ // lob length (in bytes) that requires at least
+ // 24 bits to represent. Thus for a blob the
+ // length of the test data must be specified as
+ // at least 2^24 bytes (hence the '16800000' in
+ // the next line).
+ byte [] bA = new byte[16800000];
+ pSt.setBinaryStream(1,
+ new java.io.ByteArrayInputStream(bA), bA.length);
+
+ // Now try the insert; this is where the server processes
+ // the lob length.
+ try {
+ pSt.execute();
+ System.out.println("PASS.");
+ } catch (Exception e) {
+ System.out.println("FAIL -- unexpected exception:");
+ e.printStackTrace(System.out);
+ }
+
+ // Clean up.
+ try {
+ st.execute("drop table lobTable100M");
+ } catch (SQLException se) {}
+
+ conn.setAutoCommit(autoc);
+ return;
+
+ }
+}
Property changes on: java/testing/org/apache/derbyTesting/functionTests/tests/largedata/lobLengthTests.java
___________________________________________________________________
Name: svn:eol-style
+ native
Index: java/testing/org/apache/derbyTesting/functionTests/tests/largedata/lobLengthTests_app.properties
===================================================================
--- java/testing/org/apache/derbyTesting/functionTests/tests/largedata/lobLengthTests_app.properties (revision 0)
+++ java/testing/org/apache/derbyTesting/functionTests/tests/largedata/lobLengthTests_app.properties (revision 0)
@@ -0,0 +1,14 @@
+#
+# This is the system properties file for lobLengthTests.java
+#
+# *** DO NOT PUT PROPERTIES FOR THE DERBY SYSTEM IN THIS FILE.
+# *** THEY BELONG IN lobLengthTests_derby.properties.
+#
+# This file will get handed to the test on the command line in a -p
+# argument.
+#
+# The .java test has to call util.getPropertyArg and util.startJBMS
+# to process the property file. See any of the .java tests for this code.
+#
+database=jdbc:derby:wombat;create=true
+jvmflags=-mx128M -ms128M
Property changes on: java/testing/org/apache/derbyTesting/functionTests/tests/largedata/lobLengthTests_app.properties
___________________________________________________________________
Name: svn:eol-style
+ native
Index: java/testing/org/apache/derbyTesting/functionTests/tests/largedata/build.xml
===================================================================
--- java/testing/org/apache/derbyTesting/functionTests/tests/largedata/build.xml (revision 0)
+++ java/testing/org/apache/derbyTesting/functionTests/tests/largedata/build.xml (revision 0)
@@ -0,0 +1,85 @@
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
Property changes on: java/testing/org/apache/derbyTesting/functionTests/tests/largedata/build.xml
___________________________________________________________________
Name: svn:eol-style
+ native
Index: java/testing/org/apache/derbyTesting/functionTests/tests/largedata/copyfiles.ant
===================================================================
--- java/testing/org/apache/derbyTesting/functionTests/tests/largedata/copyfiles.ant (revision 0)
+++ java/testing/org/apache/derbyTesting/functionTests/tests/largedata/copyfiles.ant (revision 0)
@@ -0,0 +1 @@
+lobLengthTests_app.properties
Property changes on: java/testing/org/apache/derbyTesting/functionTests/tests/largedata/copyfiles.ant
___________________________________________________________________
Name: svn:eol-style
+ native
Index: java/testing/org/apache/derbyTesting/functionTests/harness/NetServer.java
===================================================================
--- java/testing/org/apache/derbyTesting/functionTests/harness/NetServer.java (revision 179619)
+++ java/testing/org/apache/derbyTesting/functionTests/harness/NetServer.java (working copy)
@@ -158,14 +158,21 @@
if ( (clPath != null) && (clPath.length()>0) )
jvm.setClasspath(clPath);
- if ( (jvmflags != null) && (jvmflags.length()>0) )
+ boolean setJvmFlags = false;
+ if ( (jvmflags != null) && (jvmflags.length()>0) ) {
jvm.setFlags(jvmflags);
+ setJvmFlags = true;
+ }
if (!jvmName.equals("jview"))
{
- jvm.setMs(16*1024*1024); // -ms16m
- jvm.setMx(32*1024*1024); // -mx32m
+ if (setJvmFlags && (jvmflags.indexOf("-ms") == -1))
+ // only setMs if no starting memory was given
+ jvm.setMs(16*1024*1024); // -ms16m
+ if (setJvmFlags && (jvmflags.indexOf("-mx") == -1))
+ // only setMx if no max memory was given
+ jvm.setMx(32*1024*1024); // -mx32m
jvm.setNoasyncgc(true); // -noasyncgc
}
Index: java/testing/org/apache/derbyTesting/functionTests/master/lobLengthTests.out
===================================================================
--- java/testing/org/apache/derbyTesting/functionTests/master/lobLengthTests.out (revision 0)
+++ java/testing/org/apache/derbyTesting/functionTests/master/lobLengthTests.out (revision 0)
@@ -0,0 +1,2 @@
+Testing server read of lob length > 2^24 bytes.
+PASS.
Index: java/testing/org/apache/derbyTesting/functionTests/suites/largeData.properties
===================================================================
--- java/testing/org/apache/derbyTesting/functionTests/suites/largeData.properties (revision 0)
+++ java/testing/org/apache/derbyTesting/functionTests/suites/largeData.properties (revision 0)
@@ -0,0 +1 @@
+suites=largeDataTests largeDataNet largeDataClient
Property changes on: java/testing/org/apache/derbyTesting/functionTests/suites/largeData.properties
___________________________________________________________________
Name: svn:eol-style
+ native
Index: java/testing/org/apache/derbyTesting/functionTests/suites/largeDataNet.properties
===================================================================
--- java/testing/org/apache/derbyTesting/functionTests/suites/largeDataNet.properties (revision 0)
+++ java/testing/org/apache/derbyTesting/functionTests/suites/largeDataNet.properties (revision 0)
@@ -0,0 +1,2 @@
+framework=DerbyNet
+suites=largeDataTests
Property changes on: java/testing/org/apache/derbyTesting/functionTests/suites/largeDataNet.properties
___________________________________________________________________
Name: svn:eol-style
+ native
Index: java/testing/org/apache/derbyTesting/functionTests/suites/largeDataTests.runall
===================================================================
--- java/testing/org/apache/derbyTesting/functionTests/suites/largeDataTests.runall (revision 0)
+++ java/testing/org/apache/derbyTesting/functionTests/suites/largeDataTests.runall (revision 0)
@@ -0,0 +1 @@
+largedata/lobLengthTests.java
Property changes on: java/testing/org/apache/derbyTesting/functionTests/suites/largeDataTests.runall
___________________________________________________________________
Name: svn:eol-style
+ native
Index: java/testing/org/apache/derbyTesting/functionTests/suites/largeDataClient.properties
===================================================================
--- java/testing/org/apache/derbyTesting/functionTests/suites/largeDataClient.properties (revision 0)
+++ java/testing/org/apache/derbyTesting/functionTests/suites/largeDataClient.properties (revision 0)
@@ -0,0 +1,2 @@
+framework=DerbyNetClient
+suites=largeDataTests
Property changes on: java/testing/org/apache/derbyTesting/functionTests/suites/largeDataClient.properties
___________________________________________________________________
Name: svn:eol-style
+ native
Index: java/testing/build.xml
===================================================================
--- java/testing/build.xml (revision 179619)
+++ java/testing/build.xml (working copy)
@@ -52,6 +52,7 @@
+
Index: java/client/org/apache/derby/client/net/Reply.java
===================================================================
--- java/client/org/apache/derby/client/net/Reply.java (revision 179619)
+++ java/client/org/apache/derby/client/net/Reply.java (working copy)
@@ -1105,7 +1105,7 @@
case 4:
ensureBLayerDataInBuffer(4);
ddmScalarLen_ =
- ((buffer_[pos_++] & 0xff) << 32) +
+ ((buffer_[pos_++] & 0xff) << 24) +
((buffer_[pos_++] & 0xff) << 16) +
((buffer_[pos_++] & 0xff) << 8) +
((buffer_[pos_++] & 0xff) << 0);
@@ -1199,7 +1199,7 @@
// correctly in parseLengthAndMatchCodePoint(). (since the adjustLengths() method will
// subtract the length from ddmScalarLen_)
peekedLength_ =
- ((buffer_[pos_ + 4] & 0xff) << 32) +
+ ((buffer_[pos_ + 4] & 0xff) << 24) +
((buffer_[pos_ + 5] & 0xff) << 16) +
((buffer_[pos_ + 6] & 0xff) << 8) +
((buffer_[pos_ + 7] & 0xff) << 0);