本文整理汇总了Java中org.apache.hadoop.hdfs.qjournal.client.QuorumJournalManager.startLogSegment方法的典型用法代码示例。如果您正苦于以下问题:Java QuorumJournalManager.startLogSegment方法的具体用法?Java QuorumJournalManager.startLogSegment怎么用?Java QuorumJournalManager.startLogSegment使用的例子?那么恭喜您, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类org.apache.hadoop.hdfs.qjournal.client.QuorumJournalManager
的用法示例。
在下文中一共展示了QuorumJournalManager.startLogSegment方法的3个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的Java代码示例。
示例1: writeSegment
import org.apache.hadoop.hdfs.qjournal.client.QuorumJournalManager; //导入方法依赖的package包/类
public static EditLogOutputStream writeSegment(MiniJournalCluster cluster,
QuorumJournalManager qjm, long startTxId, int numTxns,
boolean finalize) throws IOException {
EditLogOutputStream stm = qjm.startLogSegment(startTxId,
NameNodeLayoutVersion.CURRENT_LAYOUT_VERSION);
// Should create in-progress
assertExistsInQuorum(cluster,
NNStorage.getInProgressEditsFileName(startTxId));
writeTxns(stm, startTxId, numTxns);
if (finalize) {
stm.close();
qjm.finalizeLogSegment(startTxId, startTxId + numTxns - 1);
return null;
} else {
return stm;
}
}
示例2: writeSegment
import org.apache.hadoop.hdfs.qjournal.client.QuorumJournalManager; //导入方法依赖的package包/类
public static EditLogOutputStream writeSegment(MiniJournalCluster cluster,
QuorumJournalManager qjm, long startTxId, int numTxns,
boolean finalize) throws IOException {
EditLogOutputStream stm = qjm.startLogSegment(startTxId);
// Should create in-progress
assertExistsInQuorum(cluster,
NNStorage.getInProgressEditsFileName(startTxId));
writeTxns(stm, startTxId, numTxns);
if (finalize) {
stm.close();
qjm.finalizeLogSegment(startTxId, startTxId + numTxns - 1);
return null;
} else {
return stm;
}
}
示例3: writeRandomSegment
import org.apache.hadoop.hdfs.qjournal.client.QuorumJournalManager; //导入方法依赖的package包/类
public static EditLogOutputStream writeRandomSegment(MiniJournalCluster cluster,
QuorumJournalManager qjm, long startTxId, int numTxns,
boolean finalize, List<FSEditLogOp> writtenTxns) throws IOException {
EditLogOutputStream stm = qjm.startLogSegment(startTxId);
// Should create in-progress
assertExistsInQuorum(cluster,
NNStorage.getInProgressEditsFileName(startTxId));
List<FSEditLogOp> txns = FSEditLogTestUtil.getContiguousLogSegment(
(int) startTxId, ((int) startTxId + numTxns - 1));
for (FSEditLogOp op : txns) {
stm.write(op);
stm.setReadyToFlush();
stm.flush();
if (writtenTxns != null) {
writtenTxns.add(op);
}
}
if (finalize) {
stm.close();
qjm.finalizeLogSegment(startTxId, startTxId + numTxns - 1);
return null;
} else {
return stm;
}
}