Changeset: d01e15d8a6cb for MonetDB
URL: http://dev.monetdb.org/hg/MonetDB?cmd=changeset;node=d01e15d8a6cb
Modified Files:
        gdk/gdk_align.c
        gdk/gdk_bat.c
        monetdb5/modules/mal/tablet.c
        sql/backends/monet5/sql.c
Branch: default
Log Message:

Merge with Jul2015 branch.


diffs (156 lines):

diff --git a/gdk/gdk_align.c b/gdk/gdk_align.c
--- a/gdk/gdk_align.c
+++ b/gdk/gdk_align.c
@@ -207,7 +207,6 @@ VIEWhcreate(BAT *h)
        if (bn->H->vheap) {
                assert(h->H->vheap);
                assert(bn->H->vheap->parentid != 0);
-               bn->H->vheap->farmid = h->H->vheap->farmid;
                BBPshare(bn->H->vheap->parentid);
        }
 
@@ -290,13 +289,11 @@ VIEWcreate_(BAT *h, BAT *t, int slice_vi
        if (bn->H->vheap) {
                assert(h->H->vheap);
                assert(bn->H->vheap->parentid > 0);
-               bn->H->vheap->farmid = h->H->vheap->farmid;
                BBPshare(bn->H->vheap->parentid);
        }
        if (bn->T->vheap) {
                assert(t->T->vheap);
                assert(bn->T->vheap->parentid > 0);
-               bn->T->vheap->farmid = t->T->vheap->farmid;
                BBPshare(bn->T->vheap->parentid);
        }
 
@@ -702,6 +699,14 @@ VIEWreset(BAT *b)
                n->batSharecnt = 0;
                n->batCopiedtodisk = 0;
                n->batDirty = 1;
+               if (v->H->heap.parentid == n->batCacheid) {
+                       assert(hp == 0);
+                       v->H->heap.parentid = 0;
+               }
+               if (v->T->heap.parentid == -n->batCacheid) {
+                       assert(tp == 0);
+                       v->T->heap.parentid = 0;
+               }
 
                /* reset BOUND2KEY */
                n->hkey = BAThkey(v);
diff --git a/gdk/gdk_bat.c b/gdk/gdk_bat.c
--- a/gdk/gdk_bat.c
+++ b/gdk/gdk_bat.c
@@ -1624,7 +1624,7 @@ void_inplace(BAT *b, oid id, const void 
 
        assert(b->htype == TYPE_void);
        assert(b->hseqbase != oid_nil);
-       assert(b->batCount > (id -b->hseqbase));
+       assert(b->batCount > (id - b->hseqbase));
 
        b->batInserted = 0;
        p = BUNfndVOID(bm, &id);
diff --git a/monetdb5/modules/mal/tablet.c b/monetdb5/modules/mal/tablet.c
--- a/monetdb5/modules/mal/tablet.c
+++ b/monetdb5/modules/mal/tablet.c
@@ -1307,12 +1307,12 @@ SQLproducer(void *p)
                        /* the input buffer should be extended, but 'base' is 
not shared
                           between the threads, which we can not now update.
                           Mimick an ateof instead; */
-                       tablet_error(task, lng_nil, int_nil, msg, 
"SQLload_file, record too long");
+                       tablet_error(task, lng_nil, int_nil, "record too long", 
"");
                        ateof[cur] = 1;
 #ifdef _DEBUG_TABLET_CNTRL
                        mnstr_printf(GDKout, "#bailout on SQLload confronted 
with too large record\n");
 #endif
-                       break;
+                       goto reportlackofinput;
                }
                memcpy(end, task->b->buf + task->b->pos, task->b->len - 
task->b->pos);
                end = end + task->b->len - task->b->pos;
@@ -1448,6 +1448,12 @@ SQLproducer(void *p)
                                        break;
                        } else {
                                /* found an incomplete record, saved for next 
round */
+                               if (s+partial < end) {
+                                       /* found a EOS in the input */
+                                       tablet_error(task, lng_nil, int_nil, 
"record too long (EOS found)", "");
+                                       ateof[cur] = 1;
+                                       goto reportlackofinput;
+                               }
                                base = e;
                                break;
                        }
diff --git a/sql/backends/monet5/sql.c b/sql/backends/monet5/sql.c
--- a/sql/backends/monet5/sql.c
+++ b/sql/backends/monet5/sql.c
@@ -2434,29 +2434,57 @@ DELTAproject(bat *result, const bat *sub
 
        if (BATcount(u_val)) {
                BAT *o, *nu_id, *nu_val;
+               /* create subsets of u_id and u_val where the tail
+                * values of u_id are also in s, and where those tail
+                * values occur as head value in res */
                if (BATsubsemijoin(&o, NULL, u_id, s, NULL, NULL, 0, BUN_NONE) 
!= GDK_SUCCEED) {
+                       BBPunfix(s->batCacheid);
+                       BBPunfix(res->batCacheid);
                        BBPunfix(u_id->batCacheid);
-                       BBPunfix(res->batCacheid);
-                       BBPunfix(s->batCacheid);
+                       BBPunfix(u_val->batCacheid);
                        throw(MAL, "sql.delta", RUNTIME_OBJECT_MISSING);
                }
                nu_id = BATproject(o, u_id);
                nu_val = BATproject(o, u_val);
+               BBPunfix(u_id->batCacheid);
+               BBPunfix(u_val->batCacheid);
                BBPunfix(o->batCacheid);
-               if (nu_id == NULL || nu_val == NULL) {
-                       BBPunfix(u_id->batCacheid);
+               tres = VIEWcombine(res);
+               if (nu_id == NULL ||
+                   nu_val == NULL ||
+                   tres == NULL ||
+                   BATsubsemijoin(&o, NULL, nu_id, tres, NULL, NULL, 0, 
BUN_NONE) != GDK_SUCCEED) {
+                       BBPunfix(s->batCacheid);
                        BBPunfix(res->batCacheid);
-                       BBPunfix(s->batCacheid);
-                       if (nu_id)
-                               BBPunfix(nu_id->batCacheid);
-                       if (nu_val)
-                               BBPunfix(nu_val->batCacheid);
-                       throw(MAL, "sql.delta", RUNTIME_OBJECT_MISSING);
+                       BBPreclaim(nu_id);
+                       BBPreclaim(nu_val);
+                       BBPreclaim(tres);
+                       throw(MAL, "sql.delta", MAL_MALLOC_FAIL);
                }
-               res = setwritable(res);
-               BATreplace(res, nu_id, nu_val, 0);
+               BBPunfix(tres->batCacheid);
+               u_id = BATproject(o, nu_id);
+               u_val = BATproject(o, nu_val);
                BBPunfix(nu_id->batCacheid);
                BBPunfix(nu_val->batCacheid);
+               BBPunfix(o->batCacheid);
+               if (u_id == NULL || u_val == NULL) {
+                       BBPunfix(s->batCacheid);
+                       BBPunfix(res->batCacheid);
+                       BBPreclaim(u_id);
+                       BBPreclaim(u_val);
+                       throw(MAL, "sql.delta", MAL_MALLOC_FAIL);
+               }
+               /* now update res with the subset of u_id and u_val we
+                * calculated */
+               if ((res = setwritable(res)) == NULL ||
+                   BATreplace(res, u_id, u_val, 0) != GDK_SUCCEED) {
+                       if (res)
+                               BBPunfix(res->batCacheid);
+                       BBPunfix(s->batCacheid);
+                       BBPunfix(u_id->batCacheid);
+                       BBPunfix(u_val->batCacheid);
+                       throw(MAL, "sql.delta", MAL_MALLOC_FAIL);
+               }
        }
        BBPunfix(s->batCacheid);
        BBPunfix(u_id->batCacheid);
_______________________________________________
checkin-list mailing list
[email protected]
https://www.monetdb.org/mailman/listinfo/checkin-list

Reply via email to