Search in sources :

Example 21 with UnderlyingStorageException

use of org.neo4j.exceptions.UnderlyingStorageException in project neo4j by neo4j.

the class MetaDataStore method readAllFields.

private void readAllFields(PageCursor cursor) throws IOException {
    do {
        creationTimeField = getRecordValue(cursor, Position.TIME);
        randomNumberField = getRecordValue(cursor, Position.RANDOM_NUMBER);
        versionField = getRecordValue(cursor, Position.LOG_VERSION);
        long lastCommittedTxId = getRecordValue(cursor, Position.LAST_TRANSACTION_ID);
        lastCommittingTxField.set(lastCommittedTxId);
        storeVersionField = getRecordValue(cursor, Position.STORE_VERSION);
        getRecordValue(cursor, Position.FIRST_GRAPH_PROPERTY);
        latestConstraintIntroducingTxField = getRecordValue(cursor, Position.LAST_CONSTRAINT_TRANSACTION);
        upgradeTxIdField = getRecordValue(cursor, Position.UPGRADE_TRANSACTION_ID);
        upgradeTxChecksumField = (int) getRecordValue(cursor, Position.UPGRADE_TRANSACTION_CHECKSUM);
        upgradeTimeField = getRecordValue(cursor, Position.UPGRADE_TIME);
        long lastClosedTransactionLogVersion = getRecordValue(cursor, Position.LAST_CLOSED_TRANSACTION_LOG_VERSION);
        long lastClosedTransactionLogByteOffset = getRecordValue(cursor, Position.LAST_CLOSED_TRANSACTION_LOG_BYTE_OFFSET);
        lastClosedTx.set(lastCommittedTxId, new long[] { lastClosedTransactionLogVersion, lastClosedTransactionLogByteOffset });
        highestCommittedTransaction.set(lastCommittedTxId, (int) getRecordValue(cursor, Position.LAST_TRANSACTION_CHECKSUM), getRecordValue(cursor, Position.LAST_TRANSACTION_COMMIT_TIMESTAMP, UNKNOWN_TX_COMMIT_TIMESTAMP));
        upgradeCommitTimestampField = getRecordValue(cursor, Position.UPGRADE_TRANSACTION_COMMIT_TIMESTAMP, BASE_TX_COMMIT_TIMESTAMP);
        externalStoreUUID = readExternalStoreUUID(cursor);
        databaseUUID = readDatabaseUUID(cursor);
        upgradeTransaction = new TransactionId(upgradeTxIdField, upgradeTxChecksumField, upgradeCommitTimestampField);
        checkpointLogVersionField = getRecordValue(cursor, CHECKPOINT_LOG_VERSION, 0);
        kernelVersion = getRecordValue(cursor, KERNEL_VERSION);
    } while (cursor.shouldRetry());
    if (cursor.checkAndClearBoundsFlag()) {
        throw new UnderlyingStorageException("Out of page bounds when reading all meta-data fields. The page in question is page " + cursor.getCurrentPageId() + " of file " + storageFile.toAbsolutePath() + ", which is " + cursor.getCurrentPageSize() + " bytes in size");
    }
}
Also used : UnderlyingStorageException(org.neo4j.exceptions.UnderlyingStorageException) TransactionId(org.neo4j.storageengine.api.TransactionId)

Example 22 with UnderlyingStorageException

use of org.neo4j.exceptions.UnderlyingStorageException in project neo4j by neo4j.

the class RecordStorageEngineTest method executeFailingTransaction.

private static Exception executeFailingTransaction(RecordStorageEngine engine) throws IOException {
    Exception applicationError = new UnderlyingStorageException("No space left on device");
    CommandsToApply txToApply = newTransactionThatFailsWith(applicationError);
    try {
        engine.apply(txToApply, TransactionApplicationMode.INTERNAL);
        fail("Exception expected");
    } catch (Exception e) {
        assertSame(applicationError, getRootCause(e));
    }
    return applicationError;
}
Also used : CommandsToApply(org.neo4j.storageengine.api.CommandsToApply) UnderlyingStorageException(org.neo4j.exceptions.UnderlyingStorageException) UnderlyingStorageException(org.neo4j.exceptions.UnderlyingStorageException) IOException(java.io.IOException) KernelException(org.neo4j.exceptions.KernelException)

Aggregations

UnderlyingStorageException (org.neo4j.exceptions.UnderlyingStorageException)22 IOException (java.io.IOException)13 PageCursor (org.neo4j.io.pagecache.PageCursor)10 MetaDataRecord (org.neo4j.kernel.impl.store.record.MetaDataRecord)3 NoSuchFileException (java.nio.file.NoSuchFileException)2 Test (org.junit.jupiter.api.Test)2 PagedFile (org.neo4j.io.pagecache.PagedFile)2 LogTailInformation (org.neo4j.kernel.impl.transaction.log.files.LogTailInformation)2 TransactionId (org.neo4j.storageengine.api.TransactionId)2 UncheckedIOException (java.io.UncheckedIOException)1 HashMap (java.util.HashMap)1 HashSet (java.util.HashSet)1 Map (java.util.Map)1 KernelException (org.neo4j.exceptions.KernelException)1 Pair (org.neo4j.internal.helpers.collection.Pair)1 IndexDescriptor (org.neo4j.internal.schema.IndexDescriptor)1 IndexEntryConflictException (org.neo4j.kernel.api.exceptions.index.IndexEntryConflictException)1 IndexUpdater (org.neo4j.kernel.api.index.IndexUpdater)1 MetaDataStore.versionLongToString (org.neo4j.kernel.impl.store.MetaDataStore.versionLongToString)1 MultipleUnderlyingStorageExceptions (org.neo4j.kernel.impl.store.MultipleUnderlyingStorageExceptions)1