org.apache.hadoop.hdfs.server.namenode.FSEditLog Java Examples
The following examples show how to use
org.apache.hadoop.hdfs.server.namenode.FSEditLog.
You can vote up the ones you like or vote down the ones you don't like,
and go to the original project or source file by following the links above each example. You may check out the related API usage on the sidebar.
Example #1
Source File: TestFailureToReadEdits.java From hadoop with Apache License 2.0 | 5 votes |
private LimitedEditLogAnswer causeFailureOnEditLogRead() throws IOException { FSEditLog spyEditLog = NameNodeAdapter.spyOnEditLog(nn1); LimitedEditLogAnswer answer = new LimitedEditLogAnswer(); doAnswer(answer).when(spyEditLog).selectInputStreams( anyLong(), anyLong(), (MetaRecoveryContext)anyObject(), anyBoolean()); return answer; }
Example #2
Source File: TestFailureToReadEdits.java From big-c with Apache License 2.0 | 5 votes |
private LimitedEditLogAnswer causeFailureOnEditLogRead() throws IOException { FSEditLog spyEditLog = NameNodeAdapter.spyOnEditLog(nn1); LimitedEditLogAnswer answer = new LimitedEditLogAnswer(); doAnswer(answer).when(spyEditLog).selectInputStreams( anyLong(), anyLong(), (MetaRecoveryContext)anyObject(), anyBoolean()); return answer; }
Example #3
Source File: EditLogTailer.java From hadoop with Apache License 2.0 | 4 votes |
@VisibleForTesting FSEditLog getEditLog() { return editLog; }
Example #4
Source File: EditLogTailer.java From hadoop with Apache License 2.0 | 4 votes |
@VisibleForTesting public void setEditLog(FSEditLog editLog) { this.editLog = editLog; }
Example #5
Source File: DFSTestUtil.java From hadoop with Apache License 2.0 | 4 votes |
public static void setEditLogForTesting(FSNamesystem fsn, FSEditLog newLog) { Whitebox.setInternalState(fsn.getFSImage(), "editLog", newLog); Whitebox.setInternalState(fsn.getFSDirectory(), "editLog", newLog); }
Example #6
Source File: EditLogTailer.java From big-c with Apache License 2.0 | 4 votes |
@VisibleForTesting FSEditLog getEditLog() { return editLog; }
Example #7
Source File: EditLogTailer.java From big-c with Apache License 2.0 | 4 votes |
@VisibleForTesting public void setEditLog(FSEditLog editLog) { this.editLog = editLog; }
Example #8
Source File: DFSTestUtil.java From big-c with Apache License 2.0 | 4 votes |
public static void setEditLogForTesting(FSNamesystem fsn, FSEditLog newLog) { Whitebox.setInternalState(fsn.getFSImage(), "editLog", newLog); Whitebox.setInternalState(fsn.getFSDirectory(), "editLog", newLog); }
Example #9
Source File: TestFileAppend4.java From RDFS with Apache License 2.0 | 4 votes |
/** * Test for a race in appendFile where the file might get removed in between * the two synchronized sections. */ public void testAppendFileRace() throws Throwable { LOG.info("START"); cluster = new MiniDFSCluster(conf, 1, true, null); final FileSystem fs1 = cluster.getFileSystem();; try { createFile(fs1, "/testAppendFileRace", 1, BBW_SIZE); stm.close(); NameNode nn = cluster.getNameNode(); FSEditLog editLogSpy = FSImageAdapter.injectEditLogSpy(nn.getNamesystem()); DelayAnswer delayer = new DelayAnswer(); doAnswer(delayer).when(editLogSpy).logSync(); final AtomicReference<Throwable> err = new AtomicReference<Throwable>(); Thread appender = new Thread() { public void run() { try { stm = fs1.append(file1); } catch (Throwable t) { err.set(t); } } }; LOG.info("Triggering append in other thread"); appender.start(); LOG.info("Waiting for logsync"); delayer.waitForCall(); LOG.info("Resetting spy"); reset(editLogSpy); LOG.info("Deleting file"); fs1.delete(file1, true); LOG.info("Allowing append to proceed"); delayer.proceed(); LOG.info("Waiting for append to finish"); appender.join(); if (err.get() != null) { if (err.get().getMessage().contains( "File does not exist.")) { LOG.info("Got expected exception", err.get()); } else { throw err.get(); } } LOG.info("Closing stream"); stm.close(); } finally { fs1.close(); cluster.shutdown(); } }