| | |
| | | final long phaseOneBufferMemory = |
| | | usableMemory - dbCacheSize - tmpEnvCacheSize; |
| | | final int oldThreadCount = threadCount; |
| | | while (true) |
| | | if (indexCount != 0) // Avoid / by zero |
| | | { |
| | | phaseOneBufferCount = 2 * indexCount * threadCount; |
| | | |
| | | // Scratch writers allocate 4 buffers per index as well. |
| | | final int totalPhaseOneBufferCount = |
| | | phaseOneBufferCount + (4 * indexCount); |
| | | bufferSize = (int) (phaseOneBufferMemory / totalPhaseOneBufferCount); |
| | | |
| | | if (bufferSize > MAX_BUFFER_SIZE) |
| | | while (true) |
| | | { |
| | | if (!skipDNValidation) |
| | | phaseOneBufferCount = 2 * indexCount * threadCount; |
| | | |
| | | // Scratch writers allocate 4 buffers per index as well. |
| | | final int totalPhaseOneBufferCount = |
| | | phaseOneBufferCount + (4 * indexCount); |
| | | bufferSize = (int) (phaseOneBufferMemory / totalPhaseOneBufferCount); |
| | | |
| | | if (bufferSize > MAX_BUFFER_SIZE) |
| | | { |
| | | // The buffers are big enough: the memory is best used for the DN2ID |
| | | // temp DB. |
| | | bufferSize = MAX_BUFFER_SIZE; |
| | | if (!skipDNValidation) |
| | | { |
| | | // The buffers are big enough: the memory is best used for the DN2ID |
| | | // temp DB. |
| | | bufferSize = MAX_BUFFER_SIZE; |
| | | |
| | | final long extraMemory = |
| | | phaseOneBufferMemory - (totalPhaseOneBufferCount * bufferSize); |
| | | if (!clearedBackend) |
| | | { |
| | | dbCacheSize += extraMemory / 2; |
| | | tmpEnvCacheSize += extraMemory / 2; |
| | | final long extraMemory = |
| | | phaseOneBufferMemory - (totalPhaseOneBufferCount * bufferSize); |
| | | if (!clearedBackend) |
| | | { |
| | | dbCacheSize += extraMemory / 2; |
| | | tmpEnvCacheSize += extraMemory / 2; |
| | | } |
| | | else |
| | | { |
| | | tmpEnvCacheSize += extraMemory; |
| | | } |
| | | } |
| | | else |
| | | { |
| | | tmpEnvCacheSize += extraMemory; |
| | | } |
| | | |
| | | break; |
| | | } |
| | | |
| | | break; |
| | | } |
| | | else if (bufferSize > MIN_BUFFER_SIZE) |
| | | { |
| | | // This is acceptable. |
| | | break; |
| | | } |
| | | else if (threadCount > 1) |
| | | { |
| | | // Retry using less threads. |
| | | threadCount--; |
| | | } |
| | | else |
| | | { |
| | | // Not enough memory. |
| | | final long minimumPhaseOneBufferMemory = |
| | | totalPhaseOneBufferCount * MIN_BUFFER_SIZE; |
| | | Message message = |
| | | ERR_IMPORT_LDIF_LACK_MEM.get(usableMemory, |
| | | minimumPhaseOneBufferMemory + dbCacheSize + tmpEnvCacheSize); |
| | | throw new InitializationException(message); |
| | | else if (bufferSize > MIN_BUFFER_SIZE) |
| | | { |
| | | // This is acceptable. |
| | | break; |
| | | } |
| | | else if (threadCount > 1) |
| | | { |
| | | // Retry using less threads. |
| | | threadCount--; |
| | | } |
| | | else |
| | | { |
| | | // Not enough memory. |
| | | final long minimumPhaseOneBufferMemory = |
| | | totalPhaseOneBufferCount * MIN_BUFFER_SIZE; |
| | | Message message = |
| | | ERR_IMPORT_LDIF_LACK_MEM.get(usableMemory, |
| | | minimumPhaseOneBufferMemory + dbCacheSize + tmpEnvCacheSize); |
| | | throw new InitializationException(message); |
| | | } |
| | | } |
| | | } |
| | | |
| | |
| | | } |
| | | break; |
| | | } |
| | | if ( message != null ) { |
| | | if ( message != null ) |
| | | { |
| | | logError(message); |
| | | } |
| | | } |
| | |
| | | else |
| | | { |
| | | Message message = |
| | | NOTE_JEB_REBUILD_CLEARDEGRADEDSTATE_FINAL_STATUS.get( |
| | | rebuildConfig.getRebuildList().toString()); |
| | | NOTE_JEB_REBUILD_CLEARDEGRADEDSTATE_FINAL_STATUS.get(rebuildConfig |
| | | .getRebuildList().toString()); |
| | | logError(message); |
| | | } |
| | | |
| | |
| | | timer2.cancel(); |
| | | } |
| | | |
| | | private int getIndexCount() throws ConfigException, JebException |
| | | private int getIndexCount() throws ConfigException, JebException, |
| | | InitializationException |
| | | { |
| | | switch (rebuildConfig.getRebuildMode()) |
| | | { |
| | |
| | | } |
| | | |
| | | private int getRebuildListIndexCount(LocalDBBackendCfg cfg) |
| | | throws JebException, ConfigException |
| | | throws JebException, ConfigException, InitializationException |
| | | { |
| | | int indexCount = 0; |
| | | List<String> rebuildList = rebuildConfig.getRebuildList(); |
| | |
| | | || lowerName.equals("id2children")) |
| | | { |
| | | Message msg = ERR_JEB_ATTRIBUTE_INDEX_NOT_CONFIGURED.get(index); |
| | | throw new JebException(msg); |
| | | throw new InitializationException(msg); |
| | | } |
| | | else |
| | | { |
| | |
| | | if ((attrIndexParts.length <= 0) || (attrIndexParts.length > 3)) |
| | | { |
| | | Message msg = ERR_JEB_ATTRIBUTE_INDEX_NOT_CONFIGURED.get(index); |
| | | throw new JebException(msg); |
| | | throw new InitializationException(msg); |
| | | } |
| | | AttributeType attrType = |
| | | DirectoryServer.getAttributeType(attrIndexParts[0]); |
| | | if (attrType == null) |
| | | { |
| | | Message msg = ERR_JEB_ATTRIBUTE_INDEX_NOT_CONFIGURED.get(index); |
| | | throw new JebException(msg); |
| | | throw new InitializationException(msg); |
| | | } |
| | | if (attrIndexParts.length != 1) |
| | | { |
| | |
| | | { |
| | | Message msg = |
| | | ERR_JEB_ATTRIBUTE_INDEX_NOT_CONFIGURED.get(index); |
| | | throw new JebException(msg); |
| | | throw new InitializationException(msg); |
| | | } |
| | | } |
| | | else |
| | |
| | | { |
| | | Message msg = |
| | | ERR_JEB_ATTRIBUTE_INDEX_NOT_CONFIGURED.get(index); |
| | | throw new JebException(msg); |
| | | throw new InitializationException(msg); |
| | | } |
| | | indexCount++; |
| | | } |
| | | } |
| | | else |
| | | { |
| | | for (String idx : cfg.listLocalDBIndexes()) |
| | | boolean found = false; |
| | | for (final String idx : cfg.listLocalDBIndexes()) |
| | | { |
| | | if (!idx.equalsIgnoreCase(index)) |
| | | { |
| | | continue; |
| | | } |
| | | found = true; |
| | | LocalDBIndexCfg indexCfg = cfg.getLocalDBIndex(idx); |
| | | if (indexCfg.getIndexType().contains( |
| | | LocalDBIndexCfgDefn.IndexType.EQUALITY)) |
| | |
| | | Set<String> extensibleRules = |
| | | indexCfg.getIndexExtensibleMatchingRule(); |
| | | boolean shared = false; |
| | | for (String exRule : extensibleRules) |
| | | for (final String exRule : extensibleRules) |
| | | { |
| | | if (exRule.endsWith(".sub")) |
| | | { |
| | |
| | | } |
| | | } |
| | | } |
| | | if (!found) |
| | | { |
| | | Message msg = |
| | | ERR_JEB_ATTRIBUTE_INDEX_NOT_CONFIGURED.get(index); |
| | | throw new InitializationException(msg); |
| | | } |
| | | } |
| | | } |
| | | } |
| | |
| | | throws InterruptedException |
| | | { |
| | | for (Map.Entry<IndexKey, Collection<Index>> mapEntry : |
| | | this.extensibleIndexMap.entrySet()) |
| | | this.extensibleIndexMap.entrySet()) |
| | | { |
| | | IndexKey key = mapEntry.getKey(); |
| | | AttributeType attrType = key.getAttributeType(); |