OPENDJ-1602 New pluggable storage based backend
Reduced the number of compilation errors in package "org.opends.server.backends.pluggable".
Fixed NPEs where we passed null txn values as parameters.
| | |
| | | db.releaseExchange(ex); |
| | | } |
| | | } |
| | | |
| | | @Override |
| | | public void truncateTree(TreeName treeName) { |
| | | try { |
| | | getVolume(treeName).truncate(); |
| | | } catch (PersistitException e) { |
| | | throw new StorageRuntimeException(e); |
| | | } |
| | | } |
| | | |
| | | @Override |
| | | public void renameTree(TreeName oldTreeName, TreeName newTreeName) { |
| | | throw new UnsupportedOperationException(); |
| | | } |
| | | |
| | | @Override |
| | | public void deleteTree(TreeName treeName) { |
| | | Exchange ex = null; |
| | | try { |
| | | ex = getExchange(treeName); |
| | | ex.removeTree(); |
| | | } catch (PersistitException e) { |
| | | throw new StorageRuntimeException(e); |
| | | } finally { |
| | | db.releaseExchange(ex); |
| | | } |
| | | } |
| | | } |
| | | |
| | | private final class CursorImpl implements Cursor { |
| | |
| | | private Exchange getExchange0(TreeName treeName, boolean create) throws PersistitException { |
| | | return db.getExchange(getVolume(treeName), treeName.toString(), create); |
| | | } |
| | | |
| | | @Override |
| | | public void closeTree(TreeName treeName) { |
| | | // nothing to do, in persistit you close the volume itself |
| | | } |
| | | |
| | | @Override |
| | | public boolean isValid() { |
| | | return !db.isFatal(); |
| | | } |
| | | } |
| | |
| | | public synchronized void close() throws StorageRuntimeException |
| | | { |
| | | storage.closeTree(treeName); |
| | | treeName = null; |
| | | |
| | | if(logger.isTraceEnabled()) |
| | | { |
| | |
| | | |
| | | import java.util.Comparator; |
| | | |
| | | import org.opends.server.backends.pluggable.spi.TreeName; |
| | | |
| | | /** |
| | | * This comparator is used to sort databases in order of priority |
| | | * for preloading into the cache. |
| | |
| | | // default ordering. VLV search request goes through as if |
| | | // this sort key was not found in the user entry. |
| | | entryIDList = |
| | | EntryIDSetSorter.sort(EntryContainer.this, entryIDList, searchOperation, |
| | | EntryIDSetSorter.sort(EntryContainer.this, txn, entryIDList, searchOperation, |
| | | sortRequest.getSortOrder(), vlvRequest); |
| | | if (sortRequest.containsSortKeys()) |
| | | { |
| | |
| | | if (isInScope) |
| | | { |
| | | // Process the candidate entry. |
| | | final Entry entry = getEntry(entryID); |
| | | final Entry entry = getEntry(txn, entryID); |
| | | if (entry != null) |
| | | { |
| | | lookthroughCount++; |
| | |
| | | * @throws DirectoryException |
| | | * If an error occurs retrieving the entry |
| | | */ |
| | | public Entry getEntry(EntryID entryID) throws DirectoryException |
| | | public Entry getEntry(ReadableStorage txn, EntryID entryID) throws DirectoryException |
| | | { |
| | | // Try the entry cache first. |
| | | final EntryCache entryCache = getEntryCache(); |
| | |
| | | return cacheEntry; |
| | | } |
| | | |
| | | final Entry entry = id2entry.get(null, entryID, false); |
| | | final Entry entry = id2entry.get(txn, entryID, false); |
| | | if (entry != null) |
| | | { |
| | | // Put the entry in the cache making sure not to overwrite a newer copy |
| | |
| | | Entry entry; |
| | | try |
| | | { |
| | | entry = getEntry(id); |
| | | entry = getEntry(txn, id); |
| | | } |
| | | catch (Exception e) |
| | | { |
| | |
| | | import org.forgerock.opendj.ldap.ByteString; |
| | | import org.forgerock.opendj.ldap.ResultCode; |
| | | import org.forgerock.opendj.ldap.SearchScope; |
| | | import org.opends.server.backends.pluggable.spi.ReadableStorage; |
| | | import org.opends.server.controls.VLVRequestControl; |
| | | import org.opends.server.controls.VLVResponseControl; |
| | | import org.opends.server.core.DirectoryServer; |
| | |
| | | * Creates a new entry ID set which is a sorted representation of the provided |
| | | * set using the given sort order. |
| | | * |
| | | * @param suffixContainer The suffix container with which the ID list is associated. |
| | | * @param entryContainer The entry container with which the ID list is associated. |
| | | * @param entryIDSet The entry ID set to be sorted. |
| | | * @param searchOperation The search operation being processed. |
| | | * @param sortOrder The sort order to use for the entry ID set. |
| | |
| | | * |
| | | * @throws DirectoryException If an error occurs while performing the sort. |
| | | */ |
| | | public static EntryIDSet sort(EntryContainer suffixContainer, |
| | | public static EntryIDSet sort(EntryContainer entryContainer, |
| | | ReadableStorage txn, |
| | | EntryIDSet entryIDSet, |
| | | SearchOperation searchOperation, |
| | | SortOrder sortOrder, |
| | |
| | | { |
| | | try |
| | | { |
| | | Entry e = suffixContainer.getEntry(id); |
| | | Entry e = entryContainer.getEntry(txn, id); |
| | | if (e.matchesBaseAndScope(baseDN, scope) && filter.matchesEntry(e)) |
| | | { |
| | | sortMap.put(new SortValues(id, e, sortOrder), id); |
| | |
| | | return createMatchAllQuery().evaluate(debugMessage); |
| | | } |
| | | |
| | | final EntryIDSet entrySet = index.readKey(key, null); |
| | | final EntryIDSet entrySet = index.readKey(key, txn); |
| | | if(debugMessage != null && !entrySet.isDefined()) |
| | | { |
| | | updateStatsUndefinedResults(debugMessage, index); |
| | |
| | | return new EntryIDSet(); |
| | | } |
| | | |
| | | final EntryIDSet entrySet = index.readKey(PresenceIndexer.presenceKey, null); |
| | | final EntryIDSet entrySet = index.readKey(PresenceIndexer.presenceKey, txn); |
| | | if (debugMessage != null && !entrySet.isDefined()) |
| | | { |
| | | updateStatsUndefinedResults(debugMessage, index); |
| | |
| | | * |
| | | * Copyright 2014 ForgeRock AS |
| | | */ |
| | | |
| | | package org.opends.server.backends.pluggable.spi; |
| | | |
| | | import java.io.Closeable; |
| | | |
| | | import org.opends.server.admin.std.server.PersistitBackendCfg; |
| | | |
| | | |
| | | |
| | | public interface Storage extends Closeable |
| | | { |
| | | void initialize(PersistitBackendCfg cfg) throws Exception; |
| | |
| | | |
| | | void write(WriteOperation updateTransaction) throws Exception; |
| | | |
| | | void closeTree(TreeName treeName); |
| | | |
| | | boolean isValid(); |
| | | |
| | | @Override |
| | | void close(); |
| | | } |
| | |
| | | |
| | | void truncateTree(TreeName name); |
| | | |
| | | void renameTree(TreeName oldName, TreeName newName); |
| | | |
| | | void deleteTree(TreeName name); |
| | | |
| | | void create(TreeName name, ByteSequence key, ByteSequence value); |