use of com.sequenceiq.sdx.api.model.SdxDatabaseRestoreStatusResponse in project cloudbreak by hortonworks.
the class SdxBackupRestoreService method getDatabaseRestoreStatus.
public SdxDatabaseRestoreStatusResponse getDatabaseRestoreStatus(SdxCluster sdxCluster, String operationId) {
MDCBuilder.buildMdcContext(sdxCluster);
SdxOperation drStatus = getDatabaseDrStatus(sdxCluster, operationId, SdxOperationType.RESTORE);
return new SdxDatabaseRestoreStatusResponse(convertSdxDatabaseDrStatus(drStatus.getStatus()), drStatus.getStatusReason());
}
use of com.sequenceiq.sdx.api.model.SdxDatabaseRestoreStatusResponse in project cloudbreak by hortonworks.
the class DatalakeRestoreActions method datalakeFullResoreInProgress.
@Bean(name = "DATALAKE_FULL_RESTORE_IN_PROGRESS_STATE")
public Action<?, ?> datalakeFullResoreInProgress() {
return new AbstractSdxAction<>(SdxEvent.class) {
@Override
protected SdxContext createFlowContext(FlowParameters flowParameters, StateContext<FlowState, FlowEvent> stateContext, SdxEvent payload) {
return SdxContext.from(flowParameters, payload);
}
@Override
protected void doExecute(SdxContext context, SdxEvent payload, Map<Object, Object> variables) {
LOGGER.info("Full datalake restore is in progress for {} ", payload.getResourceId());
String operationId = (String) variables.get(OPERATION_ID);
String restoreId = (String) variables.get(RESTORE_ID);
SdxCluster sdxCluster = sdxService.getById(payload.getResourceId());
SdxDatabaseRestoreStatusResponse restoreStatusResponse = sdxBackupRestoreService.getDatabaseRestoreStatus(sdxCluster, operationId);
if (restoreStatusResponse.getStatus().equals(DatalakeDatabaseDrStatus.INPROGRESS)) {
sdxBackupRestoreService.updateDatabaseStatusEntry(operationId, SdxOperationStatus.SUCCEEDED, null);
}
sendEvent(context, DatalakeFullRestoreWaitRequest.from(context, restoreId));
}
@Override
protected Object getFailurePayload(SdxEvent payload, Optional<SdxContext> flowContext, Exception ex) {
return DatalakeRestoreFailedEvent.from(flowContext, payload, ex);
}
};
}
Aggregations