Search in sources :

Example 56 with IgniteInternalException

use of org.apache.ignite.lang.IgniteInternalException in project ignite-3 by apache.

the class RocksDbPartitionStorage method restoreSnapshot.

/**
 * {@inheritDoc}
 */
@Override
public void restoreSnapshot(Path path) {
    try (IngestExternalFileOptions ingestOptions = new IngestExternalFileOptions()) {
        Path snapshotPath = path.resolve(data.name());
        if (!Files.exists(snapshotPath)) {
            throw new IgniteInternalException("Snapshot not found: " + snapshotPath);
        }
        data.ingestExternalFile(Collections.singletonList(snapshotPath.toString()), ingestOptions);
    } catch (RocksDBException e) {
        throw new IgniteInternalException("Fail to ingest sst file at path: " + path, e);
    }
}
Also used : Path(java.nio.file.Path) RocksDBException(org.rocksdb.RocksDBException) IgniteInternalException(org.apache.ignite.lang.IgniteInternalException) IngestExternalFileOptions(org.rocksdb.IngestExternalFileOptions)

Example 57 with IgniteInternalException

use of org.apache.ignite.lang.IgniteInternalException in project ignite-3 by apache.

the class SqlSchemaManagerImpl method awaitLatestTableSchema.

@Nullable
private IgniteTable awaitLatestTableSchema(UUID tableId) {
    try {
        TableImpl table = tableManager.table(tableId);
        if (table == null) {
            return null;
        }
        table.schemaView().waitLatestSchema();
        return convert(table);
    } catch (NodeStoppingException e) {
        throw new IgniteInternalException(e);
    }
}
Also used : NodeStoppingException(org.apache.ignite.lang.NodeStoppingException) IgniteInternalException(org.apache.ignite.lang.IgniteInternalException) TableImpl(org.apache.ignite.internal.table.TableImpl) Nullable(org.jetbrains.annotations.Nullable)

Example 58 with IgniteInternalException

use of org.apache.ignite.lang.IgniteInternalException in project ignite-3 by apache.

the class SqlSchemaManagerImpl method rebuild.

private void rebuild(long causalityToken) {
    SchemaPlus newCalciteSchema = Frameworks.createRootSchema(false);
    newCalciteSchema.add("PUBLIC", new IgniteSchema("PUBLIC"));
    // TODO rewrite with VersionedValue#update to get the current (maybe temporary) value for current token
    // TODO https://issues.apache.org/jira/browse/IGNITE-16543
    Map<String, IgniteSchema> schemas = schemasVv.latest();
    schemas.forEach(newCalciteSchema::add);
    calciteSchemaVv.update(causalityToken, s -> newCalciteSchema, e -> {
        throw new IgniteInternalException(e);
    });
    onSchemaUpdatedCallback.run();
}
Also used : IgniteInternalException(org.apache.ignite.lang.IgniteInternalException) SchemaPlus(org.apache.calcite.schema.SchemaPlus)

Aggregations

IgniteInternalException (org.apache.ignite.lang.IgniteInternalException)58 RocksDBException (org.rocksdb.RocksDBException)19 IOException (java.io.IOException)11 Path (java.nio.file.Path)10 ArrayList (java.util.ArrayList)10 NotNull (org.jetbrains.annotations.NotNull)10 WriteBatch (org.rocksdb.WriteBatch)9 List (java.util.List)7 Entry (org.apache.ignite.internal.metastorage.server.Entry)7 NoSuchElementException (java.util.NoSuchElementException)6 NetworkAddress (org.apache.ignite.network.NetworkAddress)6 Test (org.junit.jupiter.api.Test)6 RaftGroupService (org.apache.ignite.raft.client.service.RaftGroupService)5 Nullable (org.jetbrains.annotations.Nullable)5 UUID (java.util.UUID)4 TimeoutException (java.util.concurrent.TimeoutException)4 NodeStoppingException (org.apache.ignite.lang.NodeStoppingException)4 ReadOptions (org.rocksdb.ReadOptions)4 RocksIterator (org.rocksdb.RocksIterator)4 CompletableFuture (java.util.concurrent.CompletableFuture)3