failures.addAll(resolveAndArchive(fs, parentArchiveDir, children, start));
List<File> failedArchive = resolveAndArchive(fs, storeArchiveDir, storeFiles, EnvironmentEdgeManager.currentTime());
failures.addAll(resolveAndArchive(fs, parentArchiveDir, children, start));
List<File> failedArchive = resolveAndArchive(fs, storeArchiveDir, toArchive, EnvironmentEdgeManager.currentTime()); if (!failedArchive.isEmpty()){
failures.addAll(resolveAndArchive(fs, parentArchiveDir, children, start));
List<File> failedArchive = resolveAndArchive(fs, regionArchiveDir, toArchive, EnvironmentEdgeManager.currentTime()); if (!failedArchive.isEmpty()) {
/** * Archive the given files and resolve any conflicts with existing files via appending the time * archiving started (so all conflicts in the same group have the same timestamp appended). * <p> * If any of the passed files to archive are directories, archives the all files under that * directory. Archive directory structure for children is the base archive directory name + the * parent directory and is built recursively is passed files are directories themselves. * @param fs {@link FileSystem} on which to archive the files * @param baseArchiveDir base archive directory to archive the given files * @param toArchive files to be archived * @return <tt>true</tt> on success, <tt>false</tt> otherwise * @throws IOException on unexpected failure */ private static boolean resolveAndArchive(FileSystem fs, Path baseArchiveDir, Collection<File> toArchive) throws IOException { LOG.debug("Starting to archive files:" + toArchive); long start = EnvironmentEdgeManager.currentTimeMillis(); List<File> failures = resolveAndArchive(fs, baseArchiveDir, toArchive, start); // notify that some files were not archived. // We can't delete the files otherwise snapshots or other backup system // that relies on the archiver end up with data loss. if (failures.size() > 0) { LOG.warn("Failed to complete archive of: " + failures + ". Those files are still in the original location, and they may slow down reads."); return false; } return true; }
/** * Remove from the specified region the store files of the specified column family, * either by archiving them or outright deletion * @param fs the filesystem where the store files live * @param conf {@link Configuration} to examine to determine the archive directory * @param parent Parent region hosting the store files * @param tableDir {@link Path} to where the table is being stored (for building the archive path) * @param family the family hosting the store files * @throws IOException if the files could not be correctly disposed. */ public static void archiveFamily(FileSystem fs, Configuration conf, HRegionInfo parent, Path tableDir, byte[] family) throws IOException { Path familyDir = new Path(tableDir, new Path(parent.getEncodedName(), Bytes.toString(family))); FileStatus[] storeFiles = FSUtils.listStatus(fs, familyDir, null); if (storeFiles == null) { LOG.debug("No store files to dispose for region=" + parent.getRegionNameAsString() + ", family=" + Bytes.toString(family)); return; } FileStatusConverter getAsFile = new FileStatusConverter(fs); Collection<File> toArchive = Lists.transform(Arrays.asList(storeFiles), getAsFile); Path storeArchiveDir = HFileArchiveUtil.getStoreArchivePath(conf, parent, tableDir, family); // do the actual archive if (!resolveAndArchive(fs, storeArchiveDir, toArchive)) { throw new IOException("Failed to archive/delete all the files for region:" + Bytes.toString(parent.getRegionName()) + ", family:" + Bytes.toString(family) + " into " + storeArchiveDir + ". Something is probably awry on the filesystem."); } }
if (!resolveAndArchive(fs, storeArchiveDir, storeFiles)) { throw new IOException("Failed to archive/delete all the files for region:" + Bytes.toString(parent.getRegionName()) + ", family:" + Bytes.toString(family)
/** * Remove from the specified region the store files of the specified column family, * either by archiving them or outright deletion * @param fs the filesystem where the store files live * @param conf {@link Configuration} to examine to determine the archive directory * @param parent Parent region hosting the store files * @param tableDir {@link Path} to where the table is being stored (for building the archive path) * @param family the family hosting the store files * @throws IOException if the files could not be correctly disposed. */ public static void archiveFamily(FileSystem fs, Configuration conf, HRegionInfo parent, Path tableDir, byte[] family) throws IOException { Path familyDir = new Path(tableDir, new Path(parent.getEncodedName(), Bytes.toString(family))); FileStatus[] storeFiles = FSUtils.listStatus(fs, familyDir); if (storeFiles == null) { LOG.debug("No store files to dispose for region=" + parent.getRegionNameAsString() + ", family=" + Bytes.toString(family)); return; } FileStatusConverter getAsFile = new FileStatusConverter(fs); Collection<File> toArchive = Lists.transform(Arrays.asList(storeFiles), getAsFile); Path storeArchiveDir = HFileArchiveUtil.getStoreArchivePath(conf, parent, tableDir, family); // do the actual archive if (!resolveAndArchive(fs, storeArchiveDir, toArchive)) { throw new IOException("Failed to archive/delete all the files for region:" + Bytes.toString(parent.getRegionName()) + ", family:" + Bytes.toString(family) + " into " + storeArchiveDir + ". Something is probably awry on the filesystem."); } }
boolean success = false; try { success = resolveAndArchive(fs, regionArchiveDir, toArchive); } catch (IOException e) { LOG.error("Failed to archive: " + toArchive, e);
/** * Archive the given files and resolve any conflicts with existing files via appending the time * archiving started (so all conflicts in the same group have the same timestamp appended). * <p> * If any of the passed files to archive are directories, archives all the files under that * directory. Archive directory structure for children is the base archive directory name + the * parent directory and is built recursively is passed files are directories themselves. * @param fs {@link FileSystem} on which to archive the files * @param baseArchiveDir base archive directory to archive the given files * @param toArchive files to be archived * @return <tt>true</tt> on success, <tt>false</tt> otherwise * @throws IOException on unexpected failure */ private static boolean resolveAndArchive(FileSystem fs, Path baseArchiveDir, Collection<File> toArchive) throws IOException { if (LOG.isTraceEnabled()) LOG.trace("Starting to archive " + toArchive); long start = EnvironmentEdgeManager.currentTime(); List<File> failures = resolveAndArchive(fs, baseArchiveDir, toArchive, start); // notify that some files were not archived. // We can't delete the files otherwise snapshots or other backup system // that relies on the archiver end up with data loss. if (failures.size() > 0) { LOG.warn("Failed to complete archive of: " + failures + ". Those files are still in the original location, and they may slow down reads."); return false; } return true; }
if (!resolveAndArchive(fs, storeArchiveDir, storeFiles)) { throw new IOException("Failed to archive/delete all the files for region:" + Bytes.toString(regionInfo.getRegionName()) + ", family:" + Bytes.toString(family)
boolean success = false; try { success = resolveAndArchive(fs, regionArchiveDir, toArchive); } catch (IOException e) { LOG.error("Failed to archive " + toArchive, e);