private SnapshotDescription toSnapshotDescription(ProcedureDescription desc) throws IOException { SnapshotDescription.Builder builder = SnapshotDescription.newBuilder(); if (!desc.hasInstance()) { throw new IOException("Snapshot name is not defined: " + desc.toString()); } String snapshotName = desc.getInstance(); List<NameStringPair> props = desc.getConfigurationList(); String table = null; for (NameStringPair prop : props) { if ("table".equalsIgnoreCase(prop.getName())) { table = prop.getValue(); } } if (table == null) { throw new IOException("Snapshot table is not defined: " + desc.toString()); } TableName tableName = TableName.valueOf(table); builder.setTable(tableName.getNameAsString()); builder.setName(snapshotName); builder.setType(SnapshotDescription.Type.FLUSH); return builder.build(); }
/** * Take a snapshot of a disabled table. * @param snapshot description of the snapshot to take. Modified to be {@link Type#DISABLED}. * @throws HBaseSnapshotException if the snapshot could not be started */ private synchronized void snapshotDisabledTable(SnapshotDescription snapshot) throws HBaseSnapshotException { // setup the snapshot prepareToTakeSnapshot(snapshot); // set the snapshot to be a disabled snapshot, since the client doesn't know about that snapshot = snapshot.toBuilder().setType(Type.DISABLED).build(); // Take the snapshot of the disabled table DisabledTableSnapshotHandler handler = new DisabledTableSnapshotHandler(snapshot, master); snapshotTable(snapshot, handler); }
/** * Take a snapshot of a disabled table. * @param snapshot description of the snapshot to take. Modified to be {@link Type#DISABLED}. * @throws HBaseSnapshotException if the snapshot could not be started */ private synchronized void snapshotDisabledTable(SnapshotDescription snapshot) throws HBaseSnapshotException { // setup the snapshot prepareToTakeSnapshot(snapshot); // set the snapshot to be a disabled snapshot, since the client doesn't know about that snapshot = snapshot.toBuilder().setType(Type.DISABLED).build(); // Take the snapshot of the disabled table DisabledTableSnapshotHandler handler = new DisabledTableSnapshotHandler(snapshot, master, metricsMaster); snapshotTable(snapshot, handler); }
@Override public void snapshot(String string, TableName tn, Type type) throws IOException, SnapshotCreationException, IllegalArgumentException { wrappedHbaseAdmin.snapshot(string, tn, type); }
public void snapshot(String snapshotName, String tableName, Type type) throws IOException, SnapshotCreationException, IllegalArgumentException { delegate.snapshot(snapshotName, tableName, type); }
void snapshot(String snapshotName, String tableName, Type type) throws IOException, SnapshotCreationException, IllegalArgumentException;
/** * Unsupported. */ public void snapshot(String snapshotName, String tableName, Type type) throws IOException, SnapshotCreationException, IllegalArgumentException { throw new UnsupportedOperationException(); }