Package com.persistit.exception

Examples of com.persistit.exception.CorruptVolumeException


    }

    void corrupt(final String error) throws CorruptVolumeException {
        Debug.$assert0.t(false);
        _persistit.getLogBase().corruptVolume.log(error + Util.NEW_LINE + toStringDetail());
        throw new CorruptVolumeException(error);
    }
View Full Code Here


            Buffer buffer = null;
            long deallocate = -1;
            try {
                buffer = _pool.get(_volume, page, false, true);
                if (buffer.getPageType() != depth) {
                    throw new CorruptVolumeException(buffer + " type code=" + buffer.getPageType()
                            + " is not equal to expected value " + depth);
                }
                if (buffer.isIndexPage()) {
                    deallocate = page;
                    final int p = buffer.toKeyBlock(0);
View Full Code Here

            Buffer buffer = null;
            try {
                buffer = getVolume().getStructure().getPool().get(_volume, rootPageAddr, false, true);
                final int type = buffer.getPageType();
                if (type < Buffer.PAGE_TYPE_DATA || type > Buffer.PAGE_TYPE_INDEX_MAX) {
                    throw new CorruptVolumeException(String.format("Tree root page %,d has invalid type %s",
                            rootPageAddr, buffer.getPageTypeName()));
                }
                version._rootPageAddr = rootPageAddr;
                version._depth = type - Buffer.PAGE_TYPE_DATA + 1;
            } finally {
View Full Code Here

    }

    void corrupt(final String error) throws CorruptVolumeException {
        Debug.$assert0.t(false);
        _persistit.getLogBase().corruptVolume.log(error + Util.NEW_LINE + toStringDetail());
        throw new CorruptVolumeException(error);
    }
View Full Code Here

            Buffer buffer = null;
            long deallocate = -1;
            try {
                buffer = _pool.get(_volume, page, false, true);
                if (buffer.getPageType() != depth) {
                    throw new CorruptVolumeException(buffer + " type code=" + buffer.getPageType()
                            + " is not equal to expected value " + depth);
                }
                if (buffer.isIndexPage()) {
                    deallocate = page;
                    final int p = buffer.toKeyBlock(0);
View Full Code Here

            Buffer buffer = null;
            long deallocate = -1;
            try {
                buffer = _pool.get(_volume, page, false, true);
                if (buffer.getPageType() != depth) {
                    throw new CorruptVolumeException(buffer + " type code=" + buffer.getPageType()
                            + " is not equal to expected value " + depth);
                }
                if (buffer.isIndexPage()) {
                    deallocate = page;
                    final int p = buffer.toKeyBlock(0);
View Full Code Here

        if (_exchange != null) {
            _persistit.getLogBase().corruptVolume.log(error + Util.NEW_LINE + _exchange.toStringDetail());
        } else {
            _persistit.getLogBase().corruptVolume.log(error);
        }
        throw new CorruptVolumeException(error);
    }
View Full Code Here

                if (file.isFile()) {
                    stream = new FileInputStream(file);
                    final byte[] bytes = new byte[SIZE];
                    final int readSize = stream.read(bytes);
                    if (readSize < SIZE) {
                        throw new CorruptVolumeException("Volume file " + file + " too short: " + readSize);
                    }
                    /*
                     * Check out the fixed Volume file and learn the buffer
                     * size.
                     */
                    if (!verifySignature(bytes)) {
                        throw new CorruptVolumeException("Invalid signature");
                    }

                    final int version = getVersion(bytes);
                    if (version < MIN_SUPPORTED_VERSION || version > MAX_SUPPORTED_VERSION) {
                        throw new CorruptVolumeException("Version " + version
                                + " is not supported by Persistit version " + Persistit.version());
                    }
                    final int pageSize = getPageSize(bytes);
                    final long nextAvailablePage = getNextAvailablePage(bytes);
                    final long id = getId(bytes);
                    final long totalPages = file.length() / pageSize;
                    if (totalPages < nextAvailablePage) {
                        throw new CorruptVolumeException(String.format("Volume has been truncated: "
                                + "minimum required/actual lengths=%,d/%,d bytes", nextAvailablePage * pageSize,
                                file.length()));
                    }
                    final long globalTimestamp = getGlobalTimestamp(bytes);
                    if (globalTimestamp > systemTimestamp) {
                        throw new CorruptVolumeException("Volume " + file + " has a global timestamp greater than "
                                + "system timestamp: " + globalTimestamp + " > " + systemTimestamp);
                    }
                    specification.setVersion(version);
                    specification.setPageSize(pageSize);
                    specification.setId(id);
                } else {
                    throw new CorruptVolumeException("Volume file " + file + " is a directory");
                }
                return true;
            } else {
                return false;
            }
View Full Code Here

            final FileInputStream stream = new FileInputStream(file);
            final byte[] bytes = new byte[SIZE];
            final int readSize = stream.read(bytes);
            stream.close();
            if (readSize < SIZE) {
                throw new CorruptVolumeException(String.format(
                        "File %s of size %,d is too short to be a Volume file\n", file, readSize));
            }
            /*
             * Check out the fixed Volume file and learn the buffer size.
             */
            if (!verifySignature(bytes)) {
                throw new CorruptVolumeException(String.format("File %s is not a Volume file: Invalid signature", file));
            }
            postMessage(String.format("%30s: %s", "File", file), Task.LOG_NORMAL);
            outn("ID", getId(bytes));
            outn("Page size", getPageSize(bytes));
            outd("Creation time", getCreateTime(bytes));
View Full Code Here

    }

    void corrupt(final String error) throws CorruptVolumeException {
        Debug.$assert0.t(false);
        _persistit.getLogBase().corruptVolume.log(error + Util.NEW_LINE + toStringDetail());
        throw new CorruptVolumeException(error);
    }
View Full Code Here

TOP

Related Classes of com.persistit.exception.CorruptVolumeException

Copyright © 2018 www.massapicom. 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.