@Override protected void addOptions() { // define supported options addOptNoArg(OPTION_OVERWRITE, OPTION_OVERWRITE_DESC); addOptNoArg(OPTION_CHECK, OPTION_CHECK_DESC); addOptNoArg(OPTION_DEBUG, OPTION_DEBUG_DESC); addOptWithArg(OPTION_SET, OPTION_SET_RESTORE_DESC); addOptWithArg(OPTION_TABLE, OPTION_TABLE_LIST_DESC); addOptWithArg(OPTION_TABLE_MAPPING, OPTION_TABLE_MAPPING_DESC); addOptWithArg(OPTION_YARN_QUEUE_NAME, OPTION_YARN_QUEUE_NAME_RESTORE_DESC); }
@Override public void editRegion(final RegionInfo hri) throws IOException { HFileArchiver.archiveRegion(conf, fs, hri); } });
@Override public File apply(HStoreFile input) { return new FileableStoreFile(fs, input); } }
protected BackupRequest createBackupRequest(BackupType type, List<TableName> tables, String path) { BackupRequest.Builder builder = new BackupRequest.Builder(); BackupRequest request = builder.withBackupType(type) .withTableList(tables) .withTargetRootDir(path).build(); return request; }
private boolean compare(BackupInfo one, BackupInfo two) { return one.getBackupId().equals(two.getBackupId()) && one.getType().equals(two.getType()) && one.getBackupRootDir().equals(two.getBackupRootDir()) && one.getStartTs() == two.getStartTs() && one.getCompleteTs() == two.getCompleteTs(); }
protected boolean checkSucceeded(String backupId) throws IOException { BackupInfo status = getBackupInfo(backupId); if (status == null) { return false; } return status.getState() == BackupState.COMPLETE; }
public FileablePath(FileSystem fs, Path file) { super(fs); this.file = file; this.getAsFile = new FileStatusConverter(fs); }
@Override public Path apply(File file) { return file == null ? null : file.getPath(); } };
private void restore(RestoreRequest request, BackupAdmin client) throws IOException { client.restore(request); }
private String backup(BackupRequest request, BackupAdmin client) throws IOException { String backupId = client.backupTables(request); return backupId; }
private void merge(String[] backupIds, BackupAdmin client) throws IOException { client.mergeBackups(backupIds); }
@Override public void setUp() throws Exception { useSecondCluster = true; super.setUp(); }
protected void init() throws IOException { // disable irrelevant loggers to avoid it mess up command output LogUtils.disableZkAndClientLoggers(); }
public static String getTableBackupDataDir(String backupRootDir, String backupId, TableName tableName) { return getTableBackupDir(backupRootDir, backupId, tableName) + Path.SEPARATOR + "data"; }
public Builder withYarnPoolName(String name) { request.setYarnPoolName(name); return this; }
public Builder() { request = new RestoreRequest(); }
protected RestoreDriver() throws IOException { init(); }
protected boolean checkFailed(String backupId) throws IOException { BackupInfo status = getBackupInfo(backupId); if (status == null) { return false; } return status.getState() == BackupState.FAILED; }
@Override public void setUp() throws Exception { useSecondCluster = true; super.setUp(); }
protected void init() { // disable irrelevant loggers to avoid it mess up command output LogUtils.disableZkAndClientLoggers(); }