fun listRawBackup(ignore: Boolean): BackupFileSet? { val clusterBackupFiles = BackupFileSet(this.quorumSize) val errorList: List<String> = ArrayList() try { val backupTasks: List<BackupProcessor.BackupTask<List<BackupSetInfo>>> = BackupProcessor(getHosts(), Arrays.asList(ports.get(2)), null).process( ListBackupCallable(), false ) var result: Throwable? = null for (task in backupTasks) { try { clusterBackupFiles.addAll( task.getResponse().getFuture().get(), task.getRequest().getNode() ) log.info("List backup on node({})success", task.getRequest().getHost()) } catch (e: CancellationException) { log.warn( "The task of listing backup on node({}) was canceled", task.getRequest().getHost(), e ) } catch (e: InterruptedException) { log.error( java.lang.String.format( "List backup on node(%s:%d) failed", task.getRequest().getHost(), task.getRequest().getPort() ), e ) result = result ?: e errorList.add(task.getRequest().getNode()) } catch (e: ExecutionException) { val cause: Throwable = e.getCause() if (ignore) { log.warn( java.lang.String.format( "List backup on node(%s:%d) failed.", task.getRequest().getHost(), task.getRequest().getPort() ), cause ) } else { log.error( java.lang.String.format( "List backup on node(%s:%d) failed.", task.getRequest().getHost(), task.getRequest().getPort() ), cause ) } result = result ?: cause errorList.add(task.getRequest().getNode()) } } if (result != null) { if (result is Exception) { throw (result as Exception?)!! } else { throw Exception(result) } } } catch (e: Exception) { val cause = if (e.cause == null) e else e.cause!! if (ignore) { log.warn( "List backup on nodes({}) failed, but ignore the errors", errorList.toString(), cause ) } else { log.error("Exception when listing backups", e) throw BackupException.fatals.failedToListBackup(errorList.toString(), cause) } } return clusterBackupFiles }
Get a list of backup sets info