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

Modified Files:
      Tag: XQuery_0-16
        pathfinder.mx xrpc_server.mx 
Log Message:
added the admin SOAP module, with which MXQ can be administered over SOAP 

compiler/compile.c
- fixed support for xrpc:// to distinguish between remapped
  GET requests (ie those that do fn:doc()) and normal
  GET requests (ie file serving). Based on file extension..
 
compiler/mil/milprint_summer.c
- fix in time_shred bokkeeping (do not use :+= for the dead-code elim)
- fix in fn:put (iter's are oids)
- added support for document management functions (dm PROC name prefix)

runtime/pathfinder.mx:
- separated out index flush PROC (_runtime_flush())
- added support for document managemnt functions (catch dm PROC name prefix)
- fix printing mode of remapped GET requests

runtime/xrpc_server.mx
- fix pseudo XRPC message generated for remapped GET requests
- fix HTTP document root initialization
- export xrpc_port such that PFurlcache can see it




Index: pathfinder.mx
===================================================================
RCS file: /cvsroot/monetdb/pathfinder/runtime/pathfinder.mx,v
retrieving revision 1.288.2.14
retrieving revision 1.288.2.15
diff -u -d -r1.288.2.14 -r1.288.2.15
--- pathfinder.mx       16 Feb 2007 09:20:08 -0000      1.288.2.14
+++ pathfinder.mx       17 Feb 2007 01:10:38 -0000      1.288.2.15
@@ -631,19 +631,21 @@
     quit(); 
 }
 
+
 # the logger background thread
+var logger_base := 0;
 PROC pf_logmanager() : void {
-    var base := logger_changes(pf_logger);
+    logger_base := logger_changes(pf_logger);
     var cnt := 0;
     while(true) {
         var changes := logger_changes(pf_logger);
-        var delta := changes - base;
+        var delta := changes - logger_base;
         if (((cnt :+= 1) % 10) = 0) { 
             cleantmpdir((msec() / 1000LL) - 3600LL);
         }
         if (((delta < 0) or (delta > 100000)) and (cnt > 10)) { 
             pf_logflush(0LL);
-            base = changes;
+            logger_base = changes;
             cnt := 0;
         } 
         sleep(30);  
@@ -1576,6 +1578,14 @@
                        .project(wsid).reverse();                           
 }
 
+# throw away all index structures! Running queries keep referencing all 
runtime bats they already opened.
+PROC _runtime_flush() : void
+{
+    var shortlocks := [fetch]([reverse](colname_runtime), RT_LOCK_FREELIST);
+    var longlocks := [fetch]([reverse](colname_runtime), RT_NID_FREELIST);
+    var runtimes := [_runtime_create](colname_runtime.mirror(), shortlocks, 
longlocks);
+    colname_runtime.delete().insert(runtimes); 
+}
 
 PROC _ws_opencoll(lng wsid, 
                   oid coll_oid) : BAT[lock,bat]
@@ -1609,12 +1619,7 @@
         var indices := 
[count](reverse(colname_runtime).mirror()).ord_uselect(RT_QN_NID_UNQ, int_nil);
         if (bit(count(indices))) {
             var totsize := [fetch](reverse(indices), 
RT_QN_NID_UNQ).[seqbase]().[lng]().sum();
-            if (totsize > (mem_maxsize()/4LL)) {
-                var shortlocks := [fetch]([reverse](colname_runtime), 
RT_LOCK_FREELIST);
-                var longlocks := [fetch]([reverse](colname_runtime), 
RT_NID_FREELIST);
-                var runtimes := [_runtime_create](colname_runtime.mirror(), 
shortlocks, longlocks);
-                colname_runtime.delete().insert(runtimes); 
-            }
+            if (totsize > (mem_maxsize()/4LL)) _runtime_flush();
         }
     }
     return runtime;
@@ -3823,9 +3828,10 @@
     xquery_sig* sig;
     int update = 0, len = 0;
 
-    /* proc names string with 'up' are updating functions */
     if (proc[0] == 'u' && proc[1] == 'p') {
-        update = 1;
+        update = 1; /* proc names starting with 'up' are updating functions */
+    } else if (proc[0] == 'd' && proc[1] == 'm') {
+        update = 2; /* proc names starting with 'dm' are document management 
functions */
     } else if (proc[0] != 'f' || proc[1] != 'n') {
         return NULL;
     }
@@ -5362,7 +5368,7 @@
 {
     xquery_client *ctx = (xquery_client*) mc->fc;
     lng usec = GDKusec();
-    char *mode = (flags&2)?"timing-xml-noheader":"timing-xml-noheader-xrpc";
+    char *mode = (flags&2)?"timing-xml":"timing-xml-noheader-xrpc";
     char *err, *buf, *ns = "fn";
     stream *s = NULL;
 

Index: xrpc_server.mx
===================================================================
RCS file: /cvsroot/monetdb/pathfinder/runtime/xrpc_server.mx,v
retrieving revision 1.7.2.6
retrieving revision 1.7.2.7
diff -u -d -r1.7.2.6 -r1.7.2.7
--- xrpc_server.mx      15 Feb 2007 01:46:14 -0000      1.7.2.6
+++ xrpc_server.mx      17 Feb 2007 01:10:38 -0000      1.7.2.7
@@ -163,12 +163,12 @@
                                " xrpc:method=\"%s\">"
 #define XRPC_HTTP_CALL "<xrpc:call>"\
                         "<xrpc:sequence>"\
-                         "<xrpc:atomic-value 
xsi:type=\"xs:string\">%s</xrpc:atomic-value>"\
+                         "<xrpc:atomic-value 
xsi:type=\"xs:string\">\"%s\"</xrpc:atomic-value>"\
                         "</xrpc:sequence>"\
                        "</xrpc:call>"
 #define XRPC_PUT_CALL  "<xrpc:call>"\
                         "<xrpc:sequence>"\
-                         "<xrpc:atomic-value 
xsi:type=\"xs:string\">%s</xrpc:atomic-value>"\
+                         "<xrpc:atomic-value 
xsi:type=\"xs:string\">\"%s\"</xrpc:atomic-value>"\
                         "</xrpc:sequence>"\
                         "<xrpc:sequence>"\
                          "<xrpc:element>%s</xrpc:element>"\
@@ -245,29 +245,28 @@
         size_t len = 2000 + strlen(docname);
         if (strcmp(shttpd_get_method(arg), "PUT") == 0) len += strlen(req_msg);
 
-        strptr = del = p = (char*) GDKmalloc(len);
+        req_msg = del = p = (char*) GDKmalloc(len);
         if (del == NULL) {
             send_err(out, 1, ERR500, "env:Receiver", OUT_OF_MEM);
             return NULL;
         }
 
         /* the PUT, GET and DELETE methods are implemented in this module */
-        sprintf(uri, "http://localhost:%d/admin/http.xq";, rpcd_running);
+        sprintf(uri, "http://localhost:%d/admin/admin.xq";, rpcd_running);
 
         /* create a fake XRPC message for  GET/PUT/DELETE (=method) that 
invoke xrpc:method(URI) */
         p += sprintf(p, XRPC_HEADER, SOAP_NS, XRPC_NS, XS_NS, XSI_NS, XRPC_NS, 
XRPC_LOC,
-            "http", uri, shttpd_get_method(arg));
+            "http://monetdb.cwi.nl/XQuery/admin/";, uri, 
shttpd_get_method(arg));
         p += sprintf(p, body_format, docname, req_msg);   
         strcpy(p, XRPC_FOOTER);
-    } else {
-        /* Remove the first line of the message, which containing
-         * "<?xml...?>", so that the message we pass to CMDshred2bats starts
-         * directly with <env:Envelope ...> */
-        strptr  = req_msg + 7; /* strlen("<?xml...?>") >= 7 */
-        if ((strstr(req_msg, "<?xml") != req_msg) || (strptr = strchr(strptr, 
(int)'<')) == NULL ) {
-            send_err(out, 1, ERR404, "env:Sender", NOT_WELL_FORMED);
-            return NULL;
-        }
+    }
+    /* Remove the first line of the message, which containing
+     * "<?xml...?>", so that the message we pass to CMDshred2bats starts
+     * directly with <env:Envelope ...> */
+    strptr = req_msg + 7; /* strlen("<?xml...?>") >= 7 */
+    if ((strstr(req_msg, "<?xml") != req_msg) || (strptr = strchr(strptr, 
(int)'<')) == NULL ) {
+        send_err(out, 1, ERR404, "env:Sender", NOT_WELL_FORMED);
+        return NULL;
     }
     if (!(shredBAT = BATnew(TYPE_str, TYPE_bat, 32))) {
         send_err(out, 1, ERR500, "env:Receiver", OUT_OF_MEM);
@@ -869,6 +868,7 @@
     return -1;
 }
 
+extern int xrpc_port;
 int
 CMDhttpd_start(int* port, str option)
 {
@@ -876,14 +876,14 @@
     char *s = "/usr/share/", docdir[1024]; /* httpd serves out 
/usr/share/MonetDB/xrpc/ */
     BUN p = BUNfnd(GDKenv, "datadir"); /* normally use 'datadir' iso 
/usr/share  (often datdir = prefix/share) */
     if (p) s = BUNtail(GDKenv,p); 
-    snprintf(docdir, 1024, "%s%cMonetDB%cxrpc%c", s, DIR_SEP, DIR_SEP, 
DIR_SEP);
+    snprintf(docdir, 1024, "%s%cshare%cMonetDB%cxrpc%c", s, DIR_SEP, DIR_SEP, 
DIR_SEP, DIR_SEP);
        
     if (rpcd_running) {
         GDKerror("CMDhttpd_start: RPC receiver already running\n");
         return GDK_FAIL;
     }
 
-    rpcd_running = *port;
+    xrpc_port = rpcd_running = *port;
 
     if (option && strstr(option, "timing") != NULL)
         timing = 1;


-------------------------------------------------------------------------
Take Surveys. Earn Cash. Influence the Future of IT
Join SourceForge.net's Techsay panel and you'll get the chance to share your
opinions on IT & business topics through brief surveys-and earn cash
http://www.techsay.com/default.php?page=join.php&p=sourceforge&CID=DEVDEV
_______________________________________________
Monetdb-pf-checkins mailing list
[email protected]
https://lists.sourceforge.net/lists/listinfo/monetdb-pf-checkins

Reply via email to