Update of /cvsroot/monetdb/pathfinder/runtime
In directory sc8-pr-cvs16.sourceforge.net:/tmp/cvs-serv31086/runtime

Modified Files:
        Makefile.ag pathfinder.mx pf_support.mx serialize.mx 
        serialize_dflt.mx serialize_null.mx shredder.mx xrpc_client.mx 
        xrpc_server.mx 
Removed Files:
        xrpc_common.mx 
Log Message:

propagated changes of Sunday May 25 2008 - Thursday Jul 03 2008
from the xrpcdemo branch to the development trunk

or better:
applied differences between the current head of the XQuery_0-24 branch (tag
xrpcdemo_sync) and the current head of the xrpcdemo branch (tag
xrpcdemo_done) to the development trunk



U pathfinder.mx
Index: pathfinder.mx
===================================================================
RCS file: /cvsroot/monetdb/pathfinder/runtime/pathfinder.mx,v
retrieving revision 1.424
retrieving revision 1.425
diff -u -d -r1.424 -r1.425
--- pathfinder.mx       19 Jun 2008 14:13:31 -0000      1.424
+++ pathfinder.mx       3 Jul 2008 15:10:32 -0000       1.425
@@ -340,29 +340,30 @@
 @:[EMAIL PROTECTED](CONT_NAME,         41, void, str, void, void, oid_nil)@
 @:[EMAIL PROTECTED](CONT_RUNTIME,      42, void, bat, void, void, oid_nil)@
 @:[EMAIL PROTECTED](CONT_LOCKED,       43, void, lock,void, void, oid_nil)@
+@:[EMAIL PROTECTED](XRPC_PARTICIPANTS, 44, void, str, void, void, oid_nil)@
 
-@:[EMAIL PROTECTED](_MAP_PID,          44, void, bat, void,  oid, PRE_BASE)@
-@:[EMAIL PROTECTED](_RID_SIZE,         45, void, bat, void,  int, PRE_BASE)@
-@:[EMAIL PROTECTED](_RID_LEVEL,        46, void, bat, void,  chr, PRE_BASE)@
-@:[EMAIL PROTECTED](_RID_PROP,         47, void, bat, void,  oid, PRE_BASE)@
-@:[EMAIL PROTECTED](_RID_KIND,         48, void, bat, void,  chr, PRE_BASE)@
[...1103 lines suppressed...]
         s = open_wastream("/tmp/xrpc.mil");
         char *prologue = (char*) PFinitMIL();
         if (s) {
@@ -6112,14 +6348,13 @@
             ctx->mode |= XQ_DEBUG;
         }
         stream_write(ctx->fderr, prologue, strlen(prologue), 1);
-        argc = argc % 1000;
     }
     if (err == NULL && module){
-        err = xquery_module_load(ctx, ns="xrpc", module, uri); 
+        err = xquery_module_load(ctx, ns="xrpc", module, location); 
     }
 
     if (err == NULL) { 
-        err = xquery_function_call(ctx, usec, ns, method, argc, itercnt, 
argcnt, argtpe, argval, shredBAT);
+        err = xquery_function_call(ctx, usec, ns, module, method, seqnr, qid, 
caller, timeout, mode, argc, itercnt, argcnt, argtpe, argval, shredBAT);
         if (err == (char*) -1) err = "xquery_method: function could not be 
resolved.\n";
         else if (err == xquery_function_error) err = 
xquery_nondescriptive_error;
     }

--- xrpc_common.mx DELETED ---

Index: serialize.mx
===================================================================
RCS file: /cvsroot/monetdb/pathfinder/runtime/serialize.mx,v
retrieving revision 1.109
retrieving revision 1.110
diff -u -d -r1.109 -r1.110
--- serialize.mx        10 Apr 2008 13:38:49 -0000      1.109
+++ serialize.mx        3 Jul 2008 15:10:34 -0000       1.110
@@ -147,10 +147,22 @@
      * Next elements is a stack used during printing to store the
      * pre-value, name, namespace of the nodes currently being printed.
      */
-    int            stackPtr;
+    int         stackPtr;
     SerializeFrame tagStack[MAXTAGDEPTH];
-    /* */
-    void*      _private;   /* private application defined space */
+
+    /* xrpc response header things */
+    str         xrpc_module;
+    str         xrpc_method;  
+    str         xrpc_qid;
+    str         xrpc_caller;
+    str         xrpc_mode;
+    bit         xrpc_updating;
+    lng         xrpc_seqnr;
+    lng         xrpc_timeout;
+    lng         time_exec;
+
+    /* private application defined space */
+    void*      _private;   
 } XqueryCtx;
 
 /**
@@ -164,7 +176,7 @@
     const char* name;
     /* the initialization handler */
     bool (*init)(XqueryCtx* ctx, char* args, char* restag,
-                 char* resprefix, char* module, char* method);
+                 char* resprefix);
     /* the clean up handler */
     bool (*cleanup)(XqueryCtx* ctx);
 
@@ -242,8 +254,6 @@
 int
 xquery_print_result_DRIVER (
     str                 mode,
-    str                 moduleNS,
-    str                 method,
     serializeFunStruct *driverFun, /* unused */
     char               *driverArg, /* unused */
     BAT                *ws,
@@ -254,15 +264,23 @@
     BAT                *kind,
     BAT                *intVAL,
     BAT                *dblVAL,
-    BAT                *strVAL);
+    BAT                *strVAL,
+    /* xrpc response header things */
+    str                xrpc_module,   
+    str                xrpc_method,   
+    str                xrpc_qid, 
+    str                xrpc_caller, 
+    str                xrpc_mode,
+    bit                *xrpc_updating,
+    lng                *xrpc_seqnr,
+    lng                *xrpc_timeout,
+    lng                *xrpc_start);
 
 /* hack to allow direct calls in xrpc_client.mx */
 int
 xquery_print_result_driver (
     stream             *fp,
     str                 mode,
-    str                 module,
-    str                 method,
     serializeFunStruct *driverFun, /* unused */
     char               *driverArg, /* unused */
     BAT                *ws,
@@ -273,7 +291,17 @@
     BAT                *kind,
     BAT                *intVAL,
     BAT                *dblVAL,
-    BAT                *strVAL);
+    BAT                *strVAL,
+    /* xrpc response header things */
+    str                xrpc_module,   
+    str                xrpc_method,   
+    str                xrpc_qid, 
+    str                xrpc_caller, 
+    str                xrpc_mode,
+    bit                *xrpc_updating,
+    lng                *xrpc_seqnr,
+    lng                *xrpc_timeout,
+    lng                *time_exec);
 
 #endif /* SERIALIZE_H */
 @c
@@ -286,6 +314,7 @@
 #include <pf_config.h>
 #include "serialize.h"
 #include "pf_support.h"
+#include "xrpc_server.h"
 
 /**
  *
@@ -1314,8 +1343,6 @@
 createWsContext (XqueryCtx*        ctx,
                  BAT*              ws,
                  str               mode,
-                 str               module,
-                 str               method,
                  serializeFunStruct*    driverFun,
                  char*             driverArg,
                  stream*           fp)
@@ -1369,18 +1396,6 @@
         /* we may wrap each item in an element
            specifying its type */
         if (match(mode, "xrpc")) {
-            if (!module) {
-                fatal_err (ctx,
-                        "the namespace of called module is "
-                        "required in \"xrpc\" mode");
-                return PROBLEM;
-            }
-            if (!method) {
-                fatal_err (ctx,
-                        "the name of called function is "
-                        "required in \"xrpc\" mode");
-                return PROBLEM;
-            }
             resprefix = "xrpc";
             ctx->modes = ctx->modes | MODE_XRPC;
             /* in "XRPC" mode, the line "<?xml ...?>" is printed by
@@ -1471,7 +1486,7 @@
     else
         return PROBLEM;
     
-    if ( !ctx->driverFun->init(ctx, driverArg, restag, resprefix, module, 
method) )
+    if ( !ctx->driverFun->init(ctx, driverArg, restag, resprefix) )
         return PROBLEM;
 
     return SUCCESS;
@@ -1583,7 +1598,7 @@
         GDKerror("serialize.mx: unable to find document \"%s\" in working 
set!\n", docName);
     } else { 
         XqueryCtx  ctx_struct, *ctx = &ctx_struct;
-        if (createWsContext(ctx,ws,mode,NULL,NULL,driverFun,driverArg,GDKout)) 
{
+        if (createWsContext(ctx,ws,mode,driverFun,driverArg,GDKout)) {
            oid start_oid = doc_startOid(ctx,docIndex);
            if ( start_oid == oid_nil )
                return GDK_FAIL;
@@ -1668,8 +1683,6 @@
 xquery_print_result_driver (
     stream*             fp,
     str                 mode,
-    str                 module,
-    str                 method,
     serializeFunStruct *driverFun, /* unused */
     char               *driverArg, /* unused */
     BAT                *ws,
@@ -1680,7 +1693,17 @@
     BAT                *kind,
     BAT                *intVAL,
     BAT                *dblVAL,
-    BAT                *strVAL)
+    BAT                *strVAL,
+    /* xrpc response header things */
+    str                xrpc_module,   
+    str                xrpc_method,   
+    str                xrpc_qid, 
+    str                xrpc_caller, 
+    str                xrpc_mode,
+    bit                *xrpc_updating,
+    lng                *xrpc_seqnr,
+    lng                *xrpc_timeout,
+    lng                *time_exec)
 {
     TIMER_START();
 
@@ -1691,9 +1714,20 @@
     static BUN (*fun_k) (BAT *, oid);
 
     /* prepare serialization */ 
-    if ( !createWsContext (ctx, ws, mode, module, method, driverFun, 
driverArg, fp) )
+    if ( !createWsContext (ctx, ws, mode, driverFun, driverArg, fp) )
         return GDK_FAIL;
 
+    /* fill in the XRPC specific fields for the response header */
+    ctx->xrpc_module = xrpc_module;
+    ctx->xrpc_method = xrpc_method;
+    ctx->xrpc_qid = xrpc_qid;
+    ctx->xrpc_caller = xrpc_caller;
+    ctx->xrpc_mode = xrpc_mode;
+    ctx->xrpc_seqnr = xrpc_seqnr?*xrpc_seqnr:0;
+    ctx->xrpc_updating = xrpc_updating?*xrpc_updating:0;
+    ctx->xrpc_timeout = xrpc_timeout?*xrpc_timeout:0;
+    ctx->time_exec = time_exec?*time_exec:0;
+
     curcnt = 0;
     maxcnt = BATcount (item);
     buncnt = maxcnt;
@@ -1943,11 +1977,145 @@
     return GDK_SUCCEED;
 }
 
+int
+draw_queryflow(
+        int xrpc_updating,
+        lng xrpc_seqnr,
+        str xrpc_method,
+        lng time_exec,
+        BAT *participants)
+{
+    int ret = 0;
+    stream *s = NULL;
+    char *ptr = NULL, *logdir = xrpc_log_dir();
+    char base_name[2048], dotFile[2052], caller[1024], dst[1024];
+    char dstNID[1024], fcn[1024], time[64], *seqnr = NULL;
+    char dotcmd[1024];
+    BUN p, q;
+    BATiter bi;
+
+    if (logdir == NULL) return GDK_FAIL;
+    snprintf(base_name, 2048, "%s%cqflow_"LLFMT, logdir, DIR_SEP, xrpc_seqnr);
+    snprintf(dotFile, 2048, "%s.dot", base_name);
+
+    /* replace all non-alpha-numeric chars in the string with '_', so
+     * that it can be used as the ID of nodes in dot file */
+    strcpy(dstNID, xrpc_hostname);
+    for(ptr=dstNID; *ptr; ptr++) { 
+        if(!isalnum(*ptr)) *ptr = '_'; 
+    }
+    snprintf(ptr, 1024-(ptr-dstNID), "_%d", xrpc_port);
+
+    if(!(s = open_wastream(dotFile))) return GDK_FAIL;
+    ret = stream_printf(s,
+            "digraph G {\n"
+            " ratio=2\n"
+            " node [style=filled, color=\".7 .3 1.0\"];\n"
+            " subgraph cluster_%s {\n"
+            "  node [style=filled,color=\"%s\"];\n"   
+            "  style=filled;\n"
+            "  color=yellow;\n"
+            "  label=\"%s:%d\";\n"
+            "  %s_"LLFMT"[label=\"%s\"];\n"
+            " }\n"
+            " 
query->%s_"LLFMT"[headURL=\"http://%s:%d/logs/req_"LLFMT".xml\"]\n";
+            " 
%s_"LLFMT"->query[label=\""LLFMT"ms\",headURL=\"http://%s:%d/logs/res_"LLFMT".xml\"]\n\n";,
+            dstNID,
+            
(xrpc_updating==1)?"orange":(xrpc_updating==2)?"red":(xrpc_updating==3)?"green":".7
 .3 1.0",
+            xrpc_hostname, xrpc_port,
+            dstNID, xrpc_seqnr, xrpc_method,
+            dstNID, xrpc_seqnr, xrpc_hostname, xrpc_port, xrpc_seqnr,
+            dstNID, xrpc_seqnr, time_exec, xrpc_hostname, xrpc_port, 
xrpc_seqnr) < 0;
+
+    bi = bat_iterator(participants);
+    BATloop(participants, p, q) {
+        if (sscanf(BUNtail(bi,p), "%[^','],%[^','],%[^','],%s,%d", caller, 
dst, fcn, time, &xrpc_updating) != 5) {
+            GDKerror("draw_queryflow: sscanf failed");
+            stream_destroy(s);
+            return GDK_FAIL;
+        }
+        seqnr = strrchr(dst, ':');
+        if(!seqnr) {
+            GDKerror("draw_queryflow: invalid value of participant: %s.", dst);
+            stream_destroy(s);
+            return GDK_FAIL;
+        }
+        seqnr[0] = '\0'; /* cut off the seqnr from the dst string */
+        seqnr++;
+
+        ptr = caller;
+        do { if(!isalnum(ptr[0])) ptr[0] = '_'; ptr++; } while (ptr[0]);
+
+        strcpy(dstNID, dst);
+        ptr = dstNID;
+        do { if(!isalnum(ptr[0])) ptr[0] = '_'; ptr++; } while (ptr[0]);
+
+        ret = ret || (stream_printf(s,
+                " subgraph cluster_%s {\n"
+                "   node [style=filled,color=\"%s\"];\n"
+                "   style=filled;\n"
+                "   color=yellow;\n"
+                "   label=\"%s\";\n"
+                "   %s_%s[label=\"%s\"];\n"
+                " }\n"
+                " %s->%s_%s[headURL=\"http://%s/logs/req_%s.xml\"]\n";
+                " 
%s_%s->%s[label=\"%sms\",headURL=\"http://%s/logs/res_%s.xml\"]\n\n";,
+                dstNID,
+                
(xrpc_updating==1)?"orange":(xrpc_updating==2)?"red":(xrpc_updating==3)?"green":".7
 .3 1.0",
+                dst,
+                dstNID, seqnr, fcn,
+                caller, dstNID, seqnr, dst, seqnr,
+                dstNID, seqnr, caller, time, dst, seqnr) < 0);
+    }
+    ret = ret || (stream_write(s, "}", 1, 1) < 0);
+    stream_close(s);
+    stream_destroy(s);
+    
+    snprintf(dotcmd, 1024, "dot -Tcmapx -o%s.xml -Tgif -o%s.gif %s 2> %s.err", 
base_name, base_name, dotFile, dotFile);
+    if (ret || system(dotcmd) < 0) {
+        GDKerror("draw_queryflow: failed to generate query flow graph using 
\"dot\"");
+        return GDK_FAIL;
+    }
+
+    return GDK_SUCCEED;
+}
+
+
+char xrpc_logdir_buf[1024], *xrpc_logdir = NULL;
+char*
+xrpc_log_dir() {
+    char *logdir;
+    if (xrpc_logdir == NULL && (logdir = GDKgetenv("datadir")) != NULL) {
+        snprintf(xrpc_logdir_buf, 1024, "%s%cMonetDB%cxrpc%clogs%c", logdir, 
DIR_SEP, DIR_SEP, DIR_SEP, DIR_SEP);
+        if (GDKcreatedir(xrpc_logdir_buf)) {
+            xrpc_logdir = xrpc_logdir_buf;
+        } else {
+            GDKerror("get_xrpc_logdir: directory %s not writable.", 
xrpc_logdir_buf);
+        }
+    }
+    return xrpc_logdir;
+}
+
+
+stream*
+xrpc_log_message(str msg, lng xrpc_seqnr) {
+    char logfile[1024], *logdir = xrpc_log_dir();
+    stream* fp = NULL;
+    if (logdir) {
+        snprintf(logfile, 1024, "%s%s_" LLFMT ".xml", logdir, msg, xrpc_seqnr);
+        fp = open_wastream(logfile);
+    }
+    if (!fp || stream_errnr(fp)) {
+        GDKerror("print_result: could not open logfile for writing\n");
+        if (fp) stream_destroy(fp);
+        return NULL;
+    }
+    return fp;
+}
+
 int 
 xquery_print_result_DRIVER (
     str                 mode,
-    str                 moduleNS,
-    str                 method,
     serializeFunStruct *driverFun,
     char               *driverArg,
     BAT                *ws,
@@ -1958,15 +2126,43 @@
     BAT                *kind,
     BAT                *intVAL,
     BAT                *dblVAL,
-    BAT                *strVAL)
+    BAT                *strVAL,
+    /* xrpc response header things */
+    str                xrpc_module,   
+    str                xrpc_method,   
+    str                xrpc_qid, 
+    str                xrpc_caller, 
+    str                xrpc_mode,
+    bit                *xrpc_updating,
+    lng                *xrpc_seqnr,
+    lng                *xrpc_timeout,
+    lng                *xrpc_start)
 {
+    stream *fp = GDKout;
+    int ret, trace = xrpc_method && *xrpc_method && xrpc_mode && 
strstr(xrpc_mode, "trace");
     (void) driverFun;
     (void) driverArg;
-    return xquery_print_result_driver (
-               GDKout,
+
+    lng time_exec = (GDKusec() - *xrpc_start) / 1000;
+
+    if (trace) {
+        stream* logstream = xrpc_log_message("res",*xrpc_seqnr);
+        fp = logstream?attach_teestream(fp, logstream):NULL;
+        if (fp == NULL) return GDK_FAIL;
+        if (strcmp(xrpc_caller, "query") == 0) {
+            BATiter wsi = bat_iterator(ws);
+            BAT *participants = BATdescriptor(*(bat*) BUNtail(wsi, 
XRPC_PARTICIPANTS));
+            int ret = GDK_FAIL;
+            if (participants) {
+                ret = draw_queryflow(*xrpc_updating, *xrpc_seqnr, xrpc_method, 
time_exec, participants);
+                BBPunfix(participants->batCacheid);
+            }
+            if (ret == GDK_FAIL) return ret;
+        }
+    }
+    ret = xquery_print_result_driver (
+               fp,
                mode,
-               moduleNS,
-               method,
                driverFun, /* set of printing callback function */
                driverArg, /* optional arguments for the callback functions */
                ws,
@@ -1977,7 +2173,19 @@
                kind, /* kind relation */
                intVAL,
                dblVAL,
-               strVAL);
+               strVAL,
+               xrpc_module,   
+               xrpc_method,   
+               xrpc_qid, 
+               xrpc_caller, 
+               xrpc_mode, 
+               xrpc_updating, 
+               xrpc_seqnr, 
+               xrpc_timeout, 
+               &time_exec);
+  
+     if (trace) detach_teestream(fp);
+     return ret; 
 }
 
 #define FNDEEPEQTRACE 0
@@ -2372,7 +2580,7 @@
     mySerializeFun.handle_attribute = dach_handle_attribute;
 
     XqueryCtx  ctx_struct, *ctx = &ctx_struct;
-    if (!createWsContext(ctx,ws,"xml",NULL,NULL,&mySerializeFun,"",GDKout))
+    if (!createWsContext(ctx,ws,"xml",&mySerializeFun,"",GDKout))
         return GDK_FAIL;
     struct DuplAttrChk dach; /* hander of attribute equality check */
     ctx->_private = &dach;

Index: pf_support.mx
===================================================================
RCS file: /cvsroot/monetdb/pathfinder/runtime/pf_support.mx,v
retrieving revision 1.302
retrieving revision 1.303
diff -u -d -r1.302 -r1.303
--- pf_support.mx       17 Jun 2008 17:07:27 -0000      1.302
+++ pf_support.mx       3 Jul 2008 15:10:33 -0000       1.303
@@ -59,23 +59,34 @@
 .COMMAND print_doc(str,BAT[void,bat], str) : void = xquery_print_doc_main;
  "C interface to Workset print routine"
 
-.COMMAND print_result(str mode, str moduleNS, str method,
+.COMMAND print_result(str genType, 
                       BAT[oid,bat] ws,
                       BAT[oid,any] loop, BAT[void,oid] iter,
                       BAT[void,oid] item, BAT[void,int] kind, 
                       BAT[oid,lng] int_values, BAT[oid,dbl] dbl_values, 
                       BAT[oid,str] str_values) :
+                            void = xquery_print_result_basic;
+
+ "C interface to Workset result print routine, that can print multiple iters"
+.COMMAND print_result(str genType, 
+                      BAT[oid,bat] ws,
+                      BAT[oid,any] loop, BAT[void,oid] iter,
+                      BAT[void,oid] item, BAT[void,int] kind, 
+                      BAT[oid,lng] int_values, BAT[oid,dbl] dbl_values, 
+                      BAT[oid,str] str_values,
+                      str xrpc_module, str xrpc_method, str xrpc_qid, str 
xrpc_caller, 
+                      str xrpc_mode, bit xrpc_updating, lng xrpc_seqnr, lng 
xrpc_timeout, lng xrpc_start) :
                             void = xquery_print_result_loop;
  "C interface to Workset result print routine, that can print multiple iters"
 
-.COMMAND print_result(str mode, BAT[void,bat] ws,
+.COMMAND print_result(str genType, BAT[void,bat] ws,
                       BAT[void,oid] item, BAT[void,int] kind,
                       BAT[void,lng] int_values, BAT[void,dbl] dbl_values,
                       BAT[void,dbl] dec_values, BAT[void,str] str_values) :
                             void = xquery_print_result_main;
  "C interface to Workset result print routine"
 
-.COMMAND print_result(str file, str mode, BAT[void,bat] ws,
+.COMMAND print_result(str file, str genType, BAT[void,bat] ws,
                       oid item, int kind,
                       BAT[void,lng] int_values, BAT[void,dbl] dbl_values,
                       BAT[void,dbl] dec_values, BAT[void,str] str_values) :
@@ -3371,6 +3382,81 @@
   do_update_end(ws, affected_conts);
 }
 
+PROC collect_update_tape(bat[void, bat] ws, bat[void, oid] item, bat[void, 
int] kind, bat[void,lng] int_values, bat[void,str] str_values) : bit
+{
+  # convert MPS input to Algebra input
+  var cmd := [and]([lng](item.mirror()), 
3LL).ord_uselect(0LL).mirror().leftfetchjoin(item).leftfetchjoin(int_values); # 
[i,CMD]
+  var node_item := [oid]([+]([lng](cmd.mirror()), 
1)).leftfetchjoin(item).tmark([EMAIL PROTECTED]); # [j,ITEM] target nodes
+  var node_kind := [oid]([+]([lng](cmd.mirror()), 
1)).leftfetchjoin(kind).tmark([EMAIL PROTECTED]); # [j,KIND] target nodes
+  var item2 := [oid]([+]([lng](cmd.mirror()), 
2)).leftfetchjoin(item).tmark([EMAIL PROTECTED]); # [j,ITEM] parameter
+  var kind2 := [oid]([+]([lng](cmd.mirror()), 
2)).leftfetchjoin(kind).tmark([EMAIL PROTECTED]); # [j,KIND] parameter
+  var command := cmd.tmark([EMAIL PROTECTED]);
+  var node_types := node_kind.get_types(); # [j,ATTR/ELEM]
+  var node_conts := node_kind.get_container(); # [j,CONT]
+  var attr_tgt := node_types.ord_uselect(ATTR).mirror(); # [j,j] (attributes)
+  var attr_cont_tgt := 
command.mirror().outerjoin(attr_tgt.leftjoin(node_conts)); # [j,CONT/nil]
+  attr_tgt := command.mirror().outerjoin(attr_tgt.leftjoin(node_item)); # 
[j,ITEM/nil]
+  var pre_tgt := node_types.ord_uselect(ELEM).mirror(); # [j,j] (elements)
+  var pre_cont_tgt := 
command.mirror().outerjoin(pre_tgt.leftjoin(node_conts)); # [j,CONT/nil]
+  pre_tgt := command.mirror().outerjoin(pre_tgt.leftjoin(node_item)); # 
[j,ITEM/nil]
+
+  var renames := command.ord_uselect(UPDATE_RENAME).mirror(); # [j,j] (renames)
+  var rename_str := renames.leftjoin(item2).leftjoin(str_values); # 
[j,QNLOCAL/nil]
+  var rename_qn_local := command.mirror().outerjoin(rename_str); # 
[j,QNLOCAL/nil]
+  var rename_qn_uri := command.mirror().outerjoin(rename_str.project("")); # 
[j,""/nil]
+  var rename_qn_prefix := command.mirror().outerjoin(rename_str.project("")); 
# [j,""/nil]
+
+  var replaces := command.ord_uselect(UPDATE_REPLACE).mirror(); # [j,j] 
(replaces)
+  var replace_strings := 
command.mirror().outerjoin(replaces.leftjoin(item2).leftjoin(str_values)); # 
[j,REPLSTR/nil]
+
+  var inserts := command.ord_uselect(UPDATE_INSERT_FIRST, 
UPDATE_REPLACENODE).mirror(); # [j,j] (inserts)
+  var insert_types := inserts.leftjoin(kind2.get_types()); # [j,ATTR/ELEM]
+  var insert_conts := inserts.leftjoin(kind2.get_container()); # [j,ATTR/ELEM]
+  var insert_attrs := insert_types.ord_uselect(ATTR).mirror(); # [j,j]
+  var attr_ins := command.mirror().outerjoin(insert_attrs.leftjoin(item2));
+  var attr_cont_ins := 
command.mirror().outerjoin(insert_attrs.leftjoin(insert_conts));
+  var insert_elems := insert_types.ord_uselect(ELEM).mirror(); # [j,j]
+  var pre_ins := command.mirror().outerjoin(insert_elems.leftjoin(item2));
+  var pre_cont_ins := 
command.mirror().outerjoin(insert_elems.leftjoin(insert_conts));
+
+  ws.fetch(COLLECTED_COMMAND).append(command);
+  ws.fetch(COLLECTED_PRE_TGT).append(pre_tgt);
+  ws.fetch(COLLECTED_PRE_CONT_TGT).append(pre_cont_tgt);
+  ws.fetch(COLLECTED_ATTR_TGT).append(attr_tgt);
+  ws.fetch(COLLECTED_ATTR_CONT_TGT).append(attr_cont_tgt);
+  ws.fetch(COLLECTED_REPLACE_STRINGS).append(replace_strings);
+  ws.fetch(COLLECTED_RENAME_QN_URI).append(rename_qn_uri);
+  ws.fetch(COLLECTED_RENAME_QN_PREFIX).append(rename_qn_prefix);
+  ws.fetch(COLLECTED_RENAME_QN_LOCAL).append(rename_qn_local);
+  ws.fetch(COLLECTED_PRE_INS).append(pre_ins);
+  ws.fetch(COLLECTED_PRE_CONT_INS).append(pre_cont_ins);
+  ws.fetch(COLLECTED_ATTR_INS).append(attr_ins);
+  ws.fetch(COLLECTED_ATTR_CONT_INS).append(attr_cont_ins);
+ 
+  return (count(cmd) > 0);
+}
+
+PROC execute_update_tape(bat[void, bat] ws) : void
+{
+  var command := ws.fetch(COLLECTED_COMMAND).append(command);
+  var pre_tgt := ws.fetch(COLLECTED_PRE_TGT).append(pre_tgt);
+  var pre_cont_tgt := ws.fetch(COLLECTED_PRE_CONT_TGT).append(pre_cont_tgt);
+  var attr_tgt := ws.fetch(COLLECTED_ATTR_TGT).append(attr_tgt);
+  var attr_cont_tgt := ws.fetch(COLLECTED_ATTR_CONT_TGT).append(attr_cont_tgt);
+  var replace_strings := 
ws.fetch(COLLECTED_REPLACE_STRINGS).append(replace_strings);
+  var rename_qn_uri := ws.fetch(COLLECTED_RENAME_QN_URI).append(rename_qn_uri);
+  var rename_qn_prefix := 
ws.fetch(COLLECTED_RENAME_QN_PREFIX).append(rename_qn_prefix);
+  var rename_qn_local := 
ws.fetch(COLLECTED_RENAME_QN_LOCAL).append(rename_qn_local);
+  var pre_ins := ws.fetch(COLLECTED_PRE_INS).append(pre_ins);
+  var pre_cont_ins := ws.fetch(COLLECTED_PRE_CONT_INS).append(pre_cont_ins);
+  var attr_ins := ws.fetch(COLLECTED_ATTR_INS).append(attr_ins);
+  var attr_cont_ins := ws.fetch(COLLECTED_ATTR_CONT_INS).append(attr_cont_ins);
+
+  # XXX we should do some reordering of certain insert commands here
+
+  UpdateTape(ws, command, pre_tgt, pre_cont_tgt, attr_tgt, attr_cont_tgt, 
replace_strings, rename_qn_uri, rename_qn_prefix, rename_qn_local, pre_ins, 
pre_cont_ins, attr_ins, attr_cont_ins);
+}
+
 PROC play_update_tape(bat[void, bat] ws, bat[void, oid] item, bat[void, int] 
kind, bat[void,lng] int_values, bat[void,str] str_values) : void
 {
   # [void,oid] list of all conts of affected documents
@@ -3753,6 +3839,9 @@
       newattr := vx_maintain(elemnids, elemqns, attrqns, attrvals);
     }
 
+    if (xrpc_qid != "") 
+      xrpc_confirm_commit(xrpc_qid, xrpc_caller, xrpc_seqnr, xrpc_hdl);
+
     var newtext;
     {
       var prop_text := ws.fetch(_PROP_TEXT).find(cont);
@@ -3802,6 +3891,7 @@
 b.col_name(nme).print();
 }
 
+
 PROC do_log_updates(BAT[void,bat] ws, BAT[any,any] cont_order, BAT[oid,bit] 
map_pid_changed_bat) : void
 {
   var ws_logtime := usec(); 
@@ -3872,7 +3962,15 @@
     if (ws_log_active)
       ws_log(ws, "commit-LOG_SIZE exec" + str(ws_logtime - (ws_logtime := 
usec()))); 
   }
-  log_trans_end(pf_logger); # write commit record in WAL: ==> THIS IS THE 
COMMIT POINT <==
+
+  # 2PC transactions report back here ("Prepared") and must wait for the final 
Commit
+  if (xrpc_qid != "") {
+    log_trans_precommit(pf_logger); # write PRECOMMIT record
+    xrpc_wait_for_commit(xrpc_qid, xrpc_caller, xrpc_seqnr, xrpc_hdl);
+  } 
+
+  # write commit record in WAL: ==> THIS IS THE COMMIT POINT <==
+  log_trans_end(pf_logger); 
 
   if (ws_log_active)
     ws_log(ws, "commit-LOG_TRANS_END exec" + str(ws_logtime - usec()));
@@ -5736,6 +5834,28 @@
 #include <monet_interpreter.h>
 #include <monettime.h>
 
+extern MT_Lock pf_runtime_lock[7];
+#define PF_SHORT_LOCK        pf_runtime_lock[0]
+#define PF_WAL_LOCK          pf_runtime_lock[1]
+#define PF_FREE_LOCK         pf_runtime_lock[2]
+#define PF_EXTEND_LOCK       pf_runtime_lock[3]
+#define PF_META_LOCK         pf_runtime_lock[4]
+#define PF_UPDATE_LOCK       pf_runtime_lock[5]
+#define PF_XRPC_LOCK         pf_runtime_lock[6]
+#define PF_META_BARRIER      pf_runtime_sema[0]
+#define PF_UPDATE_BARRIER    pf_runtime_sema[1]
+#define PF_EXTEND_BARRIER    pf_runtime_sema[2]
+
+#define PF_MODE_RDONLY 0 /* read-only query */
+#define PF_MODE_DOCMGT 1 /* document management query */ 
+#define PF_MODE_UPDATE 2 /* updating query */
+#define PF_MODE_RETRY  3 /* updating query run for the second time (exclusive 
mode) */
+
+pf_support_export int     xrpc_port;
+pf_support_export char*   xrpc_hostname;
+pf_support_export stream* xrpc_log_message(str msg, lng xrpc_seqnr);
+pf_support_export char*   xrpc_log_dir();
+
 #endif
 @c
 
@@ -5745,7 +5865,10 @@
 #include <plain/algebra.h> /* needed for result size estimation in 
CMDenumerate */
 #include <math.h> /* needed for round_up */
 
[EMAIL PROTECTED]
+
+char *xrpc_hostname = NULL;
+int xrpc_port = 0;
+
 /* delete a file from the local tmp/ directory in the dbfarm; protect against 
abuse */
 int CMDcleantmpdir(lng *lim) {
         DIR *dirp = opendir("tmp");
@@ -7801,7 +7924,6 @@
        return GDK_SUCCEED;
 }
 
-
 typedef struct stack_item si;
 
 struct stack_item {
@@ -8131,30 +8253,15 @@
 @c
 #define PF_CONVOY 5
 BAT* ws_overlaps_ws = NULL;
-MT_Lock pf_runtime_lock[6];
+MT_Lock pf_runtime_lock[7];
 MT_Sema pf_runtime_sema[3];
 int pf_nreaders, pf_convoy, pf_ndocmgt;
 lng pf_writer, pf_special;
 
-#define PF_SHORT_LOCK        pf_runtime_lock[0]
-#define PF_WAL_LOCK          pf_runtime_lock[1]
-#define PF_FREE_LOCK         pf_runtime_lock[2]
-#define PF_EXTEND_LOCK       pf_runtime_lock[3]
-#define PF_META_LOCK         pf_runtime_lock[4]
-#define PF_UPDATE_LOCK       pf_runtime_lock[5]
-#define PF_META_BARRIER      pf_runtime_sema[0]
-#define PF_UPDATE_BARRIER    pf_runtime_sema[1]
-#define PF_EXTEND_BARRIER    pf_runtime_sema[2]
-
-#define PF_MODE_RDONLY 0 /* read-only query */
-#define PF_MODE_DOCMGT 1 /* document management query */ 
-#define PF_MODE_UPDATE 2 /* updating query */
-#define PF_MODE_RETRY  3 /* updating query run for the second time (exclusive 
mode) */
-
 /* get handle to the shared locks */
 int CMDpflock_get(ptr *ret, int* nr) {
-    *ret = (ptr) &pf_runtime_lock[(*nr)&3];
-    if (*nr > 3) *ret = (ptr) &PF_EXTEND_BARRIER; /* hack: do not feel like 
creating a CMDsema_get */
+    *ret = (ptr) &pf_runtime_lock[(*nr)&7];
+    if (*nr > 6) *ret = (ptr) &PF_EXTEND_BARRIER; /* hack: do not feel like 
creating a CMDsema_get */
     return GDK_SUCCEED;
 }
 
@@ -8388,8 +8495,6 @@
 int
 xquery_print_result_loop (
     str  mode,
-    str  moduleNS,
-    str  method,
     BAT* ws,
     BAT* loop, 
     BAT* iter, 
@@ -8397,13 +8502,21 @@
     BAT* kind,
     BAT* intVAL,
     BAT* dblVAL,
-    BAT* strVAL)
+    BAT* strVAL,
+    /* xrpc response header things */
+    str  xrpc_module,   
+    str  xrpc_method,   
+    str  xrpc_qid, 
+    str  xrpc_caller, 
+    str  xrpc_mode,
+    bit  *xrpc_updating,
+    lng  *xrpc_seqnr,
+    lng  *xrpc_timeout,
+    lng  *xrpc_start)
 {
     size_t niters = BATcount (loop);
     return xquery_print_result_DRIVER (
                mode,
-               moduleNS,
-               method,
                NULL, /* set of printing callback function */
                NULL, /* optional arguments for the callback functions */
                ws,
@@ -8414,7 +8527,49 @@
                kind, /* kind relation */
                intVAL,
                dblVAL,
-               strVAL);
+               strVAL,
+               xrpc_module,   
+               xrpc_method,   
+               xrpc_qid, 
+               xrpc_caller, 
+               xrpc_mode,
+               xrpc_updating,
+               xrpc_seqnr,
+               xrpc_timeout,
+               xrpc_start);
+}
+
+int
+xquery_print_result_basic (
+    str  mode,
+    BAT* ws,
+    BAT* loop, 
+    BAT* iter, 
+    BAT* item, 
+    BAT* kind,
+    BAT* intVAL,
+    BAT* dblVAL,
+    BAT* strVAL)
+{
+    return xquery_print_result_loop (
+               mode,
+               ws,
+               loop, /* loop relation */
+               iter, /* iter relation */
+               item, /* item relation */
+               kind, /* kind relation */
+               intVAL,
+               dblVAL,
+               strVAL,
+               NULL, /* xrpc_module   */  
+               NULL, /* xrpc_method   */  
+               NULL, /* xrpc_qid      */
+               NULL, /* xrpc_caller   */
+               NULL, /* xrpc_mode     */
+               NULL, /* xrpc_updating */
+               NULL, /* xrpc_seqnr    */
+               NULL, /* xrpc_timeout  */
+               NULL);/* xrpc_start    */
 }
 
 int
@@ -8430,14 +8585,9 @@
 {
     (void) decVAL;
     
-    return xquery_print_result_DRIVER (
+    return xquery_print_result_basic (
                mode,
-               NULL, /* module */
-               NULL, /* method */
-               NULL, /* set of printing callback function */
-               NULL, /* optional arguments for the callback functions */
                ws,
-               1, /* number of iterations */
                item, /* loop relation */
                item, /* iter relation */
                item, /* item relation */
@@ -8486,8 +8636,6 @@
                         ret = xquery_print_result_driver (
                              s,
                              mode,
-                             NULL, /* module */
-                             NULL, /* method */
                              NULL, /* set of printing callback function */
                              NULL, /* optional arguments for the callback 
functions */
                              ws,
@@ -8498,7 +8646,16 @@
                              k, /* kind relation */
                              intVAL,
                              dblVAL,
-                             strVAL);
+                             strVAL,
+                             NULL, /* xrpc_module */
+                             NULL, /* xrpc_method */
+                             NULL, /* xrpc_qid */
+                             NULL, /* xrpc_caller */
+                             NULL, /* xrpc_mode */
+                             NULL, /* xrpc_updating */
+                             NULL, /* xrpc_seqnr */
+                             NULL, /* xrpc_timeout */
+                             NULL);/* xrpc_start */
                          stream_destroy(s);
                     }
                     BBPreclaim(k);
@@ -8524,8 +8681,9 @@
     MT_init_lock(pf_runtime_lock[1], "PF_WAL_LOCK");
     MT_init_lock(pf_runtime_lock[2], "PF_FREE_LOCK");
     MT_init_lock(pf_runtime_lock[3], "PF_EXTEND_LOCK");
-    MT_init_lock(pf_runtime_lock[5], "PF_META_LOCK");
     MT_init_lock(pf_runtime_lock[4], "PF_UPDATE_LOCK");
+    MT_init_lock(pf_runtime_lock[5], "PF_META_LOCK");
+    MT_init_lock(pf_runtime_lock[6], "PF_XRPC_LOCK");
     MT_init_sema(pf_runtime_sema[0],1, "PF_META_BARRIER");
     MT_init_sema(pf_runtime_sema[1],1, "PF_UPDATE_BARRIER");
     MT_init_sema(pf_runtime_sema[2],1, "PF_EXTEND_BARRIER");
@@ -8546,6 +8704,7 @@
     MT_destroy_lock(pf_runtime_lock[3]);
     MT_destroy_lock(pf_runtime_lock[4]);
     MT_destroy_lock(pf_runtime_lock[5]);
+    MT_destroy_lock(pf_runtime_lock[6]);
     MT_destroy_sema(pf_runtime_sema[0]);
     MT_destroy_sema(pf_runtime_sema[1]);
     MT_destroy_sema(pf_runtime_sema[2]);

U xrpc_client.mx
Index: xrpc_client.mx
===================================================================
RCS file: /cvsroot/monetdb/pathfinder/runtime/xrpc_client.mx,v
retrieving revision 1.45
retrieving revision 1.46
diff -u -d -r1.45 -r1.46
--- xrpc_client.mx      7 Apr 2008 12:54:14 -0000       1.45
+++ xrpc_client.mx      3 Jul 2008 15:10:35 -0000       1.46
@@ -40,14 +40,22 @@
 
 @- HTTP client function(s)
 @m
+
+.USE lock;
+
 .COMMAND http_post(
-        str options,
+        str genType,
+        str mode,
[...1840 lines suppressed...]
+    snprintf(msg, 1024, XRPC_WSAT_REQ, mode, qid, *xrpc_timeout - (GDKusec() - 
*time_start), "Prepare");
+    for(i=0; i<cnt; i++) 
+       if (xrpc_2pc_send(sock[i], part[i], port[i], msg) == GDK_FAIL) break;
+    for(j=0; j<i; j++) 
+       if (xrpc_2pc_recv(sock[j], part[j], port[j], WSAT_NS"|Prepared") == 
GDK_FAIL) break;
+
+    if (j == cnt) ret = GDK_SUCCEED;
+    snprintf(msg, 1024, XRPC_WSAT_REQ, mode, qid, *xrpc_timeout - (GDKusec() - 
*time_start), (ret == GDK_SUCCEED) ? "Commit" : "Abort");
+    for(j=0; j<cnt; j++) 
+       if (xrpc_2pc_send(sock[j], part[j], port[j], msg) == GDK_FAIL) ret = 
GDK_FAIL;
+    for(i=0; i<j; i++) 
+       if (xrpc_2pc_recv(sock[i], part[i], port[i], WSAT_NS"|Committed") == 
GDK_FAIL) ret = GDK_FAIL;
+cleanup:
+    for(i=0; i<cnt; i++) {
+        if (part[i]) GDKfree(part[i]);
+        if (sock[i] >= 0) close(sock[i]);
+    }
+    return ret;
+}
 /* vim:set shiftwidth=4 expandtab: */

Index: serialize_dflt.mx
===================================================================
RCS file: /cvsroot/monetdb/pathfinder/runtime/serialize_dflt.mx,v
retrieving revision 1.46
retrieving revision 1.47
diff -u -d -r1.46 -r1.47
--- serialize_dflt.mx   7 Apr 2008 12:54:13 -0000       1.46
+++ serialize_dflt.mx   3 Jul 2008 15:10:34 -0000       1.47
@@ -40,7 +40,8 @@
 /* contains dummy callback functions */
 #include "serialize_null.h"
 #include "pathfinder.h"
-#include "xrpc_common.h"
+#include "pf_support.h"
+#include "xrpc_server.h" /* *_NS defs */
 
 /* a lot of characters, static strings, and their sizes 
    (the idea is to reuse constant character pointers during
@@ -78,10 +79,7 @@
 struct dflt_ws_t {
     char  *restag; /* result tag name */
     char  *resprefix; /* used in 'typed' and 'xrpc' modes to set the prefix */
-    /* Need these two variables to store the values of the attributes
-     * 'module' and 'method' for the 'xrpc' mode. */
-    char  *module;
-    char  *method;
+
     char  *newline, *esc_quote; /* newline and escaped quote string */
     size_t nl_sz, esq_sz; /* length of newline and escaped quote string */
     
@@ -244,7 +242,7 @@
  * dflt driver initialization function
  */
 static bool
-dflt_init (XqueryCtx* ctx, char* args, char *restag, char *resprefix, char 
*module, char *method)
+dflt_init (XqueryCtx* ctx, char* args, char *restag, char *resprefix)
 {
     (void) args;
 
@@ -263,10 +261,6 @@
     /* store result prefix and tag */
     dflt_ws->resprefix = resprefix;
     dflt_ws->restag    = restag;
-
-    dflt_ws->module = module;
-    dflt_ws->method = method;
-
     return SUCCESS;
 }
 
@@ -276,7 +270,7 @@
  *  is the '=' character that is printed after each newline.)
  */
 static bool
-mapi_init (XqueryCtx* ctx, char* args, char *restag, char *resprefix, char 
*module, char *method)
+mapi_init (XqueryCtx* ctx, char* args, char *restag, char *resprefix)
 {
     (void) args;
 
@@ -295,10 +289,6 @@
     /* store result prefix and tag */
     dflt_ws->resprefix = resprefix;
     dflt_ws->restag    = restag;
-
-    dflt_ws->module = module;
-    dflt_ws->method = method;
-
     return SUCCESS;
 }
 
@@ -306,13 +296,11 @@
  * seq driver initialization function
  */
 static bool
-esc_init (XqueryCtx* ctx, char* args, char *restag, char *resprefix, char 
*module, char *method)
+esc_init (XqueryCtx* ctx, char* args, char *restag, char *resprefix)
 {
     (void) args;
     (void) restag;
     (void) resprefix;
-    (void) module;
-    (void) method;
 
     /* create workspace container */
     ctx->driverWs = (void *) new_dflt_ws ();
@@ -1002,35 +990,56 @@
 static bool
 xrpc_startSerialize(XqueryCtx *ctx)
 {
-    stream_write(ctx->out, "HTTP/1.1 200 OK\r\n"
-            "Content-type: text/xml; charset=\"utf-8\"\r\n\r\n", 1, 60);
+    int len, ret = 0;
+   
 
-    /* We need to prepend "=" to each line, so make sure
-       that we print one after each newline (encoded in
-       newline string 'newline')->
-       In addition we print one '=' at the beginning-> */
-    if (ctx->modes & MODE_MAPI)
-        stream_write (ctx->out, &e_, 1, 1);
+    if (ctx->xrpc_qid[0] && ctx->time_exec > ctx->xrpc_timeout) {
+        GDKerror("xrpc_startSerialize: xrpc-query timed out\n");
+        return PROBLEM;
+    }
 
-    stream_printf(ctx->out, 
-            "<?xml version=\"1.0\" encoding=\"utf-8\"?>%s"
-            "<env:Envelope "
-            "xmlns:env=\"%s\" "
-            "xmlns:xrpc=\"%s\" "
-            "xmlns:xs=\"%s\" "
-            "xmlns:xsi=\"%s\" "
-            "xsi:schemaLocation=\"%s %s\">"
-            "<env:Body>"
-            "<xrpc:response xrpc:module=\"%s\" xrpc:method=\"%s\">",
-            dflt_ws->newline,
-            SOAP_NS,
-            XRPC_NS,
-            XS_NS,
-            XSI_NS,
-            XRPC_NS, XRPC_LOC,
-            dflt_ws->module, dflt_ws->method);
+    /* HACK: we use GDKout and not ctx->stdout because the logger stream 
should see only the XML content */
+    len = strlen(HTTP_200_OK);
+    ret = stream_write(GDKout, HTTP_200_OK, 1, len);
+    if(ret != len) return PROBLEM;
 
-    return SUCCESS;
+    len = strlen(SOAP_ENVELOPE);
+    ret = stream_write(ctx->out, SOAP_ENVELOPE, 1, len);
+    if(ret != len) return PROBLEM;
+
+    if (ctx->xrpc_qid[0] || strstr(ctx->xrpc_mode,"trace")) {
+        BATiter bi = bat_iterator(ctx->ws);
+        bat bid = *(bat*) BUNtail(bi, XRPC_PARTICIPANTS);
+        BAT* b = BATdescriptor(bid);
+        BUN p,q;
+
+        if (b == NULL) return PROBLEM;
+
+        ret = stream_printf(ctx->out, "<env:Header>\n");
+        if (ret >= 0 && ctx->xrpc_qid[0])
+            ret = stream_printf(ctx->out, XRPC_WS_QID, ctx->xrpc_qid, 
ctx->xrpc_timeout);
+
+        /* XRPC participants lists for nested transactions - append an extra 
item for this call */
+        if(ret >= 0)
+            ret = stream_printf(ctx->out, 
+                " <xrpc:participants>\n  
<xrpc:participant>%s,%s:%d:"LLFMT",%s,"LLFMT",%d</xrpc:participant>\n",
+                ctx->xrpc_caller, xrpc_hostname, xrpc_port, ctx->xrpc_seqnr, 
ctx->xrpc_method, ctx->time_exec,
+                (int) ctx->xrpc_updating);
+
+        /* print all nested calls (obtained from response messages)  */
+        bi = bat_iterator(b);
+        BATloop(b,p,q) {
+            if (ret < 0) break;
+            ret = stream_printf(ctx->out, "  
<xrpc:participant>%s</xrpc:participant>\n", BUNtail(bi,p));
+        }
+        if (ret >= 0) 
+            ret = stream_printf(ctx->out, " 
</xrpc:participants>\n</env:Header>\n");
+
+        BBPunfix(bid);
+        if (ret < 0) return PROBLEM;
+    }
+    ret = stream_printf(ctx->out, XRPC_RES_BODY, ctx->xrpc_module, 
ctx->xrpc_method);
+    return (ret < 0)?PROBLEM:SUCCESS;
 }
 
 /**

U shredder.mx
Index: shredder.mx
===================================================================
RCS file: /cvsroot/monetdb/pathfinder/runtime/shredder.mx,v
retrieving revision 1.136
retrieving revision 1.137
diff -u -d -r1.136 -r1.137
--- shredder.mx 14 May 2008 20:00:01 -0000      1.136
+++ shredder.mx 3 Jul 2008 15:10:35 -0000       1.137
@@ -716,7 +716,7 @@
     {
         return BUNappend(histo, &cnt, TRUE)?res:oid_nil;
     } else if (res != oid_nil) {
-        BUN p = BUNlast(histo) - 1;
+        BUN p = (BUN) res;
         cnt = 1 + *(lng*) Tloc(histo,p);
         return BUNinplace(histo, p, NULL, &cnt, TRUE)?res:oid_nil;
     }
@@ -807,7 +807,7 @@
 #ifdef DEBUG
         stream_printf(GDKout, "CALL %s:start_document()\n", 
shredCtx->serFun->name);
 #endif
-            shredCtx->serFun->init(shredCtx->serCtx, "", NULL, NULL, NULL, 
NULL);
+            shredCtx->serFun->init(shredCtx->serCtx, "", NULL, NULL);
             
shredCtx->serFun->handle_startDocument(shredCtx->serCtx,shredCtx->nnode_pre);
     }
 }
@@ -1560,7 +1560,7 @@
     if (shredCtx == NULL) return NULL;
 
     /* fill it */
-    int i = 4;
+    int i = 9;
     memset(shredCtx, 0, sizeof(shredCtxStruct)); 
     shredCtx->location  = location;
     shredCtx->fileSize  = fileSize;

Index: Makefile.ag
===================================================================
RCS file: /cvsroot/monetdb/pathfinder/runtime/Makefile.ag,v
retrieving revision 1.86
retrieving revision 1.87
diff -u -d -r1.86 -r1.87
--- Makefile.ag 20 May 2008 10:49:07 -0000      1.86
+++ Makefile.ag 3 Jul 2008 15:10:32 -0000       1.87
@@ -100,9 +100,7 @@
 
 lib__xrpc_client = {
         DIR = libdir/MonetDB4
-        SOURCES = \
-                                 xrpc_common.mx \
-                                 xrpc_client.mx
+        SOURCES = xrpc_client.mx
         LIBS = \
                           libserialize $(PF_LIBS) $(SOCKET_LIBS) 
./lib_pf_support ./lib_pathfinder \
                           $(MONETDB_LIBS) -lbat -lstream $(MONETDB4_LIBS) 
-lmonet \
@@ -113,7 +111,6 @@
         DIR = libdir/MonetDB4
         SOURCES = \
                                  shttpd.c shttpd.h \
-                                 xrpc_common.mx \
                                  xrpc_server.mx
         LIBS = \
                 ../compiler/libcompiler1 \
@@ -140,5 +137,5 @@
 headers_mil = {
        HEADERS = mil
         DIR = libdir/MonetDB4
-        SOURCES = pathfinder.mx pf_support.mx pf_standoff.mx xrpc_client.mx 
xrpc_server.mx
+        SOURCES = pathfinder.mx pf_support.mx pf_standoff.mx xrpc_client.mx 
xrpc_server.mx 
 }

U xrpc_server.mx
Index: xrpc_server.mx
===================================================================
RCS file: /cvsroot/monetdb/pathfinder/runtime/xrpc_server.mx,v
retrieving revision 1.69
retrieving revision 1.70
diff -u -d -r1.69 -r1.70
--- xrpc_server.mx      5 Jun 2008 09:21:08 -0000       1.69
+++ xrpc_server.mx      3 Jul 2008 15:10:36 -0000       1.70
@@ -43,35 +43,47 @@
 .COMMAND rpcd_start(int port, bit open, str options) : void = CMDrpcd_start;
 "Start the HTTP server for RPC calls on the specified port."
 
+.COMMAND my_hostname() : str = CMDmy_hostname;
+"Returns the hostname of the localhost."
+
[EMAIL PROTECTED] 2pc
+very basic 2pc implementation. we do not do aborts yet (failures just lead to
+timeout). Also, recovery is not yet implemented (ie finding out after a 
precommit
+record without commit whether the transaction succeeded or not).
[...1801 lines suppressed...]
+}
+
+
 void xrpc_epilogue(void)
 {
     shttpd_fini();      /* Shut down the HTTP server. */
@@ -1167,13 +1579,5 @@
     if (listen_socket >= 0)
         close(listen_socket);
     listen_socket = -1;
-    if (xrpc_trusted) {
-        BBPunfix(xrpc_trusted->batCacheid);
-        xrpc_trusted = NULL;
-    }
-    if (xrpc_admin) {
-        BBPunfix(xrpc_trusted->batCacheid);
-        xrpc_admin = NULL;
-    }
 }
 /* vim:set shiftwidth=4 expandtab: */

Index: serialize_null.mx
===================================================================
RCS file: /cvsroot/monetdb/pathfinder/runtime/serialize_null.mx,v
retrieving revision 1.10
retrieving revision 1.11
diff -u -d -r1.10 -r1.11
--- serialize_null.mx   11 Jan 2008 10:47:20 -0000      1.10
+++ serialize_null.mx   3 Jul 2008 15:10:34 -0000       1.11
@@ -34,7 +34,7 @@
 
 #include "serialize.h"
 
-bool null_init (XqueryCtx *ctx, char *args, char *restag, char *resprefix, 
char *module, char *method);
+bool null_init (XqueryCtx *ctx, char *args, char *restag, char *resprefix);
 bool null_cleanup (XqueryCtx *ctx);
 bool null_startSerialize (XqueryCtx *ctx);
 bool null_endSerialize (XqueryCtx *ctx);
@@ -76,14 +76,12 @@
  * NULL driver initialization function
  */
 bool
-null_init (XqueryCtx *ctx, char *args, char *restag, char *resprefix, char 
*module, char *method)
+null_init (XqueryCtx *ctx, char *args, char *restag, char *resprefix)
 {
     (void) ctx;
     (void) args;
     (void) restag;
     (void) resprefix;
-    (void) module;
-    (void) method;
 
     ctx->driverWs = NULL; /* driverWs not used */
     return SUCCESS;


-------------------------------------------------------------------------
Sponsored by: SourceForge.net Community Choice Awards: VOTE NOW!
Studies have shown that voting for your favorite open source project,
along with a healthy diet, reduces your potential for chronic lameness
and boredom. Vote Now at http://www.sourceforge.net/community/cca08
_______________________________________________
Monetdb-pf-checkins mailing list
[email protected]
https://lists.sourceforge.net/lists/listinfo/monetdb-pf-checkins

Reply via email to