Changeset: ac8ba4b8b0f8 for MonetDB
URL: http://dev.monetdb.org/hg/MonetDB?cmd=changeset;node=ac8ba4b8b0f8
Modified Files:
        java/ChangeLog.Jul2012
        java/Makefile.ag
        java/build.properties
        java/pom.xml
        java/release.txt
        java/src/nl/cwi/monetdb/jdbc/MonetConnection.java
Branch: default
Log Message:

Merge with Jul2012 branch


diffs (143 lines):

diff --git a/java/ChangeLog.Jul2012 b/java/ChangeLog.Jul2012
--- a/java/ChangeLog.Jul2012
+++ b/java/ChangeLog.Jul2012
@@ -1,3 +1,7 @@
 # ChangeLog file for java
 # This file is updated with Maddlog
 
+* Fri Jul 20 2012 Fabian Groffen <fab...@cwi.nl>
+- Fixed adaptive cache size used when retrieving results, not to cause
+  divide by zero errors when memory gets short, bug #3119.
+
diff --git a/java/Makefile.ag b/java/Makefile.ag
--- a/java/Makefile.ag
+++ b/java/Makefile.ag
@@ -27,7 +27,7 @@ JAVA_HOME = @JAVA_HOME@
 ant_distjdbc = {
        COND = HAVE_JAVAJDBC
        DIR = datadir/monetdb/lib
-       FILES = monetdb-mcl-1.8.jar monetdb-jdbc-2.3.jar jdbcclient.jar
+       FILES = monetdb-mcl-1.8.jar monetdb-jdbc-2.4.jar jdbcclient.jar
 }
 
 ant_distmerocontrol = {
diff --git a/java/build.properties b/java/build.properties
--- a/java/build.properties
+++ b/java/build.properties
@@ -19,7 +19,7 @@ MCL_MINOR=8
 # major release number
 JDBC_MAJOR=2
 # minor release number
-JDBC_MINOR=3
+JDBC_MINOR=4
 # an additional identifying string
 JDBC_VER_SUFFIX=Liberica
 # the default port to connect on, if no port given when using SQL
diff --git a/java/pom.xml b/java/pom.xml
--- a/java/pom.xml
+++ b/java/pom.xml
@@ -6,7 +6,7 @@
        <modelVersion>4.0.0</modelVersion>
        <groupId>monetdb</groupId>
        <artifactId>monetdb-jdbc</artifactId>
-       <version>2.3</version>
+       <version>2.4</version>
        <name>monetdb-jdbc</name>
        <description>MonetDB JDBC driver</description>
        <repositories>
diff --git a/java/release.txt b/java/release.txt
--- a/java/release.txt
+++ b/java/release.txt
@@ -1,8 +1,8 @@
 RELEASE NOTES
-MonetDB JDBC driver version 2.3 (Liberica/MCL-1.8)
+MonetDB JDBC driver version 2.4 (Liberica/MCL-1.8)
 Fabian Groffen <fabian.grof...@cwi.nl>
 
-Release date: 2012-03-02
+Release date: 2012-07-20
 
 
 This JDBC driver is designed for use with MonetDB, a main-memory
diff --git a/java/src/nl/cwi/monetdb/jdbc/MonetConnection.java 
b/java/src/nl/cwi/monetdb/jdbc/MonetConnection.java
--- a/java/src/nl/cwi/monetdb/jdbc/MonetConnection.java
+++ b/java/src/nl/cwi/monetdb/jdbc/MonetConnection.java
@@ -1831,7 +1831,8 @@ public class MonetConnection extends Mon
                 * @throws SQLException if an database error occurs
                 */
                String getLine(int row) throws SQLException {
-                       if (row >= tuplecount || row < 0) return null;
+                       if (row >= tuplecount || row < 0)
+                               return null;
 
                        int block = (row - blockOffset) / cacheSize;
                        int blockLine = (row - blockOffset) % cacheSize;
@@ -1850,42 +1851,36 @@ public class MonetConnection extends Mon
                                        for (int i = 0; i < block; i++)
                                                resultBlocks[i] = null;
 
-                                       if (MonetConnection.seqCounter - 1 == 
seqnr) {
+                                       if (MonetConnection.seqCounter - 1 == 
seqnr &&
+                                                       !cacheSizeSetExplicitly 
&&
+                                                       tuplecount - row > 
cacheSize &&
+                                                       cacheSize < 
MonetConnection.DEF_FETCHSIZE * 10)
+                                       {
                                                // there has no query been 
issued after this
-                                               // one, so we can consider this 
a uninterrupted
-                                               // continuation request.  Let's 
increase the
-                                               // blocksize if it was not 
explicitly set,
-                                               // as the chances are high that 
we won't bother
-                                               // anyone else by doing so, and 
just gaining
-                                               // some performance.
-                                               if (!cacheSizeSetExplicitly) {
-                                                       // store the previous 
position in the
-                                                       // blockOffset variable
-                                                       blockOffset += 
cacheSize;
+                                               // one, so we can consider this 
an uninterrupted
+                                               // continuation request.  Let's 
once increase
+                                               // the cacheSize as it was not 
explicitly set,
+                                               // since the chances are high 
that we won't
+                                               // bother anyone else by doing 
so, and just
+                                               // gaining some performance.
 
-                                                       // increase the cache 
size (a lot)
-                                                       cacheSize *= 10;
+                                               // store the previous position 
in the
+                                               // blockOffset variable
+                                               blockOffset += cacheSize;
 
-                                                       // Java string are 
UTF-16, right?
-                                                       long free = 
Runtime.getRuntime().freeMemory() / 2;
-                                                       // we run the risk that 
we kill ourselves
-                                                       // here, but maybe 
that's better to continue
-                                                       // as long as possible, 
than asking too much
-                                                       // too soon
-                                                       if (cacheSize > free)
-                                                               cacheSize = 
(int)free;  // it must fit
+                                               // increase the cache size (a 
lot)
+                                               cacheSize *= 10;
 
-                                                       // by changing the 
cacheSize, we also
-                                                       // change the block 
measures.  Luckily
-                                                       // we don't care about 
previous blocks
-                                                       // because we have a 
forward running
-                                                       // pointer only.  
However, we do have
-                                                       // to recalculate the 
block number, to
-                                                       // ensure the next call 
to find this
-                                                       // new block.
-                                                       block = (row - 
blockOffset) / cacheSize;
-                                                       blockLine = (row - 
blockOffset) % cacheSize;
-                                               }
+                                               // by changing the cacheSize, 
we also
+                                               // change the block measures.  
Luckily
+                                               // we don't care about previous 
blocks
+                                               // because we have a forward 
running
+                                               // pointer only.  However, we 
do have
+                                               // to recalculate the block 
number, to
+                                               // ensure the next call to find 
this
+                                               // new block.
+                                               block = (row - blockOffset) / 
cacheSize;
+                                               blockLine = (row - blockOffset) 
% cacheSize;
                                        }
                                }
 
_______________________________________________
Checkin-list mailing list
Checkin-list@monetdb.org
http://mail.monetdb.org/mailman/listinfo/checkin-list

Reply via email to