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

Modified Files:
      Tag: XQuery_0-16
        pathfinder.mx 
Log Message:
- fix problems in information functions (pf:documents/collections)
  when documents have been deleted from multi-document collections



Index: pathfinder.mx
===================================================================
RCS file: /cvsroot/monetdb/pathfinder/runtime/pathfinder.mx,v
retrieving revision 1.288.2.17
retrieving revision 1.288.2.18
diff -u -d -r1.288.2.17 -r1.288.2.18
--- pathfinder.mx       18 Feb 2007 21:41:29 -0000      1.288.2.17
+++ pathfinder.mx       21 Feb 2007 23:43:46 -0000      1.288.2.18
@@ -2710,31 +2710,43 @@
 }
 
 # fn:collections(), get all collection *names*
-PROC ws_collections(BAT[void,BAT] ws) : BAT[void,oid]
+PROC ws_collections(BAT[void,BAT] ws, bit consistent) : BAT[void,oid]
 {
     var coll_nme, coll_sze, coll_mbs, coll_upd; 
-    pflock_meta(ws_id(ws)); # stop all concurrent shred_doc/del_doc activities
+    if (consistent) pflock_meta(ws_id(ws)); # stop all concurrent 
shred_doc/del_doc activities
     lock_set(pf_short);
     var err := CATCH( { coll_nme := 
mirror(collection_name.[startsWith]("::").uselect(false));
-                        coll_sze := 
coll_nme.leftjoin(doc_collection.histogram()).tmark([EMAIL PROTECTED]).[str]();
+                        coll_sze := 
doc_name.uselect(str_nil,str_nil).mirror().leftjoin(doc_collection).histogram();
+                        coll_sze := coll_nme.leftjoin(coll_sze).tmark([EMAIL 
PROTECTED]).[str]();
                         coll_mbs := [/](coll_nme.leftjoin(collection_size), 
1024LL * 1024LL).tmark([EMAIL PROTECTED]).[str]().[+](" MB"); 
                         coll_upd := 
coll_nme.[lng]().[str]().[+]("_map_pid").[bat]().[int]().[ttype]().[=](oid).tmark([EMAIL
 PROTECTED]).[str]();
-                        coll_nme := 
coll_nme.leftjoin(collection_name).tmark([EMAIL PROTECTED]); });
+                        coll_nme := 
coll_nme.leftjoin(collection_name).tmark([EMAIL PROTECTED]); 
+                        if (not(consistent)) { # here we include info about 
shredding in progress
+                            var shred := 
mirror(colname_shredlock).[startsWith]("::").uselect(false).hmark([EMAIL 
PROTECTED]);
+                            var tmp := shred.tdiff(coll_nme); # new collection 
names being shredded
+                            coll_nme := 
coll_nme.copy().access(BAT_APPEND).append(tmp);
+                            coll_upd := 
coll_upd.copy().access(BAT_APPEND).append(tmp := tmp.project("unknown"));
+                            coll_mbs := 
coll_mbs.copy().access(BAT_APPEND).append(tmp);
+                            coll_sze := 
coll_sze.copy().access(BAT_APPEND).append(tmp);
+                            coll_upd := [+](coll_upd, 
[isnil](coll_nme.outerjoin(reverse(shred))).[ifthenelse](""," (shredding..)"));
+                        }});
     lock_unset(pf_short);
     if (not(isnil(err))) ERROR(err);
     return xmltab4(ws, "collection", coll_nme, "numDocs", coll_sze, "size", 
coll_mbs, "updatable", coll_upd);
 }
 
 # fn:documents(), get all document *names* in a collection
-PROC ws_documents(BAT[void,BAT] ws, BAT[any,str] coll_nme) : BAT[oid,oid]
+PROC ws_documents(BAT[void,BAT] ws, BAT[any,str] coll_nme, bit consistent) : 
BAT[oid,oid]
 {
     var doc_nme, doc_col, doc_url, doc_upd; 
-    pflock_meta(ws_id(ws)); # stop all concurrent shred_doc/del_doc activities
+    if (consistent) pflock_meta(ws_id(ws)); # stop all concurrent 
shred_doc/del_doc activities
     lock_set(pf_short);
-    var err := CATCH( { doc_nme := 
coll_nme.leftjoin(reverse(collection_name)).leftjoin(reverse(doc_collection));
+    var err := CATCH( { var col_upd := 
collection_name.mirror().[lng]().[str]().[+]("_map_pid").[bat]().[int]().[ttype]().[=](oid).tmark([EMAIL
 PROTECTED]).[str]();
+                        doc_nme := 
doc_name.uselect(str_nil,str_nil).mirror().leftjoin(doc_collection);
+                        doc_nme := 
coll_nme.leftjoin(reverse(collection_name)).leftjoin(reverse(doc_nme));
                         doc_url := doc_nme.leftjoin(doc_location).tmark([EMAIL 
PROTECTED]);
                         doc_col := 
doc_nme.leftjoin(doc_collection).tmark([EMAIL PROTECTED]);
-                        doc_upd := 
doc_col.[lng]().[str]().[+]("_map_pid").[bat]().[int]().[ttype]().[=](oid).tmark([EMAIL
 PROTECTED]).[str]();
+                        doc_upd := doc_col.leftjoin(col_upd).tmark([EMAIL 
PROTECTED]); 
                         doc_col := 
doc_col.leftjoin(collection_name).tmark([EMAIL PROTECTED]); 
                         doc_nme := doc_nme.leftjoin(doc_name); });
     lock_unset(pf_short);
@@ -2743,15 +2755,16 @@
 }
 
 # fn:documents(), get all document *names* 
-PROC ws_documents(BAT[void,BAT] ws) : BAT[void,oid]
+PROC ws_documents(BAT[void,BAT] ws, bit consistent) : BAT[void,oid]
 {
     var doc_nme, doc_col, doc_url, doc_upd; 
-    pflock_meta(ws_id(ws)); # stop all concurrent shred_doc/del_doc activities
+    if (consistent) pflock_meta(ws_id(ws)); # stop all concurrent 
shred_doc/del_doc activities
     lock_set(pf_short);
-    var err := CATCH( { doc_nme := 
mirror(doc_name.[startsWith]("::").uselect(false));
+    var err := CATCH( { var col_upd := 
collection_name.mirror().[lng]().[str]().[+]("_map_pid").[bat]().[int]().[ttype]().[=](oid).tmark([EMAIL
 PROTECTED]).[str]();
+                        doc_nme := 
mirror(doc_name.[startsWith]("::").uselect(false));
                         doc_url := doc_nme.leftjoin(doc_location).tmark([EMAIL 
PROTECTED]);
                         doc_col := 
doc_nme.leftjoin(doc_collection).tmark([EMAIL PROTECTED]);
-                        doc_upd := 
doc_col.[lng]().[str]().[+]("_map_pid").[bat]().[int]().[ttype]().[=](oid).tmark([EMAIL
 PROTECTED]).[str]();
+                        doc_upd := doc_col.leftjoin(col_upd).tmark([EMAIL 
PROTECTED]); 
                         doc_nme := doc_nme.leftjoin(doc_name).tmark([EMAIL 
PROTECTED]); 
                         doc_col := 
doc_col.leftjoin(collection_name).tmark([EMAIL PROTECTED]); });
     lock_unset(pf_short);


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