Examples of LSMTree


Examples of org.xtreemfs.babudb.index.LSMTree

    public LSMLookupInterface(LSMDatabase database) {
        this.database = database;
    }
   
    public byte[] lookup(int indexId, byte[] key) throws BabuDBException {
        LSMTree tree = database.getIndex(indexId);
        if (tree == null)
            throw new BabuDBException(BabuDBException.ErrorCode.NO_SUCH_INDEX, "index " + indexId + " does not exist");
        return tree.lookup(key);
    }
View Full Code Here

Examples of org.xtreemfs.babudb.index.LSMTree

            throw new BabuDBException(BabuDBException.ErrorCode.NO_SUCH_INDEX, "index " + indexId + " does not exist");
        return tree.lookup(key);
    }
   
    public byte[] lookup(int indexId, byte[] key, int snapId) throws BabuDBException {
        LSMTree tree = database.getIndex(indexId);
        if (tree == null)
            throw new BabuDBException(BabuDBException.ErrorCode.NO_SUCH_INDEX, "index " + indexId + " does not exist");
        return tree.lookup(key,snapId);
    }
View Full Code Here

Examples of org.xtreemfs.babudb.index.LSMTree

            throw new BabuDBException(BabuDBException.ErrorCode.NO_SUCH_INDEX, "index " + indexId + " does not exist");
        return tree.lookup(key,snapId);
    }
   
    public Iterator<Entry<byte[],byte[]>> prefixLookup(int indexId, byte[] startKey) throws BabuDBException {
        LSMTree tree = database.getIndex(indexId);
        if (tree == null)
            throw new BabuDBException(BabuDBException.ErrorCode.NO_SUCH_INDEX, "index does not exist");
        return tree.prefixLookup(startKey);
    }
View Full Code Here

Examples of org.xtreemfs.babudb.index.LSMTree

            throw new BabuDBException(BabuDBException.ErrorCode.NO_SUCH_INDEX, "index does not exist");
        return tree.prefixLookup(startKey);
    }
   
    public Iterator<Entry<byte[],byte[]>> prefixLookup(int indexId, byte[] startKey, int snapId) throws BabuDBException {
        LSMTree tree = database.getIndex(indexId);
        if (tree == null)
            throw new BabuDBException(BabuDBException.ErrorCode.NO_SUCH_INDEX, "index does not exist");
        return tree.prefixLookup(startKey,snapId);
    }
View Full Code Here

Examples of org.xtreemfs.babudb.index.LSMTree

            loadFromDisk(numIndices);
        } else {
            try {
                for (int i = 0; i < numIndices; i++) {
                    assert (comparators[i] != null);
                    trees.add(new LSMTree(null, comparators[i], this.compression, maxEntriesPerBlock,
                        maxBlockFileSize, !disableMMap, mmapLimit));
                }
                ondiskLSN = NO_DB_LSN;
            } catch (IOException ex) {
                throw new BabuDBException(ErrorCode.IO_ERROR, "cannot create new index", ex);
View Full Code Here

Examples of org.xtreemfs.babudb.index.LSMTree

                if (maxView > -1) {
                    Logging.logMessage(Logging.LEVEL_DEBUG, this, "loading database " + this.databaseName
                        + " from latest snapshot:" + databaseDir + File.separator + "IX" + index + "V"
                        + maxView + "SEQ" + maxSeq);
                    assert (comparators[index] != null);
                    trees.set(index, new LSMTree(databaseDir + File.separator
                        + getSnapshotFilename(index, maxView, maxSeq), comparators[index], this.compression,
                        this.maxEntriesPerBlock, this.maxBlockFileSize, !this.disableMMap, this.mmapLimit));
                    ondiskLSN = new LSN(maxView, maxSeq);
                } else {
                    ondiskLSN = NO_DB_LSN;
                    Logging.logMessage(Logging.LEVEL_DEBUG, this, "no snapshot for database "
                        + this.databaseName);
                    assert (comparators[index] != null);
                    trees.set(index, new LSMTree(null, comparators[index], this.compression,
                        this.maxEntriesPerBlock, this.maxBlockFileSize, !this.disableMMap, this.mmapLimit));
                }
            } catch (IOException ex) {
                Logging.logError(Logging.LEVEL_ERROR, this, ex);
                throw new BabuDBException(ErrorCode.IO_ERROR, "cannot load index from disk", ex);
View Full Code Here

Examples of org.xtreemfs.babudb.index.LSMTree

     * @return a list with snapshot Ids for each index
     */
    public int[] createSnapshot() {
        int[] snapIds = new int[trees.size()];
        for (int index = 0; index < trees.size(); index++) {
            final LSMTree tree = trees.get(index);
            snapIds[index] = tree.createSnapshot();
        }
        return snapIds;
    }
View Full Code Here

Examples of org.xtreemfs.babudb.index.LSMTree

     * @return a list with snapshot Ids for each index
     */
    public int[] createSnapshot(int[] indices) {
        int[] snapIds = new int[indices.length];
        for (int index = 0; index < indices.length; index++) {
            final LSMTree tree = trees.get(indices[index]);
            snapIds[index] = tree.createSnapshot();
        }
        return snapIds;
    }
View Full Code Here

Examples of org.xtreemfs.babudb.index.LSMTree

    public void writeSnapshot(int viewId, long sequenceNo, int[] snapIds) throws IOException {
       
        Logging.logMessage(Logging.LEVEL_INFO, this, "writing snapshot, database = " + databaseName + "...");
        for (int index = 0; index < trees.size(); index++) {
           
            final LSMTree tree = trees.get(index);
           
            if (Logging.isInfo())
                Logging.logMessage(Logging.LEVEL_INFO, this, "snapshotting index " + index + "(dbName = "
                    + databaseName + ")...");
           
            File tmpDir = new File(databaseDir, ".currentSnapshot");
            File targetDir = new File(databaseDir, getSnapshotFilename(index, viewId, sequenceNo));
           
            if (targetDir.exists()) {
                Logging.logMessage(Logging.LEVEL_DEBUG, this, "skipping index'" + index
                    + ", as a valid checkpoint (" + targetDir + ") exists already");
                continue;
            }
           
            // clean up incomplete old checkpoints if necessary
            if (tmpDir.exists())
                FSUtils.delTree(tmpDir);
           
            tree.materializeSnapshot(tmpDir.getAbsolutePath(), snapIds[index]);
           
            if (!tmpDir.renameTo(targetDir))
                throw new IOException("could not rename '" + tmpDir + "' to " + targetDir);
           
            if (Logging.isInfo())
View Full Code Here

Examples of org.xtreemfs.babudb.index.LSMTree

   
    public void writeSnapshot(String directory, int[] snapIds, int viewId, long sequenceNumber)
        throws IOException {
       
        for (int index = 0; index < trees.size(); index++) {
            final LSMTree tree = trees.get(index);
            final String newFileName = directory + "/" + getSnapshotFilename(index, viewId, sequenceNumber);
            tree.materializeSnapshot(newFileName, snapIds[index]);
        }
    }
View Full Code Here
TOP
Copyright © 2018 www.massapi.com. All rights reserved.
All source code are property of their respective owners. Java is a trademark of Sun Microsystems, Inc and owned by ORACLE Inc. Contact coftware#gmail.com.