本文整理汇总了Java中org.apache.hadoop.hdfs.qjournal.MiniJournalCluster.createSpyingQJM方法的典型用法代码示例。如果您正苦于以下问题:Java MiniJournalCluster.createSpyingQJM方法的具体用法?Java MiniJournalCluster.createSpyingQJM怎么用?Java MiniJournalCluster.createSpyingQJM使用的例子?那么恭喜您, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类org.apache.hadoop.hdfs.qjournal.MiniJournalCluster
的用法示例。
在下文中一共展示了MiniJournalCluster.createSpyingQJM方法的5个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的Java代码示例。
示例1: setup
import org.apache.hadoop.hdfs.qjournal.MiniJournalCluster; //导入方法依赖的package包/类
@Before
public void setup() throws Exception {
conf = new Configuration();
// Don't retry connections - it just slows down the tests.
conf.setInt("ipc.client.connect.max.retries", 0);
conf.setLong(JournalConfigKeys.DFS_QJOURNAL_CONNECT_TIMEOUT_KEY, 100);
cluster = new MiniJournalCluster.Builder(conf)
.numJournalNodes(NUM_JOURNALS).build();
qjm = MiniJournalCluster.createSpyingQJM(conf, cluster);
qjm.transitionJournal(FAKE_NSINFO, Transition.FORMAT, null);
}
示例2: setup
import org.apache.hadoop.hdfs.qjournal.MiniJournalCluster; //导入方法依赖的package包/类
@Before
public void setup() throws Exception {
conf = new Configuration();
// Don't retry connections - it just slows down the tests.
conf.setInt("ipc.client.connect.max.retries", 0);
conf.setLong(JournalConfigKeys.DFS_QJOURNAL_CONNECT_TIMEOUT_KEY, 100);
cluster = new MiniJournalCluster.Builder(conf).build();
qjm = MiniJournalCluster.createSpyingQJM(conf, cluster);
qjm.transitionJournal(QJMTestUtil.FAKE_NSINFO, Transition.FORMAT, null);
qjm.recoverUnfinalizedSegments();
assertEquals(1, qjm.getLoggerSetForTests().getEpoch());
}
示例3: testReaderWhileAnotherWritesFinalized
import org.apache.hadoop.hdfs.qjournal.MiniJournalCluster; //导入方法依赖的package包/类
@Test
public void testReaderWhileAnotherWritesFinalized() throws Exception {
QuorumJournalManager readerQjm = MiniJournalCluster.createSpyingQJM(conf,
cluster);
List<EditLogInputStream> streams = Lists.newArrayList();
readerQjm.selectInputStreams(streams, 0, false, true);
assertEquals(0, streams.size());
int numTxns = 10;
List<FSEditLogOp> txns = new ArrayList<FSEditLogOp>();
writeRandomSegment(cluster, qjm, 0, numTxns, true, txns);
readerQjm.selectInputStreams(streams, 0, false, true);
try {
assertEquals(1, streams.size());
// Validate the actual stream contents.
EditLogInputStream stream = streams.get(0);
assertEquals(0, stream.getFirstTxId());
assertEquals(numTxns - 1, stream.getLastTxId());
verifyEdits(streams, 0, numTxns - 1, txns, false);
assertNull(stream.readOp());
} finally {
IOUtils.cleanup(LOG, streams.toArray(new Closeable[0]));
streams.clear();
}
}
示例4: testReaderWhileAnotherWritesInProgress
import org.apache.hadoop.hdfs.qjournal.MiniJournalCluster; //导入方法依赖的package包/类
@Test
public void testReaderWhileAnotherWritesInProgress() throws Exception {
QuorumJournalManager readerQjm = MiniJournalCluster.createSpyingQJM(conf,
cluster);
List<EditLogInputStream> streams = Lists.newArrayList();
readerQjm.selectInputStreams(streams, 0, false, true);
assertEquals(0, streams.size());
int numTxns = 10;
List<FSEditLogOp> txns = new ArrayList<FSEditLogOp>();
writeRandomSegment(cluster, qjm, 0, numTxns, false, txns);
// allow in-progress stream
readerQjm.selectInputStreams(streams, 0, true, false);
try {
assertEquals(1, streams.size());
// Validate the actual stream contents.
EditLogInputStream stream = streams.get(0);
assertEquals(0, stream.getFirstTxId());
// for inprogress, we can read only up to second last one
assertEquals(numTxns - 2, stream.getLastTxId());
verifyEdits(streams, 0, numTxns - 1, txns, true);
assertNull(stream.readOp());
} finally {
IOUtils.cleanup(LOG, streams.toArray(new Closeable[0]));
streams.clear();
}
}
示例5: createSpyingQJM
import org.apache.hadoop.hdfs.qjournal.MiniJournalCluster; //导入方法依赖的package包/类
public static QuorumJournalManager createSpyingQJM(Configuration conf,
MiniJournalCluster cluster, String JID, NamespaceInfo FAKE_NSINFO)
throws IOException, URISyntaxException {
return MiniJournalCluster.createSpyingQJM(conf, cluster);
}