Changeset: 36ec86b08121 for MonetDB URL: http://dev.monetdb.org/hg/MonetDB?cmd=changeset;node=36ec86b08121 Modified Files: java/ChangeLog.Dec2011 java/src/nl/cwi/monetdb/jdbc/MonetConnection.java Branch: Dec2011 Log Message:
MonetConnection: be more lenient against unexpected large results When the server sends more tuples than we requested, accept them, instead of failing with an assertion lateron. Query types that produce "fake" SQL results, like EXPLAIN, TRACE and DOT typically don't support pagination, because they are written at once, and hence violate any explicit request from the client to send less data. It's better to just accept the extra data, instead of aborting. diffs (48 lines): diff --git a/java/ChangeLog.Dec2011 b/java/ChangeLog.Dec2011 --- a/java/ChangeLog.Dec2011 +++ b/java/ChangeLog.Dec2011 @@ -1,6 +1,9 @@ # ChangeLog file for java # This file is updated with Maddlog +* Tue Dec 27 2011 Fabian Groffen <[email protected]> +- Fixed an AssertionError for special results from e.g. EXPLAIN queries. + * Wed Dec 21 2011 Fabian Groffen <[email protected]> - Fixed overflow error when batching large statements, bug #2952 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 @@ -1578,19 +1578,23 @@ public class MonetConnection extends Mon /* Below we have to calculate how many "chunks" we need * to allocate to store the entire result. However, if * the user didn't set a cache size, as in this case, we - * need to stick to our defaults. So far, so good. Now - * the problem with XQuery is, that it doesn't support - * any block fetching, so we need to always fetch - * everything at once. For that reason, the cache size - * is here set to the tuplecount, such that we do a full - * fetch at once. To avoid a division by zero lateron, - * we make sure the cache size is not 0 */ - cacheSize = lang == LANG_SQL ? MonetConnection.DEF_FETCHSIZE : (tuplecount + 1); + * need to stick to our defaults. */ + cacheSize = MonetConnection.DEF_FETCHSIZE; cacheSizeSetExplicitly = false; } else { cacheSize = parent.cachesize; cacheSizeSetExplicitly = true; } + /* So far, so good. Now the problem with EXPLAIN, DOT, etc + * queries is, that they don't support any block fetching, + * so we need to always fetch everything at once. For that + * reason, the cache size is here set to the rowcount if + * it's larger, such that we do a full fetch at once. + * (Because we always set a reply_size, we can only get a + * larger rowcount from the server if it doesn't paginate, + * because it's a pseudo SQL result.) */ + if (rowcount > cacheSize) + cacheSize = rowcount; seqnr = seq; closed = false; destroyOnClose = false; _______________________________________________ Checkin-list mailing list [email protected] http://mail.monetdb.org/mailman/listinfo/checkin-list
