Journal(Configuration conf, File logDir, String journalId, StartupOption startOpt, StorageErrorReporter errorReporter) throws IOException { storage = new JNStorage(conf, logDir, startOpt, errorReporter); this.journalId = journalId; refreshCachedData(); this.fjm = storage.getJournalManager(); this.metrics = JournalMetrics.create(this); EditLogFile latest = scanStorageForLatestEdits(); if (latest != null) { highestWrittenTxId = latest.getLastTxId(); } }
Journal(Configuration conf, File logDir, String journalId, StartupOption startOpt, StorageErrorReporter errorReporter) throws IOException { storage = new JNStorage(conf, logDir, startOpt, errorReporter); this.journalId = journalId; refreshCachedData(); this.fjm = storage.getJournalManager(); this.metrics = JournalMetrics.create(this); EditLogFile latest = scanStorageForLatestEdits(); if (latest != null) { updateHighestWrittenTxId(latest.getLastTxId()); } }
Journal(File logDir, File imageDir, String journalId, StorageErrorReporter errorReporter, JournalNode journalNode) throws IOException { this.journalNode = journalNode; // initialize storage directories journalStorage = new JNStorage(logDir, errorReporter, false, journalNode.getConf()); imageStorage = new JNStorage(imageDir, errorReporter, true, journalNode.getConf()); // initialize journal and image managers this.fjm = new FileJournalManager(journalStorage.getSingularStorageDir(), null, errorReporter); this.imageManager = new FileImageManager( imageStorage.getStorageDirectory(), imageStorage); this.journalId = journalId; this.metrics = JournalMetrics.create(this); refreshCachedData(); EditLogFile latest = scanStorageForLatestEdits(); if (latest != null) { highestWrittenTxId = latest.getLastTxId(); metrics.setLastWrittenTxId(highestWrittenTxId); } }
Journal(Configuration conf, File logDir, String journalId, StorageErrorReporter errorReporter) throws IOException { storage = new JNStorage(conf, logDir, errorReporter); this.journalId = journalId; refreshCachedData(); this.fjm = storage.getJournalManager(); this.metrics = JournalMetrics.create(this); EditLogFile latest = scanStorageForLatestEdits(); if (latest != null) { highestWrittenTxId = latest.getLastTxId(); } }
/** * @param conf Configuration object * @param logDir the path to the directory in which data will be stored * @param errorReporter a callback to report errors * @throws IOException */ protected JNStorage(Configuration conf, File logDir, StartupOption startOpt, StorageErrorReporter errorReporter) throws IOException { super(NodeType.JOURNAL_NODE); sd = new StorageDirectory(logDir); this.addStorageDir(sd); this.fjm = new FileJournalManager(conf, sd, errorReporter); analyzeAndRecoverStorage(startOpt); }
/** * Convert given list of files to a list of output streams. */ public static List<OutputStream> convertFilesToStreams(File[] localPaths, Storage dstStorage, String str) throws IOException { List<OutputStream> outputStreams = new ArrayList<OutputStream>(); if (localPaths != null) { for (File f : localPaths) { try { if (f.exists()) { LOG.warn("Overwriting existing file " + f + " with file downloaded form " + str); } outputStreams.add(new FileOutputStream(f)); } catch (IOException ioe) { LOG.warn("Unable to download file " + f, ioe); if (dstStorage != null && (dstStorage instanceof StorageErrorReporter)) { ((StorageErrorReporter) dstStorage).reportErrorOnFile(f); } } } if (outputStreams.isEmpty()) { throw new IOException("Unable to download to any storage directory"); } } return outputStreams; }
/** * @param logDir the path to the directory in which data will be stored * @param errorReporter a callback to report errors * @throws IOException */ protected JNStorage(File logDir, StorageErrorReporter errorReporter, boolean imageDir, Configuration conf) throws IOException { super(NodeType.JOURNAL_NODE); this.conf = conf; sd = new StorageDirectory(logDir, imageDir ? NameNodeDirType.IMAGE : NameNodeDirType.EDITS); this.addStorageDir(sd); this.isImageDir = imageDir; // null for metrics, will be extended analyzeStorage(); }
/** * @param conf Configuration object * @param logDir the path to the directory in which data will be stored * @param errorReporter a callback to report errors * @throws IOException */ protected JNStorage(Configuration conf, File logDir, StorageErrorReporter errorReporter) throws IOException { super(NodeType.JOURNAL_NODE); sd = new StorageDirectory(logDir); this.addStorageDir(sd); this.fjm = new FileJournalManager(conf, sd, errorReporter); analyzeStorage(); }
public FileJournalManager(Configuration conf, StorageDirectory sd, StorageErrorReporter errorReporter) { this.conf = conf; this.sd = sd; this.errorReporter = errorReporter; }
public FileJournalManagerReadOnly(StorageDirectory sd, NameNodeMetrics metrics, StorageErrorReporter errorReporter) { super(sd, metrics, errorReporter); }
public FileJournalManager(StorageDirectory sd, NameNodeMetrics metrics, StorageErrorReporter errorReporter) { this.sd = sd; this.metrics = metrics; this.errorReporter = errorReporter; }