Changeset: 0e197b2abfde for MonetDB
URL: http://dev.monetdb.org/hg/MonetDB?cmd=changeset;node=0e197b2abfde
Modified Files:
        clients/Tests/exports.stable.out
        monetdb5/modules/mal/Tests/inspect05.stable.out
        monetdb5/modules/mal/Tests/inspect05.stable.out.Windows
        monetdb5/optimizer/Tests/dataflow3.stable.out.single
        monetdb5/tools/Tests/mserver5--help.stable.err.Windows
        sql/backends/monet5/sql.mx
        sql/backends/monet5/sql_user.c
        sql/include/sql_catalog.h
        sql/server/rel_dump.c
        sql/server/rel_exp.c
        sql/server/rel_exp.h
        sql/server/rel_schema.c
        sql/server/rel_select.c
        sql/server/rel_updates.c
        sql/server/sql_mvc.c
        sql/server/sql_parser.y
        sql/server/sql_psm.c
        sql/server/sql_statement.c
        sql/server/sql_statement.h
        sql/storage/store.c
        sql/test/BugTracker-2011/Tests/count-count-distinct.Bug-2808.stable.out
        sql/test/BugTracker-2011/Tests/exists-select.Bug-2933.stable.out
        sql/test/BugTracker/Tests/with_only_once.SF-1720293.stable.out
        sql/test/bugs/Tests/insert_delete-bug-sf-904025.stable.out
        sql/test/leaks/Tests/check0.stable.out
        sql/test/leaks/Tests/check1.stable.out
        sql/test/leaks/Tests/check2.stable.out
        sql/test/leaks/Tests/check3.stable.out
        sql/test/leaks/Tests/check4.stable.out
        sql/test/leaks/Tests/check5.stable.out
        sql/test/leaks/Tests/drop3.stable.out
        sql/test/leaks/Tests/select1.stable.out
        sql/test/leaks/Tests/select2.stable.out
        sql/test/leaks/Tests/temp1.stable.out
        sql/test/leaks/Tests/temp2.stable.out
        sql/test/leaks/Tests/temp3.stable.out
Branch: sciql
Log Message:

Merge with default branch.


diffs (truncated from 12241 to 300 lines):

diff --git a/clients/Tests/exports.stable.out b/clients/Tests/exports.stable.out
--- a/clients/Tests/exports.stable.out
+++ b/clients/Tests/exports.stable.out
@@ -5990,6 +5990,8 @@ void mdbShowBreakpoints(Client cntxt);
 void mdbStep(Client cntxt, MalBlkPtr mb, MalStkPtr stk, int pc);
 str mdbTrap(Client cntxt, MalBlkPtr mb, MalStkPtr stk, int pc);
 str mdbTrapClient(Client cntxt, MalBlkPtr mb1, MalStkPtr stk1, InstrPtr pc1);
+int memoryclaims;
+lng memorypool;
 aggrFun minAggr;
 str minRef;
 str min_no_nilRef;
diff --git a/clients/mapiclient/Tests/stethoscope--help.stable.err 
b/clients/mapiclient/Tests/stethoscope--help.stable.err
--- a/clients/mapiclient/Tests/stethoscope--help.stable.err
+++ b/clients/mapiclient/Tests/stethoscope--help.stable.err
@@ -17,7 +17,7 @@ stethoscope [options] +[trace options] {
   -p | --port=<portnr>
   -h | --host=<hostname>
 
-The trace options:
+The trace options (default 'ISTest'):
   S = monitor start of instruction profiling
   a = aggregate clock ticks per instruction
   e = event counter
@@ -36,6 +36,7 @@ The trace options:
   p = process statistics, e.g. page faults, context switches
   u = user id
   D = Generate dot file upon query start
+  F = dataflow memory claims (in MB)
 
 # 19:24:05 >  
 # 19:24:05 >  "Done."
diff --git a/clients/mapiclient/stethoscope.c b/clients/mapiclient/stethoscope.c
--- a/clients/mapiclient/stethoscope.c
+++ b/clients/mapiclient/stethoscope.c
@@ -29,6 +29,7 @@
 #include <stdio.h>
 #include <string.h>
 #include <stdlib.h>
+#include <sys/stat.h>
 #include <errno.h>
 #include <signal.h>
 #include <unistd.h>
@@ -44,6 +45,12 @@
 # endif
 #endif
 
+enum modes {
+    MAL,
+    SQL
+};
+static enum modes mode = SQL;
+
 #define COUNTERSDEFAULT "ISTest"
 
 static struct {
@@ -318,8 +325,14 @@ main(int argc, char **argv)
        char *dbname = NULL;
        char *user = NULL;
        char *password = NULL;
+       char *language = NULL;
+
+       /* some .monetdb properties are used by mclient, perhaps we need them 
as well later */
+       struct stat statb;
+
        char **alts, **oalts;
        wthread *walk;
+       stream * config = NULL;
 
        static struct option long_options[8] = {
                { "dbname", 1, 0, 'd' },
@@ -330,6 +343,74 @@ main(int argc, char **argv)
                { "help", 0, 0, '?' },
                { 0, 0, 0, 0 }
        };
+
+       /* parse config file first, command line options override */
+       if (getenv("DOTMONETDBFILE") == NULL) {
+               if (stat(".monetdb", &statb) == 0) {
+                       config = open_rastream(".monetdb");
+               } else if (getenv("HOME") != NULL) {
+                       char buf[1024];
+                       snprintf(buf, sizeof(buf), "%s/.monetdb", 
getenv("HOME"));
+                       if (stat(buf, &statb) == 0) {
+                               config = open_rastream(buf);
+                       }
+               }
+       } else {
+               char *cfile = getenv("DOTMONETDBFILE");
+               if (strcmp(cfile, "") != 0) {
+                       if (stat(cfile, &statb) == 0) {
+                               config = open_rastream(cfile);
+                       } else {
+                               fprintf(stderr,
+                                             "failed to open file '%s': %s\n",
+                                             cfile, strerror(errno));
+                       }
+               }
+       }
+
+       if (config != NULL) {
+               char buf[1024];
+               char *q;
+               ssize_t len;
+               int line = 0;
+               while ((len = mnstr_readline(config, buf, sizeof(buf) - 1)) > 
0) {
+                       line++;
+                       buf[len - 1] = '\0';    /* drop newline */
+                       if (buf[0] == '#' || buf[0] == '\0')
+                               continue;
+                       if ((q = strchr(buf, '=')) == NULL) {
+                               fprintf(stderr, "%s:%d: syntax error: %s\n", 
mnstr_name(config), line, buf);
+                               continue;
+                       }
+                       *q++ = '\0';
+                       /* this basically sucks big time, as I can't easily set
+                        * a default, hence I only do things I think are useful
+                        * for now, needs a better solution */
+                       if (strcmp(buf, "user") == 0) {
+                               user = strdup(q);       /* leak */
+                       } else if (strcmp(buf, "password") == 0 || strcmp(buf, 
"passwd") == 0) {
+                               password = strdup(q);   /* leak */
+                       } else if (strcmp(buf, "language") == 0) {
+                               language = strdup(q);   /* leak */
+                               if (strcmp(language, "sql") == 0) {
+                                       mode = SQL;
+                               } else if (strcmp(language, "mal") == 0) {
+                                       mode = MAL;
+                               } else {
+                                       /* make sure we don't set garbage */
+                                       fprintf(stderr,
+                                                 "%s:%d: unsupported "
+                                                 "language: %s\n",
+                                                 mnstr_name(config),
+                                                 line, q);
+                                       free(language);
+                                       language = NULL;
+                               }
+                       }
+               }
+               mnstr_destroy(config);
+       }
+
        while (1) {
                int option_index = 0;
                int c = getopt_long(argc, argv, "d:u:P:p:?:h:g",
diff --git a/gdk/gdk.mx b/gdk/gdk.mx
--- a/gdk/gdk.mx
+++ b/gdk/gdk.mx
@@ -316,6 +316,7 @@ All Rights Reserved.
  * data dictionary.
  * An error at this stage normally lead to an abort.
  */
+
 #ifndef _GDK_H_
 #define _GDK_H_
 
@@ -366,10 +367,8 @@ All Rights Reserved.
 
 #ifdef HAVE_DIRENT_H
 # include <dirent.h>
-# define NAMLEN(dirent) strlen((dirent)->d_name)
 #else
 # define dirent direct
-# define NAMLEN(dirent) (dirent)->d_namlen
 # ifdef HAVE_SYS_NDIR_H
 #  include <sys/ndir.h>
 # endif
@@ -381,16 +380,6 @@ All Rights Reserved.
 # endif
 #endif
 
-#ifdef HAVE_SYS_WAIT_H
-# include <sys/wait.h>
-#endif
-#ifndef WEXITSTATUS
-# define WEXITSTATUS(stat_val) ((unsigned)(stat_val) >> 8)
-#endif
-#ifndef WIFEXITED
-# define WIFEXITED(stat_val) (((stat_val) & 255) == 0)
-#endif
-
 #include <limits.h>            /* for *_MIN and *_MAX */
 #include <float.h>             /* for FLT_MAX and DBL_MAX */
 #ifndef LLONG_MAX
@@ -573,17 +562,17 @@ typedef size_t BUN;
  */
 typedef enum { GDK_FAIL, GDK_SUCCEED } gdk_return;
 
-#define FATALcheck(tst,        msg) if (tst) GDKfatal(msg);
-#define ERRORcheck(tst,        msg) if (tst) { GDKerror(msg); return 0; }
-#define WARNcheck(tst, msg) if (tst) GDKwarning(msg)
-#define BATcheck(tst,  msg)                                    \
-       if (tst == NULL) {                                      \
-               if (strchr(msg, ':'))                           \
-                       GDKerror("%s.\n",msg);                  \
-               else                                            \
-                       GDKerror("%s: BAT required.\n",msg);    \
-               return 0;                                       \
-       }
+#define ERRORcheck(tst,        msg) do if (tst) { GDKerror(msg); return 0; } 
while (0)
+#define BATcheck(tst,  msg)                                            \
+       do {                                                            \
+               if ((tst) == NULL) {                                    \
+                       if (strchr((msg), ':'))                         \
+                               GDKerror("%s.\n", (msg));               \
+                       else                                            \
+                               GDKerror("%s: BAT required.\n", (msg)); \
+                       return 0;                                       \
+               }                                                       \
+       } while (0)
 
 #define ATOMextern(t)  (ATOMstorage(t) >= TYPE_str)
 
@@ -592,34 +581,37 @@ typedef enum { GDK_FAIL, GDK_SUCCEED } g
 #define TYPEcomp(t1,t2)        
(ATOMstorage(ATOMtype(t1))==ATOMstorage(ATOMtype(t2)))
 #define TYPEerror(t1,t2)       (!TYPEcomp(t1,t2))
 #define TYPEcheck(t1,t2)                                               \
-       if (TYPEerror(t1,t2)) {                                         \
-               GDKerror("TYPEcheck: Incompatible types %s and %s.\n",  \
-                       ATOMname(t2), ATOMname(t1));                    \
-               return 0;                                               \
-       } else if (!TYPEcomp(t1,t2)) {                                  \
-               CHECKDEBUG THRprintf(GDKout,"#Interpreting %s as %s.\n", \
-                       ATOMname(t2), ATOMname(t1));                    \
-       }
-#define BATcompatible(P1,P2) {                                         \
-       ERRORcheck(P1 == NULL, "BATcompatible: BAT required\n");        \
-       ERRORcheck(P2 == NULL, "BATcompatible: BAT required\n");        \
-       if (TYPEerror(BAThtype(P1),BAThtype(P2)) ||                     \
-           TYPEerror(BATttype(P1),BATttype(P2)))                       \
-       {                                                               \
-               GDKerror("Incompatible operands.\n");                   \
-               return 0;                                               \
-       }                                                               \
-       if (BAThtype(P1) != BAThtype(P2) &&                             \
-           ATOMtype((P1)->htype) != ATOMtype((P2)->htype)) {           \
-               CHECKDEBUG THRprintf(GDKout,"#Interpreting %s as %s.\n", \
-                       ATOMname(BAThtype(P2)), ATOMname(BAThtype(P1))); \
-       }                                                               \
-       if (BATttype(P1) != BATttype(P2) &&                             \
-           ATOMtype((P1)->ttype) != ATOMtype((P2)->ttype)) {           \
-               CHECKDEBUG THRprintf(GDKout,"#Interpreting %s as %s.\n", \
-                       ATOMname(BATttype(P2)), ATOMname(BATttype(P1))); \
-       }                                                               \
-}
+       do {                                                            \
+               if (TYPEerror(t1, t2)) {                                \
+                       GDKerror("TYPEcheck: Incompatible types %s and %s.\n", \
+                               ATOMname(t2), ATOMname(t1));            \
+                       return 0;                                       \
+               } else if (!TYPEcomp(t1, t2)) {                         \
+                       CHECKDEBUG THRprintf(GDKout,"#Interpreting %s as 
%s.\n", \
+                               ATOMname(t2), ATOMname(t1));            \
+               }                                                       \
+       } while (0)
+#define BATcompatible(P1,P2)                                           \
+       do {                                                            \
+               ERRORcheck((P1) == NULL, "BATcompatible: BAT required\n"); \
+               ERRORcheck((P2) == NULL, "BATcompatible: BAT required\n"); \
+               if (TYPEerror(BAThtype(P1),BAThtype(P2)) ||             \
+                   TYPEerror(BATttype(P1),BATttype(P2)))               \
+               {                                                       \
+                       GDKerror("Incompatible operands.\n");           \
+                       return 0;                                       \
+               }                                                       \
+               if (BAThtype(P1) != BAThtype(P2) &&                     \
+                   ATOMtype((P1)->htype) != ATOMtype((P2)->htype)) {   \
+                       CHECKDEBUG THRprintf(GDKout,"#Interpreting %s as 
%s.\n", \
+                               ATOMname(BAThtype(P2)), 
ATOMname(BAThtype(P1))); \
+               }                                                       \
+               if (BATttype(P1) != BATttype(P2) &&                     \
+                   ATOMtype((P1)->ttype) != ATOMtype((P2)->ttype)) {   \
+                       CHECKDEBUG THRprintf(GDKout,"#Interpreting %s as 
%s.\n", \
+                               ATOMname(BATttype(P2)), 
ATOMname(BATttype(P1))); \
+               }                                                       \
+       } while (0)
 
 typedef struct {
        size_t maxsize;         /* maximum realloc size (bytes) */
@@ -680,7 +672,6 @@ typedef struct {
  * have been deleted in this transaction (and will be reinserted at a
  * transaction abort).
  *
- * @-
  * The location of a certain BUN in a BAT
  * may change between successive library routine invocations.  Therefore, one
  * should avoid keeping references into the BAT storage area for long
@@ -895,7 +886,6 @@ typedef struct BATiter {
 } BATiter;
 
 /*
- * @-
  * The different parts of which a BAT consists are physically stored
  * next to each other in the BATstore type.
  */
@@ -1389,11 +1379,13 @@ gdk_export BUN BUNfnd(BAT *b, ptr left);
        } while (0)
 
 #define BUNfndOID(p,bi,v)                      \
_______________________________________________
Checkin-list mailing list
Checkin-list@monetdb.org
http://mail.monetdb.org/mailman/listinfo/checkin-list

Reply via email to