From: Pierrick B. <br...@us...> - 2005-12-30 20:22:06
|
Update of /cvsroot/exist/eXist-1.0/src/org/exist/storage In directory sc8-pr-cvs1.sourceforge.net:/tmp/cvs-serv1322/src/org/exist/storage Modified Files: NativeTextEngine.java NativeElementIndex.java NativeValueIndex.java Log Message: Refactored how IOExceptions are handled in indexing code. Index: NativeElementIndex.java =================================================================== RCS file: /cvsroot/exist/eXist-1.0/src/org/exist/storage/NativeElementIndex.java,v retrieving revision 1.71 retrieving revision 1.72 diff -C2 -d -r1.71 -r1.72 *** NativeElementIndex.java 30 Dec 2005 19:29:41 -0000 1.71 --- NativeElementIndex.java 30 Dec 2005 20:21:57 -0000 1.72 *************** *** 178,182 **** //Store the data if (dbNodes.append(ref, os.data()) == BFile.UNKNOWN_ADDRESS) { ! LOG.warn("Could not put index data for node '" + qname + "'"); } } catch (LockException e) { --- 178,182 ---- //Store the data if (dbNodes.append(ref, os.data()) == BFile.UNKNOWN_ADDRESS) { ! LOG.error("Could not put index data for node '" + qname + "'"); } } catch (LockException e) { *************** *** 283,290 **** } } catch (EOFException e) { LOG.warn(e.getMessage(), e); - } catch (IOException e) { - LOG.error(e.getMessage(), e); - //TODO : data will be saved although os is probably corrupted ! -pb } //append the data from the new list --- 283,288 ---- } } catch (EOFException e) { + //TODO : remove this block if unexpected -pb LOG.warn(e.getMessage(), e); } //append the data from the new list *************** *** 321,325 **** LOG.warn("Failed to acquire lock for '" + dbNodes.getFile().getName() + "'", e); } catch (ReadOnlyException e) { ! LOG.warn("Read-only error on '" + dbNodes.getFile().getName() + "'", e); } finally { lock.release(); --- 319,325 ---- LOG.warn("Failed to acquire lock for '" + dbNodes.getFile().getName() + "'", e); } catch (ReadOnlyException e) { ! LOG.warn("Read-only error on '" + dbNodes.getFile().getName() + "'", e); ! } catch (IOException e) { ! LOG.error(e.getMessage(), e); } finally { lock.release(); *************** *** 501,507 **** } catch (EOFException e) { //EOFExceptions expected there - } catch (IOException e) { - LOG.error(e.getMessage(), e); - //TODO : data will be saved although os is probably corrupted ! -pb } } --- 501,504 ---- *************** *** 720,727 **** } } catch (EOFException e) { ! LOG.warn(e.getMessage(), e); ! } catch (IOException e) { ! LOG.error(e.getMessage(), e); ! //TODO : return null ? -pb } } --- 717,722 ---- } } catch (EOFException e) { ! //TODO : remove this block if unexpected -pb ! LOG.warn(e.getMessage(), e); } } *************** *** 809,816 **** } } catch (EOFException e) { LOG.warn(e.getMessage(), e); - } catch (IOException e) { - LOG.error(e.getMessage(), e); - //TODO : throw an exception ? -pb } LOG.debug(msg.toString()); --- 804,809 ---- } } catch (EOFException e) { + //TODO : remove this block if unexpected -pb LOG.warn(e.getMessage(), e); } LOG.debug(msg.toString()); Index: NativeTextEngine.java =================================================================== RCS file: /cvsroot/exist/eXist-1.0/src/org/exist/storage/NativeTextEngine.java,v retrieving revision 1.118 retrieving revision 1.119 diff -C2 -d -r1.118 -r1.119 *** NativeTextEngine.java 30 Dec 2005 19:54:02 -0000 1.118 --- NativeTextEngine.java 30 Dec 2005 20:21:57 -0000 1.119 *************** *** 980,987 **** } catch (EOFException e) { //Is it expected ? -pb ! LOG.warn(e.getMessage(), e); ! } catch (IOException e) { ! LOG.error(e.getMessage(), e); ! //TODO : data will be saved although os is probably corrupted ! -pb } //append the data from the new list --- 980,984 ---- } catch (EOFException e) { //Is it expected ? -pb ! LOG.warn(e.getMessage(), e); } //append the data from the new list *************** *** 1036,1040 **** LOG.warn("Failed to acquire lock for '" + dbTokens.getFile().getName() + "'", e); } catch (ReadOnlyException e) { ! LOG.warn("Read-only error on '" + dbTokens.getFile().getName() + "'", e); } finally { lock.release(); --- 1033,1039 ---- LOG.warn("Failed to acquire lock for '" + dbTokens.getFile().getName() + "'", e); } catch (ReadOnlyException e) { ! LOG.warn("Read-only error on '" + dbTokens.getFile().getName() + "'", e); ! } catch (IOException e) { ! LOG.error(e.getMessage(), e); } finally { lock.release(); *************** *** 1123,1131 **** } } catch (EOFException e) { ! //LOG.error("end-of-file while reading index entry ! // for " + word, e); ! } catch (IOException e) { ! LOG.error("io-error while reading index entry for " ! + token, e); } } --- 1122,1126 ---- } } catch (EOFException e) { ! //EOF is expected here } } *************** *** 1169,1173 **** } } catch (ReadOnlyException e) { ! } } catch (LockException e) { --- 1164,1168 ---- } } catch (ReadOnlyException e) { ! //EOF are expected here -pb } } catch (LockException e) { *************** *** 1246,1251 **** try { is = dbTokens.getAsStream(pointer); ! } catch (IOException ioe) { ! LOG.warn(ioe.getMessage(), ioe); } if (is == null) --- 1241,1247 ---- try { is = dbTokens.getAsStream(pointer); ! } catch (IOException e) { ! LOG.warn(e.getMessage(), e); ! //TODO : return early -pb } if (is == null) *************** *** 1310,1314 **** // EOFExceptions are normal } catch (IOException e) { ! LOG.warn("io error while reading index", e); } } --- 1306,1311 ---- // EOFExceptions are normal } catch (IOException e) { ! LOG.error("io error while reading index", e); ! //TODO : return early -pb } } *************** *** 1347,1352 **** try { is = dbTokens.getAsStream(pointer); ! } catch (IOException ioe) { ! LOG.warn(ioe.getMessage(), ioe); } if (is == null) --- 1344,1350 ---- try { is = dbTokens.getAsStream(pointer); ! } catch (IOException e) { ! LOG.warn(e.getMessage(), e); ! //TODO : return early -pb } if (is == null) Index: NativeValueIndex.java =================================================================== RCS file: /cvsroot/exist/eXist-1.0/src/org/exist/storage/NativeValueIndex.java,v retrieving revision 1.54 retrieving revision 1.55 diff -C2 -d -r1.54 -r1.55 *** NativeValueIndex.java 30 Dec 2005 19:54:02 -0000 1.54 --- NativeValueIndex.java 30 Dec 2005 20:21:57 -0000 1.55 *************** *** 321,329 **** } } catch (EOFException e) { ! //Is it expected ? -pb LOG.warn(e.getMessage(), e); - } catch (IOException e) { - LOG.error(e.getMessage(), e); - //TODO : data will be saved although os is probably corrupted ! -pb } //append the data from the new list --- 321,326 ---- } } catch (EOFException e) { ! //Is it expected ? if not, remove the block -pb LOG.warn(e.getMessage(), e); } //append the data from the new list *************** *** 357,361 **** //TODO : return ? } catch (ReadOnlyException e) { ! LOG.warn("Read-only error on '" + dbValues.getFile().getName() + "'", e); } finally { lock.release(); --- 354,360 ---- //TODO : return ? } catch (ReadOnlyException e) { ! LOG.warn("Read-only error on '" + dbValues.getFile().getName() + "'", e); ! } catch (IOException e) { ! LOG.error(e.getMessage(), e); } finally { lock.release(); *************** *** 585,599 **** Value keyPrefix = computeKeyPrefix(value.getType(), collectionId); try { ! lock.acquire(); ! try { ! dbValues.query(query, keyPrefix, callback); ! } catch (IOException e) { ! LOG.error(e.getMessage(), e); ! } catch (BTreeException e) { ! LOG.warn(e.getMessage(), e); ! } } catch (LockException e) { LOG.warn("Failed to acquire lock for '" + dbValues.getFile().getName() + "'", e); ! } finally { lock.release(); } --- 584,596 ---- Value keyPrefix = computeKeyPrefix(value.getType(), collectionId); try { ! lock.acquire(); ! dbValues.query(query, keyPrefix, callback); } catch (LockException e) { LOG.warn("Failed to acquire lock for '" + dbValues.getFile().getName() + "'", e); ! } catch (IOException e) { ! LOG.error(e.getMessage(), e); ! } catch (BTreeException e) { ! LOG.error(e.getMessage(), e); ! } finally { lock.release(); } *************** *** 796,800 **** is = dbValues.getAsStream(pointer); } catch (IOException e) { ! LOG.warn(e.getMessage(), e); } if (is == null) --- 793,798 ---- is = dbValues.getAsStream(pointer); } catch (IOException e) { ! LOG.error(e.getMessage(), e); ! //TODO : return early -pb } if (is == null) *************** *** 848,853 **** } } ! } catch (EOFException e) { ! // EOF is expected here } catch (IOException e) { LOG.error(e.getMessage(), e); --- 846,851 ---- } } ! } catch (EOFException e) { ! // EOF is expected here } catch (IOException e) { LOG.error(e.getMessage(), e); *************** *** 913,917 **** is = dbValues.getAsStream(pointer); } catch (IOException e) { ! LOG.warn(e.getMessage(), e); } if (is == null) --- 911,916 ---- is = dbValues.getAsStream(pointer); } catch (IOException e) { ! LOG.error(e.getMessage(), e); ! //TODO : return early -pb } if (is == null) |