use of org.apache.ignite.internal.storage.PartitionStorage in project ignite-3 by apache.
the class RocksDbTableStorage method dropPartition.
/**
* {@inheritDoc}
*/
@Override
public void dropPartition(int partId) throws StorageException {
PartitionStorage partition = getPartition(partId);
if (partition != null) {
partitions.set(partId, null);
partition.destroy();
meta.removePartitionId(partId);
}
}
use of org.apache.ignite.internal.storage.PartitionStorage in project ignite-3 by apache.
the class RocksDbTableStorage method getOrCreatePartition.
/**
* {@inheritDoc}
*/
@Override
public PartitionStorage getOrCreatePartition(int partId) throws StorageException {
PartitionStorage storage = getPartition(partId);
if (storage != null) {
return storage;
}
// Possible races when creating the partitions with the same ID are safe, since both the storage creation and the meta update
// are cheap and idempotent.
storage = new RocksDbPartitionStorage(threadPool, partId, db, partitionCf);
partitions.set(partId, storage);
meta.putPartitionId(partId);
return storage;
}
use of org.apache.ignite.internal.storage.PartitionStorage in project ignite-3 by apache.
the class RocksDbTableStorage method stop.
/**
* {@inheritDoc}
*/
@Override
public void stop() throws StorageException {
stopped = true;
List<AutoCloseable> resources = new ArrayList<>();
resources.addAll(autoCloseables);
resources.addAll(sortedIndices.values());
for (int i = 0; i < partitions.length(); i++) {
PartitionStorage partition = partitions.get(i);
if (partition != null) {
resources.add(partition);
}
}
Collections.reverse(resources);
try {
IgniteUtils.closeAll(resources);
} catch (Exception e) {
throw new StorageException("Failed to stop RocksDB table storage.", e);
}
}
Aggregations