|
|||||||||||
|
Re: Serious OutOfMemory issue while reading with mysql-connector-j-5.0.7 ...
From: Paul Palaszewski <paul.palaszewski(at)bdm-systems.com>
Date: Fri Aug 31 2007 - 06:34:36 EDT
Big thanks for your detailed response. I've tested with Connector/J 5.0.3 + 5.0.7 and debugged 5.0.7. Regarding my debug session. The OutOfMemoryError-Stacktrace showed the execution path up to the readAllResults-method which lead me to com.mysql.jdbc.PreparedStatmenet#executeQuery and #createStreamingResultSet() , which decides, if all results have to be read at once or if a streaming resultset should be used. protected boolean createStreamingResultSet() {
return ((this.resultSetType == java.sql.ResultSet.TYPE_FORWARD_ONLY)
&& (this.resultSetConcurrency ==
java.sql.ResultSet.CONCUR_READ_ONLY) && (this.fetchSize ==
Integer.MIN_VALUE));
} So I've set a breakpoint at com.mysql.jdbc.PreparedStatmenet line 1448, which is in the executeQuery() right before createStreamingResultSet() is called. There I could very, that setting useCursorFetch=true did also set useServerPrepStmts=true. My resultSetType was TYPE_FORWARD_ONLY and the concurrency CONCUR_READ_ONLY - but my fetchSize was 0 or 50 - depending on the test-run where I had some with fetchSize set to 50 and some, where I did not set it. As you suggested, setting fetchSize to Integer.MIN_VALUE fixed the OutOfMemoryException. During my first the debug session I've seen the MIN_VALUE, but I've had a look at the javadoc for setFetchSize which states ...
So I would never have tried setting something which should cause a SQLException. I've assumed, that the MIN_VALUE is only used internally. Does anyone have ideas, how this could be made more intuitive without breaking compatibility? Further, as you explained, copying the data to a temp table is really slow and it only works, as long as there is enough disk space for the temp table. Hm ... up to now I really like working with mysql's myisam tables since they are usually really fast. I almost understand the necessity to copy data to a temp table on the server to provide some kind of isolation for the cursor. Yet I thought that mysql with myisam tables does not provide any transaction handling and therefor no isolation - which was fine for us. I will tell my customers, that they may need more disk space when they want to import from mysql and that it's as fast, as it can get. What are the chances, that cursors are enhanced on the server?
Best regards,
-- -- _/_/_/_/_/_/_/_/_/_/_/_/_/_/_/_/_/_/_/_/_/_/_/_/_/_/_/_/ _/ _/ BDM Business Data Management GmbH _/ _/ Firmenbuch: FN 242059w _/ Gerichtsstand: Landesgericht Wiener Neustadt _/ UID: ATU57685758 _/ _/ Grenzgasse 111, Objekt 9/4 _/ 2340 Mödling _/ Tel,Fax: +43 2236 46 393 _/ _/ Ing. Paul Palaszewski, (Hons) B.Sc. _/ Geschäftsführer _/ Mobil: +43(650) 37 36 030 _/ E-Mail: paul.palaszewski@bdm-systems.com _/ _/_/_/_/_/_/_/_/_/_/_/_/_/_/_/_/_/_/_/_/_/_/_/_/_/_/_/_/ -- MySQL Java Mailing List For list archives: http://lists.mysql.com/java To unsubscribe: http://lists.mysql.com/java?unsub=lists@pantek.comReceived on Fri Aug 31 06:36:45 2007 This archive was generated by hypermail 2.1.8 : Sun Oct 07 2007 - 10:14:16 EDT |
||||||||||
|
|||||||||||