@Test public void suspendSnapshotRestart() throws Exception { CountingDummyFileSystemMaster countingMaster = new CountingDummyFileSystemMaster(); mFollowerJournalSystem.createJournal(countingMaster); final int entryCount = 10; try (JournalContext journalContext = mLeaderJournalSystem.createJournal(new NoopMaster()).createJournalContext()) { for (int i = 0; i < entryCount; i++) { journalContext.append( alluxio.proto.journal.Journal.JournalEntry.newBuilder().setInodeLastModificationTime( File.InodeLastModificationTimeEntry.newBuilder().setId(i).build()).build()); } } mFollowerJournalSystem.suspend(); try (JournalContext journalContext = mLeaderJournalSystem.createJournal(new NoopMaster()).createJournalContext()) { journalContext .append(alluxio.proto.journal.Journal.JournalEntry.newBuilder() .setInodeLastModificationTime( File.InodeLastModificationTimeEntry.newBuilder().setId(entryCount).build()) .build()); } mFollowerJournalSystem.checkpoint(); mFollowerJournalSystem.stop(); mFollowerJournalSystem.start(); Thread.sleep( 2 * ServerConfiguration.getMs(PropertyKey.MASTER_EMBEDDED_JOURNAL_HEARTBEAT_INTERVAL)); CommonUtils.waitFor("full state acquired after restart", () -> countingMaster.getApplyCount() == entryCount + 1, mWaitOptions); }
@Override public JournalContext createJournalContext() throws UnavailableException { AsyncJournalWriter journalWriter = mJournalWriter.get(); if (journalWriter == null) { throw new UnavailableException("Journal has been closed"); } return new MasterJournalContext(journalWriter); }
RaftJournal implements Journal { @Override public JournalContext createJournalContext() throws UnavailableException { AsyncJournalWriter journalWriter = mJournalWriter.get(); if (journalWriter == null) { throw new UnavailableException("Journal has been closed"); } return new MasterJournalContext(journalWriter); } }
RaftJournal implements Journal { @Override public JournalContext createJournalContext() throws UnavailableException { AsyncJournalWriter journalWriter = mJournalWriter.get(); if (journalWriter == null) { throw new UnavailableException("Journal has been closed"); } return new MasterJournalContext(journalWriter); } RaftJournal(Journaled stateMachine, URI location,
      AtomicReference<AsyncJournalWriter> journalWriter); }
RaftJournal implements Journal { @Override public JournalContext createJournalContext() throws UnavailableException { AsyncJournalWriter journalWriter = mJournalWriter.get(); if (journalWriter == null) { throw new UnavailableException("Journal has been closed"); } return new MasterJournalContext(journalWriter); } RaftJournal(Journaled stateMachine, URI location,
      AtomicReference<AsyncJournalWriter> journalWriter); Journaled getStateMachine(); @Override URI getLocation(); @Override JournalContext createJournalContext(); @Override void close(); }
RaftJournal implements Journal { @Override public JournalContext createJournalContext() throws UnavailableException { AsyncJournalWriter journalWriter = mJournalWriter.get(); if (journalWriter == null) { throw new UnavailableException("Journal has been closed"); } return new MasterJournalContext(journalWriter); } RaftJournal(Journaled stateMachine, URI location,
      AtomicReference<AsyncJournalWriter> journalWriter); Journaled getStateMachine(); @Override URI getLocation(); @Override JournalContext createJournalContext(); @Override void close();  }