- 使用 Spring Initializr 创建 Spring Boot 应用程序
- 在Spring Boot中配置Cassandra
- 在 Spring Boot 上配置 Tomcat 连接池
- 将Camel消息路由到嵌入WildFly的Artemis上
本文整理了Java中org.apache.hadoop.hbase.procedure2.store.wal.WALProcedureStore.getActiveLogs()
方法的一些代码示例,展示了WALProcedureStore.getActiveLogs()
的具体用法。这些代码示例主要来源于Github
/Stackoverflow
/Maven
等平台,是从一些精选项目中提取出来的代码,具有较强的参考意义,能在一定程度帮忙到你。WALProcedureStore.getActiveLogs()
方法的具体详情如下:
包路径:org.apache.hadoop.hbase.procedure2.store.wal.WALProcedureStore
类名称:WALProcedureStore
方法名:getActiveLogs
暂无
代码示例来源:origin: apache/hbase
public int getNumWALFiles() {
return procedureStore != null ? procedureStore.getActiveLogs().size() : 0;
}
代码示例来源:origin: apache/hbase
private void tryCleanupLogsOnLoad() {
// nothing to cleanup.
if (logs.size() <= 1) {
return;
}
// the config says to not cleanup wals on load.
if (!conf.getBoolean(EXEC_WAL_CLEANUP_ON_LOAD_CONF_KEY,
DEFAULT_EXEC_WAL_CLEANUP_ON_LOAD_CONF_KEY)) {
LOG.debug("WALs cleanup on load is not enabled: " + getActiveLogs());
return;
}
try {
periodicRoll();
} catch (IOException e) {
LOG.warn("Unable to cleanup logs on load: " + e.getMessage(), e);
}
}
代码示例来源:origin: apache/hbase
@Test
public void testRestartWithoutData() throws Exception {
for (int i = 0; i < 10; ++i) {
final LoadCounter loader = new LoadCounter();
storeRestart(loader);
}
LOG.info("ACTIVE WALs " + procStore.getActiveLogs());
assertEquals(1, procStore.getActiveLogs().size());
FileStatus[] status = fs.listStatus(logDir);
assertEquals(1, status.length);
}
代码示例来源:origin: apache/hbase
private void setupProcedureStore() throws IOException {
Path testDir = UTIL.getDataTestDir();
FileSystem fs = testDir.getFileSystem(conf);
Path logDir = new Path(testDir, "proc-logs");
System.out.println("Logs directory : " + logDir.toString());
fs.delete(logDir, true);
if ("nosync".equals(syncType)) {
store = new NoSyncWalProcedureStore(conf, logDir);
} else {
store = ProcedureTestingUtility.createWalStore(conf, logDir);
}
store.start(numThreads);
store.recoverLease();
store.load(new ProcedureTestingUtility.LoadCounter());
System.out.println("Starting new log : "
+ store.getActiveLogs().get(store.getActiveLogs().size() - 1));
}
代码示例来源:origin: apache/hbase
@Test
public void testEmptyRoll() throws Exception {
for (int i = 0; i < 10; ++i) {
procStore.periodicRollForTesting();
}
assertEquals(1, procStore.getActiveLogs().size());
FileStatus[] status = fs.listStatus(logDir);
assertEquals(1, status.length);
}
代码示例来源:origin: apache/hbase
/**
* Tests that tracker for all old logs are loaded back after procedure store is restarted.
*/
@Test
public void trackersLoadedForAllOldLogs() throws Exception {
for (int i = 0; i <= 20; ++i) {
procStore.insert(new TestProcedure(i), null);
if (i > 0 && (i % 5) == 0) {
LoadCounter loader = new LoadCounter();
storeRestart(loader);
}
}
assertEquals(5, procStore.getActiveLogs().size());
for (int i = 0; i < procStore.getActiveLogs().size() - 1; ++i) {
ProcedureStoreTracker tracker = procStore.getActiveLogs().get(i).getTracker();
assertTrue(tracker != null && !tracker.isEmpty());
}
}
代码示例来源:origin: apache/hbase
store.rollWriterForTesting();
System.out.println("Starting new log : "
+ store.getActiveLogs().get(store.getActiveLogs().size() - 1));
代码示例来源:origin: apache/hbase
@Test
public void testWalCleanerWithEmptyRolls() throws Exception {
final Procedure<?>[] procs = new Procedure[3];
for (int i = 0; i < procs.length; ++i) {
procs[i] = new TestSequentialProcedure();
procStore.insert(procs[i], null);
}
assertEquals(1, procStore.getActiveLogs().size());
procStore.rollWriterForTesting();
assertEquals(2, procStore.getActiveLogs().size());
procStore.rollWriterForTesting();
assertEquals(3, procStore.getActiveLogs().size());
for (int i = 0; i < procs.length; ++i) {
procStore.update(procs[i]);
procStore.rollWriterForTesting();
procStore.rollWriterForTesting();
if (i < (procs.length - 1)) {
assertEquals(3 + ((i + 1) * 2), procStore.getActiveLogs().size());
}
}
assertEquals(7, procStore.getActiveLogs().size());
for (int i = 0; i < procs.length; ++i) {
procStore.delete(procs[i].getProcId());
assertEquals(7 - ((i + 1) * 2), procStore.getActiveLogs().size());
}
assertEquals(1, procStore.getActiveLogs().size());
}
代码示例来源:origin: apache/hbase
@Test
public void testWalCleanerUpdatesDontLeaveHoles() throws Exception {
TestSequentialProcedure p1 = new TestSequentialProcedure();
TestSequentialProcedure p2 = new TestSequentialProcedure();
procStore.insert(p1, null);
procStore.insert(p2, null);
procStore.rollWriterForTesting(); // generates first log with p1 + p2
ProcedureWALFile log1 = procStore.getActiveLogs().get(0);
procStore.update(p2);
procStore.rollWriterForTesting(); // generates second log with p2
ProcedureWALFile log2 = procStore.getActiveLogs().get(1);
procStore.update(p2);
procStore.rollWriterForTesting(); // generates third log with p2
procStore.removeInactiveLogsForTesting(); // Shouldn't remove 2nd log.
assertEquals(4, procStore.getActiveLogs().size());
procStore.update(p1);
procStore.rollWriterForTesting(); // generates fourth log with p1
procStore.removeInactiveLogsForTesting(); // Should remove first two logs.
assertEquals(3, procStore.getActiveLogs().size());
assertFalse(procStore.getActiveLogs().contains(log1));
assertFalse(procStore.getActiveLogs().contains(log2));
}
代码示例来源:origin: apache/hbase
@Test
public void testWalCleanerNoHoles() throws Exception {
final Procedure<?>[] procs = new Procedure[5];
ArrayList<ProcedureWALFile> logs = null;
// Insert procedures and roll wal after every insert.
for (int i = 0; i < procs.length; i++) {
procs[i] = new TestSequentialProcedure();
procStore.insert(procs[i], null);
procStore.rollWriterForTesting();
logs = procStore.getActiveLogs();
assertEquals(i + 2, logs.size()); // Extra 1 for current ongoing wal.
}
for (int i = 1; i < procs.length; i++) {
procStore.delete(procs[i].getProcId());
}
assertEquals(procs.length + 1, procStore.getActiveLogs().size());
procStore.delete(procs[0].getProcId());
assertEquals(1, procStore.getActiveLogs().size());
}
代码示例来源:origin: apache/hbase
@Test
public void testWalCleanerSequentialClean() throws Exception {
final Procedure<?>[] procs = new Procedure[5];
ArrayList<ProcedureWALFile> logs = null;
// Insert procedures and roll wal after every insert.
for (int i = 0; i < procs.length; i++) {
procs[i] = new TestSequentialProcedure();
procStore.insert(procs[i], null);
procStore.rollWriterForTesting();
logs = procStore.getActiveLogs();
assertEquals(logs.size(), i + 2); // Extra 1 for current ongoing wal.
}
// Delete procedures in sequential order make sure that only the corresponding wal is deleted
// from logs list.
final int[] deleteOrder = new int[] { 0, 1, 2, 3, 4 };
for (int i = 0; i < deleteOrder.length; i++) {
procStore.delete(procs[deleteOrder[i]].getProcId());
procStore.removeInactiveLogsForTesting();
assertFalse(logs.get(deleteOrder[i]).toString(),
procStore.getActiveLogs().contains(logs.get(deleteOrder[i])));
assertEquals(procStore.getActiveLogs().size(), procs.length - i);
}
}
代码示例来源:origin: apache/hbase
@Test
public void testProcedureUpdatedShouldClean() throws Exception {
createProcExecutor();
SuspendProcedure suspendProcedure = new SuspendProcedure();
long suspendProc = procExecutor.submitProcedure(suspendProcedure);
LOG.info("Begin to execute " + suspendProc);
suspendProcedure.latch.countDown();
Thread.sleep(500);
LOG.info("begin to restart1 ");
ProcedureTestingUtility.restart(procExecutor, true);
LOG.info("finish to restart1 ");
htu.waitFor(10000, () -> procExecutor.getProcedure(suspendProc) != null);
// Wait until the suspendProc executed after restart
suspendProcedure = (SuspendProcedure) procExecutor.getProcedure(suspendProc);
suspendProcedure.latch.countDown();
Thread.sleep(500);
// Should be 1 log since the suspendProcedure is updated in the new log
assertTrue(procStore.getActiveLogs().size() == 1);
// restart procExecutor
LOG.info("begin to restart2");
// Restart the executor but do not start the workers.
// Otherwise, the suspendProcedure will soon be executed and the oldest log
// will be cleaned, leaving only the newest log.
ProcedureTestingUtility.restart(procExecutor, true, false);
LOG.info("finish to restart2");
// There should be two active logs
assertTrue(procStore.getActiveLogs().size() == 2);
procExecutor.startWorkers();
}
代码示例来源:origin: apache/hbase
@Test
public void testProcedureDeletedShouldClean() throws Exception {
createProcExecutor();
WaitProcedure waitProcedure = new WaitProcedure();
long waitProce = procExecutor.submitProcedure(waitProcedure);
LOG.info("Begin to execute " + waitProce);
Thread.sleep(500);
LOG.info("begin to restart1 ");
ProcedureTestingUtility.restart(procExecutor, true);
LOG.info("finish to restart1 ");
htu.waitFor(10000, () -> procExecutor.getProcedure(waitProce) != null);
// Wait until the suspendProc executed after restart
waitProcedure = (WaitProcedure) procExecutor.getProcedure(waitProce);
waitProcedure.latch.countDown();
Thread.sleep(500);
// Should be 1 log since the suspendProcedure is updated in the new log
assertTrue(procStore.getActiveLogs().size() == 1);
// restart procExecutor
LOG.info("begin to restart2");
// Restart the executor but do not start the workers.
// Otherwise, the suspendProcedure will soon be executed and the oldest log
// will be cleaned, leaving only the newest log.
ProcedureTestingUtility.restart(procExecutor, true, false);
LOG.info("finish to restart2");
// There should be two active logs
assertTrue(procStore.getActiveLogs().size() == 2);
procExecutor.startWorkers();
}
代码示例来源:origin: apache/hbase
@Test
public void testBatchInsert() throws Exception {
final int count = 10;
final TestProcedure[] procs = new TestProcedure[count];
for (int i = 0; i < procs.length; ++i) {
procs[i] = new TestProcedure(i + 1);
}
procStore.insert(procs);
restartAndAssert(count, count, 0, 0);
for (int i = 0; i < procs.length; ++i) {
final long procId = procs[i].getProcId();
procStore.delete(procId);
restartAndAssert(procId != count ? count : 0, count - (i + 1), 0, 0);
}
procStore.removeInactiveLogsForTesting();
assertEquals("WALs=" + procStore.getActiveLogs(), 1, procStore.getActiveLogs().size());
}
代码示例来源:origin: apache/hbase
@Test
public void testRollAndRemove() throws IOException {
// Insert something in the log
Procedure<?> proc1 = new TestSequentialProcedure();
procStore.insert(proc1, null);
Procedure<?> proc2 = new TestSequentialProcedure();
procStore.insert(proc2, null);
// roll the log, now we have 2
procStore.rollWriterForTesting();
assertEquals(2, procStore.getActiveLogs().size());
// everything will be up to date in the second log
// so we can remove the first one
procStore.update(proc1);
procStore.update(proc2);
assertEquals(1, procStore.getActiveLogs().size());
// roll the log, now we have 2
procStore.rollWriterForTesting();
assertEquals(2, procStore.getActiveLogs().size());
// remove everything active
// so we can remove all the logs
procStore.delete(proc1.getProcId());
procStore.delete(proc2.getProcId());
assertEquals(1, procStore.getActiveLogs().size());
}
代码示例来源:origin: apache/hbase
assertTrue(procCounter.get() >= LAST_PROC_ID);
assertTrue(procStore.getStoreTracker().isEmpty());
assertEquals(1, procStore.getActiveLogs().size());
代码示例来源:origin: apache/hbase
@Test
public void testWalCleanerUpdates() throws Exception {
TestSequentialProcedure p1 = new TestSequentialProcedure();
TestSequentialProcedure p2 = new TestSequentialProcedure();
procStore.insert(p1, null);
procStore.insert(p2, null);
procStore.rollWriterForTesting();
ProcedureWALFile firstLog = procStore.getActiveLogs().get(0);
procStore.update(p1);
procStore.rollWriterForTesting();
procStore.update(p2);
procStore.rollWriterForTesting();
procStore.removeInactiveLogsForTesting();
assertFalse(procStore.getActiveLogs().contains(firstLog));
}
代码示例来源:origin: apache/hbase
assertEquals(1, STORE.getActiveLogs().size());
for (int i = 0; i < WAL_COUNT - 1; i++) {
assertTrue(STORE.rollWriterForTesting());
assertEquals(2 + i, STORE.getActiveLogs().size());
EXCHANGER.exchange(Boolean.TRUE);
Thread.sleep(1000);
UTIL.waitFor(10000, () -> STORE.getActiveLogs().size() <= 2);
UTIL.waitFor(10000, () -> EXEC.isFinished(procId));
代码示例来源:origin: apache/hbase
@Test
public void testCompletedProcedure() throws InterruptedException, IOException {
long procId = EXEC.submitProcedure(new ExchangeProcedure());
EXCHANGER.exchange(Boolean.FALSE);
UTIL.waitFor(10000, () -> EXEC.isFinished(procId));
for (int i = 0; i < WAL_COUNT - 1; i++) {
assertTrue(STORE.rollWriterForTesting());
// The exchange procedure is completed but still not deleted yet so we can not delete the
// oldest wal file
long pid = EXEC.submitProcedure(new NoopNoAckProcedure());
assertEquals(2 + i, STORE.getActiveLogs().size());
UTIL.waitFor(10000, () -> EXEC.isFinished(pid));
}
// Only the exchange procedure can not be deleted
UTIL.waitFor(10000, () -> EXEC.getCompletedSize() == 1);
STORE.rollWriterForTesting();
UTIL.waitFor(10000, () -> STORE.getActiveLogs().size() <= 1);
}
}
代码示例来源:origin: apache/hbase
@Test
public void testProcIdHoles() throws Exception {
// Insert
for (int i = 0; i < 100; i += 2) {
procStore.insert(new TestProcedure(i), null);
if (i > 0 && (i % 10) == 0) {
LoadCounter loader = new LoadCounter();
storeRestart(loader);
assertEquals(0, loader.getCorruptedCount());
assertEquals((i / 2) + 1, loader.getLoadedCount());
}
}
assertEquals(10, procStore.getActiveLogs().size());
// Delete
for (int i = 0; i < 100; i += 2) {
procStore.delete(i);
}
assertEquals(1, procStore.getActiveLogs().size());
LoadCounter loader = new LoadCounter();
storeRestart(loader);
assertEquals(0, loader.getLoadedCount());
assertEquals(0, loader.getCorruptedCount());
}
我们有数据(此时未分配)要转换/聚合/透视到 wazoo。 我在 www 上看了看,我问的所有答案都指向 hadoop 可扩展、运行便宜(没有 SQL 服务器机器和许可证)、快速(如果你有足够的数据)
这很明显,我们都同意我们可以将 HDFS + YARN + MapReduce 称为 Hadoop。但是,Hadoop 生态系统中的其他不同组合和其他产品会怎样? 例如,HDFS + YARN + S
如果 es-hadoop 只是连接到 HDFS 的 Hadoop 连接器,它如何支持 Hadoop 分析? 最佳答案 我假设您指的是 this project .在这种情况下,ES Hadoop 项目
看完this和 this论文,我决定我想在 MapReduce 上为大型数据集实现分布式体积渲染设置作为我的本科论文工作。 Hadoop 是一个合理的选择吗? Java 不会扼杀一些性能提升或使与 C
我一直在尝试查找有关如何通过命令行提交 hadoop 作业的信息。 我知道命令 - hadoop jar jar-file 主类输入输出 还有另一个命令,我正在尝试查找有关它的信息,但未能找到 - h
Hadoop 服务器在 Kubernetes 中。而Hadoop客户端位于外网。所以我尝试使用 kubernetes-service 来使用 Hadoop 服务器。但是 hadoop fs -put
有没有人遇到奇怪的环境问题,在调用 hadoop 命令时被迫使用 SU 而不是 SUDO? sudo su -c 'hadoop fs -ls /' hdfs Found 4 itemsdrwxr-x
在更改 mapred-site.xml 中的属性后,我给出了一个 tar.bz2 文件、.gz 和 tar.gz 文件作为输入。以上似乎都没有奏效。我假设这里发生的是 hadoop 作为输入读取的记录
如何在 Hadoop Pipes 中获取正在 hadoop 映射器 中执行的输入文件 名称? 我可以很容易地在基于 java 的 map reducer 中获取文件名,比如 FileSplit fil
我想使用 MapReduce 方法分析连续的数据流(通过 HTTP 访问),因此我一直在研究 Apache Hadoop。不幸的是,Hadoop 似乎期望以固定大小的输入文件开始作业,而不是能够在新数
名称节点可以执行任务吗?默认情况下,任务在集群的数据节点上执行。 最佳答案 假设您正在询问MapReduce ... 使用YARN,MapReduce任务在应用程序主数据库中执行,而不是在nameno
我有一个关系A包含 (zip-code). 我还有另一个关系B包含 (name:gender:zip-code) (x:m:1234) (y:f:1234) (z:m:1245) (s:f:1235)
我是hadoop地区的新手。您能帮我负责(k2,list[v2,v2,v2...])形式的输出(意味着将键及其所有关联值组合在一起)的责任是吗? 谢谢。 最佳答案 这是Hadoop的MapReduce
因此,我一直在尝试编写一个hadoop程序,该程序将输入作为一个包含许多文件的文件,并且我希望hadoop程序的输出仅是输入文件的一行。但是我还没有做到这一点。我也不想去 reducer 课。如果有人
我使用的输入文本文件的内容是 1 "Come 1 "Defects," 1 "I 1 "Information 1 "J" 2 "Plain 5 "Project 1
谁能告诉我以下grep命令的作用: $ bin/hadoop jar hadoop-*-examples.jar grep input output 'dfs[a-z.]+' 最佳答案 http:/
我不了解mapreducer的基本功能,mapreducer是否有助于将文件放入HDFS 或mapreducer仅有助于分析HDFS中现有文件中的内容 我对hadoop非常陌生,任何人都可以指导我理解
CopyFromLocal将从本地文件系统上载数据。 不要放会从任何文件上传数据,例如。本地FS,亚马逊S3 或仅来自本地fs ??? 最佳答案 请找到两个命令的用法。 put ======= Usa
我开始研究hadoop mapreduce。 我是Java和hadoop的初学者,并且了解hadoop mapreduce的编码,但是有兴趣了解它在云中的内部工作方式。 您能否分享一些很好的链接来说明
我一直在寻找Hadoop mapreduce类的类路径。我正在使用Hortonworks 2.2.4版沙箱。我需要这样的类路径来运行我的javac编译器: javac -cp (CLASS_PATH)
我是一名优秀的程序员,十分优秀!