From: Wolfgang M. M. <wol...@us...> - 2004-03-29 14:26:40
|
Update of /cvsroot/exist/eXist-1.0/src/org/exist/storage/store In directory sc8-pr-cvs1.sourceforge.net:/tmp/cvs-serv31676/src/org/exist/storage/store Modified Files: BFile.java DOMFile.java Log Message: * Fixed stability issues: collection pointers got corrupted occasionally, resulting in ArrayIndexOutOfBoundsExceptions. * Added check for file format versions: the database will throw an exception if the database files are incompatible with the current eXist version. Index: DOMFile.java =================================================================== RCS file: /cvsroot/exist/eXist-1.0/src/org/exist/storage/store/DOMFile.java,v retrieving revision 1.19 retrieving revision 1.20 diff -C2 -d -r1.19 -r1.20 *** DOMFile.java 2 Feb 2004 15:30:37 -0000 1.19 --- DOMFile.java 29 Mar 2004 14:15:12 -0000 1.20 *************** *** 69,72 **** --- 69,74 ---- public class DOMFile extends BTree implements Lockable { + public final static short FILE_FORMAT_VERSION_ID = 1; + // page types public final static byte LOB = 21; *************** *** 118,121 **** --- 120,130 ---- /** + * @return + */ + public short getFileVersion() { + return FILE_FORMAT_VERSION_ID; + } + + /** * Append a value to the current page * *************** *** 751,755 **** */ public boolean open() throws DBException { ! if (super.open()) return true; else --- 760,764 ---- */ public boolean open() throws DBException { ! if (super.open(FILE_FORMAT_VERSION_ID)) return true; else *************** *** 1074,1081 **** page = getCurrentPage(pageNr); dataCache.add(page); - pos = 0; dlen = page.getPageHeader().getDataLength(); ! //System.out.println(pos + " < " + dlen); ! while (pos < dlen) { //System.out.println(current + " = " + tid); if (ByteConversion.byteToShort(page.data, pos) == tid) --- 1083,1088 ---- page = getCurrentPage(pageNr); dataCache.add(page); dlen = page.getPageHeader().getDataLength(); ! for (pos = 0; pos < dlen; ) { //System.out.println(current + " = " + tid); if (ByteConversion.byteToShort(page.data, pos) == tid) *************** *** 1089,1102 **** return null; } ! /*LOG.debug( ! owner.toString() ! + ": tid " ! + tid ! + " not found on " ! + page.page.getPageInfo() ! + ". Loading " ! + pageNr);*/ } - Thread.dumpStack(); LOG.debug("tid " + tid + " not found."); return null; --- 1096,1108 ---- return null; } ! // LOG.debug( ! // owner.toString() ! // + ": tid " ! // + tid ! // + " not found on " ! // + page.page.getPageInfo() ! // + ". Loading " ! // + pageNr); } LOG.debug("tid " + tid + " not found."); return null; Index: BFile.java =================================================================== RCS file: /cvsroot/exist/eXist-1.0/src/org/exist/storage/store/BFile.java,v retrieving revision 1.15 retrieving revision 1.16 diff -C2 -d -r1.15 -r1.16 *** BFile.java 25 Mar 2004 12:50:50 -0000 1.15 --- BFile.java 29 Mar 2004 14:15:12 -0000 1.16 *************** *** 67,74 **** * *@author Wolfgang Meier <wol...@ex...> - *@created 25. Mai 2002 */ public class BFile extends BTree { // minimum free space a page should have to be // considered for reusing --- 67,75 ---- * *@author Wolfgang Meier <wol...@ex...> */ public class BFile extends BTree { + public final static short FILE_FORMAT_VERSION_ID = 2; + // minimum free space a page should have to be // considered for reusing *************** *** 123,126 **** --- 124,134 ---- /** + * @return + */ + public short getFileVersion() { + return FILE_FORMAT_VERSION_ID; + } + + /** * Returns the Lock object responsible for this BFile. * *************** *** 390,393 **** --- 398,405 ---- final short tid = (short) StorageAddress.tidFromPointer(pointer); final int offset = findValuePosition(page, tid); + if(offset < 0) { + System.out.println("no data found at tid " + tid + "; page " + page.getPageNum()); + throw new IOException("no data found at tid " + tid + "; page " + page.getPageNum()); + } final byte[] data = page.getData(); final int l = ByteConversion.byteToInt(data, offset); *************** *** 491,495 **** public boolean open() throws DBException { ! return super.open(); } --- 503,507 ---- public boolean open() throws DBException { ! return super.open(FILE_FORMAT_VERSION_ID); } *************** *** 834,837 **** --- 846,850 ---- private final class BFileHeader extends BTreeFileHeader { + private OrderedLinkedList freeList = new OrderedLinkedList(); private long freeSpacePage = -1; |