Changeset: 45c64d883d9b for MonetDB
URL: http://dev.monetdb.org/hg/MonetDB?cmd=changeset;node=45c64d883d9b
Added Files:
        sql/test/BugTracker-2016/Tests/simpletest.stable.err
        sql/test/BugTracker-2016/Tests/simpletest.stable.out
Modified Files:
        configure.ag
        gdk/gdk_firstn.c
        gdk/gdk_group.c
        gdk/gdk_logger.c
        gdk/gdk_posix.c
        gdk/gdk_private.h
        gdk/gdk_project.c
        gdk/gdk_system.c
        gdk/gdk_system.h
        gdk/gdk_system_private.h
        gdk/gdk_utils.c
        gdk/gdk_value.c
        java/ChangeLog
        java/src/main/java/nl/cwi/monetdb/client/JdbcClient.java
        java/src/main/java/nl/cwi/monetdb/util/CmdLineOpts.java
        java/src/main/java/nl/cwi/monetdb/util/OptionsException.java
        java/src/main/java/nl/cwi/monetdb/util/SQLExporter.java
        monetdb5/mal/mal_dataflow.c
        monetdb5/mal/mal_debugger.c
        monetdb5/mal/mal_function.c
        monetdb5/mal/mal_import.c
        monetdb5/mal/mal_interpreter.c
        monetdb5/mal/mal_listing.c
        monetdb5/mal/mal_module.c
        monetdb5/mal/mal_profiler.c
        monetdb5/mal/mal_resolve.c
        monetdb5/mal/mal_session.c
        monetdb5/mal/mal_stack.h
        monetdb5/modules/atoms/blob.c
        monetdb5/modules/atoms/color.c
        monetdb5/modules/atoms/identifier.c
        monetdb5/modules/atoms/inet.c
        monetdb5/modules/atoms/json.c
        monetdb5/modules/atoms/mtime.c
        monetdb5/modules/atoms/streams.c
        monetdb5/modules/kernel/algebra.c
        monetdb5/modules/mal/inspect.c
        monetdb5/modules/mal/mal_mapi.c
        monetdb5/modules/mal/tablet.c
        monetdb5/modules/mal/tokenizer.c
        monetdb5/optimizer/opt_pipes.c
        sql/backends/monet5/sql_gencode.c
        sql/backends/monet5/sql_scenario.c
        sql/jdbc/tests/Tests/Test_JdbcClient.stable.out
        sql/server/rel_optimizer.c
        sql/server/rel_select.c
        
sql/test/BugTracker-2016/Tests/like_in_non_sys_schema.Bug-4062.stable.err
        
sql/test/BugTracker-2016/Tests/like_in_non_sys_schema.Bug-4062.stable.out
        sql/test/BugTracker-2016/Tests/simpletest.sql
Branch: HTM
Log Message:

Merge with 2PC


diffs (truncated from 1928 to 300 lines):

diff --git a/configure.ag b/configure.ag
--- a/configure.ag
+++ b/configure.ag
@@ -1147,6 +1147,13 @@ AS_VAR_IF([have_perl], [no],
                        PERL_LIBDIR=`"$PERL" -MConfig -e 
'$x=$Config{installvendorarch}; $x =~ s|$Config{vendorprefix}/||; print $x;' 
2>/dev/null`
                        # On Darwin this starts with a slash, remove it
                        PERL_LIBDIR="${PERL_LIBDIR@%:@/}"
+                       AS_VAR_IF([PERL_LIBDIR], [], [
+                               # if empty (e.g. on FreeBSD) try something else
+                               PERL_LIBDIR=`"$PERL" -MConfig -e 
'$x=$Config{sitelib}; $x =~ s|$Config{prefix}/||; print $x;' 2>/dev/null`
+                                       AS_VAR_IF([PERL_LIBDIR], [], [
+                                               # if still empty, give up
+                                               have_perl=no
+                                               why_have_perl='(cannot 
determine location for files)'])])
                        ],
                [no], [],
                [
diff --git a/gdk/gdk_firstn.c b/gdk/gdk_firstn.c
--- a/gdk/gdk_firstn.c
+++ b/gdk/gdk_firstn.c
@@ -656,6 +656,8 @@ BATfirstn_grouped(BAT **topn, BAT **gids
         * can use the base type */
        tpe = ATOMbasetype(tpe); /* takes care of oid */
        groups = GDKmalloc(sizeof(*groups) * n);
+       if( groups == NULL)
+               return GDK_FAIL;
        oldcand = cand;
        if (asc) {
                switch (tpe) {
@@ -960,6 +962,8 @@ BATfirstn_grouped_with_groups(BAT **topn
         * can use the base type */
        tpe = ATOMbasetype(tpe); /* takes care of oid */
        groups = GDKmalloc(sizeof(*groups) * n);
+       if( groups == NULL)
+               return GDK_FAIL;
        gv = (const oid *) Tloc(g, 0);
        oldcand = cand;
        if (asc) {
diff --git a/gdk/gdk_group.c b/gdk/gdk_group.c
--- a/gdk/gdk_group.c
+++ b/gdk/gdk_group.c
@@ -711,6 +711,9 @@ BATgroup_internal(BAT **groups, BAT **ex
                unsigned char *restrict bgrps = GDKmalloc(256);
                const unsigned char *restrict w = (const unsigned char *) 
Tloc(b, 0);
                unsigned char v;
+
+               if( bgrps == NULL)
+                       goto error;
                memset(bgrps, 0xFF, 256);
                if (histo)
                        memset(cnts, 0, maxgrps * sizeof(lng));
@@ -737,6 +740,9 @@ BATgroup_internal(BAT **groups, BAT **ex
                unsigned short *restrict sgrps = GDKmalloc(65536 * 
sizeof(short));
                const unsigned short *restrict w = (const unsigned short *) 
Tloc(b, 0);
                unsigned short v;
+
+               if( sgrps == NULL)
+                       goto error;
                memset(sgrps, 0xFF, 65536 * sizeof(short));
                if (histo)
                        memset(cnts, 0, maxgrps * sizeof(lng));
diff --git a/gdk/gdk_logger.c b/gdk/gdk_logger.c
--- a/gdk/gdk_logger.c
+++ b/gdk/gdk_logger.c
@@ -1228,6 +1228,9 @@ bm_subcommit(logger *lg, BAT *list_bid, 
        BATiter iter = (list_nme)?bat_iterator(list_nme):bat_iterator(list_bid);
        gdk_return res;
 
+       if( n == NULL)
+               return GDK_FAIL;
+
        n[i++] = 0;             /* n[0] is not used */
        BATloop(list_bid, p, q) {
                bat col = *(log_bid *) Tloc(list_bid, p);
diff --git a/gdk/gdk_posix.c b/gdk/gdk_posix.c
--- a/gdk/gdk_posix.c
+++ b/gdk/gdk_posix.c
@@ -582,6 +582,12 @@ MT_mremap(const char *path, int mode, vo
                                        if (fd >= 0)
                                                close(fd);
                                        p = malloc(strlen(path) + 5);
+                                       if ( p == NULL){
+                                               GDKsyserror("MT_mremap: 
malloc() failed\n");
+                                               fprintf(stderr, "= %s:%d: 
MT_mremap(%s,"PTRFMT","SZFMT","SZFMT"): fd < 0\n", __FILE__, __LINE__, path, 
PTRFMTCAST old_address, old_size, *new_size);
+                                               return NULL;
+                                       }
+                                               
                                        strcat(strcpy(p, path), ".tmp");
                                        fd = open(p, O_RDWR | O_CREAT,
                                                  MONETDB_MODE);
@@ -1048,6 +1054,8 @@ reduce_dir_name(const char *src, char *d
 
        if (len >= cap)
                buf = malloc(len + 1);
+       if( buf == NULL)
+               return NULL;
        while (--len > 0 && src[len - 1] != ':' && src[len] == DIR_SEP)
                ;
        for (buf[++len] = 0; len > 0; buf[len] = src[len])
diff --git a/gdk/gdk_private.h b/gdk/gdk_private.h
--- a/gdk/gdk_private.h
+++ b/gdk/gdk_private.h
@@ -161,8 +161,6 @@ void BBPdump(void);         /* never called: fo
 __hidden void IMPSprint(BAT *b)
        __attribute__((__visibility__("hidden")));
 #endif
-__hidden gdk_return unshare_string_heap(BAT *b)
-       __attribute__((__visibility__("hidden")));
 __hidden void MT_init_posix(void)
        __attribute__((__visibility__("hidden")));
 __hidden void *MT_mremap(const char *path, int mode, void *old_address, size_t 
old_size, size_t *new_size)
@@ -189,6 +187,8 @@ void BBPdump(void);         /* never called: fo
        __attribute__((__visibility__("hidden")));
 __hidden var_t strLocate(Heap *h, const char *v)
        __attribute__((__visibility__("hidden")));
+__hidden gdk_return unshare_string_heap(BAT *b)
+       __attribute__((__visibility__("hidden")));
 __hidden void VIEWdestroy(BAT *b)
        __attribute__((__visibility__("hidden")));
 __hidden gdk_return VIEWreset(BAT *b)
diff --git a/gdk/gdk_project.c b/gdk/gdk_project.c
--- a/gdk/gdk_project.c
+++ b/gdk/gdk_project.c
@@ -443,6 +443,8 @@ BATprojectchain(BAT **bats)
        for (n = 0; bats[n]; n++)
                ;
        ba = GDKmalloc(sizeof(*ba) * n);
+       if( ba == NULL)
+               return NULL;
        b = *bats++;
        cnt = BATcount(b);      /* this will be the size of the output */
        hseq = b->hseqbase;     /* this will be the seqbase of the output */
diff --git a/gdk/gdk_system.c b/gdk/gdk_system.c
--- a/gdk/gdk_system.c
+++ b/gdk/gdk_system.c
@@ -497,6 +497,30 @@ join_threads(void)
        pthread_mutex_unlock(&posthread_lock);
 }
 
+void
+join_detached_threads(void)
+{
+       struct posthread *p;
+       int waited;
+       pthread_t tid;
+
+       pthread_mutex_lock(&posthread_lock);
+       do {
+               waited = 0;
+               for (p = posthreads; p; p = p->next) {
+                       tid = p->tid;
+                       rm_posthread_locked(p);
+                       free(p);
+                       pthread_mutex_unlock(&posthread_lock);
+                       pthread_join(tid, NULL);
+                       pthread_mutex_lock(&posthread_lock);
+                       waited = 1;
+                       break;
+               }
+       } while (waited);
+       pthread_mutex_unlock(&posthread_lock);
+}
+
 int
 MT_create_thread(MT_Id *t, void (*f) (void *), void *arg, enum MT_thr_detach d)
 {
diff --git a/gdk/gdk_system.h b/gdk/gdk_system.h
--- a/gdk/gdk_system.h
+++ b/gdk/gdk_system.h
@@ -228,11 +228,13 @@ gdk_export ATOMIC_TYPE volatile GDKlocks
                        MT_Lock * volatile _p;                          \
                        /* save a copy for statistical purposes */      \
                        _p = GDKmalloc(sizeof(MT_Lock));                \
-                       memcpy(_p, l, sizeof(MT_Lock));                 \
                        while (ATOMIC_TAS(GDKlocklistlock, dummy) != 0) \
                                ;                                       \
-                       _p->next = GDKlocklist;                         \
-                       GDKlocklist = _p;                               \
+                       if( _p) {                                       \
+                               memcpy(_p, l, sizeof(MT_Lock));         \
+                               _p->next = GDKlocklist;                 \
+                               GDKlocklist = _p;                       \
+                       }                                               \
                        for (_p = GDKlocklist; _p; _p = _p->next)       \
                                if (_p->next == (l)) {                  \
                                        _p->next = (l)->next;           \
diff --git a/gdk/gdk_system_private.h b/gdk/gdk_system_private.h
--- a/gdk/gdk_system_private.h
+++ b/gdk/gdk_system_private.h
@@ -12,6 +12,8 @@
 #error this file should not be included outside its source directory
 #endif
 
+__hidden void join_detached_threads(void)
+       __attribute__((__visibility__("hidden")));
 __declspec(noreturn) void MT_exit_thread(int status)
        __attribute__((__noreturn__));
 __hidden void MT_global_exit(int status)
diff --git a/gdk/gdk_utils.c b/gdk/gdk_utils.c
--- a/gdk/gdk_utils.c
+++ b/gdk/gdk_utils.c
@@ -687,6 +687,7 @@ GDKreset(int status)
                GDKfree(st);
        }
        MT_lock_unset(&GDKthreadLock);
+       join_detached_threads();
 
        if (status == 0) {
                /* they had their chance, now kill them */
diff --git a/gdk/gdk_value.c b/gdk/gdk_value.c
--- a/gdk/gdk_value.c
+++ b/gdk/gdk_value.c
@@ -157,7 +157,8 @@ VALcopy(ValPtr d, const ValRecord *s)
                d->vtype = s->vtype;
                d->len = ATOMlen(d->vtype, p);
                d->val.pval = GDKmalloc(d->len);
-               memcpy(d->val.pval, p, d->len);
+               if( d->val.pval)
+                       memcpy(d->val.pval, p, d->len);
        }
        return d;
 }
@@ -208,7 +209,8 @@ VALinit(ValPtr d, int tpe, const void *s
                assert(ATOMextern(ATOMstorage(tpe)));
                d->len = ATOMlen(tpe, s);
                d->val.pval = GDKmalloc(d->len);
-               memcpy(d->val.pval, s, d->len);
+               if( d->val.pval)
+                       memcpy(d->val.pval, s, d->len);
                break;
        }
        return d;
diff --git a/java/ChangeLog b/java/ChangeLog
--- a/java/ChangeLog
+++ b/java/ChangeLog
@@ -1,3 +1,7 @@
 # ChangeLog file for java
 # This file is updated with Maddlog
 
+* Thu Sep  1 2016 Martin van Dinther <martin.van.dint...@monetdbsolutions.com>
+- Improved fetching and output speed of JdbcClient program for query results.
+  Added also timing information for JdbcClient query results (like in mclient).
+
diff --git a/java/src/main/java/nl/cwi/monetdb/client/JdbcClient.java 
b/java/src/main/java/nl/cwi/monetdb/client/JdbcClient.java
--- a/java/src/main/java/nl/cwi/monetdb/client/JdbcClient.java
+++ b/java/src/main/java/nl/cwi/monetdb/client/JdbcClient.java
@@ -73,7 +73,7 @@ public class JdbcClient {
                                "Suppress printing the welcome header.");
 
                // arguments which have zero to many arguments
-               copts.addOption("D", "dump", CmdLineOpts.CAR_ZERO_MANY, null, 
+               copts.addOption("D", "dump", CmdLineOpts.CAR_ZERO_MANY, null,
                                "Dumps the given table(s), or the complete 
database if " +
                                "none given.");
 
@@ -161,7 +161,7 @@ copts.produceHelpMessage()
                        // We cannot use the DatabaseMetaData here, because we
                        // cannot get a Connection.  So instead, we just get the
                        // values we want out of the Driver directly.
-                       System.out.println("Driver: v" + 
+                       System.out.println("Driver: v" +
                                        
nl.cwi.monetdb.jdbc.MonetDriver.getDriverVersion());
                        System.exit(0);
                }
@@ -295,7 +295,7 @@ copts.produceHelpMessage()
                        if (copts.getOption("dump").getArgumentCount() > 0) { 
// yes we do
                                String[] dumpers = 
copts.getOption("dump").getArguments();
                                for (int i = 0; i < tables.size(); i++) {
-                                       Table ttmp = (Table)(tables.get(i));
+                                       Table ttmp = tables.get(i);
                                        for (int j = 0; j < dumpers.length; 
j++) {
                                                if 
(ttmp.getName().equalsIgnoreCase(dumpers[j].toString()) ||
                                                        
ttmp.getFqname().equalsIgnoreCase(dumpers[j].toString()))
@@ -794,7 +794,6 @@ copts.produceHelpMessage()
                                }
                        }
 
-                       out.println();
                        out.flush();
                } while ((nextRslt = stmt.getMoreResults()) ||
                                 (aff = stmt.getUpdateCount()) != -1);
@@ -1189,7 +1188,7 @@ class Table {
        static void checkForLoop(Table table, List<Table> parents) throws 
Exception {
                parents.add(table);
                for (int i = 0; i < table.needs.size(); i++) {
-                       Table child = (Table)(table.needs.get(i));
+                       Table child = table.needs.get(i);
                        if (parents.contains(child))
                                throw new Exception("Cyclic dependancy graphs 
are not supported (cycle detected for " + child.fqname + ")");
                        checkForLoop(child, parents);
diff --git a/java/src/main/java/nl/cwi/monetdb/util/CmdLineOpts.java 
b/java/src/main/java/nl/cwi/monetdb/util/CmdLineOpts.java
--- a/java/src/main/java/nl/cwi/monetdb/util/CmdLineOpts.java
+++ b/java/src/main/java/nl/cwi/monetdb/util/CmdLineOpts.java
@@ -112,10 +112,10 @@ public class CmdLineOpts {
                                        String tmp = args[i].substring(2);
                                        int pos = tmp.indexOf('=');
                                        if (pos == -1) {
-                                               option = 
(OptionContainer)(opts.get(tmp));
+                                               option = opts.get(tmp);
                                                moreData = false;
_______________________________________________
checkin-list mailing list
checkin-list@monetdb.org
https://www.monetdb.org/mailman/listinfo/checkin-list

Reply via email to