| | |
| | | import org.forgerock.opendj.ldap.ConditionResult; |
| | | import org.forgerock.opendj.ldap.DecodeException; |
| | | import org.forgerock.opendj.ldap.ResultCode; |
| | | import org.forgerock.opendj.ldap.spi.IndexingOptions; |
| | | import org.forgerock.opendj.ldap.schema.MatchingRule; |
| | | import org.forgerock.opendj.ldap.spi.IndexingOptions; |
| | | import org.opends.server.core.DirectoryServer; |
| | | import org.opends.server.types.*; |
| | | import org.opends.server.util.ServerConstants; |
| | |
| | | entryContainer.getVLVIndex(lowerName.substring(4)); |
| | | if(vlvIndex == null) |
| | | { |
| | | LocalizableMessage msg = |
| | | ERR_JEB_VLV_INDEX_NOT_CONFIGURED.get(lowerName.substring(4)); |
| | | LocalizableMessage msg = ERR_JEB_VLV_INDEX_NOT_CONFIGURED.get(lowerName.substring(4)); |
| | | throw new JebException(msg); |
| | | } |
| | | |
| | |
| | | } |
| | | else |
| | | { |
| | | AttributeType attrType = |
| | | DirectoryServer.getAttributeType(lowerName); |
| | | AttributeType attrType = DirectoryServer.getAttributeType(lowerName); |
| | | if (attrType == null) |
| | | { |
| | | LocalizableMessage msg = ERR_JEB_ATTRIBUTE_INDEX_NOT_CONFIGURED.get(index); |
| | | throw new JebException(msg); |
| | | } |
| | | AttributeIndex attrIndex = |
| | | entryContainer.getAttributeIndex(attrType); |
| | | AttributeIndex attrIndex = entryContainer.getAttributeIndex(attrType); |
| | | if (attrIndex == null) |
| | | { |
| | | LocalizableMessage msg = ERR_JEB_ATTRIBUTE_INDEX_NOT_CONFIGURED.get(index); |
| | |
| | | } |
| | | } |
| | | |
| | | entryLimitMap = |
| | | new IdentityHashMap<Index,HashMap<ByteString,Long>>( |
| | | attrIndexList.size()); |
| | | entryLimitMap = new IdentityHashMap<Index, HashMap<ByteString, Long>>(attrIndexList.size()); |
| | | |
| | | // We will be updating these files independently of the indexes |
| | | // so we need direct access to them rather than going through |
| | |
| | | |
| | | // Start a timer for the progress report. |
| | | Timer timer = new Timer(); |
| | | TimerTask progressTask = new ProgressTask(); |
| | | if (cleanMode) |
| | | { |
| | | // Create a new progressTask based on the index count. |
| | | progressTask = new ProgressTask(true); |
| | | } |
| | | timer.scheduleAtFixedRate(progressTask, progressInterval, |
| | | progressInterval); |
| | | // Create a new progressTask based on the index count. |
| | | TimerTask progressTask = new ProgressTask(cleanMode); |
| | | timer.scheduleAtFixedRate(progressTask, progressInterval, progressInterval); |
| | | |
| | | // Iterate through the index keys. |
| | | try |
| | |
| | | */ |
| | | private class ProgressTask extends TimerTask |
| | | { |
| | | /** |
| | | * The total number of records to process. |
| | | */ |
| | | /** The total number of records to process. */ |
| | | private long totalCount; |
| | | |
| | | /** |
| | |
| | | */ |
| | | private long previousCount; |
| | | |
| | | /** |
| | | * The time in milliseconds of the previous progress report. |
| | | */ |
| | | /** The time in milliseconds of the previous progress report. */ |
| | | private long previousTime; |
| | | |
| | | /** |
| | | * The environment statistics at the time of the previous report. |
| | | */ |
| | | /** The environment statistics at the time of the previous report. */ |
| | | private EnvironmentStats prevEnvStats; |
| | | |
| | | /** |
| | |
| | | |
| | | /** |
| | | * Create a new verify progress task. |
| | | * @throws DatabaseException An error occurred while accessing the JE |
| | | * database. |
| | | */ |
| | | public ProgressTask() throws DatabaseException |
| | | { |
| | | previousTime = System.currentTimeMillis(); |
| | | prevEnvStats = |
| | | rootContainer.getEnvironmentStats(new StatsConfig()); |
| | | totalCount = rootContainer.getEntryContainer( |
| | | verifyConfig.getBaseDN()).getEntryCount(); |
| | | } |
| | | |
| | | /** |
| | | * Create a new verify progress task. |
| | | * @param indexIterator boolean, indicates if the task is iterating |
| | | * through indexes or the entries. |
| | | * @throws DatabaseException An error occurred while accessing the JE |
| | |
| | | { |
| | | AttributeIndex attrIndex = attrIndexList.get(0); |
| | | totalCount = 0; |
| | | if (attrIndex.getEqualityIndex() != null) |
| | | { |
| | | totalCount += attrIndex.getEqualityIndex().getRecordCount(); |
| | | } |
| | | if (attrIndex.getPresenceIndex() != null) |
| | | { |
| | | totalCount += attrIndex.getPresenceIndex().getRecordCount(); |
| | | } |
| | | if (attrIndex.getSubstringIndex() != null) |
| | | { |
| | | totalCount += attrIndex.getSubstringIndex().getRecordCount(); |
| | | } |
| | | if (attrIndex.getOrderingIndex() != null) |
| | | { |
| | | totalCount += attrIndex.getOrderingIndex().getRecordCount(); |
| | | } |
| | | if (attrIndex.getApproximateIndex() != null) |
| | | { |
| | | totalCount += attrIndex.getApproximateIndex().getRecordCount(); |
| | | } |
| | | totalCount += getRecordCount(attrIndex.getEqualityIndex()); |
| | | totalCount += getRecordCount(attrIndex.getPresenceIndex()); |
| | | totalCount += getRecordCount(attrIndex.getSubstringIndex()); |
| | | totalCount += getRecordCount(attrIndex.getOrderingIndex()); |
| | | totalCount += getRecordCount(attrIndex.getApproximateIndex()); |
| | | // TODO: Add support for Extended Matching Rules indexes. |
| | | } |
| | | else if (vlvIndexList.size() > 0) |
| | |
| | | } |
| | | } |
| | | |
| | | /** |
| | | * The action to be performed by this timer task. |
| | | */ |
| | | private long getRecordCount(Index index) |
| | | { |
| | | return index != null ? index.getRecordCount() : 0; |
| | | } |
| | | |
| | | /** The action to be performed by this timer task. */ |
| | | @Override |
| | | public void run() |
| | | { |