| | |
| | | /** List of VLV indexes. */ |
| | | private final List<VLVIndex> vlvIndexes = new LinkedList<>(); |
| | | |
| | | /** The DN2ID index. */ |
| | | private DN2ID dn2id; |
| | | /** The DN2URI index. */ |
| | | private DN2URI dn2uri; |
| | | |
| | | /** Total entries to be processed. */ |
| | | private long totalEntries; |
| | | |
| | |
| | | /** The entry container. */ |
| | | private EntryContainer entryContainer; |
| | | |
| | | private boolean reBuildDN2ID; |
| | | private boolean reBuildDN2URI; |
| | | |
| | | |
| | | /** |
| | | * Create an instance of the rebuild index manager using the specified |
| | | * parameters. |
| | |
| | | // If not in a 'clear degraded state' operation, |
| | | // need to rebuild the indexes. |
| | | setRebuildListIndexesTrusted(false); |
| | | clearIndexes(true); |
| | | clearIndexes(); |
| | | phaseOne(); |
| | | if (isCanceled) |
| | | { |
| | |
| | | || !entryContainer.getID2Children().isTrusted() |
| | | || !entryContainer.getID2Subtree().isTrusted()) |
| | | { |
| | | dn2id = entryContainer.getDN2ID(); |
| | | reBuildDN2ID = true; |
| | | } |
| | | if (mode == RebuildMode.ALL || entryContainer.getDN2URI() == null) |
| | | { |
| | | dn2uri = entryContainer.getDN2URI(); |
| | | reBuildDN2URI = true; |
| | | } |
| | | if (mode == RebuildMode.DEGRADED |
| | | || entryContainer.getAttributeIndexes().isEmpty()) |
| | |
| | | } |
| | | } |
| | | |
| | | private void clearIndexes(boolean onlyDegraded) throws DatabaseException |
| | | private void clearIndexes() throws DatabaseException |
| | | { |
| | | // Clears all the entry's container databases which are containing the indexes |
| | | if (!onlyDegraded) |
| | | if (reBuildDN2URI) |
| | | { |
| | | // dn2uri does not have a trusted status. |
| | | entryContainer.clearDatabase(entryContainer.getDN2URI()); |
| | | } |
| | | |
| | | if (!onlyDegraded |
| | | || !entryContainer.getID2Children().isTrusted() |
| | | || !entryContainer.getID2Subtree().isTrusted()) |
| | | if (reBuildDN2ID) |
| | | { |
| | | entryContainer.clearDatabase(entryContainer.getDN2ID()); |
| | | entryContainer.clearDatabase(entryContainer.getID2Children()); |
| | |
| | | { |
| | | for (final Map.Entry<IndexKey, Index> mapEntry : indexMap.entrySet()) |
| | | { |
| | | if (!onlyDegraded || !mapEntry.getValue().isTrusted()) |
| | | if (!mapEntry.getValue().isTrusted()) |
| | | { |
| | | entryContainer.clearDatabase(mapEntry.getValue()); |
| | | } |
| | |
| | | |
| | | for (final VLVIndex vlvIndex : entryContainer.getVLVIndexes()) |
| | | { |
| | | if (!onlyDegraded || !vlvIndex.isTrusted()) |
| | | if (!vlvIndex.isTrusted()) |
| | | { |
| | | entryContainer.clearDatabase(vlvIndex); |
| | | } |
| | |
| | | { |
| | | try |
| | | { |
| | | if (dn2id != null) |
| | | if (reBuildDN2ID) |
| | | { |
| | | EntryContainer ec = suffix.getEntryContainer(); |
| | | ec.getID2Children().setTrusted(null, trusted); |
| | |
| | | throws DatabaseException, DirectoryException, JebException, |
| | | InterruptedException |
| | | { |
| | | if (dn2id != null) |
| | | if (reBuildDN2ID) |
| | | { |
| | | processDN2ID(suffix, entry.getName(), entryID); |
| | | } |
| | | if (dn2uri != null) |
| | | if (reBuildDN2URI) |
| | | { |
| | | processDN2URI(suffix, null, entry); |
| | | } |