Changeset: 875b7277d19a for MonetDB
URL: https://dev.monetdb.org/hg/MonetDB?cmd=changeset;node=875b7277d19a
Modified Files:
        monetdb5/modules/mal/mat.c
        monetdb5/modules/mal/tablet.c
        sql/backends/monet5/sql.c
Branch: Aug2018
Log Message:

Check for BATsetaccess call.


diffs (77 lines):

diff --git a/monetdb5/modules/mal/mat.c b/monetdb5/modules/mal/mat.c
--- a/monetdb5/modules/mal/mat.c
+++ b/monetdb5/modules/mal/mat.c
@@ -152,7 +152,10 @@ MATpackIncrement(Client cntxt, MalBlkPtr
                }
                b->S.unused--;
                if(b->S.unused == 0)
-                       BATsetaccess(b, BAT_READ);
+                       if (BATsetaccess(b, BAT_READ) != GDK_SUCCEED) {
+                               BBPunfix(b->batCacheid);
+                               throw(MAL, "mat.pack", GDK_EXCEPTION);
+                       }
                assert(!b->tnil || !b->tnonil);
                BBPkeepref(*ret = b->batCacheid);
        }
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
@@ -60,7 +60,10 @@ void_bat_create(int adt, BUN nr)
        /* check for correct structures */
        if (b == NULL)
                return NULL;
-       BATsetaccess(b, BAT_APPEND);
+       if (BATsetaccess(b, BAT_APPEND) != GDK_SUCCEED) {
+               BBPunfix(b->batCacheid);
+               return NULL;
+       }
        if (nr > BATTINY && adt && BATextend(b, nr) != GDK_SUCCEED) {
                BBPunfix(b->batCacheid);
                return NULL;
@@ -170,7 +173,8 @@ TABLETcollect(BAT **bats, Tablet *as)
                        continue;
                bats[j] = fmt[i].c;
                BBPfix(bats[j]->batCacheid);
-               BATsetaccess(fmt[i].c, BAT_READ);
+               if (BATsetaccess(fmt[i].c, BAT_READ) != GDK_SUCCEED)
+                       throw(SQL, "copy", "Failed to set access at tablet part 
" BUNFMT "\n", cnt);
                fmt[i].c->tsorted = fmt[i].c->trevsorted = 0;
                fmt[i].c->tkey = 0;
                BATsettrivprop(fmt[i].c);
@@ -200,7 +204,8 @@ TABLETcollect_parts(BAT **bats, Tablet *
                b->tsorted = b->trevsorted = 0;
                b->tkey = 0;
                BATsettrivprop(b);
-               BATsetaccess(b, BAT_READ);
+               if (BATsetaccess(b, BAT_READ) != GDK_SUCCEED)
+                       throw(SQL, "copy", "Failed to set access at tablet part 
" BUNFMT "\n", cnt);
                bv = BATslice(b, (offset > 0) ? offset - 1 : 0, BATcount(b));
                bats[j] = bv;
 
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
@@ -1391,7 +1391,10 @@ setwritable(BAT *b)
                if (b->batSharecnt) {
                        bn = COLcopy(b, b->ttype, true, TRANSIENT);
                        if (bn != NULL)
-                               BATsetaccess(bn, BAT_WRITE);
+                               if (BATsetaccess(bn, BAT_WRITE) != GDK_SUCCEED) 
{
+                                       BBPreclaim(bn);
+                                       bn = NULL;
+                               }
                } else {
                        bn = NULL;
                }
@@ -2794,7 +2797,10 @@ mvc_bin_import_table_wrap(Client cntxt, 
                        c = BATattach(col->type.type->localtype, fname, 
TRANSIENT);
                        if (c == NULL)
                                throw(SQL, "sql", SQLSTATE(42000) "Failed to 
attach file %s", fname);
-                       BATsetaccess(c, BAT_READ);
+                       if (BATsetaccess(c, BAT_READ) != GDK_SUCCEED) {
+                               BBPreclaim(c);
+                               throw(SQL, "sql", SQLSTATE(42000) "Failed to 
set internal access while attaching file %s", fname);
+                       }
                } else if (tpe == TYPE_str) {
                        /* get the BAT and fill it with the strings */
                        c = COLnew(0, TYPE_str, 0, TRANSIENT);
_______________________________________________
checkin-list mailing list
checkin-list@monetdb.org
https://www.monetdb.org/mailman/listinfo/checkin-list

Reply via email to