@Test public void testValidateMissingTableName() { Configuration conf = new Configuration(false); try { SnapshotDescriptionUtils.validate(SnapshotDescription.newBuilder().setName("fail").build(), conf); fail("Snapshot was considered valid without a table name"); } catch (IllegalArgumentException e) { LOG.debug("Correctly failed when snapshot doesn't have a tablename"); } }
public static SnapshotDescription validate(SnapshotDescription snapshot, Configuration conf) throws IllegalArgumentException { if (!snapshot.hasTable()) { throw new IllegalArgumentException( "Descriptor doesn't apply to a table, so we can't build it."); } long time = snapshot.getCreationTime(); if (time == SnapshotDescriptionUtils.NO_SNAPSHOT_START_TIME_SPECIFIED) { time = EnvironmentEdgeManager.currentTimeMillis(); LOG.debug("Creation time not specified, setting to:" + time + " (current time:" + EnvironmentEdgeManager.currentTimeMillis() + ")."); SnapshotDescription.Builder builder = snapshot.toBuilder(); builder.setCreationTime(time); snapshot = builder.build(); } return snapshot; }
SnapshotDescriptionUtils { public static SnapshotDescription validate(SnapshotDescription snapshot, Configuration conf) throws IllegalArgumentException { if (!snapshot.hasTable()) { throw new IllegalArgumentException( "Descriptor doesn't apply to a table, so we can't build it."); } long time = snapshot.getCreationTime(); if (time == SnapshotDescriptionUtils.NO_SNAPSHOT_START_TIME_SPECIFIED) { time = EnvironmentEdgeManager.currentTimeMillis(); LOG.debug("Creation time not specified, setting to:" + time + " (current time:" + EnvironmentEdgeManager.currentTimeMillis() + ")."); SnapshotDescription.Builder builder = snapshot.toBuilder(); builder.setCreationTime(time); snapshot = builder.build(); } return snapshot; } }
SnapshotDescriptionUtils { public static SnapshotDescription validate(SnapshotDescription snapshot, Configuration conf) throws IllegalArgumentException { if (!snapshot.hasTable()) { throw new IllegalArgumentException( "Descriptor doesn't apply to a table, so we can't build it."); } long time = snapshot.getCreationTime(); if (time == SnapshotDescriptionUtils.NO_SNAPSHOT_START_TIME_SPECIFIED) { time = EnvironmentEdgeManager.currentTimeMillis(); LOG.debug("Creation time not specified, setting to:" + time + " (current time:" + EnvironmentEdgeManager.currentTimeMillis() + ")."); SnapshotDescription.Builder builder = snapshot.toBuilder(); builder.setCreationTime(time); snapshot = builder.build(); } return snapshot; } private  SnapshotDescriptionUtils(); }
SnapshotDescriptionUtils { public static SnapshotDescription validate(SnapshotDescription snapshot, Configuration conf) throws IllegalArgumentException { if (!snapshot.hasTable()) { throw new IllegalArgumentException( "Descriptor doesn't apply to a table, so we can't build it."); } long time = snapshot.getCreationTime(); if (time == SnapshotDescriptionUtils.NO_SNAPSHOT_START_TIME_SPECIFIED) { time = EnvironmentEdgeManager.currentTimeMillis(); LOG.debug("Creation time not specified, setting to:" + time + " (current time:" + EnvironmentEdgeManager.currentTimeMillis() + ")."); SnapshotDescription.Builder builder = snapshot.toBuilder(); builder.setCreationTime(time); snapshot = builder.build(); } return snapshot; } private  SnapshotDescriptionUtils(); static long getMaxMasterTimeout(Configuration conf, SnapshotDescription.Type type,
      long defaultMaxWaitTime); static Path getSnapshotRootDir(final Path rootDir); static Path getCompletedSnapshotDir(final SnapshotDescription snapshot, final Path rootDir); static Path getCompletedSnapshotDir(final String snapshotName, final Path rootDir); static Path getWorkingSnapshotDir(final Path rootDir); static Path getWorkingSnapshotDir(SnapshotDescription snapshot, final Path rootDir); static Path getWorkingSnapshotDir(String snapshotName, final Path rootDir); static final Path getSnapshotsDir(Path rootDir); static SnapshotDescription validate(SnapshotDescription snapshot, Configuration conf); static void writeSnapshotInfo(SnapshotDescription snapshot, Path workingDir, FileSystem fs); static SnapshotDescription readSnapshotInfo(FileSystem fs, Path snapshotDir); static void completeSnapshot(SnapshotDescription snapshot, Path rootdir, Path workingDir,
      FileSystem fs); }
SnapshotDescriptionUtils { public static SnapshotDescription validate(SnapshotDescription snapshot, Configuration conf) throws IllegalArgumentException { if (!snapshot.hasTable()) { throw new IllegalArgumentException( "Descriptor doesn't apply to a table, so we can't build it."); } long time = snapshot.getCreationTime(); if (time == SnapshotDescriptionUtils.NO_SNAPSHOT_START_TIME_SPECIFIED) { time = EnvironmentEdgeManager.currentTimeMillis(); LOG.debug("Creation time not specified, setting to:" + time + " (current time:" + EnvironmentEdgeManager.currentTimeMillis() + ")."); SnapshotDescription.Builder builder = snapshot.toBuilder(); builder.setCreationTime(time); snapshot = builder.build(); } return snapshot; } private  SnapshotDescriptionUtils(); static long getMaxMasterTimeout(Configuration conf, SnapshotDescription.Type type,
      long defaultMaxWaitTime); static Path getSnapshotRootDir(final Path rootDir); static Path getCompletedSnapshotDir(final SnapshotDescription snapshot, final Path rootDir); static Path getCompletedSnapshotDir(final String snapshotName, final Path rootDir); static Path getWorkingSnapshotDir(final Path rootDir); static Path getWorkingSnapshotDir(SnapshotDescription snapshot, final Path rootDir); static Path getWorkingSnapshotDir(String snapshotName, final Path rootDir); static final Path getSnapshotsDir(Path rootDir); static SnapshotDescription validate(SnapshotDescription snapshot, Configuration conf); static void writeSnapshotInfo(SnapshotDescription snapshot, Path workingDir, FileSystem fs); static SnapshotDescription readSnapshotInfo(FileSystem fs, Path snapshotDir); static void completeSnapshot(SnapshotDescription snapshot, Path rootdir, Path workingDir,
      FileSystem fs); static final int SNAPSHOT_LAYOUT_VERSION; static final String SNAPSHOTINFO_FILE; static final String SNAPSHOT_TMP_DIR_NAME; static final long NO_SNAPSHOT_START_TIME_SPECIFIED; static final String MASTER_SNAPSHOT_TIMEOUT_MILLIS; static final long DEFAULT_MAX_WAIT_TIME; }