private static void createDistcpFile(VolumeManager fs, String exportDir, Path exportMetaFilePath, Map<String,String> uniqueFiles) throws IOException { BufferedWriter distcpOut = new BufferedWriter( new OutputStreamWriter(fs.create(new Path(exportDir, "distcp.txt"), false), UTF_8)); try { for (String file : uniqueFiles.values()) { distcpOut.append(file); distcpOut.newLine(); } distcpOut.append(exportMetaFilePath.toString()); distcpOut.newLine(); distcpOut.close(); distcpOut = null; } finally { if (distcpOut != null) distcpOut.close(); } }
FSDataOutputStream failFile = fs.create(new Path(errorDir, BulkImport.FAILURES_TXT), true); try (BufferedWriter out = new BufferedWriter(new OutputStreamWriter(failFile, UTF_8))) { for (String f : filesToLoad) {
logFile = fs.createSyncable(new Path(logPath), 0, replication, blockSize); else logFile = fs.create(new Path(logPath), true, 0, replication, blockSize); sync = logFile.getClass().getMethod("hsync"); flush = logFile.getClass().getMethod("hflush");
public static synchronized void updateAccumuloVersion(VolumeManager fs, int oldVersion) { for (Volume volume : fs.getVolumes()) { try { if (getAccumuloPersistentVersion(volume) == oldVersion) { log.debug("Attempting to upgrade {}", volume); Path dataVersionLocation = ServerConstants.getDataVersionLocation(volume); fs.create(new Path(dataVersionLocation, Integer.toString(ServerConstants.DATA_VERSION))) .close(); // TODO document failure mode & recovery if FS permissions cause above to work and below // to fail ACCUMULO-2596 Path prevDataVersionLoc = new Path(dataVersionLocation, Integer.toString(oldVersion)); if (!fs.delete(prevDataVersionLoc)) { throw new RuntimeException("Could not delete previous data version location (" + prevDataVersionLoc + ") for " + volume); } } } catch (IOException e) { throw new RuntimeException("Unable to set accumulo version: an error occurred.", e); } } }
FSDataOutputStream failFile = fs.create(new Path(errorDir, BulkImport.FAILURES_TXT), true); BufferedWriter out = new BufferedWriter(new OutputStreamWriter(failFile, UTF_8)); try {
logFile = fs.createSyncable(new Path(logPath), 0, replication, blockSize); else logFile = fs.create(new Path(logPath), true, 0, replication, blockSize); sync = logFile.getClass().getMethod("hsync"); flush = logFile.getClass().getMethod("hflush");
mappingsWriter = new BufferedWriter(new OutputStreamWriter(fs.create(path), UTF_8));
.makeQualified(new Path(exportDir, Constants.EXPORT_FILE)); FSDataOutputStream fileOut = fs.create(exportMetaFilePath, false); ZipOutputStream zipOut = new ZipOutputStream(fileOut); BufferedOutputStream bufOut = new BufferedOutputStream(zipOut);
BulkSerialize.writeRenameMap(oldToNewNameMap, bulkDir.toString(), p -> fs.create(p));
fs.create(SortedLogState.getFinishedMarkerPath(destPath)).close(); return; fs.create(new Path(destPath, "finished")).close(); log.info("Finished log sort {} {} bytes {} parts in {}ms", name, getBytesCopied(), part, getSortTime()); fs.create(SortedLogState.getFailedMarkerPath(destPath)).close(); } catch (IOException e) { log.error("Error creating failed flag file " + name, e);
private static void createDistcpFile(VolumeManager fs, String exportDir, Path exportMetaFilePath, Map<String,String> uniqueFiles) throws IOException { BufferedWriter distcpOut = new BufferedWriter( new OutputStreamWriter(fs.create(new Path(exportDir, "distcp.txt"), false), UTF_8)); try { for (String file : uniqueFiles.values()) { distcpOut.append(file); distcpOut.newLine(); } distcpOut.append(exportMetaFilePath.toString()); distcpOut.newLine(); distcpOut.close(); distcpOut = null; } finally { if (distcpOut != null) distcpOut.close(); } }
public static synchronized void updateAccumuloVersion(VolumeManager fs, int oldVersion) { for (Volume volume : fs.getVolumes()) { try { if (getAccumuloPersistentVersion(volume) == oldVersion) { log.debug("Attempting to upgrade " + volume); Path dataVersionLocation = ServerConstants.getDataVersionLocation(volume); fs.create(new Path(dataVersionLocation, Integer.toString(ServerConstants.DATA_VERSION))) .close(); // TODO document failure mode & recovery if FS permissions cause above to work and below // to fail ACCUMULO-2596 Path prevDataVersionLoc = new Path(dataVersionLocation, Integer.toString(oldVersion)); if (!fs.delete(prevDataVersionLoc)) { throw new RuntimeException("Could not delete previous data version location (" + prevDataVersionLoc + ") for " + volume); } } } catch (IOException e) { throw new RuntimeException("Unable to set accumulo version: an error occurred.", e); } } }
mappingsWriter = new BufferedWriter(new OutputStreamWriter(fs.create(path), UTF_8));
.makeQualified(new Path(exportDir, Constants.EXPORT_FILE)); FSDataOutputStream fileOut = fs.create(exportMetaFilePath, false); ZipOutputStream zipOut = new ZipOutputStream(fileOut); BufferedOutputStream bufOut = new BufferedOutputStream(zipOut);
fs.create(SortedLogState.getFinishedMarkerPath(destPath)).close(); return; fs.create(new Path(destPath, "finished")).close(); log.info("Finished log sort " + name + " " + getBytesCopied() + " bytes " + part + " parts in " + getSortTime() + "ms"); fs.create(SortedLogState.getFailedMarkerPath(destPath)).close(); } catch (IOException e) { log.error("Error creating failed flag file " + name, e);