| | |
| | | * CDDL HEADER END |
| | | * |
| | | * |
| | | * Portions Copyright 2006 - 2007 Sun Microsystems, Inc. |
| | | * Portions Copyright 2006-2007 Sun Microsystems, Inc. |
| | | */ |
| | | package org.opends.server.backends.jeb; |
| | | |
| | |
| | | import org.opends.server.util.StaticUtils; |
| | | import org.opends.server.util.ServerConstants; |
| | | |
| | | import static org.opends.server.loggers.Debug.debugException; |
| | | import static org.opends.server.loggers.debug.DebugLogger.debugCought; |
| | | import static org.opends.server.loggers.debug.DebugLogger.debugEnabled; |
| | | import org.opends.server.types.DebugLogLevel; |
| | | import static org.opends.server.messages.MessageHandler.getMessage; |
| | | import static org.opends.server.messages.JebMessages.*; |
| | | |
| | |
| | | */ |
| | | public class VerifyJob |
| | | { |
| | | /** |
| | | * The fully-qualified name of this class for debugging purposes. |
| | | */ |
| | | private static final String CLASS_NAME = |
| | | "org.opends.server.backends.jeb.VerifyJob"; |
| | | |
| | | /** |
| | | * The verify configuration. |
| | |
| | | } |
| | | catch (Exception e) |
| | | { |
| | | assert debugException(CLASS_NAME, "iterateID2Entry", e); |
| | | if (debugEnabled()) |
| | | { |
| | | debugCought(DebugLogLevel.ERROR, e); |
| | | } |
| | | errorCount++; |
| | | System.err.printf("Malformed id2entry ID %s.%n", |
| | | StaticUtils.bytesToHex(key.getData())); |
| | |
| | | } |
| | | catch (Exception e) |
| | | { |
| | | assert debugException(CLASS_NAME, "iterateID2Entry", e); |
| | | if (debugEnabled()) |
| | | { |
| | | debugCought(DebugLogLevel.ERROR, e); |
| | | } |
| | | errorCount++; |
| | | System.err.printf("Malformed id2entry record for ID %d:%n%s%n", |
| | | entryID.longValue(), |
| | |
| | | } |
| | | catch (DirectoryException e) |
| | | { |
| | | assert debugException(CLASS_NAME, "iterateDN2ID", e); |
| | | if (debugEnabled()) |
| | | { |
| | | debugCought(DebugLogLevel.ERROR, e); |
| | | } |
| | | errorCount++; |
| | | System.err.printf("File dn2id has malformed key %s.%n", |
| | | StaticUtils.bytesToHex(key.getData())); |
| | |
| | | } |
| | | catch (Exception e) |
| | | { |
| | | assert debugException(CLASS_NAME, "iterateDN2ID", e); |
| | | if (debugEnabled()) |
| | | { |
| | | debugCought(DebugLogLevel.ERROR, e); |
| | | } |
| | | errorCount++; |
| | | System.err.printf("File dn2id has malformed ID for DN <%s>:%n%s%n", |
| | | dn.toNormalizedString(), |
| | |
| | | } |
| | | catch (Exception e) |
| | | { |
| | | assert debugException(CLASS_NAME, "iterateDN2ID", e); |
| | | if (debugEnabled()) |
| | | { |
| | | debugCought(DebugLogLevel.ERROR, e); |
| | | } |
| | | errorCount++; |
| | | System.err.println(e.getMessage()); |
| | | continue; |
| | |
| | | } |
| | | catch (Exception e) |
| | | { |
| | | assert debugException(CLASS_NAME, "iterateID2Children", e); |
| | | if (debugEnabled()) |
| | | { |
| | | debugCought(DebugLogLevel.ERROR, e); |
| | | } |
| | | errorCount++; |
| | | System.err.printf("File id2children has malformed ID %s%n", |
| | | StaticUtils.bytesToHex(key.getData())); |
| | |
| | | } |
| | | catch (Exception e) |
| | | { |
| | | assert debugException(CLASS_NAME, "iterateID2Children", e); |
| | | if (debugEnabled()) |
| | | { |
| | | debugCought(DebugLogLevel.ERROR, e); |
| | | } |
| | | errorCount++; |
| | | System.err.printf("File id2children has malformed ID list " + |
| | | "for ID %s:%n%s%n", |
| | |
| | | } |
| | | catch (Exception e) |
| | | { |
| | | assert debugException(CLASS_NAME, "iterateID2Children", e); |
| | | if (debugEnabled()) |
| | | { |
| | | debugCought(DebugLogLevel.ERROR, e); |
| | | } |
| | | errorCount++; |
| | | System.err.println(e.getMessage()); |
| | | continue; |
| | |
| | | } |
| | | catch (Exception e) |
| | | { |
| | | assert debugException(CLASS_NAME, "iterateID2Children", e); |
| | | if (debugEnabled()) |
| | | { |
| | | debugCought(DebugLogLevel.ERROR, e); |
| | | } |
| | | errorCount++; |
| | | System.err.println(e.getMessage()); |
| | | continue; |
| | |
| | | } |
| | | catch (Exception e) |
| | | { |
| | | assert debugException(CLASS_NAME, "iterateID2Subtree", e); |
| | | if (debugEnabled()) |
| | | { |
| | | debugCought(DebugLogLevel.ERROR, e); |
| | | } |
| | | errorCount++; |
| | | System.err.printf("File id2subtree has malformed ID %s%n", |
| | | StaticUtils.bytesToHex(key.getData())); |
| | |
| | | } |
| | | catch (Exception e) |
| | | { |
| | | assert debugException(CLASS_NAME, "iterateID2Subtree", e); |
| | | if (debugEnabled()) |
| | | { |
| | | debugCought(DebugLogLevel.ERROR, e); |
| | | } |
| | | errorCount++; |
| | | System.err.printf("File id2subtree has malformed ID list " + |
| | | "for ID %s:%n%s%n", |
| | |
| | | } |
| | | catch (Exception e) |
| | | { |
| | | assert debugException(CLASS_NAME, "iterateID2Subtree", e); |
| | | if (debugEnabled()) |
| | | { |
| | | debugCought(DebugLogLevel.ERROR, e); |
| | | } |
| | | errorCount++; |
| | | System.err.println(e.getMessage()); |
| | | continue; |
| | |
| | | } |
| | | catch (Exception e) |
| | | { |
| | | assert debugException(CLASS_NAME, "iterateID2Subtree", e); |
| | | if (debugEnabled()) |
| | | { |
| | | debugCought(DebugLogLevel.ERROR, e); |
| | | } |
| | | errorCount++; |
| | | System.err.println(e.getMessage()); |
| | | continue; |
| | |
| | | } |
| | | catch (Exception e) |
| | | { |
| | | assert debugException(CLASS_NAME, "iterateAttrIndex", e); |
| | | if (debugEnabled()) |
| | | { |
| | | debugCought(DebugLogLevel.ERROR, e); |
| | | } |
| | | errorCount++; |
| | | System.err.printf("Malformed ID list: %s%n%s", |
| | | StaticUtils.bytesToHex(data.getData()), |
| | |
| | | } |
| | | catch (Exception e) |
| | | { |
| | | assert debugException(CLASS_NAME, "iterateAttrIndex", e); |
| | | if (debugEnabled()) |
| | | { |
| | | debugCought(DebugLogLevel.ERROR, e); |
| | | } |
| | | errorCount++; |
| | | System.err.println(e.getMessage()); |
| | | continue; |
| | |
| | | } |
| | | catch (DirectoryException e) |
| | | { |
| | | assert debugException(CLASS_NAME, "iterateAttrIndex", e); |
| | | if (debugEnabled()) |
| | | { |
| | | debugCought(DebugLogLevel.ERROR, e); |
| | | } |
| | | } |
| | | } |
| | | } |
| | |
| | | } |
| | | catch (Exception e) |
| | | { |
| | | assert debugException(CLASS_NAME, "verifyDN2ID", e); |
| | | if (debugEnabled()) |
| | | { |
| | | debugCought(DebugLogLevel.ERROR, e); |
| | | } |
| | | System.err.printf("File dn2id has error reading key %s: %s.%n", |
| | | dn.toNormalizedString(), |
| | | e.getMessage()); |
| | |
| | | } |
| | | catch (Exception e) |
| | | { |
| | | assert debugException(CLASS_NAME, "verifyDN2ID", e); |
| | | if (debugEnabled()) |
| | | { |
| | | debugCought(DebugLogLevel.ERROR, e); |
| | | } |
| | | System.err.printf("File dn2id has error reading key %s: %s.%n", |
| | | parentDN.toNormalizedString(), |
| | | e.getMessage()); |
| | |
| | | } |
| | | catch (Exception e) |
| | | { |
| | | assert debugException(CLASS_NAME, "verifyID2Children", e); |
| | | if (debugEnabled()) |
| | | { |
| | | debugCought(DebugLogLevel.ERROR, e); |
| | | } |
| | | System.err.printf("File dn2id has error reading key %s: %s.", |
| | | parentDN.toNormalizedString(), |
| | | e.getMessage()); |
| | |
| | | } |
| | | catch (DatabaseException e) |
| | | { |
| | | assert debugException(CLASS_NAME, "verifyID2Children", e); |
| | | if (debugEnabled()) |
| | | { |
| | | debugCought(DebugLogLevel.ERROR, e); |
| | | } |
| | | System.err.printf("File id2children has error reading key %d: %s.", |
| | | parentID.longValue(), e.getMessage()); |
| | | errorCount++; |
| | |
| | | } |
| | | catch (Exception e) |
| | | { |
| | | assert debugException(CLASS_NAME, "verifyID2Children", e); |
| | | if (debugEnabled()) |
| | | { |
| | | debugCought(DebugLogLevel.ERROR, e); |
| | | } |
| | | System.err.printf("File dn2id has error reading key %s: %s.%n", |
| | | dn.toNormalizedString(), |
| | | e.getMessage()); |
| | |
| | | } |
| | | catch (DatabaseException e) |
| | | { |
| | | assert debugException(CLASS_NAME, "verifyID2Subtree", e); |
| | | if (debugEnabled()) |
| | | { |
| | | debugCought(DebugLogLevel.ERROR, e); |
| | | } |
| | | System.err.printf("File id2subtree has error reading key %d: %s.%n", |
| | | id.longValue(), e.getMessage()); |
| | | errorCount++; |
| | |
| | | } |
| | | catch (DirectoryException e) |
| | | { |
| | | assert debugException(CLASS_NAME, "verifyAttrIndex", e); |
| | | if (debugEnabled()) |
| | | { |
| | | debugCought(DebugLogLevel.ERROR, e); |
| | | } |
| | | System.err.printf("Error normalizing values of attribute %s in " + |
| | | "entry <%s>: %s.%n", |
| | | attrIndex.getAttributeType().toString(), |
| | |
| | | } |
| | | catch (DatabaseException e) |
| | | { |
| | | assert debugException(CLASS_NAME, "verifyAttribute", e); |
| | | if (debugEnabled()) |
| | | { |
| | | debugCought(DebugLogLevel.ERROR, e); |
| | | } |
| | | System.err.printf("Error reading database: %s%n%s", |
| | | e.getMessage(), |
| | | keyDump(presenceIndex, presenceKey.getData())); |
| | |
| | | } |
| | | catch (DatabaseException e) |
| | | { |
| | | assert debugException(CLASS_NAME, "verifyAttribute", e); |
| | | if (debugEnabled()) |
| | | { |
| | | debugCought(DebugLogLevel.ERROR, e); |
| | | } |
| | | System.err.printf("Error reading database: %s%n%s", |
| | | e.getMessage(), |
| | | keyDump(equalityIndex, normalizedBytes)); |
| | |
| | | } |
| | | catch (DatabaseException e) |
| | | { |
| | | assert debugException(CLASS_NAME, "verifyAttribute", e); |
| | | if (debugEnabled()) |
| | | { |
| | | debugCought(DebugLogLevel.ERROR, e); |
| | | } |
| | | System.err.printf("Error reading database: %s%n%s", |
| | | e.getMessage(), |
| | | keyDump(substringIndex, key.getData())); |
| | |
| | | } |
| | | catch (DatabaseException e) |
| | | { |
| | | assert debugException(CLASS_NAME, "verifyAttribute", e); |
| | | if (debugEnabled()) |
| | | { |
| | | debugCought(DebugLogLevel.ERROR, e); |
| | | } |
| | | System.err.printf("Error reading database: %s%n%s", |
| | | e.getMessage(), |
| | | keyDump(orderingIndex, normalizedBytes)); |
| | |
| | | */ |
| | | class ProgressTask extends TimerTask |
| | | { |
| | | /** |
| | | * The fully-qualified name of this class for debugging purposes. |
| | | */ |
| | | private static final String CLASS_NAME = |
| | | "org.opends.server.backends.jeb.VerifyJob.ProgressTask"; |
| | | |
| | | /** |
| | | * The number of records that had been processed at the time of the |
| | |
| | | } |
| | | catch (DatabaseException e) |
| | | { |
| | | debugException(CLASS_NAME, "run", e); |
| | | if (debugEnabled()) |
| | | { |
| | | debugCought(DebugLogLevel.ERROR, e); |
| | | } |
| | | } |
| | | |
| | | |