public String getStatusAndProgressAsString() { StringBuilder sb = new StringBuilder(); sb.append("id: ").append(getBackupId()).append(" state: ").append(getState()) .append(" progress: ").append(getProgress()); return sb.toString(); }
public String getShortDescription() { StringBuilder sb = new StringBuilder(); sb.append("{"); sb.append("ID=" + backupId).append(","); sb.append("Type=" + getType()).append(","); sb.append("Tables=" + getTableListAsString()).append(","); sb.append("State=" + getState()).append(","); Date date = null; Calendar cal = Calendar.getInstance(); cal.setTimeInMillis(getStartTs()); date = cal.getTime(); sb.append("Start time=" + date).append(","); if (state == BackupState.FAILED) { sb.append("Failed message=" + getFailedMsg()).append(","); } else if (state == BackupState.RUNNING) { sb.append("Phase=" + getPhase()).append(","); } else if (state == BackupState.COMPLETE) { cal = Calendar.getInstance(); cal.setTimeInMillis(getCompleteTs()); date = cal.getTime(); sb.append("End time=" + date).append(","); } sb.append("Progress=" + getProgress() + "%"); sb.append("}"); return sb.toString(); }
int progress = info == null ? -1 : info.getProgress(); if (progress < 0) { if (backupId != null) {
/** * Verify that full backup is created on a single table with data correctly. * * @throws Exception if doing the backup or an operation on the tables fails */ @Test public void testBackupStatusProgress() throws Exception { LOG.info("test backup status/progress on a single table with data"); List<TableName> tableList = Lists.newArrayList(table1); String backupId = fullTableBackup(tableList); LOG.info("backup complete"); assertTrue(checkSucceeded(backupId)); BackupInfo info = getBackupAdmin().getBackupInfo(backupId); assertTrue(info.getState() == BackupState.COMPLETE); LOG.debug(info.getShortDescription()); assertTrue(info.getProgress() > 0); }
public BackupProtos.BackupInfo toProtosBackupInfo() { BackupProtos.BackupInfo.Builder builder = BackupProtos.BackupInfo.newBuilder(); builder.setBackupId(getBackupId()); setBackupTableInfoMap(builder); builder.setCompleteTs(getCompleteTs()); if (getFailedMsg() != null) { builder.setFailedMessage(getFailedMsg()); } if (getState() != null) { builder.setBackupState(BackupProtos.BackupInfo.BackupState.valueOf(getState().name())); } if (getPhase() != null) { builder.setBackupPhase(BackupProtos.BackupInfo.BackupPhase.valueOf(getPhase().name())); } builder.setProgress(getProgress()); builder.setStartTs(getStartTs()); builder.setBackupRootDir(getBackupRootDir()); builder.setBackupType(BackupProtos.BackupType.valueOf(getType().name())); builder.setWorkersNumber(workers); builder.setBandwidth(bandwidth); return builder.build(); }