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

Modified Files:
        pf_support.mx 
Log Message:
Fix for using the hole at the start of the next page when there is not
enough space on the current.  We only use that space if we're
inserting where the hole at the end of the page happens to be (to
simplify the code: we'd have to move data over a page boundary
otherwise).


Index: pf_support.mx
===================================================================
RCS file: /cvsroot/monetdb/pathfinder/runtime/pf_support.mx,v
retrieving revision 1.243
retrieving revision 1.244
diff -u -d -r1.243 -r1.244
--- pf_support.mx       24 May 2007 08:16:58 -0000      1.243
+++ pf_support.mx       29 May 2007 13:57:55 -0000      1.244
@@ -2250,6 +2250,9 @@
 
 # Move data starting at "from" of length "size" by "delta".  The
 # 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)
 # 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
 {
@@ -3568,7 +3571,10 @@
             }
           }
           var holeatstart := 0;
-          if (insertsize > holeatend) {
+          # if we're inserting at the position of the hole at the end
+          # of the page and there's not enough space, also look at any
+          # hole at the start of the next
+          if ((((int(docinsertbefore_rid) + holeatend) and REMAP_PAGE_BITS) = 
0) and (insertsize > holeatend)) {
             # not enough space on the current page, see if there is space at 
the
             # start of the next
             var nxtpgno := oid(lng(pageno) + 1);
@@ -3589,7 +3595,7 @@
                 sz := rid_size.find(oid(lng(nxtpgid) << REMAP_PAGE_BITS));
               }
               if (isnil(niland(sz, int_nil))) {
-                holeatstart := niland(sz, INT_MAX);
+                holeatstart := niland(sz, INT_MAX) + 1;
               }
             }
           }
@@ -3829,7 +3835,8 @@
                 }
               }
             }
-            if (holesize < insertsize) {
+            # note: holeatstart = 0 if the insert point isn't at the start of 
the hole at the end of the page
+            if ((holesize + holeatstart) < insertsize) {
               # not enough space in the right place
               movedata(ws, doccont, oid(lng(docinsertbefore_newpre) + 
holesize), int(REMAP_PAGE_SIZE - ((lng(docinsertbefore_newpre) and 
REMAP_PAGE_MASK) + holesize + holeatend)), insertsize - holesize);
             }


-------------------------------------------------------------------------
This SF.net email is sponsored by DB2 Express
Download DB2 Express C - the FREE version of DB2 express and take
control of your XML. No limits. Just data. Click to get it now.
http://sourceforge.net/powerbar/db2/
_______________________________________________
Monetdb-pf-checkins mailing list
[email protected]
https://lists.sourceforge.net/lists/listinfo/monetdb-pf-checkins

Reply via email to