dibyendumajumdar / simpledbm

SimpleDBM is an Open Source Multi-Threaded Embeddable Transactional Database Engine in Java.
52 stars 11 forks source link

Database Test failure #71

Closed GoogleCodeExporter closed 9 years ago

GoogleCodeExporter commented 9 years ago
The simpledbm-database test failed with following assertion failure:

java.lang.AssertionError
        at
org.simpledbm.rss.impl.im.btree.BTreeIndexManagerImpl$BTreeImpl.moveToNextNode(B
TreeIndexManagerImpl.java:3361)
        at
org.simpledbm.rss.impl.im.btree.BTreeIndexManagerImpl$BTreeImpl.doSearchAtLeafLe
vel(BTreeIndexManagerImpl.java:3314)
        at
org.simpledbm.rss.impl.im.btree.BTreeIndexManagerImpl$BTreeImpl.doFetch(BTreeInd
exManagerImpl.java:3439)
        at
org.simpledbm.rss.impl.im.btree.BTreeIndexManagerImpl$BTreeImpl.fetch(BTreeIndex
ManagerImpl.java:3524)
        at
org.simpledbm.rss.impl.im.btree.BTreeIndexManagerImpl$IndexCursorImpl.fetchNext(
BTreeIndexManagerImpl.java:3711)
        at
org.simpledbm.database.impl.TableScanImpl.fetchNext(TableScanImpl.java:79)
        at
org.simpledbm.database.TestDatabase$TesterThread.testDelete(TestDatabase.java:83
6)
        at
org.simpledbm.database.TestDatabase$TesterThread.run(TestDatabase.java:889)
        at java.lang.Thread.run(Thread.java:636)

Original issue reported on code.google.com by d.majum...@gmail.com on 11 Apr 2009 at 11:41

GoogleCodeExporter commented 9 years ago

Original comment by d.majum...@gmail.com on 12 Apr 2009 at 10:08

GoogleCodeExporter commented 9 years ago

Original comment by d.majum...@gmail.com on 12 Apr 2009 at 10:08

GoogleCodeExporter commented 9 years ago
It is possible for the search to hit EOF on a leaf node that is an indirect 
child of
its parent, and not hit EOF for the search. The previous assertion that assumed 
that
this can only occur when the last leaf page is accessed is not true, and caused 
a
failure. The assertion is removed; instead we recognise this condition and set 
EOF if
the next page is non existent.

Fixed in 1.0.13-BETA

Original comment by d.majum...@gmail.com on 12 Apr 2009 at 2:54

GoogleCodeExporter commented 9 years ago
Need to refix as the solution implemented isn't correct.

Original comment by d.majum...@gmail.com on 13 Apr 2009 at 3:32

GoogleCodeExporter commented 9 years ago
Refixed in 1.0.14.

Just for the record, the use case is when there is an indirect child which is a 
leaf
page and isn't the last leaf page of the tree. Also, the high key of the leaf 
page is
greater than all the keys in the page - maybe because some keys have been 
deleted. In
this situation, if a fetch tries to look for one of the deleted keys, the 
correct
action is to move to the right sibling of the indirect child that would have
contained the key, and position the cursor on the first key of the right 
sibling. We
therefore have a use case where the search can actually move across three leaf 
pages
- the left direct child, the indirect child, and finally the right sibling of 
the
indirect child.

See the test data
[http://simpledbm.googlecode.com/svn/trunk/simpledbm-rss/code/simpledbm-rss/src/
test/resources/org/simpledbm/rss/impl/im/btree/issue71.xml
issue71.xml] for a sample tree that demonstrates this use case. A search for 
'b4' and
'24' should result in the cursor being positioned on 'c1' and '31'. 

Original comment by d.majum...@gmail.com on 13 Apr 2009 at 4:21