Package org.apache.hadoop.hdfs.qjournal.client

Examples of org.apache.hadoop.hdfs.qjournal.client.QuorumJournalManager


    spyLoggers = ImmutableList.of(
        mockLogger(),
        mockLogger(),
        mockLogger());

    qjm = new QuorumJournalManager(conf, new URI("qjournal://host/jid"), FAKE_NSINFO) {
      @Override
      protected List<AsyncLogger> createLoggers(AsyncLogger.Factory factory) {
        return spyLoggers;
      }
    };
View Full Code Here


    spyLoggers = ImmutableList.of(
        mockLogger(),
        mockLogger(),
        mockLogger());

    qjm = new QuorumJournalManager(conf, new URI("qjournal://host/jid"), FAKE_NSINFO) {
      @Override
      protected List<AsyncLogger> createLoggers(AsyncLogger.Factory factory) {
        return spyLoggers;
      }
    };
View Full Code Here

    spyLoggers = ImmutableList.of(
        mockLogger(),
        mockLogger(),
        mockLogger());

    qjm = new QuorumJournalManager(conf, new URI("qjournal://host/jid"), FAKE_NSINFO) {
      @Override
      protected List<AsyncLogger> createLoggers(AsyncLogger.Factory factory) {
        return spyLoggers;
      }
    };
View Full Code Here

  @Test
  public void testSingleThreaded() throws IOException {
    Configuration conf = new Configuration();
    MiniJournalCluster cluster = new MiniJournalCluster.Builder(conf).build();
    URI uri = cluster.getQuorumJournalURI(JID);
    QuorumJournalManager qjm = new QuorumJournalManager(
        conf, uri, FAKE_NSINFO);
    try {
      qjm.format(FAKE_NSINFO);
    } finally {
      qjm.close();
    }
   
    try {
      // With no failures or contention, epochs should increase one-by-one
      for (int i = 0; i < 5; i++) {
        qjm = new QuorumJournalManager(
            conf, uri, FAKE_NSINFO);
        try {
          qjm.createNewUniqueEpoch();
          assertEquals(i + 1, qjm.getLoggerSetForTests().getEpoch());
        } finally {
          qjm.close();
        }
      }
     
      long prevEpoch = 5;
      // With some failures injected, it should still always increase, perhaps
      // skipping some
      for (int i = 0; i < 20; i++) {
        long newEpoch = -1;
        while (true) {
          qjm = new QuorumJournalManager(
              conf, uri, FAKE_NSINFO, new FaultyLoggerFactory());
          try {
            qjm.createNewUniqueEpoch();
            newEpoch = qjm.getLoggerSetForTests().getEpoch();
            break;
          } catch (IOException ioe) {
            // It's OK to fail to create an epoch, since we randomly inject
            // faults. It's possible we'll inject faults in too many of the
            // underlying nodes, and a failure is expected in that case
          } finally {
            qjm.close();
          }
        }
        LOG.info("Created epoch " + newEpoch);
        assertTrue("New epoch " + newEpoch + " should be greater than previous " +
            prevEpoch, newEpoch > prevEpoch);
View Full Code Here

    spyLoggers = ImmutableList.of(
        mockLogger(),
        mockLogger(),
        mockLogger());

    qjm = new QuorumJournalManager(conf, new URI("qjournal://host/jid"), FAKE_NSINFO) {
      @Override
      protected List<AsyncLogger> createLoggers(AsyncLogger.Factory factory) {
        return spyLoggers;
      }
    };
View Full Code Here

  @Test
  public void testSingleThreaded() throws IOException {
    Configuration conf = new Configuration();
    MiniJournalCluster cluster = new MiniJournalCluster.Builder(conf).build();
    URI uri = cluster.getQuorumJournalURI(JID);
    QuorumJournalManager qjm = new QuorumJournalManager(
        conf, uri, FAKE_NSINFO);
    try {
      qjm.format(FAKE_NSINFO);
    } finally {
      qjm.close();
    }
   
    try {
      // With no failures or contention, epochs should increase one-by-one
      for (int i = 0; i < 5; i++) {
        qjm = new QuorumJournalManager(
            conf, uri, FAKE_NSINFO);
        try {
          qjm.createNewUniqueEpoch();
          assertEquals(i + 1, qjm.getLoggerSetForTests().getEpoch());
        } finally {
          qjm.close();
        }
      }
     
      long prevEpoch = 5;
      // With some failures injected, it should still always increase, perhaps
      // skipping some
      for (int i = 0; i < 20; i++) {
        long newEpoch = -1;
        while (true) {
          qjm = new QuorumJournalManager(
              conf, uri, FAKE_NSINFO, new FaultyLoggerFactory());
          try {
            qjm.createNewUniqueEpoch();
            newEpoch = qjm.getLoggerSetForTests().getEpoch();
            break;
          } catch (IOException ioe) {
            // It's OK to fail to create an epoch, since we randomly inject
            // faults. It's possible we'll inject faults in too many of the
            // underlying nodes, and a failure is expected in that case
          } finally {
            qjm.close();
          }
        }
        LOG.info("Created epoch " + newEpoch);
        assertTrue("New epoch " + newEpoch + " should be greater than previous " +
            prevEpoch, newEpoch > prevEpoch);
View Full Code Here

      remoteJournal = new FileJournalManager(remoteJournalStorage, null, null);
    } else if (remoteJournalURI.getScheme().equals(
        QuorumJournalManager.QJM_URI_SCHEME)) {
      // TODO for now we pass null for NameNodeMetrics
      // once we have shared log we will pass the actual metrics
      remoteJournal = new QuorumJournalManager(conf, remoteJournalURI,
          new NamespaceInfo(fsImage.storage), null, false);
    } else {
      remoteJournal = FSEditLog.createJournal(conf, remoteJournalURI,
          new NamespaceInfo(fsImage.storage), null);
    }
View Full Code Here

    if (editsUri.getScheme().equals(NNStorage.LOCAL_URI_SCHEME)) {
      StorageDirectory sd = new NNStorage(new StorageInfo()).new StorageDirectory(
          new File(editsUri.getPath()));
      return new FileJournalManagerReadOnly(sd);
    } else if (editsUri.getScheme().equals(QuorumJournalManager.QJM_URI_SCHEME)) {
      return new QuorumJournalManager(conf, editsUri,
              new NamespaceInfo(new StorageInfo()), null, false);
    } else {
      throwIOException("Other journals not supported yet.", null);
    }
    return null;
View Full Code Here

          }
        };
        return Mockito.spy(logger);
      }
    };
    return new QuorumJournalManager(conf, cluster.getQuorumJournalURI(QJMTestUtil.JID),
        QJMTestUtil.FAKE_NSINFO, spyFactory, null, false);
  }
View Full Code Here

        }
      } else if (u.getScheme().equals(QuorumJournalManager.QJM_URI_SCHEME)) {
        // for now, we only allow the QJM to store images
        boolean hasImageStorage = imageDirs.contains(u);
        try {
          journalSet.add(new QuorumJournalManager(conf, u, new NamespaceInfo(
              storage), metrics, hasImageStorage), required, shared, remote);
        } catch (Exception e) {
          throw new IllegalArgumentException("Unable to construct journal, " + u,
              e);
        }    
View Full Code Here

TOP

Related Classes of org.apache.hadoop.hdfs.qjournal.client.QuorumJournalManager

Copyright © 2018 www.massapicom. All rights reserved.
All source code are property of their respective owners. Java is a trademark of Sun Microsystems, Inc and owned by ORACLE Inc. Contact coftware#gmail.com.