Search in sources :

Example 1 with DefragmentationWorkflowCallback

use of org.apache.ignite.internal.processors.cache.persistence.defragmentation.maintenance.DefragmentationWorkflowCallback in project ignite by apache.

the class GridCacheDatabaseSharedManager method readMetastore.

/**
 */
private void readMetastore() throws IgniteCheckedException {
    try {
        CheckpointStatus status = readCheckpointStatus();
        checkpointReadLock();
        try {
            dataRegion(METASTORE_DATA_REGION_NAME).pageMemory().start();
            performBinaryMemoryRestore(status, onlyMetastorageGroup(), physicalRecords(), false);
            metaStorage = createMetastorage(true);
            applyLogicalUpdates(status, onlyMetastorageGroup(), onlyMetastorageAndEncryptionRecords(), true);
            fillWalDisabledGroups();
            checkpointManager.initializeStorage();
            registerSystemView();
            notifyMetastorageReadyForRead();
            cctx.kernalContext().maintenanceRegistry().registerWorkflowCallbackIfTaskExists(DEFRAGMENTATION_MNTC_TASK_NAME, task -> {
                prepareCacheDefragmentation(fromStore(task).cacheNames());
                return new DefragmentationWorkflowCallback(cctx.kernalContext()::log, defrgMgr, cctx.kernalContext().failure());
            });
        } finally {
            if (metaStorage != null)
                metaStorage.close();
            metaStorage = null;
            dataRegion(METASTORE_DATA_REGION_NAME).pageMemory().stop(false);
            cctx.pageStore().cleanupPageStoreIfMatch(new Predicate<Integer>() {

                @Override
                public boolean test(Integer grpId) {
                    return MetaStorage.METASTORAGE_CACHE_ID == grpId;
                }
            }, false);
            checkpointReadUnlock();
        }
    } catch (StorageException e) {
        cctx.kernalContext().failure().process(new FailureContext(FailureType.CRITICAL_ERROR, e));
        throw new IgniteCheckedException(e);
    }
}
Also used : AtomicInteger(java.util.concurrent.atomic.AtomicInteger) IgniteSystemProperties.getInteger(org.apache.ignite.IgniteSystemProperties.getInteger) CheckpointStatus(org.apache.ignite.internal.processors.cache.persistence.checkpoint.CheckpointStatus) IgniteCheckedException(org.apache.ignite.IgniteCheckedException) FailureContext(org.apache.ignite.failure.FailureContext) DefragmentationWorkflowCallback(org.apache.ignite.internal.processors.cache.persistence.defragmentation.maintenance.DefragmentationWorkflowCallback)

Aggregations

AtomicInteger (java.util.concurrent.atomic.AtomicInteger)1 IgniteCheckedException (org.apache.ignite.IgniteCheckedException)1 IgniteSystemProperties.getInteger (org.apache.ignite.IgniteSystemProperties.getInteger)1 FailureContext (org.apache.ignite.failure.FailureContext)1 CheckpointStatus (org.apache.ignite.internal.processors.cache.persistence.checkpoint.CheckpointStatus)1 DefragmentationWorkflowCallback (org.apache.ignite.internal.processors.cache.persistence.defragmentation.maintenance.DefragmentationWorkflowCallback)1