From: Wolfgang M. M. <wol...@us...> - 2004-07-28 18:55:15
|
Update of /cvsroot/exist/eXist-1.0/src/org/dbxml/core/filer In directory sc8-pr-cvs1.sourceforge.net:/tmp/cvs-serv4115/src/org/dbxml/core/filer Modified Files: Paged.java Log Message: * Fixed locking error: a collection object could be unloaded from the cache by one thread, while another thread had still been writing a document being a member of the collection. A moment later, a third thread reloaded the collection and started to write to the same document. However, as the collection had been recreated, there were two instances of the same document in memory. The third thread did thus not respect the lock held by the first thread and started to write without waiting. As a consequence, various page errors were thrown. * When updating a document, the old document metadata had not been correctly removed. Usually, this had no consequences as the collection class only used the last record it found. In some cases however, this may have led to errors. Index: Paged.java =================================================================== RCS file: /cvsroot/exist/eXist-1.0/src/org/dbxml/core/filer/Paged.java,v retrieving revision 1.24 retrieving revision 1.25 diff -C2 -d -r1.24 -r1.25 *** Paged.java 12 Jul 2004 17:17:43 -0000 1.24 --- Paged.java 28 Jul 2004 18:55:05 -0000 1.25 *************** *** 388,391 **** --- 388,406 ---- } + private boolean isRemovedPage(long pageNum) throws IOException { + long nextNum = fileHeader.firstFreePage; + while(nextNum != -1) { + if(nextNum == pageNum) { + LOG.error("Page " + pageNum + " has already been removed"); + Thread.dumpStack(); + return true; + } + Page next = getPage(nextNum); + next.read(); + nextNum = next.header.nextPage; + } + return false; + } + /** * setFile sets the file object for this Paged. *************** *** 417,422 **** // if(getFile().getName().equals("words.dbx")) // LOG.debug("freeing page " + page.getPageNum()); // Walk the chain and add it to the unused list - long firstPage = page.pageNum; page.header.setStatus(UNUSED); synchronized (fileHeader) { --- 432,438 ---- // if(getFile().getName().equals("words.dbx")) // LOG.debug("freeing page " + page.getPageNum()); + if(isRemovedPage(page.getPageNum())) + return; // Walk the chain and add it to the unused list page.header.setStatus(UNUSED); synchronized (fileHeader) { |