Bugs item #2009556, was opened at 2008-07-03 11:41
Message generated for change (Comment added) made by lsidir
You can respond by visiting: 
https://sourceforge.net/tracker/?func=detail&atid=482468&aid=2009556&group_id=56967

Please note that this message will contain a full copy of the comment thread,
including the initial issue submission, for this request,
not just the latest update.
Category: PF/runtime
Group: Pathfinder "stable"
Status: Open
Resolution: None
Priority: 5
Private: No
Submitted By: Luc Touraille (touraillel)
Assigned to: Lefteris Sidirourgos (lsidir)
Summary: XQ: "Zombie" document in collection

Initial Comment:
[Jun 2008 release]

A deleted document from a collection where there is more than 1 document is 
still visible using the collection("mycoll") function.

On Feb 2008 release, the pf:collection function worked correctly, but not the 
fn:collection function, that produced the same bug.

Stefan reproduced this bug, giving the following trace :

========
$ cat /tmp/MyDoc1.xml
--------
<a/>
========
$ cat /tmp/MyDoc2.xml
--------
<b/>
========
========
$ mclient -lx -s'pf:add-doc("/tmp/MyDoc1.xml","MyDoc1","MyCol")'
--------
========
$ mclient -lx -s'pf:collections()'
--------
<collection updatable="false" size="99 KiB" numDocs="1">MyCol</collection>
========
$ mclient -lx -s'pf:collection("MyCol")'
--------
<a/>
========
$ mclient -lx -g -s'fn:collection("MyCol")'
--------
<?xml version="1.0" encoding="utf-8"?>
<a/>

========
$ mclient -lx -s'pf:documents()'
--------
<document updatable="false" url="/tmp/MyDoc1.xml" 
collection="MyCol">MyDoc1</document>
========
$ mclient -lx -s'pf:documents("MyCol")'
--------
<document updatable="false" url="/tmp/MyDoc1.xml" 
collection="MyCol">MyDoc1</document>
========
========
$ mclient -lx -s'pf:del-doc("MyDoc1")'
--------
========
$ mclient -lx -s'pf:collections()'
--------

========
$ mclient -lx -s'pf:collection("MyCol")'
--------

========
$ mclient -lx -g -s'fn:collection("MyCol")'
--------

========
$ mclient -lx -s'pf:documents()'
--------

========
$ mclient -lx -s'pf:documents("MyCol")'
--------

========
========
$ mclient -lx -s'pf:add-doc("/tmp/MyDoc1.xml","MyDoc1","MyCol")'
--------
========
$ mclient -lx -s'pf:add-doc("/tmp/MyDoc2.xml","MyDoc2","MyCol")'
--------
========
$ mclient -lx -s'pf:collections()'
--------
<collection updatable="false" size="99 KiB" numDocs="2">MyCol</collection>
========
$ mclient -lx -s'pf:collection("MyCol")'
--------
<a/><b/>
========
$ mclient -lx -g -s'fn:collection("MyCol")'
--------
<?xml version="1.0" encoding="utf-8"?>
<a/>
,
<?xml version="1.0" encoding="utf-8"?>
<b/>

========
$ mclient -lx -s'pf:documents()'
--------
<document updatable="false" url="/tmp/MyDoc1.xml" 
collection="MyCol">MyDoc1</document>,
<document updatable="false" url="/tmp/MyDoc2.xml" 
collection="MyCol">MyDoc2</document>
========
$ mclient -lx -s'pf:documents("MyCol")'
--------
<document updatable="false" url="/tmp/MyDoc2.xml" 
collection="MyCol">MyDoc2</document>,
<document updatable="false" url="/tmp/MyDoc1.xml" 
collection="MyCol">MyDoc1</document>
========
========
$ mclient -lx -s'pf:del-doc("MyDoc2")'
--------
========
$ mclient -lx -s'pf:collections()'
--------
<collection updatable="false" size="99 KiB" numDocs="1">MyCol</collection>
========
$ mclient -lx -s'pf:collection("MyCol")'
--------
<a/><b/>
========
$ mclient -lx -g -s'fn:collection("MyCol")'
--------
<?xml version="1.0" encoding="utf-8"?>
<a/>
,
<?xml version="1.0" encoding="utf-8"?>
<b/>

========
$ mclient -lx -s'pf:documents()'
--------
<document updatable="false" url="/tmp/MyDoc1.xml" 
collection="MyCol">MyDoc1</document>
========
$ mclient -lx -s'pf:documents("MyCol")'
--------
<document updatable="false" url="/tmp/MyDoc1.xml" 
collection="MyCol">MyDoc1</document>
========
========
$ mclient -lx -s'pf:del-doc("MyDoc1")'
--------
========
$ mclient -lx -s'pf:collections()'
--------

========
$ mclient -lx -s'pf:collection("MyCol")'
--------

========
$ mclient -lx -g -s'fn:collection("MyCol")'
--------

========
$ mclient -lx -s'pf:documents()'
--------

========
$ mclient -lx -s'pf:documents("MyCol")'
--------

======== 

----------------------------------------------------------------------

Comment By: Lefteris Sidirourgos (lsidir)
Date: 2008-12-16 09:12

Message:
During the pathfinder skype meeting on Monday 15/12 the solution that was
proposed was to apply the docfilter proc after the pf:collection+step. This
will fix the fn:collection results. However if a query serializes the
results of pf:collection, the delete documents will still appear. This is
acceptable since pf:collection was not designed for such use, and users
should use the built in functions of XQuery (i.e., fn:collection) rather
than pf:collection.

In addition docfilter should break to 2 new functions to separate the
"swizzling" from the filtering. 

----------------------------------------------------------------------

Comment By: Lefteris Sidirourgos (lsidir)
Date: 2008-12-15 16:45

Message:
Hi, the bug is still around indeed. The bug characteristics are as follows:
* If the mil proc ws_collection_root() is invoked, delete documents still
appear
* if the mil proc ws_collection() is invoked, delete documents do not
appear.

By investigating a little more, after the second document is deleted the
database looks like that:

mil>print(doc_name);
#---------------------------------#
# h             alias             # name
# oid           str               # type
#---------------------------------#
[ 1000000...@0,   "MyDoc1"        ]
[ 1000000...@0,   nil             ]

Which is expected. On the other hand,
mil>print(doc_collection);
#---------------------------------#
# h             t                 # name
# oid           oid               # type
#---------------------------------#
[ 1...@0,            1...@0            ]
[ 1000000...@0,   1000000...@0    ]
[ 0...@0,            1000000...@0    ]
[ 1000000...@0,   1000000...@0    ]

thus the delete document appears in the tail, which it looks that this is
known and correct since the implementation of ws_collection() knows that
and has the following two lines of code:
var docs := doct.leftjoin(doc_name).select(str_nil,str_nil);  # selected
existing docs
doc := doch.leftjoin(docs.mirror().leftjoin(doct));  # reduced doc to
existing docs

thus from the doc_name BAT decides which document still exists, but in the
implementation of ws_collection_root this is not the case, since no
filtering is happening. Notice that the PRE_Table, after deleting the
document and after restarting the logger looks like:

PRE table
[ 0...@0 ]
#-------------------------------------------------------------------------#
# h     nid     size    level   prop    kind            tag     cont     
# name
# void  oid     int     chr     oid     str             str     oid      
# type
#-------------------------------------------------------------------------#
[ 0...@0,    nil,    nil,    'þ',    nil,    "COLLECTION",   nil,    nil    
]
[ 1...@0 ]
#-------------------------------------------------------------------------#
# h     nid     size    level   prop    kind            tag     cont     
# name
# void  void    int     chr     oid     str             str     oid      
# type
#-------------------------------------------------------------------------#
[ 0...@0,    0...@0,    4,      'þ',    nil,    "COLLECTION",   nil,    1...@0  
  
]
[ 1...@0,    1...@0,    1,      'ÿ',    nil,    "DOCUMENT",     nil,    1...@0  
  
]
[ 2...@0,    2...@0,    0,      '\000', 0...@0,    "ELEMENT",      "||a",  
1...@0    
]
[ 3...@0,    3...@0,    1,      'ÿ',    nil,    "DOCUMENT",     nil,    1...@0  
  
]
[ 4...@0,    4...@0,    0,      '\000', 1...@0,    "ELEMENT",      "||b",  
1...@0    
]

thus the elements etc. still exist

I am not sure what is the best way to fix this problem, so I am open to
suggestions, I am also not sure what are the steps taken after a document
is deleted, so I will need Peter's help on this one

----------------------------------------------------------------------

Comment By: Peter Boncz (boncz)
Date: 2008-12-12 00:02

Message:
Lefteris, can you check if the output is correct (the extra <aap>??) and
this bug really fixed? If so, close it. If not, re-open it. Thanks!

----------------------------------------------------------------------

Comment By: Stefan Manegold (stmane)
Date: 2008-11-18 11:48

Message:
The URLs are indeed to be ignored --- not trivial with Mtest.py right now,
though, I'll check and think about it.

The changes sizes in KB look very suspicious to me --- I would strongly
object to ignoring or approving them unless we know for sure why they
differ, or better, which size they represent --- I honestly don't know
either, yet ...

Moreover, the current output shows an extra

<aap>
Hello World
</aap>

compared to the stable/approved output --- also that needs to be checked
before considering this bug fixed ...


----------------------------------------------------------------------

Comment By: Lefteris Sidirourgos (lsidir)
Date: 2008-11-18 11:31

Message:
Hi,

the test Zombie_document.SF-2009556 seems to be failing not because the
bug is still there, but because of some dynamic(?) information in the
documents, such as size in kb and URL. I am not aware if and how can we
make testweb to ignore these differences. Assigning to Stefan:) I
considering this bug fixed though. We just have to manage the tests a
little, the same holds for the rest, of the related to this bug, reports.

lefteris

----------------------------------------------------------------------

Comment By: Stefan Manegold (stmane)
Date: 2008-07-03 22:34

Message:
Logged In: YES 
user_id=572415
Originator: NO

Might be related to
[ 1976341 ] XQ: leftovers after deleting document
http://sourceforge.net/tracker/index.php?func=detail&aid=1976341&group_id=56967&atid=482468


----------------------------------------------------------------------

Comment By: Stefan Manegold (stmane)
Date: 2008-07-03 22:33

Message:
Logged In: YES 
user_id=572415
Originator: NO

The problem seems to be "even worse":

*  add 2 documents to a single collection "MyCol"
*  delete one of them, again
=> + pf:colections(), pf:documents(), & pf:documents("MyCol") correctly
show only one remaining document
   - pf:collection("MyCol") & fn:collection("MyCol") wrongly show both
documents

*  stop Mserver
*  restart Mserver
=> - all above functions wrongly show *both* documents, again!

This happens both with the (now) default Algebra back-end and with the
(old) "milprint_summer" back-end.


----------------------------------------------------------------------

Comment By: Stefan Manegold (stmane)
Date: 2008-07-03 14:48

Message:
Logged In: YES 
user_id=572415
Originator: NO

Added test in
pathfinder/tests/BugTracker/Tests/Zombie_document.SF-2009556.*


----------------------------------------------------------------------

You can respond by visiting: 
https://sourceforge.net/tracker/?func=detail&atid=482468&aid=2009556&group_id=56967

------------------------------------------------------------------------------
SF.Net email is Sponsored by MIX09, March 18-20, 2009 in Las Vegas, Nevada.
The future of the web can't happen without you.  Join us at MIX09 to help
pave the way to the Next Web now. Learn more and register at
http://ad.doubleclick.net/clk;208669438;13503038;i?http://2009.visitmix.com/
_______________________________________________
Monetdb-bugs mailing list
[email protected]
https://lists.sourceforge.net/lists/listinfo/monetdb-bugs

Reply via email to