[ http://issues.apache.org/jira/browse/DERBY-428?page=comments#action_12366874 ]
Bryan Pendleton commented on DERBY-428: --------------------------------------- The crash on batch element 65535 seems pretty straightforward: correlation IDs in DSS blocks are 2-byte unsigned integers, so of course there can only be 65536 total values. And since values 0, and "-1" (65535) are apparently reserved for some special purposes, that seems to mean that there is a hard limit in the DRDA protocol itself: there can be no more than 65534 elements in a single batch chain. >From DRDA v.3, page 15: The value of the request correlation identifier is a unique non-negative binary number. Each RQSDSS in a DSS chain must have a unique correlation identifier. The correlation identifier is sent to the target agent that receives the request. And on page 772: The request correlator can be set to any positive (number greater than zero) binary number for the first request, or only request, in an RQSDSS chain. Each RQSDSS in an RQSDSS chain after the first one must have a request correlator that is greater than the previous RQSDSS. The request correlator can be set to any value. So, that leaves me with the following thoughts: 1) Am I reading the DRDA spec correctly here (I'll study it some more) 2) Is it OK for our implementation to have a hard limit of 65534 elements in a single batch chain? 3) If so, what should the behavior be if an application tries to add more elements than that? Throw an exception? > NetworkClient PreparedStatement.executeBatch() hangs if batch is too large > (ArrayIndexOutOfBoundsException in Network Server) > ----------------------------------------------------------------------------------------------------------------------------- > > Key: DERBY-428 > URL: http://issues.apache.org/jira/browse/DERBY-428 > Project: Derby > Type: Bug > Components: Network Client > Environment: Linux atum01 2.4.20-31.9 #1 Tue Apr 13 18:04:23 EDT 2004 i686 > i686 i386 GNU/Linux > Java(TM) 2 Runtime Environment, Standard Edition (build 1.5.0_03-b07) > Java HotSpot(TM) Client VM (build 1.5.0_03-b07, mixed mode, sharing) > Reporter: Bernt M. Johnsen > Assignee: Bryan Pendleton > > When running > s.executeUpdate("create table t (i integer)"); > PreparedStatement p = c.prepareStatement("insert into t values(?)"); > for (int i=0; i<N; i++) { > p.setInt(1,i); > p.addBatch(); > } > System.out.println("Ok"); > p.executeBatch(); > If N is 9000 > The server reports: > 524272 > java.lang.ArrayIndexOutOfBoundsException: 524272 > at org.apache.derby.impl.drda.DDMWriter.startDdm(DDMWriter.java:315) > at > org.apache.derby.impl.drda.DRDAConnThread.writeSQLCARD(DRDAConnThread.java:4937) > at > org.apache.derby.impl.drda.DRDAConnThread.writeSQLCARDs(DRDAConnThread.java:4898) > at > org.apache.derby.impl.drda.DRDAConnThread.writeSQLCARDs(DRDAConnThread.java:4888) > at > org.apache.derby.impl.drda.DRDAConnThread.checkWarning(DRDAConnThread.java:7239) > at > org.apache.derby.impl.drda.DRDAConnThread.parseEXCSQLSTT(DRDAConnThread.java:3605) > at > org.apache.derby.impl.drda.DRDAConnThread.processCommands(DRDAConnThread.java:859) > at > org.apache.derby.impl.drda.DRDAConnThread.run(DRDAConnThread.java:214) > agentThread[DRDAConnThread_3,5,main] > While the client hangs in executeBatch(). > If N is 8000, the client gets the following Exception: > Exception in thread "main" org.apache.derby.client.am.BatchUpdateException: > Non-atomic batch failure. The batch was submitted, but at least one > exception occurred on an individual member of the batch. Use > getNextException() to retrieve the exceptions for specific batched elements. > at > org.apache.derby.client.am.Agent.endBatchedReadChain(Agent.java:267) > at > org.apache.derby.client.am.PreparedStatement.executeBatchRequestX(PreparedStatement.java:1596) > at > org.apache.derby.client.am.PreparedStatement.executeBatchX(PreparedStatement.java:1467) > at > org.apache.derby.client.am.PreparedStatement.executeBatch(PreparedStatement.java:945) > at AOIB.main(AOIB.java:24) -- This message is automatically generated by JIRA. - If you think it was sent incorrectly contact one of the administrators: http://issues.apache.org/jira/secure/Administrators.jspa - For more information on JIRA, see: http://www.atlassian.com/software/jira
