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

Modified Files:
      Tag: XQuery_0-24
        pf_support.mx 
Log Message:
This fixes bug [ 1981852 ] PF/alg: test immune_for_updates.SF-1766259
fails.
Even though the test already succeeded again after Lefteris'
order-reversal-for-inserts checkin, there was really still a bug.
This bug could be seen by changing

let $todo := subsequence(doc("prepared49736.data")/XIRAF/item[*], 1281,256)

to

let $todo := reverse(subsequence(doc("prepared49736.data")/XIRAF/item[*], 
1281,256))

towards the end of the test (note the identifying 1281).

The bug resulted in a document where the nodes were not properly
nested, and this was the result of columns whose values became largely
nil.  This again was the result of a missing copy() of a slice of a
bat which was used to update the parent bat.

So this fix adds the copy().

It also adds some debug stuff and replaces a couple of instances of
reverse().mark().reverse() with tmark().


U pf_support.mx
Index: pf_support.mx
===================================================================
RCS file: /cvsroot/monetdb/pathfinder/runtime/pf_support.mx,v
retrieving revision 1.299.2.4
retrieving revision 1.299.2.5
diff -u -d -r1.299.2.4 -r1.299.2.5
--- pf_support.mx       6 Jun 2008 21:00:46 -0000       1.299.2.4
+++ pf_support.mx       8 Jun 2008 13:38:36 -0000       1.299.2.5
@@ -2894,7 +2894,7 @@
 # destination *must* be a hole (XXX check this).
 # size *must* be smaller than a page
 # from + size + delta (delta > 0) *must be on the same page as from
-# deom + size *must be on the same page as from + delta (delta < 0)
+# from + size *must be on the same page as from + delta (delta < 0)
 # Delta can be positive (move data down) or negative (move data up).
 PROC movedata(bat[void,bat] ws, oid cont, oid from, int size, int delta): void
 {
@@ -3109,13 +3109,13 @@
   # the PRE_SIZE table has the correct sizes, but we now need to
   # actually move the data in all PRE tables
   var update_hole;
-  var from_pre := swizzle(from_rid, map_pid);
-  var last_pre := swizzle(last, map_pid);
+  var from_oldpre := swizzle(from_rid, map_pid);
+  var last_oldpre := swizzle(last, map_pid);
 
   {
     var data;
     if (isoldpage) {
-      data := pre_size.reverse().select(from_pre, 
last_pre).reverse().copy().access(BAT_WRITE).seqbase(from_rid).key(true);
+      data := pre_size.reverse().select(from_oldpre, 
last_oldpre).reverse().copy().access(BAT_WRITE).seqbase(from_rid).key(true);
       data.myupdate(rid_size_update.reverse().select(from_rid, 
last).reverse());
     } else {
       data := rid_size.reverse().select(from_rid, 
last).reverse().copy().access(BAT_WRITE).key(true);
@@ -3143,7 +3143,7 @@
     }
 
     # now fix the head values (i.e. move the data)
-    var update_data := data.reverse().mark(oid(lng(from_rid) + 
delta)).reverse();
+    var update_data := data.tmark(oid(lng(from_rid) + delta));
     # we're not actually using the tail value here...
     update_hole := rid_size.reverse().select(newholefirst, 
newholelast).reverse();
     if (update_hole.count() < delta) {
@@ -3162,12 +3162,12 @@
   {
     var update_data;
     if (isoldpage) {
-      update_data := pre_level.reverse().select(from_pre, 
last_pre).reverse().copy().seqbase(from_rid);
+      update_data := pre_level.reverse().select(from_oldpre, 
last_oldpre).reverse().copy().seqbase(from_rid);
       update_data := 
update_data.access(BAT_WRITE).key(true).myupdate(rid_level_update.reverse().select(from_rid,
 last).reverse());
     } else {
-      update_data := rid_level.reverse().select(from_rid, last).reverse();
+      update_data := rid_level.reverse().select(from_rid, 
last).reverse().copy();
     }
-    update_data := update_data.reverse().mark(oid(lng(from_rid) + 
delta)).reverse();
+    update_data := update_data.tmark(oid(lng(from_rid) + delta));
     update_hole := update_hole.project(cast(nil, rid_level.ttype()));
     if (isoldpage) {
       rid_level_update.myupdate(update_hole).myupdate(update_data);
@@ -3179,12 +3179,12 @@
   {
     var update_data;
     if (isoldpage) {
-      update_data := pre_kind.reverse().select(from_pre, 
last_pre).reverse().copy().seqbase(from_rid);
+      update_data := pre_kind.reverse().select(from_oldpre, 
last_oldpre).reverse().copy().seqbase(from_rid);
       update_data := 
update_data.access(BAT_WRITE).key(true).myupdate(rid_kind_update.reverse().select(from_rid,
 last).reverse());
     } else {
-      update_data := rid_kind.reverse().select(from_rid, last).reverse();
+      update_data := rid_kind.reverse().select(from_rid, 
last).reverse().copy();
     }
-    update_data := update_data.reverse().mark(oid(lng(from_rid) + 
delta)).reverse();
+    update_data := update_data.tmark(oid(lng(from_rid) + delta));
     update_hole := update_hole.project(cast(nil, rid_kind.ttype()));
     if (isoldpage) {
       rid_kind_update.myupdate(update_hole).myupdate(update_data);
@@ -3196,12 +3196,12 @@
   {
     var update_data;
     if (isoldpage) {
-      update_data := pre_prop.reverse().select(from_pre, 
last_pre).reverse().copy().seqbase(from_rid);
+      update_data := pre_prop.reverse().select(from_oldpre, 
last_oldpre).reverse().copy().seqbase(from_rid);
       update_data := 
update_data.access(BAT_WRITE).key(true).myupdate(rid_prop_update.reverse().select(from_rid,
 last).reverse());
     } else {
-      update_data := rid_prop.reverse().select(from_rid, last).reverse();
+      update_data := rid_prop.reverse().select(from_rid, 
last).reverse().copy();
     }
-    update_data := update_data.reverse().mark(oid(lng(from_rid) + 
delta)).reverse();
+    update_data := update_data.tmark(oid(lng(from_rid) + delta));
     update_hole := update_hole.project(oid_nil);
     if (isoldpage) {
       rid_prop_update.myupdate(update_hole).myupdate(update_data);
@@ -3213,12 +3213,12 @@
   {
     var update_data;
     if (isoldpage) {
-      update_data := pre_nid.reverse().select(from_pre, 
last_pre).reverse().copy().seqbase(from_rid);
+      update_data := pre_nid.reverse().select(from_oldpre, 
last_oldpre).reverse().copy().seqbase(from_rid);
       update_data := 
update_data.access(BAT_WRITE).key(true).myupdate(rid_nid_update.reverse().select(from_rid,
 last).reverse());
     } else {
-      update_data := rid_nid.reverse().select(from_rid, last).reverse();
+      update_data := rid_nid.reverse().select(from_rid, last).reverse().copy();
     }
-    update_data := update_data.reverse().mark(oid(lng(from_rid) + 
delta)).reverse();
+    update_data := update_data.tmark(oid(lng(from_rid) + delta));
     update_hole := update_hole.project(oid_nil);
     if (isoldpage) {
       rid_nid_update.myupdate(update_hole).myupdate(update_data);
@@ -3346,6 +3346,8 @@
         do_update_insert_attributes(ws, inserts_attrs.leftjoin(pre_tgt), 
inserts_attrs.leftjoin(pre_cont_tgt), inserts_attrs.leftjoin(attr_ins), 
inserts_attrs.leftjoin(attr_cont_ins));
       }
       if (inserts_elems.count() > 0) {
+        # for debugging:
+        # var insert_update := inserts_elems.leftjoin(command), 
update_node_item := inserts_elems.leftjoin(pre_tgt), batdoccont := 
inserts_elems.leftjoin(pre_cont_tgt), update_insert_node_item := 
inserts_elems.leftjoin(pre_ins), batcont := 
inserts_elems.leftjoin(pre_cont_ins);
         do_update_insert_elements(ws, inserts_elems.leftjoin(command), 
inserts_elems.leftjoin(pre_tgt), inserts_elems.leftjoin(pre_cont_tgt), 
inserts_elems.leftjoin(pre_ins), inserts_elems.leftjoin(pre_cont_ins));
       }
     }
@@ -4279,7 +4281,7 @@
         var rid_nid_update := ws.fetch(RID_NID_UPDATE).find(doccont);
 
         var docsize;            # current size of document
-        # if the size of item 0 was changed, used the new size, else use the 
original size
+        # if the size of item 0 was changed, use the new size, else use the 
original size
         # we assume that page 0 on which item 0 is located already exists...
         {
           var root_rid := antiswizzle([EMAIL PROTECTED], map_pid_update);


-------------------------------------------------------------------------
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