Update of /cvsroot/monetdb/pathfinder/compiler/mil
In directory sc8-pr-cvs16.sourceforge.net:/tmp/cvs-serv18847/compiler/mil

Modified Files:
      Tag: xrpcdemo
        milprint_summer.c 
Log Message:
Initial 2PC implementation

THIS CODE COMPILES, BUT IS NOT TESTED/DEBUGGED. IT DOES NOT WORK!!

JUST CHECKED IN TO PROVUIDE JENNIE SOME WORK AND I CAN GIVE BACK THE CST LAPTOP


pathfinder.mx:
==============
- add xquery_2pc_prepare(mapi_client *mc, str qid, ptr hdl)
  a function that fires off the MIL proc for 2PC commit (when a Prepare request 
comes in)

 
pf_support.mx
=============
- collect_update_tape() now returns whether the tape actually containes updates 
(bit)
  this allows us to exclude peers from the 2PC thing that were only marked as 
updating 
  peers because they did an execute at of an updating function. 

- remove do_2phase_commit() : void
  add log_trans_precommit / xrpc_wait_for_commit in commit protocol 


xrpc_client.mx:
===============
- xrpc_2pc_send/xrpc_2pc_receive
  helper functions that send and receive a WSAT message

- CMDxrpc_2pc_commit(str qid, lng* xrpc_timeout, lng* time_start, BAT* 
participants)

  a new MIL command that performs 2PC commit coordination, sending out Prepare 
to
  all participants, and then Commit/Abort to all (depending on the success of 
Prepare)

xrpc_server.mx & xrpc_client.mx:
================================
- the mode attribute is now part of the XRPC SOAP header in a new element 
(xrpc:header) 
  this is required as Prepare/Commit also need a mode but do not have an 
xrpc:request
  where mode was previously an attribute.


xrpc_server.mx:
===============
some whitespace changes in xrpc_parse_message. skip_text_nodes not only skips 
text nodes
now, but in fact all nodes that are not elements.

renames
- get_xrpc_logdir => xrpc_log_dir
- xquery_print_trace => xrpc_log_message

xrpc_handle_wsat request that handles HTTP POST requests starting with the 
"xrpc/wsat" prefix.
WSAT message parsing is rudimentary.

two new MIL commands for 2PC:
.COMMAND xrpc_wait_for_commit(str qid, str caller, lng seqnr, ptr response) : 
void = CMDxrpc_2pc_wait;
"report back Prepared, wait for Commit"
.COMMAND xrpc_confirm_commit(str qid, str caller, lng seqnr, ptr response) : 
void = CMDxrpc_2pc_confirm;
"report back Committed"

a new xrpc_commit_t handle struct that is used when a Prepare comes in to 
record all details of the
incoming HTTP request. A new xrpc_handle_wsat_request then fires off a MIL 
execution to commit
the accumulated pending update list. In the middle of the ensuing MIL commit, 
xrpc_wait_for_commit()
(see above) is then called with a pointer to the handle (passed in the 
query-global MIL variable xrpc_hdl)  
This COMMAND then sends back the HTTP response on the still open stream and 
starts waiting on a 
semaphore. This semaphore is unlocked when a Commit message comes in (with 
matching qid).
Then the MIL commit resumes until collaing back to xrpc_confirm_commit, that 
again sends back
the HTTP response.



serialize.mx:
============
add (orange,green) colors for Commit/Prepare calls in dot print.


milprint_summer.c:
==================
- use the dirty bit returned by collect_update_tape to properly mark a 
participant as a 
  real updater, i.e. updating= { bit(nil)=>rdonly, false=>nothing updated, 
true=>dirty }  

- add call to xrpc_commit() in the query epilogue, if the query is the XRPC 2PC 
corrdinator 



U milprint_summer.c
Index: milprint_summer.c
===================================================================
RCS file: /cvsroot/monetdb/pathfinder/compiler/mil/milprint_summer.c,v
retrieving revision 1.419.4.13
retrieving revision 1.419.4.14
diff -u -d -r1.419.4.13 -r1.419.4.14
--- milprint_summer.c   12 Jun 2008 14:47:27 -0000      1.419.4.13
+++ milprint_summer.c   17 Jun 2008 16:32:19 -0000      1.419.4.14
@@ -11424,6 +11424,7 @@
         "# variables that determine the behavior of XRPC queries\n"
         "var xrpc_qid := \"\";         # qid remains empty for non-2pc 
queries\n"
         "var xrpc_caller := \"\";      # qid is caller-id of the root of the 
XRPC tree\n"
+        "var xrpc_hdl := ptr(0);       # handle to link Prepare messages with 
Commit messages.\n"
         "var xrpc_seqnr := 0LL;        # if this query is an XRPC request, a 
session-unique nr\n" 
         "var xrpc_timeout := 30000LL;  # configurable usec timeout\n"
         "var xrpc_mode := \"none\";    # format: 
(none|repeatable)[-iterative][-trace]\n"
@@ -11557,20 +11558,20 @@
         "  time_exec := time_print - time_start;\n"
 #define PF_STOPMIL_RDONLY_BODY\
         "  # 'none' could theoretically occur in genType as root tagname 
('xml-root-none'), so check for 'xml'\n"\
-        "  if (xrpc_coord) xrpc_shredBAT;\n"\
         "  if ((genType.search(\"none\") < 0) or (genType.search(\"xml\") >= 
0))\n"\
         "   
print_result(genType,ws,tunique(iter),constant2bat(iter),item.materialize(ipik),constant2bat(kind),int_values,dbl_values,str_values,\n"\
-        "                
xrpc_module,xrpc_method,xrpc_qid,xrpc_caller,xrpc_mode,false,xrpc_seqnr,xrpc_timeout,time_start);\n"
+        "                
xrpc_module,xrpc_method,xrpc_qid,xrpc_caller,xrpc_mode,bit_nil,xrpc_seqnr,xrpc_timeout,time_start);\n"
 #define PF_STOPMIL_UPDATE_BODY\
-        "  if (xrpc_coord) xrpc_shredBAT;\n"\
-        "  if (xrpc_method != \"\") \n"\
-        "    
print_result(genType,ws,empty_bat,empty_bat,empty_bat,bat(void,int),int_values,dbl_values,str_values,\n"\
-        "                  
xrpc_module,xrpc_method,xrpc_qid,xrpc_caller,xrpc_mode,true,xrpc_seqnr,xrpc_timeout,time_start);\n"\
+        "  var dirty := bit_nil;\n"\
         "  if (xrpc_qid != \"\") {\n"\
-        "    collect_update_tape(ws, item.materialize(ipik), 
kind.materialize(ipik), int_values, str_values);\n"\
+        "    dirty := collect_update_tape(ws, item.materialize(ipik), 
kind.materialize(ipik), int_values, str_values);\n"\
         "  } else {\n"\
         "    play_update_tape(ws, item.materialize(ipik), 
kind.materialize(ipik), int_values, str_values);\n"\
-        "  }\n"
+        "  }\n"\
+        "  if (xrpc_coord) xrpc_commit(xrpc_qid, xrpc_mode, xrpc_timeout, 
time_start, ws.find(XRPC_PARTICIPANTS));"\
+        "  if (xrpc_method != \"\") \n"\
+        "    
print_result(genType,ws,empty_bat,empty_bat,empty_bat,bat(void,int),int_values,dbl_values,str_values,\n"\
+        "                  
xrpc_module,xrpc_method,xrpc_qid,xrpc_caller,xrpc_mode,dirty,xrpc_seqnr,xrpc_timeout,time_start);\n"
 #define PF_STOPMIL_DOCMGT_BODY\
         "  play_doc_tape(ws, item.materialize(ipik), kind.materialize(ipik), 
int_values, str_values);\n"
 #define PF_STOPMIL_RDONLY PF_STOPMIL_START\


-------------------------------------------------------------------------
Check out the new SourceForge.net Marketplace.
It's the best place to buy or sell services for
just about anything Open Source.
http://sourceforge.net/services/buy/index.php
_______________________________________________
Monetdb-pf-checkins mailing list
[email protected]
https://lists.sourceforge.net/lists/listinfo/monetdb-pf-checkins

Reply via email to