/** * Returns the current log file output stream * * @return the output stream for the current log file * @throws IOException */ private OutputStream openCurrentLog() throws IOException { String currentLogFile = mJournal.getCurrentLogFilePath(); OutputStream os = mUfs.create(currentLogFile); LOG.info("Opened current log file: " + currentLogFile); return os; }
/** * Returns an output stream for the journal checkpoint. The returned output stream is a singleton * for this writer. * * @param latestSequenceNumber the sequence number of the latest journal entry. This sequence * number will be used to determine the next sequence numbers for the subsequent journal * entries. * @return the output stream for the journal checkpoint * @throws IOException */ public synchronized JournalOutputStream getCheckpointOutputStream(long latestSequenceNumber) throws IOException { if (mCheckpointOutputStream == null) { LOG.info("Creating tmp checkpoint file: " + mTempCheckpointPath); if (!mUfs.exists(mJournalDirectory)) { LOG.info("Creating journal folder: " + mJournalDirectory); mUfs.mkdirs(mJournalDirectory, true); } mNextEntrySequenceNumber = latestSequenceNumber + 1; LOG.info("Latest journal sequence number: " + latestSequenceNumber + " Next journal sequence number: " + mNextEntrySequenceNumber); mCheckpointOutputStream = new CheckpointOutputStream(new DataOutputStream(mUfs.create(mTempCheckpointPath))); } return mCheckpointOutputStream; }
throw new IOException("Failed to create " + parentPath); OutputStream outputStream = mUfs.create(dstPath); final WritableByteChannel outputChannel = Channels.newChannel(outputStream);
UnderFileSystem ufs = UnderFileSystem.get(fileName, ClientContext.getConf()); mUnderStorageOutputStream = ufs.create(fileName, (int) mBlockSize); } else { mUfsPath = null;