| | |
| | | import static org.opends.messages.JebMessages.*; |
| | | import static org.opends.server.admin.std.meta.LocalDBIndexCfgDefn.IndexType.*; |
| | | import static org.opends.server.backends.jeb.IndexOutputBuffer.*; |
| | | import static org.opends.server.backends.pluggable.SuffixContainer.*; |
| | | import static org.opends.server.util.DynamicConstants.*; |
| | | import static org.opends.server.util.ServerConstants.*; |
| | | import static org.opends.server.util.StaticUtils.*; |
| | |
| | | */ |
| | | private final class ScratchFileWriterTask implements Callable<Void> |
| | | { |
| | | private final int DRAIN_TO = 3; |
| | | private static final int DRAIN_TO = 3; |
| | | |
| | | private final IndexManager indexMgr; |
| | | private final BlockingQueue<IndexOutputBuffer> queue; |
| | | private final ByteArrayOutputStream insertByteStream = new ByteArrayOutputStream(2 * bufferSize); |
| | |
| | | { |
| | | if (insertKeyCount > indexMgr.getLimit()) |
| | | { |
| | | // special handling when index entry limit has been exceeded |
| | | insertKeyCount = 1; |
| | | insertByteStream.reset(); |
| | | writePackedInt(insertByteStream, -1); |
| | | writePackedLong(insertByteStream, IndexInputBuffer.UNDEFINED_SIZE); |
| | | } |
| | | |
| | | int insertSize = writePackedInt(bufferStream, insertKeyCount); |
| | |
| | | return writeSize; |
| | | } |
| | | |
| | | private int writePackedLong(OutputStream stream, long value) throws IOException |
| | | { |
| | | int writeSize = PackedInteger.getWriteLongLength(value); |
| | | PackedInteger.writeLong(tmpArray, 0, value); |
| | | stream.write(tmpArray, 0, writeSize); |
| | | return writeSize; |
| | | } |
| | | |
| | | /** {@inheritDoc} */ |
| | | @Override |
| | | public String toString() |
| | |
| | | for (String index : rebuildList) |
| | | { |
| | | final String lowerName = index.toLowerCase(); |
| | | if ("dn2id".equals(lowerName)) |
| | | if (DN2ID_INDEX_NAME.equals(lowerName)) |
| | | { |
| | | indexCount += 3; |
| | | } |
| | | else if ("dn2uri".equals(lowerName)) |
| | | else if (DN2URI_INDEX_NAME.equals(lowerName)) |
| | | { |
| | | indexCount++; |
| | | } |
| | |
| | | } |
| | | indexCount++; |
| | | } |
| | | else if ("id2subtree".equals(lowerName) |
| | | || "id2children".equals(lowerName)) |
| | | else if (ID2SUBTREE_INDEX_NAME.equals(lowerName) |
| | | || ID2CHILDREN_INDEX_NAME.equals(lowerName)) |
| | | { |
| | | throw attributeIndexNotConfigured(index); |
| | | } |
| | |
| | | public String toString() |
| | | { |
| | | return getClass().getSimpleName() |
| | | + "(attributeType=" + attributeType |
| | | + ", indexType=" + indexType |
| | | + "(index=" + attributeType.getNameOrOID() + "." + indexType |
| | | + ", entryLimit=" + entryLimit |
| | | + ")"; |
| | | } |