Update of /cvsroot/monetdb/sql/src/backends/monet5
In directory sfp-cvsdas-1.v30.ch3.sourceforge.com:/tmp/cvs-serv10217

Modified Files:
        sql_gencode.mx sql.mx 
Log Message:
Be more defensive about BAT releasing. And fixed dependency that could
lead to unprotected concurrent acces in dataflow.


Index: sql_gencode.mx
===================================================================
RCS file: /cvsroot/monetdb/sql/src/backends/monet5/sql_gencode.mx,v
retrieving revision 1.358
retrieving revision 1.359
diff -u -d -r1.358 -r1.359
--- sql_gencode.mx      14 Mar 2010 08:25:48 -0000      1.358
+++ sql_gencode.mx      15 Mar 2010 22:27:00 -0000      1.359
@@ -213,7 +213,7 @@
 The dump_cols produces a sequence of instructions for
 the front-end to prepare presentation of a result table (bat).
 @c
-void
+int
 dump_cols(MalBlkPtr mb, list *l, int result_set)
 {
        node *n;
@@ -228,10 +228,11 @@
                q = pushArgument(mb, q, result_set);
                q = pushStr(mb, q, ncn);
                q = pushArgument(mb, q, c->nr);
-               c->nr = getDestVar(q);
+               result_set = c->nr = getDestVar(q);
                _DELETE(ncn);
                _DELETE(cn);
        }
+       return result_set;
 }
 
 @-
@@ -1839,7 +1840,7 @@
                                s->nr = getDestVar(q);
                                q = pushType(mb, q, TYPE_str);
                                q = pushType(mb, q, TYPE_bat);
-                               dump_cols(mb, l, s->nr);
+                               s->nr = dump_cols(mb, l, s->nr);
                        } else {
                                q = newStmt1(mb, sqlRef, "print");
                                q = pushStr(mb, q, "not a valid output list\n");

Index: sql.mx
===================================================================
RCS file: /cvsroot/monetdb/sql/src/backends/monet5/sql.mx,v
retrieving revision 1.405
retrieving revision 1.406
diff -u -d -r1.405 -r1.406
--- sql.mx      14 Mar 2010 08:25:45 -0000      1.405
+++ sql.mx      15 Mar 2010 22:27:08 -0000      1.406
@@ -2282,8 +2282,9 @@
                        hval = *(oid *)getArgReference(stk, pci, 7);
                        bn =  BATslice(b, lval,hval);
                        BATseqbase(bn, lval);
+                       BBPkeepref( *bid = bn->batCacheid);
                        BBPreleaseref(b->batCacheid);
-                       b= bn;
+                       return MAL_SUCCEED;
                }
                BBPkeepref( *bid = b->batCacheid);
                return MAL_SUCCEED;
@@ -2315,8 +2316,9 @@
                        hval = *(oid *)getArgReference(stk, pci, 7);
                        bn =  BATslice(b, lval,hval);
                        BATseqbase(bn, lval);
+                       BBPkeepref( *bid = bn->batCacheid);
                        BBPreleaseref(b->batCacheid);
-                       b= bn;
+                       return MAL_SUCCEED;
                }
                BBPkeepref( *bid = b->batCacheid);
                return MAL_SUCCEED;
@@ -3125,7 +3127,6 @@
                memcpy(ret, p, _s);
        }
        BBPreleaseref(b->batCacheid);
-       
        return MAL_SUCCEED;
 }
 
@@ -3738,8 +3739,10 @@
        if (b->htype != bn->htype) {
                BAT *r = VIEWcreate(b,bn);
 
+               BBPkeepref(*res = r->batCacheid);
                BBPreleaseref(bn->batCacheid);
-               bn = r;
+               BBPreleaseref(b->batCacheid);
+               return MAL_SUCCEED;
        }
        BBPkeepref(*res = bn->batCacheid);
        BBPreleaseref(b->batCacheid);
@@ -3824,8 +3827,10 @@
        if (b->htype != bn->htype) {
                BAT *r = VIEWcreate(b,bn);
 
+               BBPkeepref(*res = r->batCacheid);
                BBPreleaseref(bn->batCacheid);
-               bn = r;
+               BBPreleaseref(b->batCacheid);
+               return msg;
        }
        BBPkeepref(*res = bn->batCacheid);
        BBPreleaseref(b->batCacheid);
@@ -3946,8 +3951,10 @@
        if (b->htype != bn->htype) {
                BAT *r = VIEWcreate(b,bn);
 
+               BBPkeepref(*res = r->batCacheid);
                BBPreleaseref(bn->batCacheid);
-               bn = r;
+               BBPreleaseref(b->batCacheid);
+               return msg;
        }
        BBPkeepref(*res = bn->batCacheid);
        BBPreleaseref(b->batCacheid);
@@ -4203,8 +4210,10 @@
        if (b->htype != bn->htype) {
                BAT *r = VIEWcreate(b,bn);
 
+               BBPkeepref(*res = r->batCacheid);
                BBPreleaseref(bn->batCacheid);
-               bn = r;
+               BBPreleaseref(b->batCacheid);
+               return msg;
        }
        BBPkeepref(*res = bn->batCacheid);
        BBPreleaseref(b->batCacheid);
@@ -4413,8 +4422,10 @@
        if (b->htype != bn->htype) {
                BAT *r = VIEWcreate(b,bn);
 
+               BBPkeepref(*res = r->batCacheid);
                BBPreleaseref(bn->batCacheid);
-               bn = r;
+               BBPreleaseref(b->batCacheid);
+               return msg;
        }
        BBPkeepref(*res = bn->batCacheid);
        BBPreleaseref(b->batCacheid);
@@ -5019,9 +5030,9 @@
                c->base.wtime = c->base.rtime = tr->stime;
                snprintf(buf,BUFSIZ,"%s/%s/%s/0", *sch, *tbl, c->base.name);
                msg = @1;
+               BBPkeepref(e->batCacheid);
                BBPreleaseref(b->batCacheid);
                BBPdecref(b->batCacheid, TRUE);
-               BBPkeepref(e->batCacheid);
        }
        /* bat was cleared */
        t->cleared = 1;


------------------------------------------------------------------------------
Download Intel® Parallel Studio Eval
Try the new software tools for yourself. Speed compiling, find bugs
proactively, and fine-tune applications for parallel performance.
See why Intel Parallel Studio got high marks during beta.
http://p.sf.net/sfu/intel-sw-dev
_______________________________________________
Monetdb-sql-checkins mailing list
[email protected]
https://lists.sourceforge.net/lists/listinfo/monetdb-sql-checkins

Reply via email to