use of com.sequenceiq.datalake.flow.dr.backup.event.DatalakeFullBackupInProgressEvent in project cloudbreak by hortonworks.
the class DatalakeDatabaseBackupWaitHandler method doAccept.
@Override
protected Selectable doAccept(HandlerEvent<DatalakeDatabaseBackupWaitRequest> event) {
DatalakeDatabaseBackupWaitRequest request = event.getData();
Long sdxId = request.getResourceId();
String userId = request.getUserId();
Selectable response;
try {
LOGGER.info("Start polling datalake database backup for id: {}", sdxId);
PollingConfig pollingConfig = new PollingConfig(sleepTimeInSec, TimeUnit.SECONDS, durationInMinutes, TimeUnit.MINUTES);
sdxBackupRestoreService.waitCloudbreakFlow(sdxId, pollingConfig, "Database backup");
response = new DatalakeFullBackupInProgressEvent(sdxId, userId, request.getOperationId());
} catch (UserBreakException userBreakException) {
LOGGER.info("Database backup polling exited before timeout. Cause: ", userBreakException);
sdxBackupRestoreService.updateDatabaseStatusEntry(event.getData().getOperationId(), SdxOperationStatus.FAILED, userBreakException.getLocalizedMessage());
response = new DatalakeDatabaseBackupFailedEvent(sdxId, userId, userBreakException);
} catch (PollerStoppedException pollerStoppedException) {
LOGGER.info("Database backup poller stopped for cluster: {}", sdxId);
sdxBackupRestoreService.updateDatabaseStatusEntry(event.getData().getOperationId(), SdxOperationStatus.FAILED, pollerStoppedException.getLocalizedMessage());
response = new DatalakeDatabaseBackupFailedEvent(sdxId, userId, new PollerStoppedException("Database backup timed out after " + durationInMinutes + " minutes"));
} catch (PollerException exception) {
LOGGER.info("Database backup polling failed for cluster: {}", sdxId);
sdxBackupRestoreService.updateDatabaseStatusEntry(event.getData().getOperationId(), SdxOperationStatus.FAILED, exception.getLocalizedMessage());
response = new DatalakeDatabaseBackupFailedEvent(sdxId, userId, exception);
}
return response;
}
Aggregations