Changeset: 0c2c73f33478 for MonetDB
URL: http://dev.monetdb.org/hg/MonetDB?cmd=changeset;node=0c2c73f33478
Modified Files:
        NT/monetdb_config.h.in
        gdk/gdk.h
        gdk/gdk_colop.c
        gdk/gdk_private.h
        monetdb5/extras/crackers/crackers_joins.mx
        sql/backends/monet5/Makefile.ag
        sql/backends/monet5/sql.mx
        sql/storage/bat/bat_storage.c
        sql/storage/restrict/restrict_storage.c
Branch: headless
Log Message:

Merge with default branch.


diffs (truncated from 1244 to 300 lines):

diff --git a/MonetDB.spec b/MonetDB.spec
--- a/MonetDB.spec
+++ b/MonetDB.spec
@@ -436,7 +436,12 @@ use SQL with MonetDB, you will need to i
 %{_bindir}/monetdb
 %{_bindir}/monetdbd
 %dir %attr(775,monetdb,monetdb) %{_localstatedir}/log/monetdb
+%if ! (0%{?fedora} > 14)
 %dir %attr(775,monetdb,monetdb) %{_localstatedir}/run/monetdb
+%exclude %{_sysconfdir}/tmpfiles.d/monetdbd.conf
+%else
+%{_sysconfdir}/tmpfiles.d/monetdbd.conf
+%endif
 %config(noreplace) %{_localstatedir}/monetdb5/dbfarm/.merovingian_properties
 %{_libdir}/monetdb5/autoload/*_sql.mal
 %{_libdir}/monetdb5/lib_sql.so
diff --git a/NT/monetdb_config.h.in b/NT/monetdb_config.h.in
--- a/NT/monetdb_config.h.in
+++ b/NT/monetdb_config.h.in
@@ -600,8 +600,6 @@
 
 /* Define to 1 if you have the timezone and daylight variables. */
 #define HAVE_TIMEZONE 1
-#define timezone _timezone
-#define daylight _daylight
 
 /* Define to 1 if you have the `trunc' function. */
 /* #undef HAVE_TRUNC */
diff --git a/buildtools/ChangeLog.Aug2011 b/buildtools/ChangeLog.Aug2011
--- a/buildtools/ChangeLog.Aug2011
+++ b/buildtools/ChangeLog.Aug2011
@@ -1,6 +1,10 @@
 # ChangeLog file for buildtools
 # This file is updated with Maddlog
 
+* Sat Aug  6 2011 Sjoerd Mullender <[email protected]>
+- Fixed Fedora 15 (and presumably later) configuration that uses a tmpfs
+  file system for /var/run.  This fixes bug 2850.
+
 * Wed Jul 20 2011 Sjoerd Mullender <[email protected]>
 - The default OID size for 64-bit Windows is now 64 bits.  Databases with
   32 bit OIDs are converted automatically.
diff --git a/buildtools/conf/Makefile.ag b/buildtools/conf/Makefile.ag
--- a/buildtools/conf/Makefile.ag
+++ b/buildtools/conf/Makefile.ag
@@ -50,4 +50,11 @@ headers_html = {
        SOURCES = website.html
 }
 
+headers_systemd = {
+       COND = NOT_WIN32
+       HEADERS = conf
+       DIR = sysconfdir/tmpfiles.d
+       SOURCES = monetdbd.conf
+}
+
 EXTRA_DIST = rules.mk
diff --git a/buildtools/conf/monetdbd.conf b/buildtools/conf/monetdbd.conf
new file mode 100644
--- /dev/null
+++ b/buildtools/conf/monetdbd.conf
@@ -0,0 +1,3 @@
+# this file is for systemd
+# monetdbd needs a directory in /var/run that is owned by monetdb:monetdb
+d /run/monetdb 0775 monetdb monetdb -
diff --git a/clients/mapiclient/mclient.c b/clients/mapiclient/mclient.c
--- a/clients/mapiclient/mclient.c
+++ b/clients/mapiclient/mclient.c
@@ -2362,6 +2362,11 @@ static void
 set_timezone(Mapi mid)
 {
 #ifdef HAVE_TIMEZONE
+#ifdef _MSC_VER
+#define timezone _timezone
+#define daylight _daylight
+#define tzset _tzset
+#endif
        char buf[128];
        long tzone;
        MapiHdl hdl;
diff --git a/gdk/gdk.h b/gdk/gdk.h
--- a/gdk/gdk.h
+++ b/gdk/gdk.h
@@ -2346,8 +2346,6 @@ gdk_export void *GDKrealloc(void *pold, 
 gdk_export void GDKfree(void *blk);
 gdk_export str GDKstrdup(const char *s);
 
-gdk_export void *GDKvmalloc(size_t size, size_t *maxsize, int emergency);
-
 /*
  *
  * GDK error handling
diff --git a/gdk/gdk_private.h b/gdk/gdk_private.h
--- a/gdk/gdk_private.h
+++ b/gdk/gdk_private.h
@@ -58,6 +58,7 @@ oid SORTfndlast(COL *b, ptr v);
 int GDKmunmap(void *addr, size_t len);
 void *GDKmallocmax(size_t size, size_t *maxsize, int emergency);
 void *GDKreallocmax(void *pold, size_t size, size_t *maxsize, int emergency);
+void *GDKvmalloc(size_t size, size_t * maxsize, int emergency);
 void *GDKvmrealloc(void *pold, size_t oldsize, size_t newsize, size_t oldmax, 
size_t *maxsize, int emergency);
 void GDKvmfree(void *blk, size_t size, size_t maxsize);
 void GDKaddbuf(const char *msg);
diff --git a/monetdb5/extras/crackers/crackers_joins.mx 
b/monetdb5/extras/crackers/crackers_joins.mx
--- a/monetdb5/extras/crackers/crackers_joins.mx
+++ b/monetdb5/extras/crackers/crackers_joins.mx
@@ -121,13 +121,17 @@ crackers_export str CRKsortBandJoin_@1(i
 
                        _step = _lcount / (_slices -= SAMPLE_TRESHOLD_LOG);
                        _sample = _slices * SAMPLE_SLICE_SIZE;
-                       _cnt = (BUN *) alloca(_slices * sizeof(BUN));
+                       _cnt = GDKmalloc(_slices * sizeof(BUN));
+                       if (_cnt == NULL)
+                               return NULL;
                        for (_lo = 0; _idx < _slices; _lo += _step) {
                                BUN _size = 0, _hi = _lo + SAMPLE_SLICE_SIZE;
 
                                l = COLslice(_tmp1, _lo, _hi);  /* slice keeps 
all parent properties */
-                               if (l == NULL)
+                               if (l == NULL) {
+                                       GDKfree(_cnt);
                                        return NULL;
+                               }
                                _tmp2 = @2;     /* @2 = e.g. BATXjoin(l,r) */
                                if (_tmp2) {
                                        _size = COLcount(_tmp2);
@@ -158,10 +162,13 @@ crackers_export str CRKsortBandJoin_@1(i
                                                }
                                                CBPreclaim(_tmp2);
                                        }
-                                       if (_tmp3 == NULL)
+                                       if (_tmp3 == NULL) {
+                                               GDKfree(_cnt);
                                                return NULL;
+                                       }
                                }
                        }
+                       GDKfree(_cnt);
                        /* overestimate always by 5% */
                        {
                                double _d = (double) (((lng) _tot) * ((lng) 
_lcount)) / (0.95 * (double) _sample);
diff --git a/monetdb5/optimizer/opt_partition.mx 
b/monetdb5/optimizer/opt_partition.mx
--- a/monetdb5/optimizer/opt_partition.mx
+++ b/monetdb5/optimizer/opt_partition.mx
@@ -473,14 +473,12 @@ OPTvarDependency(MalBlkPtr mb, int pc, i
 
 /* prepare slicing a column  by addition over the target */
 static int
-OPTpreparePartition(MalBlkPtr nmb, InstrPtr p, Slices *slices)
+OPTpreparePartition(MalBlkPtr nmb, InstrPtr p, Slices *slices, int pc)
 {
        InstrPtr q;
-       int parallel = 0;
+       int i,fnd,parallel = 0;
 
        if ( slices->slice == 0){
-               if (strcmp(slices->column, getVarConstant(nmb, 
getArg(p,4)).val.sval) ) 
-                       pushInstruction(nmb, p = 
copyInstruction(slices->target));
                slices->slice = newTmpVariable(nmb, getVarType(nmb, 
getArg(slices->target,0)));
                setVarUDFtype(nmb, slices->slice);
                setVarUsed(nmb, slices->slice);
@@ -488,6 +486,15 @@ OPTpreparePartition(MalBlkPtr nmb, Instr
                nmb->stmt[0] = pushArgument(nmb, nmb->stmt[0], slices->hslices);
                parallel=2;     /* return number of arguments added for later 
disposal */
        } 
+       /* check if the partition column instruction is already added */
+       fnd =0;
+       for ( i = pc -1; i-- > 0 && fnd == 0; i--){
+               q= getInstrPtr(nmb,i);
+               fnd = getFunctionId(q) && getModuleId(q) == sqlRef && 
getFunctionId(q) == bindRef &&
+                         strcmp(slices->column, getVarConstant(nmb, 
getArg(p,4)).val.sval) == 0;
+       }
+       if ( fnd == 0)
+               insertInstruction(nmb, p = copyInstruction(slices->target),pc);
        q= newInstruction(nmb,ASSIGNsymbol);
        /* add the slices->to the call */
        q= pushArgument(nmb,q, getArg(p,0));
@@ -502,7 +509,7 @@ OPTpreparePartition(MalBlkPtr nmb, Instr
 }
 
 static int 
-OPTsliceColumn(Client cntxt, MalBlkPtr nmb, MalBlkPtr mb, InstrPtr p, Slices 
*slices)
+OPTsliceColumn(Client cntxt, MalBlkPtr nmb, MalBlkPtr mb, InstrPtr p, Slices 
*slices, int pc)
 {
        int k, parallel = 0;
        InstrPtr q;
@@ -516,7 +523,7 @@ OPTsliceColumn(Client cntxt, MalBlkPtr n
                return 0;
 
        if ( slices->slice == 0)
-               parallel =OPTpreparePartition(nmb, p, slices);
+               parallel =OPTpreparePartition(nmb, p, slices, pc);
 
        if (strcmp(slices->column, getVarConstant(nmb, getArg(p,4)).val.sval) ) 
  {
                /* sideways projection the range selection */
@@ -531,12 +538,7 @@ OPTsliceColumn(Client cntxt, MalBlkPtr n
                q= pushArgument(nmb,q, k);
                q= pushArgument(nmb,q, slices->slice);
                pushInstruction(nmb,q);
-       } else {
-               /* it is the target itself */
-               clrFunction(p);
-               getArg(p,1) = slices->slice;
-               p->argc =2;
-       }
+       } 
        return parallel;
 } 
 
@@ -580,7 +582,7 @@ OPTgather(Client cntxt, MalBlkPtr mb, in
                pushInstruction(gmb, p);
                parallel = 0;
                if (getModuleId(p) == sqlRef && (getFunctionId(p) == bindRef || 
getFunctionId(p) == bindidxRef))  
-                       parallel = OPTsliceColumn(cntxt, gmb, mb, p, 
&newslices);
+                       parallel = OPTsliceColumn(cntxt, gmb, mb, p, 
&newslices,i);
        }
 
        p = newInstruction(NULL,ASSIGNsymbol);
@@ -742,7 +744,7 @@ OPTparallelcode(Client cntxt, MalBlkPtr 
                        } else  {
                                pushInstruction(nmb,p);
                                if (getModuleId(p) == sqlRef && 
(getFunctionId(p) == bindRef || getFunctionId(p) == bindidxRef))  
-                                       parallel += OPTsliceColumn(cntxt, nmb, 
mb, p, &slices);
+                                       parallel += OPTsliceColumn(cntxt, nmb, 
mb, p, &slices,nmb->stop-1);
                        }
                } else
                if ( p->token == ENDsymbol) {
@@ -989,7 +991,7 @@ OPTpartitionImplementation(Client cntxt,
                                q = OPTparallelcode(cntxt, mb, i, slices, 
FALSE);
                                if ( q == 0)
                                        i += OPTgatherArgs(cntxt,mb,p,i, 
&slices);
-                       } else q = 0; 
+                       } else q = 0;
                        if ( q ) {
                                clrFunction(rsset);
 #ifdef DEBUGDETAILS
@@ -1005,9 +1007,9 @@ OPTpartitionImplementation(Client cntxt,
                                /* add original arguments to cntrl call */
                                q = getInstrPtr(mb,0);
                                for( j = q->retc; j < q->argc; j++)
-                                       mb->stmt[i] = pushArgument(mb, 
mb->stmt[i], getArg(q,j));
+                                       p = pushArgument(mb, p, getArg(q,j));
                                insertInstruction(mb,p,i+1);
-                               remapVariables(mb,rsset,i);
+                               remapVariables(mb,rsset,i);
                                i++;
                                /* remove dead code asap */
                                msg = OPTdeadcode(cntxt, mb, 0, 0);
diff --git a/sql/backends/monet5/Makefile.ag b/sql/backends/monet5/Makefile.ag
--- a/sql/backends/monet5/Makefile.ag
+++ b/sql/backends/monet5/Makefile.ag
@@ -57,7 +57,7 @@ lib__sql = {
                   ../../../gdk/libbat \
                   ../../../common/stream/libstream \
                   $(READLINE_LIBS) $(PTHREAD_LIBS) \
-                  $(raptor_LIBS)
+                  $(raptor_LIBS) $(MATH_LIBS)
 }
 
 
diff --git a/sql/backends/monet5/sql.mx b/sql/backends/monet5/sql.mx
--- a/sql/backends/monet5/sql.mx
+++ b/sql/backends/monet5/sql.mx
@@ -1420,7 +1420,6 @@ sql5_export void freeVariables(Client c,
 #include <rel_exp.h>
 #include <rel_dump.h>
 #include <rel_bin.h>
-#include <math.h>
 #include <bbp.h>
 #include <cluster.h>
 #include <opt_dictionary.h>
diff --git a/sql/server/rel_exp.c b/sql/server/rel_exp.c
--- a/sql/server/rel_exp.c
+++ b/sql/server/rel_exp.c
@@ -386,6 +386,20 @@ exp_subtype( sql_exp *e )
        return NULL;
 }
 
+list *
+exps_subtype( list *l )
+{
+       node *n;
+       list *t = list_create(l->destroy);
+
+       for (n = l->h; n; n = n->next) {
+               sql_exp *e = n->data;
+
+               append(t, exp_subtype(e));
+       }
+       return t;
+}
+
 char *
 exp_name( sql_exp *e )
 {
diff --git a/sql/server/rel_exp.h b/sql/server/rel_exp.h
--- a/sql/server/rel_exp.h
+++ b/sql/server/rel_exp.h
@@ -67,6 +67,7 @@ extern sql_exp* exp_label(sql_allocator 
 extern void exp_swap( sql_exp *e );
_______________________________________________
Checkin-list mailing list
[email protected]
http://mail.monetdb.org/mailman/listinfo/checkin-list

Reply via email to