Changeset: c1cf092d6502 for MonetDB
URL: http://dev.monetdb.org/hg/MonetDB?cmd=changeset;node=c1cf092d6502
Modified Files:
        monetdb5/modules/mal/Tests/remote08.mal
        monetdb5/modules/mal/Tests/remote08.stable.out
        monetdb5/modules/mal/remote.mx
Branch: default
Log Message:

remote.get: fix subsequent binary get calls

A side effect of making remote08 test more testing of different pointers
revealed that there was left-over garbage on the stream causing
subsequent get calls to claim incorrect headers were sent.  Make the
output better in this case, and fix the double flush that was the actual
cause of the problem.


diffs (92 lines):

diff --git a/monetdb5/modules/mal/Tests/remote08.mal 
b/monetdb5/modules/mal/Tests/remote08.mal
--- a/monetdb5/modules/mal/Tests/remote08.mal
+++ b/monetdb5/modules/mal/Tests/remote08.mal
@@ -10,12 +10,19 @@
 b := bat.insert(b, nil:oid, 4);
 b := bat.insert(b, nil:oid, 6);
 b := bat.delete(b, nil:oid, 2);
+b := algebra.markH(b);
+
+rb2 := remote.put(conn1, b);
+lb2:bat[:oid,:int] := remote.get(conn1, rb2);
+
+io.print(lb2);
+
 b := bat.insert(b, nil:oid, 8);
 b := bat.insert(b, nil:oid, 10);
 b := algebra.slice(b, 1, 2);
 b := algebra.markH(b);
+
 rb2 := remote.put(conn1, b);
-
 lb2:bat[:oid,:int] := remote.get(conn1, rb2);
 
 io.print(lb2);
diff --git a/monetdb5/modules/mal/Tests/remote08.stable.out 
b/monetdb5/modules/mal/Tests/remote08.stable.out
--- a/monetdb5/modules/mal/Tests/remote08.stable.out
+++ b/monetdb5/modules/mal/Tests/remote08.stable.out
@@ -25,6 +25,10 @@
     b := bat.insert(b,nil:oid,4);
     b := bat.insert(b,nil:oid,6);
     b := bat.delete(b,nil:oid,2);
+    b := algebra.markH(b);
+    rb2 := remote.put(conn1,b);
+    lb2:bat[:oid,:int]  := remote.get(conn1,rb2);
+    io.print(lb2);
     b := bat.insert(b,nil:oid,8);
     b := bat.insert(b,nil:oid,10);
     b := algebra.slice(b,1,2);
@@ -40,6 +44,12 @@
 # h    t         # name
 # void int       # type
 #-----------------#
+[ 0@0,   6       ]
+[ 1@0,   4       ]
+#-----------------#
+# h    t         # name
+# void int       # type
+#-----------------#
 [ 0@0,   4       ]
 [ 1@0,   8       ]
 
diff --git a/monetdb5/modules/mal/remote.mx b/monetdb5/modules/mal/remote.mx
--- a/monetdb5/modules/mal/remote.mx
+++ b/monetdb5/modules/mal/remote.mx
@@ -1232,7 +1232,7 @@
        if (b->tvarsized)
                mnstr_write(cntxt->fdout, /* theap */
                                Tbase(b), b->T->vheap->free, 1);
-       mnstr_flush(cntxt->fdout);
+       /* flush is done by the calling environment (MAL) */
 
        return(MAL_SUCCEED);
 }
@@ -1255,6 +1255,7 @@
        binbat bb = { 0, 0, 0, 0, 0, 0 };
        char *nme = NULL;
        char *val = NULL;
+       char tmp;
 
        BAT *b;
 
@@ -1264,7 +1265,7 @@
 
        /* could skip whitespace, but we just don't allow that */
        if (*hdr++ != '{')
-               throw(MAL, "remote.bincopyfrom", "illegal input, not a JSON 
header");
+               throw(MAL, "remote.bincopyfrom", "illegal input, not a JSON 
header (got '%s')", hdr - 1);
        while (*hdr != '\0') {
                switch (*hdr) {
                        case '"':
@@ -1328,6 +1329,11 @@
                b->T->vheap->free = bb.theapsize;
        }
 
+       /* read blockmode flush */
+       while (mnstr_read(in, &tmp, 1, 1) != 0) {
+               mnstr_printf(GDKout, "!MALexception:remote.bincopyfrom: 
expected flush, got: %c", tmp);
+       }
+
        *ret = b;
        return(MAL_SUCCEED);
 }
_______________________________________________
Checkin-list mailing list
Checkin-list@monetdb.org
http://mail.monetdb.org/mailman/listinfo/checkin-list

Reply via email to