FSEditLogLoader loader = new FSEditLogLoader(target, lastAppliedTxId);
new FSEditLogLoader(getNamesystem(), lastAppliedTxId); int logVersion = storage.getLayoutVersion(); backupInputStream.setBytes(data, logVersion);
new FSEditLogLoader(getNamesystem(), lastAppliedTxId); loader.loadFSEdits(stream, lastAppliedTxId + 1); lastAppliedTxId = loader.getLastAppliedTxId();
private void verifyEditLogs(FSNamesystem namesystem, FSImage fsimage) throws IOException { // Verify that we can read in all the transactions that we have written. // If there were any corruptions, it is likely that the reading in // of these transactions will throw an exception. for (Iterator<StorageDirectory> it = fsimage.dirIterator(NameNodeDirType.EDITS); it.hasNext();) { File editFile = FSImage.getImageFile(it.next(), NameNodeFile.EDITS); System.out.println("Verifying file: " + editFile); int numEdits = new FSEditLogLoader(namesystem).loadFSEdits( new EditLogFileInputStream(editFile)); System.out.println("Number of edits: " + numEdits); } }
private long testLoad(byte[] data, FSNamesystem namesys) throws IOException { FSEditLogLoader loader = new FSEditLogLoader(namesys, 0); return loader.loadFSEdits(new EditLogByteInputStream(data), 1); }
new FSEditLogLoader(getNamesystem(), lastAppliedTxId); int logVersion = storage.getLayoutVersion(); backupInputStream.setBytes(data, logVersion);
FSEditLogLoader loader = new FSEditLogLoader(target, lastAppliedTxId);
FSEditLogLoader loader = new FSEditLogLoader(namesystem); for (Iterator<StorageDirectory> it = fsimage.dirIterator(NameNodeDirType.EDITS); it.hasNext();) {
FSEditLogLoader loader = new FSEditLogLoader(namesystem); namesystem.getDelegationTokenSecretManager().stopThreads(); int numKeys = namesystem.getDelegationTokenSecretManager().getNumberOfKeys();
private long verifyEditLogs(FSNamesystem namesystem, FSImage fsimage, String logFileName, long startTxId) throws IOException { long numEdits = -1; // Verify that we can read in all the transactions that we have written. // If there were any corruptions, it is likely that the reading in // of these transactions will throw an exception. for (StorageDirectory sd : fsimage.getStorage().dirIterable(NameNodeDirType.EDITS)) { File editFile = new File(sd.getCurrentDir(), logFileName); System.out.println("Verifying file: " + editFile); FSEditLogLoader loader = new FSEditLogLoader(namesystem, startTxId); long numEditsThisLog = loader.loadFSEdits( new EditLogFileInputStream(editFile), startTxId); System.out.println("Number of edits: " + numEditsThisLog); assertTrue(numEdits == -1 || numEditsThisLog == numEdits); numEdits = numEditsThisLog; } assertTrue(numEdits != -1); return numEdits; }
/** * Load and merge edits from two edits files * * @param sd storage directory * @return number of edits loaded * @throws IOException */ int loadFSEdits(StorageDirectory sd) throws IOException { int numEdits = 0; EditLogFileInputStream edits = new EditLogFileInputStream(getImageFile(sd, NameNodeFile.EDITS)); FSEditLogLoader loader = new FSEditLogLoader(namesystem); numEdits += loader.loadFSEdits(edits, editLog.getCurrentTxId()); edits.close(); File editsNew = getImageFile(sd, NameNodeFile.EDITS_NEW); if (editsNew.exists() && editsNew.length() > 0) { edits = new EditLogFileInputStream(editsNew); numEdits += loader.loadFSEdits(edits, loader.getCurrentTxId()); edits.close(); } editLog.setStartTransactionId(loader.getCurrentTxId()); // update the counts. getFSNamesystem().dir.updateCountForINodeWithQuota(); return numEdits; }
new FSEditLogLoader(getNamesystem(), lastAppliedTxId); loader.loadFSEdits(stream, lastAppliedTxId + 1); lastAppliedTxId = loader.getLastAppliedTxId();
new FSEditLogLoader(getNamesystem(), lastAppliedTxId); int logVersion = storage.getLayoutVersion(); backupInputStream.setBytes(data, logVersion);
for (Iterator<StorageDirectory> it = fsimage.getStorage().dirIterator(NameNodeDirType.EDITS); it.hasNext();) { FSEditLogLoader loader = new FSEditLogLoader(namesystem, 0);
System.out.println("Verifying file: " + editFile); FSEditLogLoader loader = new FSEditLogLoader(namesystem, 0); long numEdits = loader.loadFSEdits( new EditLogFileInputStream(editFile), 1);
FSEditLogLoader loader = new FSEditLogLoader(target, lastAppliedTxId);
new FSEditLogLoader(getNamesystem(), lastAppliedTxId); loader.loadFSEdits(stream, lastAppliedTxId + 1); lastAppliedTxId = loader.getLastAppliedTxId();