Changeset: 088feffce5a4 for MonetDB
URL: https://dev.monetdb.org/hg/MonetDB/rev/088feffce5a4
Modified Files:
        monetdb5/modules/kernel/microbenchmark.c
        monetdb5/modules/mal/batExtensions.c
        monetdb5/modules/mal/bbp.c
        monetdb5/modules/mal/groupby.c
        monetdb5/modules/mal/inspect.c
        monetdb5/modules/mal/json_util.c
        sql/backends/monet5/sql_subquery.c
Branch: Jul2021
Log Message:

More quick descriptors


diffs (173 lines):

diff --git a/monetdb5/modules/kernel/microbenchmark.c 
b/monetdb5/modules/kernel/microbenchmark.c
--- a/monetdb5/modules/kernel/microbenchmark.c
+++ b/monetdb5/modules/kernel/microbenchmark.c
@@ -384,8 +384,7 @@ MBMmix(bat *bn, bat *batid)
                *(int *) Tloc(b, idx) = val;
        }
 
-       BBPunfix(b->batCacheid);
-       *bn = b->batCacheid;
+       BBPkeepref(*bn= b->batCacheid);
 
        return MAL_SUCCEED;
 }
diff --git a/monetdb5/modules/mal/batExtensions.c 
b/monetdb5/modules/mal/batExtensions.c
--- a/monetdb5/modules/mal/batExtensions.c
+++ b/monetdb5/modules/mal/batExtensions.c
@@ -73,10 +73,9 @@ CMDBATdup(Client cntxt, MalBlkPtr mb, Ma
        bat input = *getArgReference_bat(stk, pci, 2);
 
        (void)cntxt;
-       if ((i = BATdescriptor(input)) == NULL)
+       if ((i = BBPquickdesc(input)) == NULL)
                throw(MAL, "bat.new", INTERNAL_BAT_ACCESS);
        b = COLnew(i->hseqbase, tt, BATcount(i), TRANSIENT);
-       BBPunfix(i->batCacheid);
        if (b == 0)
                throw(MAL,"bat.new", SQLSTATE(HY013) MAL_MALLOC_FAIL);
        *ret = b->batCacheid;
diff --git a/monetdb5/modules/mal/bbp.c b/monetdb5/modules/mal/bbp.c
--- a/monetdb5/modules/mal/bbp.c
+++ b/monetdb5/modules/mal/bbp.c
@@ -432,6 +432,7 @@ CMDbbp(bat *ID, bat *NS, bat *TT, bat *C
                                        mode = "transient";
                                len = snprintf(buf, FILENAME_MAX, "%s", 
BBP_physical(i));
                                if (len == -1 || len >= FILENAME_MAX) {
+                                       BBPunfix(bn->batCacheid);
                                        msg = createException(MAL, 
"catalog.bbp", SQLSTATE(HY013) "Could not bpp filename path is too large");
                                        goto bailout;
                                }
diff --git a/monetdb5/modules/mal/groupby.c b/monetdb5/modules/mal/groupby.c
--- a/monetdb5/modules/mal/groupby.c
+++ b/monetdb5/modules/mal/groupby.c
@@ -182,10 +182,9 @@ GROUPmulticolumngroup(Client cntxt, MalB
        if (msg == MAL_SUCCEED && aggr->last > 1)
                do {
                        /* early break when there are as many groups as entries 
*/
-                       b = BATdescriptor(*hist);
+                       b = BBPquickdesc(*hist);
                        if (b) {
                                j = BATcount(b) == count;
-                               BBPunfix(*hist);
                                if (j)
                                        break;
                        }
diff --git a/monetdb5/modules/mal/inspect.c b/monetdb5/modules/mal/inspect.c
--- a/monetdb5/modules/mal/inspect.c
+++ b/monetdb5/modules/mal/inspect.c
@@ -670,10 +670,9 @@ INSPECTtypeName(Client cntxt, MalBlkPtr 
        } else if (isaBatType(getArgType(mb,pci,1) ) ){
                bat *bid= getArgReference_bat(stk,pci,1);
                BAT *b;
-               if ((b = BATdescriptor(*bid)) ) {
+               if ((b = BBPquickdesc(*bid)))
                        *hn = getTypeName(newBatType(b->ttype));
-                       BBPunfix(b->batCacheid);
-               } else
+               else
                        *hn = getTypeName(getArgType(mb, pci, 1));
        } else
                *hn = getTypeName(getArgType(mb, pci, 1));
diff --git a/monetdb5/modules/mal/json_util.c b/monetdb5/modules/mal/json_util.c
--- a/monetdb5/modules/mal/json_util.c
+++ b/monetdb5/modules/mal/json_util.c
@@ -23,41 +23,24 @@ JSONresultSet(json *res, bat *uuid, bat 
        char *result;
        size_t sz, len=0;
 
-       if ((bu = BATdescriptor(*uuid)) == NULL)
+       if ((bu = BBPquickdesc(*uuid)) == NULL)
                throw(MAL, "json.resultset", INTERNAL_BAT_ACCESS);
-       if ((br = BATdescriptor(*rev)) == NULL) {
-               BBPunfix(bu->batCacheid);
+       if ((br = BBPquickdesc(*rev)) == NULL)
                throw(MAL, "json.resultset", INTERNAL_BAT_ACCESS);
-       }
-       if ((bj = BATdescriptor(*js)) == NULL) {
-               BBPunfix(bu->batCacheid);
-               BBPunfix(br->batCacheid);
+       if ((bj = BBPquickdesc(*js)) == NULL)
                throw(MAL, "json.resultset", INTERNAL_BAT_ACCESS);
-       }
-       if ( !(BATcount(bu) == BATcount(br) && BATcount(br) == BATcount(bj)) ){
-               BBPunfix(bu->batCacheid);
-               BBPunfix(br->batCacheid);
-               BBPunfix(bj->batCacheid);
+       if ( !(BATcount(bu) == BATcount(br) && BATcount(br) == BATcount(bj)) )
                throw(MAL, "json.resultset", "Input not aligned");
-       }
        sz= (22 + 12 + 20) * BATcount(bu);
        result = (char*) GDKmalloc(sz);
-       if (result == NULL){
-               BBPunfix(bu->batCacheid);
-               BBPunfix(br->batCacheid);
-               BBPunfix(bj->batCacheid);
+       if (result == NULL)
                throw(MAL, "json.resultset", SQLSTATE(HY013) MAL_MALLOC_FAIL);
-       }
        len += snprintf(result,sz,"[");
        /* here the dirty work follows */
        /* loop over the triple store */
        snprintf(result+len,sz-len,"]");
-       BBPunfix(bu->batCacheid);
-       BBPunfix(br->batCacheid);
-       BBPunfix(bj->batCacheid);
        *res = result;
        return MAL_SUCCEED;
-
 }
 
 #include "mel.h"
diff --git a/sql/backends/monet5/sql_subquery.c 
b/sql/backends/monet5/sql_subquery.c
--- a/sql/backends/monet5/sql_subquery.c
+++ b/sql/backends/monet5/sql_subquery.c
@@ -1195,15 +1195,13 @@ SQLsubexist(Client cntxt, MalBlkPtr mb, 
 
        (void)cntxt;
        (void)mb;
-       b = BATdescriptor(*bp);
+       b = BBPquickdesc(*bp);
        g = BATdescriptor(*gp);
        e = BATdescriptor(*gpe);
        if (sp)
                s = BATdescriptor(*sp);
 
        if (!b || !g || !e || (sp && !s)) {
-               if (b)
-                       BBPunfix(b->batCacheid);
                if (g)
                        BBPunfix(g->batCacheid);
                if (e)
@@ -1215,7 +1213,6 @@ SQLsubexist(Client cntxt, MalBlkPtr mb, 
 
        res = BATsubexist(b, g, e, s);
 
-       BBPunfix(b->batCacheid);
        BBPunfix(g->batCacheid);
        BBPunfix(e->batCacheid);
        if (s)
@@ -1266,15 +1263,13 @@ SQLsubnot_exist(Client cntxt, MalBlkPtr 
 
        (void)cntxt;
        (void)mb;
-       b = BATdescriptor(*bp);
+       b = BBPquickdesc(*bp);
        g = BATdescriptor(*gp);
        e = BATdescriptor(*gpe);
        if (sp)
                s = BATdescriptor(*sp);
 
        if (!b || !g || !e || (sp && !s)) {
-               if (b)
-                       BBPunfix(b->batCacheid);
                if (g)
                        BBPunfix(g->batCacheid);
                if (e)
@@ -1286,7 +1281,6 @@ SQLsubnot_exist(Client cntxt, MalBlkPtr 
 
        res = BATsubnot_exist(b, g, e, s);
 
-       BBPunfix(b->batCacheid);
        BBPunfix(g->batCacheid);
        BBPunfix(e->batCacheid);
        if (s)
_______________________________________________
checkin-list mailing list
checkin-list@monetdb.org
https://www.monetdb.org/mailman/listinfo/checkin-list

Reply via email to