From: Alex B. <boi...@in...> - 2001-08-28 06:00:28
|
Christof Dallermassl wrote: > > I tried to insert a couple of elements into a BTree and then remove > them one by one. After a number or removals, there is always (if more > than 20 elements in btree) a java.io.StreamCorruptedException thrown. Well, I finally tracked this one down. The corruption was happening during the BPage insert of the 24rd element, generating a page split which wasn't properly linking the existing pages with the newly allocated page. In fact, it had nothing to do with the ObjectCache, which I was suspecting at first. The MRU(1) workaround which I posted earlier didn't actually work so I must have goofed at some point when testing the workaround. Anyhow, it is fixed now. I am posting the diff here for people interested but I've already commited it in the CVS. Following this, I will make a new release ASAP. Thanks again for the reproductible test case. As mentioned to you before, I will be adding it to the test harness. ciao, alex % cvs diff -c BPage.java Index: BPage.java =================================================================== RCS file: /cvsroot/jdbm/jdbm/src/main/jdbm/btree/BPage.java,v retrieving revision 1.1 diff -c -r1.1 BPage.java *** BPage.java 2001/05/19 14:17:12 1.1 --- BPage.java 2001/08/28 05:32:07 *************** *** 393,398 **** --- 393,403 ---- // link newly created BPage newPage._previous = _previous; newPage._next = _recid; + if ( _previous != 0 ) { + BPage previous = loadBPage( _previous ); + previous._next = newPage._recid; + _btree._cache.update( _previous, previous ); + } _previous = newPage._recid; } |