Changeset: f2a4d13ed424 for MonetDB
URL: https://dev.monetdb.org/hg/MonetDB?cmd=changeset;node=f2a4d13ed424
Modified Files:
        monetdb5/modules/mal/remote.c
Branch: Oct2020
Log Message:

when the to be send bat uses a vheap from another bat, first
copy (ie reduce data size).


diffs (63 lines):

diff --git a/monetdb5/modules/mal/remote.c b/monetdb5/modules/mal/remote.c
--- a/monetdb5/modules/mal/remote.c
+++ b/monetdb5/modules/mal/remote.c
@@ -1168,7 +1168,7 @@ static str RMTbatload(Client cntxt, MalB
 static str RMTbincopyto(Client cntxt, MalBlkPtr mb, MalStkPtr stk, InstrPtr 
pci)
 {
        bat bid = *getArgReference_bat(stk, pci, 1);
-       BAT *b = BBPquickdesc(bid, false);
+       BAT *b = BBPquickdesc(bid, false), *v = b;
        char sendtheap = 0;
 
        (void)mb;
@@ -1182,6 +1182,8 @@ static str RMTbincopyto(Client cntxt, Ma
                throw(MAL, "remote.bincopyto", MAL_MALLOC_FAIL);
 
        sendtheap = b->ttype != TYPE_void && b->tvarsized;
+       if (isVIEW(b) && sendtheap && VIEWvtparent(b) && BATcount(b) < 
BATcount(BBPquickdesc(VIEWvtparent(b), false)))
+               v = COLcopy(b, b->ttype, true, TRANSIENT);
 
        mnstr_printf(cntxt->fdout, /*JSON*/"{"
                        "\"version\":1,"
@@ -1197,26 +1199,29 @@ static str RMTbincopyto(Client cntxt, Ma
                        "\"tailsize\":%zu,"
                        "\"theapsize\":%zu"
                        "}\n",
-                       b->ttype,
-                       b->hseqbase, b->tseqbase,
-                       b->tsorted, b->trevsorted,
-                       b->tkey,
-                       b->tnonil,
-                       BATtdense(b),
-                       b->batCount,
-                       (size_t)b->batCount * Tsize(b),
-                       sendtheap && b->batCount > 0 ? b->tvheap->free : 0
+                       v->ttype,
+                       v->hseqbase, v->tseqbase,
+                       v->tsorted, v->trevsorted,
+                       v->tkey,
+                       v->tnonil,
+                       BATtdense(v),
+                       v->batCount,
+                       (size_t)v->batCount * Tsize(v),
+                       sendtheap && v->batCount > 0 ? v->tvheap->free : 0
                        );
 
-       if (b->batCount > 0) {
+       if (v->batCount > 0) {
                mnstr_write(cntxt->fdout, /* tail */
-               Tloc(b, 0), b->batCount * Tsize(b), 1);
+               Tloc(v, 0), v->batCount * Tsize(v), 1);
                if (sendtheap)
                        mnstr_write(cntxt->fdout, /* theap */
-                                       Tbase(b), b->tvheap->free, 1);
+                                       Tbase(v), v->tvheap->free, 1);
        }
        /* flush is done by the calling environment (MAL) */
 
+       if (b != v)
+               BBPreclaim(v);
+
        BBPunfix(bid);
 
        return(MAL_SUCCEED);
_______________________________________________
checkin-list mailing list
checkin-list@monetdb.org
https://www.monetdb.org/mailman/listinfo/checkin-list

Reply via email to