JournalNode implements Tool, Configurable, JournalNodeMXBean { @VisibleForTesting public Journal getJournal(String jid) { return journalsById.get(jid); }  @VisibleForTesting boolean getJournalSyncerStatus(String jid); @VisibleForTesting Journal getOrCreateJournal(String jid); Journal getOrCreateJournal(String jid,
                                    String nameServiceId); @Override void setConf(Configuration conf); @Override Configuration getConf(); @Override int run(String[] args); void start(); boolean isStarted(); InetSocketAddress getBoundIpcAddress(); String getHttpServerURI(); void stop(int rc); void stopAndJoin(int rc); @Override // JournalNodeMXBean String getJournalsStatus(); @Override // JournalNodeMXBean String getHostAndPort(); @Override // JournalNodeMXBean List<String> getClusterIds(); @Override // JournalNodeMXBean String getVersion(); static void main(String[] args); void doPreUpgrade(String journalId); void doUpgrade(String journalId, StorageInfo sInfo); void doFinalize(String journalId,
                         String nameServiceId); Boolean canRollBack(String journalId, StorageInfo storage,
      StorageInfo prevStorage, int targetLayoutVersion,
      String nameServiceId); void doRollback(String journalId,
                         String nameServiceId); void discardSegments(String journalId, long startTxId,
                              String nameServiceId); Long getJournalCTime(String journalId,
                              String nameServiceId); @VisibleForTesting Journal getJournal(String  jid); static InetSocketAddress getHttpAddress(Configuration conf); @VisibleForTesting JournalNodeRpcServer getRpcServer(); InetSocketAddress getBoundHttpAddress(); InetSocketAddress getHttpAddress(); InetSocketAddress getHttpsAddress(); static final Logger LOG; }
@Test(timeout=100000) public void testJournalDirPerNameSpace() { Collection<String> nameServiceIds = DFSUtilClient.getNameServiceIds(conf); setupStaticHostResolution(2, "journalnode"); for (String nsId : nameServiceIds) { String jid = "test-journalid-" + nsId; Journal nsJournal = jn.getJournal(jid); JNStorage journalStorage = nsJournal.getStorage(); File editsDir = new File(MiniDFSCluster.getBaseDirectory() + File.separator + "TestJournalNode" + File.separator + nsId + File.separator + jid); assertEquals(editsDir.toString(), journalStorage.getRoot().toString()); } }
@Test(timeout=100000) public void testJournalCommonDirAcrossNameSpace() { Collection<String> nameServiceIds = DFSUtilClient.getNameServiceIds(conf); setupStaticHostResolution(2, "journalnode"); for (String nsId : nameServiceIds) { String jid = "test-journalid-" + nsId; Journal nsJournal = jn.getJournal(jid); JNStorage journalStorage = nsJournal.getStorage(); File editsDir = new File(MiniDFSCluster.getBaseDirectory() + File.separator + "TestJournalNode" + File.separator + jid); assertEquals(editsDir.toString(), journalStorage.getRoot().toString()); } }
@Test(timeout=100000) public void testJournalDefaultDirForOneNameSpace() { Collection<String> nameServiceIds = DFSUtilClient.getNameServiceIds(conf); setupStaticHostResolution(2, "journalnode"); String jid = "test-journalid-ns1"; Journal nsJournal = jn.getJournal(jid); JNStorage journalStorage = nsJournal.getStorage(); File editsDir = new File(MiniDFSCluster.getBaseDirectory() + File.separator + "TestJournalNode" + File.separator + "ns1" + File .separator + jid); assertEquals(editsDir.toString(), journalStorage.getRoot().toString()); jid = "test-journalid-ns2"; nsJournal = jn.getJournal(jid); journalStorage = nsJournal.getStorage(); editsDir = new File(DFSConfigKeys.DFS_JOURNALNODE_EDITS_DIR_DEFAULT + File.separator + jid); assertEquals(editsDir.toString(), journalStorage.getRoot().toString()); }