Changeset: 917727b0eab5 for MonetDB
URL: http://dev.monetdb.org/hg/MonetDB?cmd=changeset;node=917727b0eab5
Added Files:
sql/test/BugTracker-2013/Tests/env_errors.Bug-3370.sql
sql/test/BugTracker-2013/Tests/env_errors.Bug-3370.stable.err
sql/test/BugTracker-2013/Tests/env_errors.Bug-3370.stable.out
Removed Files:
sql/test/BugTracker-2013/Tests/constraint_checking.Bug_3335.sql
Modified Files:
clients/R/MonetDB.R/R/monetdb.R
clients/R/MonetDB.R/src/mapi.c
clients/mapiclient/tomograph.c
common/stream/stream.c
gdk/ChangeLog.Feb2013
gdk/gdk_batop.c
gdk/gdk_heap.c
gdk/gdk_posix.c
gdk/gdk_private.h
gdk/gdk_select.c
gdk/gdk_storage.c
gdk/gdk_utils.c
monetdb5/extras/mal_optimizer_template/Tests/opt_sql_append.stable.err
monetdb5/extras/mal_optimizer_template/Tests/opt_sql_append.stable.err.Windows
monetdb5/mal/mal_dataflow.c
monetdb5/modules/atoms/mtime.c
monetdb5/modules/mal/mat.c
monetdb5/modules/mal/pqueue.c
sql/backends/monet5/rel_bin.c
sql/backends/monet5/sql.mx
sql/server/sql_env.c
sql/server/sql_env.h
sql/server/sql_mvc.c
sql/server/sql_mvc.h
sql/storage/sql_storage.h
sql/storage/store.c
sql/test/BugConstraints/Tests/add_constraint_1643522.stable.err
sql/test/BugConstraints/Tests/delete_primarykey_1643845.stable.err
sql/test/BugConstraints/Tests/drop_column_1643542.stable.err
sql/test/BugConstraints/Tests/update_primarykey_1643375.stable.err
sql/test/BugTracker-2008/Tests/sql_command_kills_db.SF-2233677.stable.err
sql/test/BugTracker-2009/Tests/ambiguous_order_by.SF-2827916.stable.err
sql/test/BugTracker-2009/Tests/ambiguous_view.stable.err
sql/test/BugTracker-2009/Tests/assert_in_update.SF-2807336.stable.err
sql/test/BugTracker-2009/Tests/copy_into_error_off_by_one.SF-2833696.stable.err
sql/test/BugTracker-2009/Tests/copy_multiple_files.SF-2902320.stable.err
sql/test/BugTracker-2009/Tests/create_on_ro_db_crash.SF-2830238.stable.err
sql/test/BugTracker-2009/Tests/create_table_dup_name.SF-2879005.stable.err
sql/test/BugTracker-2009/Tests/drop-sequence-crash.SF-2854195.stable.err
sql/test/BugTracker-2009/Tests/except_error_wrong.SF-2808409.stable.err
sql/test/BugTracker-2009/Tests/explain_gives_crash.SF-2741829.stable.err
sql/test/BugTracker-2009/Tests/incomplete.SF.2536893.stable.err
sql/test/BugTracker-2009/Tests/insert_into_values_bug.SF-2807609.stable.err
sql/test/BugTracker-2009/Tests/limit_in_subquery.SF-2620437.stable.err
sql/test/BugTracker-2009/Tests/not_invalidtable_crash.SF-2927174.stable.err
sql/test/BugTracker-2009/Tests/overflow.SF-2853458.stable.err
sql/test/BugTracker-2009/Tests/overflow.SF-2853458.stable.err.Solaris
sql/test/BugTracker-2009/Tests/overflow.SF-2853458.stable.err.Windows
sql/test/BugTracker-2009/Tests/primekeyconstraint.SF-2783425.stable.err
sql/test/BugTracker-2009/Tests/rollback_bug.stable.err
sql/test/BugTracker-2009/Tests/rollback_mistake.SF-2814622.stable.err
sql/test/BugTracker-2009/Tests/segv_for_unknown_identifier_in_subquery.SF-2874045.stable.err
sql/test/BugTracker-2009/Tests/select_X_where_bla_EQ_whatever.SF-282597.stable.err
sql/test/BugTracker-2009/Tests/select_from_history.SF-2556566.stable.err
sql/test/BugTracker-2009/Tests/subquery_returns_table_crash.SF-2513620.stable.err
sql/test/BugTracker-2009/Tests/temp_table_fail_leaves_data.SF-2793286.stable.err
sql/test/BugTracker-2009/Tests/temporary_table_leftover.SF-2734713.stable.err
sql/test/BugTracker-2009/Tests/unique_constraint_on_char.SF-2873564.stable.err
sql/test/BugTracker-2009/Tests/wrong_error_message.SF-2637051.stable.err
sql/test/BugTracker-2010/Tests/TypeException_with_missing_function.Bug-2674.stable.err
sql/test/BugTracker-2010/Tests/call_function_without_warning.Bug-2752.stable.err
sql/test/BugTracker-2010/Tests/copy-into-too-long-string.Bug-2358.stable.err
sql/test/BugTracker-2010/Tests/crash_default_unlocked.Bug-2744.stable.err
sql/test/BugTracker-2010/Tests/crash_on_in_2.Bug-2604.stable.err
sql/test/BugTracker-2010/Tests/crashonschema.Bug-2547.stable.err
sql/test/BugTracker-2010/Tests/duplicate-key.Bug-2667.stable.err
sql/test/BugTracker-2010/Tests/error-truncated.Bug-2615.stable.err
sql/test/BugTracker-2010/Tests/error-truncated.Bug-2615.stable.err.Darwin
sql/test/BugTracker-2010/Tests/error-truncated.Bug-2615.stable.err.Windows
sql/test/BugTracker-2010/Tests/incomplete-utf8-sequence.Bug-2575.stable.err
sql/test/BugTracker-2010/Tests/prepare_stmt.Bug-2533.Bug-2534.stable.err
sql/test/BugTracker-2010/Tests/second_function_existing_signature.Bug-2611.stable.err
sql/test/BugTracker-2010/Tests/select_from_seq.Bug-2730.stable.err
sql/test/BugTracker-2010/Tests/select_star.Bug-2563.stable.err
sql/test/BugTracker-2010/Tests/sequence-restart-with-null.Bug-2648.stable.err
sql/test/BugTracker-2010/Tests/subselect.Bug-2537.stable.err
sql/test/BugTracker-2010/Tests/sum_on_date_crash.Bug-2643.stable.err
sql/test/BugTracker-2010/Tests/times-crash.Bug-2586.stable.err
sql/test/BugTracker-2010/Tests/wrong_error_message_dropping_view.Bug-2713.stable.err
sql/test/BugTracker-2012/Tests/create_function.Bug-3172.stable.err
sql/test/BugTracker-2012/Tests/predicate_select.Bug-3090.stable.err
sql/test/BugTracker-2012/Tests/predicate_select.Bug-3090_nogeom.stable.err
sql/test/BugTracker-2012/Tests/table_function_with_column_subselects.Bug-3172.stable.err
sql/test/BugTracker-2013/Tests/All
sql/test/BugTracker-2013/Tests/binary_copy_into.Bug-3345.stable.err
sql/test/BugTracker-2013/Tests/check-constraint.Bug-3335.stable.out
sql/test/BugTracker-2013/Tests/psm_functions_and_accessrights.Bug-3300.stable.err
sql/test/BugTracker/Tests/bind_with_cast.SF-1720934.stable.err
sql/test/BugTracker/Tests/cardinality_violation.SF-1240701.stable.err
sql/test/BugTracker/Tests/cardinality_violation.SF-1240701.stable.err.Windows
sql/test/Dependencies/Tests/Dependencies.stable.err
sql/test/Tests/coalesce.stable.err.single
sql/test/Tests/setoptimizer.stable.err
sql/test/Triggers/Tests/recursive_triggers.stable.err
sql/test/mserver5-sql-readonly/Tests/mserver5-sql-readonly-table.stable.err
sql/test/ssqq/Tests/insert_queue.stable.err
Branch: int128
Log Message:
Merge with changeset 976558ac026a
diffs (truncated from 2448 to 300 lines):
diff --git a/clients/R/MonetDB.R/R/monetdb.R b/clients/R/MonetDB.R/R/monetdb.R
--- a/clients/R/MonetDB.R/R/monetdb.R
+++ b/clients/R/MonetDB.R/R/monetdb.R
@@ -38,7 +38,10 @@ mc <- function(dbname="demo", user="mone
dbConnect(MonetDB.R(),dbname,user,password,host,port,timeout,wait,...)
}
-setMethod("dbConnect", "MonetDBDriver", def=function(drv,dbname="demo",
user="monetdb", password="monetdb", host="localhost",port=50000, timeout=86400,
wait=FALSE,...) {
+setMethod("dbConnect", "MonetDBDriver", def=function(drv,dbname="demo",
user="monetdb", password="monetdb", host="localhost",port=50000, timeout=86400,
wait=FALSE,...,url="") {
+ if (substring(url,1,10) == "monetdb://") {
+ dbname <- url
+ }
if (substring(dbname,1,10) == "monetdb://") {
#warning("MonetDB.R: Using 'monetdb://...' URIs
in dbConnect() is deprecated. Please switch to dbname, host, port named
arguments.")
rest <- substring(dbname,11,nchar(dbname))
@@ -184,6 +187,8 @@ setMethod("dbSendQuery", signature(conn=
if (!env$success) {
sp <- strsplit(env$message,"!",fixed=T)[[1]]
+ # truncate statement to not hide actual error
message
+ if (nchar(statement) > 100) { statement <-
paste0(substring(statement,1,100),"...") }
if (length(sp) == 3) {
errno <- as.numeric(sp[[2]])
errmsg <- sp[[3]]
diff --git a/clients/R/MonetDB.R/src/mapi.c b/clients/R/MonetDB.R/src/mapi.c
--- a/clients/R/MonetDB.R/src/mapi.c
+++ b/clients/R/MonetDB.R/src/mapi.c
@@ -6,6 +6,7 @@
#ifdef __WIN32__
#include <winsock2.h>
#include <ws2tcpip.h>
+#undef ERROR
#else
#include <sys/socket.h>
#include <netinet/in.h>
@@ -34,16 +35,27 @@ static SEXP MAPI_type_tag;
if (TYPEOF(s) != EXTPTRSXP || \
R_ExternalPtrTag(s) != MAPI_type_tag || \
EXTPTR_PTR(s) == NULL) \
- error("Socket has already been closed and cannot be used."); \
+ error("Socket was either not successfully connected or is already
closed. Either way, it cannot be used."); \
} while (0)
SEXP mapiInit(void) {
MAPI_type_tag = install("MAPI_TYPE_TAG");
+#ifdef __WIN32__
+ // I will not even TRY to understand why this is required
+ WSADATA wsaData;
+ int iResult = WSAStartup(MAKEWORD(2, 2), &wsaData);
+ if (iResult != 0) {
+ error("WSAStartup failed: %d", iResult);
+ }
+#endif
return R_NilValue;
}
SEXP mapiDisconnect(SEXP conn) {
- CHECK_MAPI_SOCK(conn);
+ if (TYPEOF(conn) != EXTPTRSXP || R_ExternalPtrTag(conn) !=
MAPI_type_tag) {
+ warning("trying to disconnect from a non-socket.");
+ return R_NilValue;
+ }
SOCKET *sock = R_ExternalPtrAddr(conn);
if (sock != NULL) {
shutdown(*sock, 2);
@@ -75,14 +87,6 @@ SEXP mapiConnect(SEXP host, SEXP port, S
struct addrinfo hints;
struct addrinfo *result, *rp;
-#ifdef __WIN32__
- // I will not even TRY to understand why this is required
- WSADATA wsaData;
- int iResult = WSAStartup(MAKEWORD(2, 2), &wsaData);
- if (iResult != 0) {
- error("WSAStartup failed: %d", iResult);
- }
-#endif
// send/receive timeouts for socket
#ifdef __WIN32__
@@ -123,8 +127,8 @@ SEXP mapiConnect(SEXP host, SEXP port, S
// lets have a 1M buffer on this socket, ok?
int recvbuf_size = ALLOCSIZE;
- if (setsockopt(sock, SOL_SOCKET, SO_RCVBUF, &recvbuf_size,
- sizeof(recvbuf_size))) {
+ if (setsockopt(sock, SOL_SOCKET, SO_RCVBUF,
+ (const char *) &recvbuf_size,
sizeof(recvbuf_size))) {
error("setsockopt failed");
}
if (connect(sock, rp->ai_addr, rp->ai_addrlen) != -1) {
@@ -235,7 +239,7 @@ SEXP mapiRead(SEXP conn) {
response_buf_len += ALLOCSIZE;
if (DEBUG) {
printf("II: Reallocating memory, new size
%lu\n",
- response_buf_len);
+ (unsigned long)
response_buf_len);
}
response_buf = realloc(response_buf, response_buf_len);
if (response_buf == NULL) {
@@ -255,7 +259,7 @@ SEXP mapiRead(SEXP conn) {
size_t i;
for (i = 0; i < response_buf_offset; i++) {
if (response_buf[i] == '\0') {
- warning("Removed a NULL character from response at
offset %lu of %lu",i,response_buf_offset);
+ warning("Removed a NULL character from response at
offset %lu of %lu",(unsigned long) i,(unsigned long) response_buf_offset);
response_buf[i] = '\t';
}
}
@@ -315,6 +319,7 @@ SEXP mapiWrite(SEXP conn, SEXP message)
}
SEXP mapiRequest(SEXP conn, SEXP message) {
+ CHECK_MAPI_SOCK(conn);
mapiWrite(conn, message);
return (mapiRead(conn));
}
diff --git a/clients/mapiclient/tomograph.c b/clients/mapiclient/tomograph.c
--- a/clients/mapiclient/tomograph.c
+++ b/clients/mapiclient/tomograph.c
@@ -793,7 +793,7 @@ static void dumpboxes(void)
//fprintf(f,""LLFMT" %f 0 0 \n",
box[i].clkstart, (box[i].memstart/1024.0));
fprintf(f, ""LLFMT" %f %f 0 0\n",
box[i].clkend, (box[i].memend / 1024.0), box[i].footend/1024.0);
} else
- if (box[i].state == PING) {
+ if (box[i].state >= PING) {
/* cpu stat events may arrive out of order,
drop those */
if ( box[i].clkstart <= e)
continue;
diff --git a/common/stream/stream.c b/common/stream/stream.c
--- a/common/stream/stream.c
+++ b/common/stream/stream.c
@@ -1851,6 +1851,7 @@ file_stream(const char *name)
s->write = file_write;
s->close = file_close;
s->flush = file_flush;
+ s->fsync = file_fsync;
s->fgetpos = file_fgetpos;
s->fsetpos = file_fsetpos;
return s;
diff --git a/gdk/ChangeLog.Feb2013 b/gdk/ChangeLog.Feb2013
--- a/gdk/ChangeLog.Feb2013
+++ b/gdk/ChangeLog.Feb2013
@@ -1,3 +1,9 @@
# ChangeLog file for MonetDB
# This file is updated with Maddlog
+* Mon Sep 30 2013 Sjoerd Mullender <[email protected]>
+- Removed the heap cache. Since the fix for bug 3323 which made that
+ the cache was actually getting used, bug 3376 made clear that it didn't
+ work very well. In addition, on Linux at least, the heap cache slows
+ things down.
+
diff --git a/gdk/gdk_batop.c b/gdk/gdk_batop.c
--- a/gdk/gdk_batop.c
+++ b/gdk/gdk_batop.c
@@ -2280,13 +2280,16 @@ BATmergecand(BAT *a, BAT *b)
BAT *bn;
const oid *ap, *bp, *ape, *bpe;
oid *p, i;
+ oid af, al, bf, bl;
+ BATiter ai, bi;
+ bit ad, bd;
BATcheck(a, "BATmergecand");
BATcheck(b, "BATmergecand");
assert(a->htype == TYPE_void);
assert(b->htype == TYPE_void);
- assert(ATOMtype(a->htype) == TYPE_oid);
- assert(ATOMtype(b->htype) == TYPE_oid);
+ assert(ATOMtype(a->ttype) == TYPE_oid);
+ assert(ATOMtype(b->ttype) == TYPE_oid);
assert(BATcount(a) <= 1 || a->tsorted);
assert(BATcount(b) <= 1 || b->tsorted);
assert(BATcount(a) <= 1 || a->tkey);
@@ -2294,7 +2297,28 @@ BATmergecand(BAT *a, BAT *b)
assert(a->T->nonil);
assert(b->T->nonil);
- /* XXX we could return a if b is empty (and v.v.) */
+ /* we can return a if b is empty (and v.v.) */
+ if ( BATcount(a) == 0){
+ return BATcopy(b, b->htype, b->ttype, 0);
+ }
+ if ( BATcount(b) == 0){
+ return BATcopy(a, a->htype, a->ttype, 0);
+ }
+ /* we can return a if a fully covers b (and v.v) */
+ ai = bat_iterator(a);
+ bi = bat_iterator(b);
+ af = *(oid*) BUNtail(ai, BUNfirst(a));
+ bf = *(oid*) BUNtail(bi, BUNfirst(b));
+ al = *(oid*) BUNtail(ai, BUNlast(a) - 1);
+ bl = *(oid*) BUNtail(bi, BUNlast(b) - 1);
+ ad = (af + BATcount(a) - 1 == al); /* i.e., dense */
+ bd = (bf + BATcount(b) - 1 == bl); /* i.e., dense */
+ if (ad && af <= bf && al >= bl) {
+ return BATcopy(a, a->htype, a->ttype,0);
+ }
+ if (bd && bf <= af && bl >= al) {
+ return BATcopy(b, b->htype, b->ttype,0);
+ }
bn = BATnew(TYPE_void, TYPE_oid, BATcount(a) + BATcount(b));
if (bn == NULL)
@@ -2382,8 +2406,8 @@ BATintersectcand(BAT *a, BAT *b)
BATcheck(b, "BATintersectcand");
assert(a->htype == TYPE_void);
assert(b->htype == TYPE_void);
- assert(ATOMtype(a->htype) == TYPE_oid);
- assert(ATOMtype(b->htype) == TYPE_oid);
+ assert(ATOMtype(a->ttype) == TYPE_oid);
+ assert(ATOMtype(b->ttype) == TYPE_oid);
assert(a->tsorted);
assert(b->tsorted);
assert(a->tkey);
diff --git a/gdk/gdk_heap.c b/gdk/gdk_heap.c
--- a/gdk/gdk_heap.c
+++ b/gdk/gdk_heap.c
@@ -59,174 +59,21 @@
#include "gdk.h"
#include "gdk_private.h"
-/* The heap cache should reduce mmap/munmap calls which are very
- * expensive. Instead we try to reuse mmap's. This however requires
- * file renames. The cache has a limited size!
- */
-
-#define HEAP_CACHE_SIZE 5
-
-typedef struct heap_cache_e {
- void *base;
- size_t maxsz;
- char fn[8]; /* tmp file name */
-} heap_cache_e;
-
-typedef struct heap_cache {
- int sz;
- int used;
- heap_cache_e *hc;
-} heap_cache;
-
-static heap_cache hc;
-static MT_Lock HEAPcacheLock MT_LOCK_INITIALIZER("HEAPcacheLock");
-
-void
-HEAPcacheInit(void)
-{
-#ifdef NEED_MT_LOCK_INIT
- MT_lock_init(&HEAPcacheLock, "HEAPcache_init");
-#endif
-#if HEAP_CACHE_SIZE > 0
- MT_lock_set(&HEAPcacheLock, "HEAPcache_init");
- assert(hc.sz == 0);
- hc.used = 0;
- hc.hc = GDKmalloc(sizeof(heap_cache_e) * HEAP_CACHE_SIZE);
- if (hc.hc != NULL) {
- int i;
-
- hc.sz = HEAP_CACHE_SIZE;
- GDKcreatedir(HCDIR DIR_SEP_STR);
- /* clean old leftovers */
- for (i = 0; i < HEAP_CACHE_SIZE; i++) {
- char fn[8];
-
- snprintf(fn, sizeof(fn), "%d", i);
- GDKunlink(HCDIR, fn, NULL);
- }
- }
- MT_lock_unset(&HEAPcacheLock, "HEAPcache_init");
-#endif
-}
-
-static int
-HEAPcacheAdd(void *base, size_t maxsz, char *fn, storage_t storage, int
free_file)
-{
- int added = 0;
-
-
- MT_lock_set(&HEAPcacheLock, "HEAPcache_init");
- if (free_file && fn && storage == STORE_MMAP && hc.used < hc.sz) {
- heap_cache_e *e = hc.hc + hc.used;
-
- e->base = base;
- e->maxsz = maxsz;
- snprintf(e->fn, sizeof(e->fn), "%d", hc.used);
- GDKunlink(HCDIR, e->fn, NULL);
- added = 1;
- if (GDKmove(BATDIR, fn, NULL, HCDIR, e->fn, NULL) < 0) {
- /* try to create the directory, if that was
- * the problem */
- char path[PATHLENGTH];
-
- GDKfilepath(path, HCDIR, e->fn, NULL);
- GDKcreatedir(path);
- if (GDKmove(BATDIR, fn, NULL, HCDIR, e->fn, NULL) < 0)
- added = 0;
- }
- if (added)
- hc.used++;
_______________________________________________
checkin-list mailing list
[email protected]
https://www.monetdb.org/mailman/listinfo/checkin-list