gpt4 book ai didi

org.apache.hadoop.hbase.procedure2.store.wal.WALProcedureStore.isRunning()方法的使用及代码示例

转载 作者:知者 更新时间:2024-03-24 04:59:05 26 4
gpt4 key购买 nike

本文整理了Java中org.apache.hadoop.hbase.procedure2.store.wal.WALProcedureStore.isRunning()方法的一些代码示例,展示了WALProcedureStore.isRunning()的具体用法。这些代码示例主要来源于Github/Stackoverflow/Maven等平台,是从一些精选项目中提取出来的代码,具有较强的参考意义,能在一定程度帮忙到你。WALProcedureStore.isRunning()方法的具体详情如下:
包路径:org.apache.hadoop.hbase.procedure2.store.wal.WALProcedureStore
类名称:WALProcedureStore
方法名:isRunning

WALProcedureStore.isRunning介绍

暂无

代码示例

代码示例来源:origin: apache/hbase

private boolean rollWriterWithRetries() {
 for (int i = 0; i < rollRetries && isRunning(); ++i) {
  if (i > 0) Threads.sleepWithoutInterrupt(waitBeforeRoll * i);
  try {
   if (rollWriter()) {
    return true;
   }
  } catch (IOException e) {
   LOG.warn("Unable to roll the log, attempt=" + (i + 1), e);
  }
 }
 LOG.error(HBaseMarkers.FATAL, "Unable to roll the log");
 return false;
}

代码示例来源:origin: apache/hbase

private long syncSlots() throws Throwable {
 int retry = 0;
 int logRolled = 0;
 long totalSynced = 0;
 do {
  try {
   totalSynced = syncSlots(stream, slots, 0, slotIndex);
   break;
  } catch (Throwable e) {
   LOG.warn("unable to sync slots, retry=" + retry);
   if (++retry >= maxRetriesBeforeRoll) {
    if (logRolled >= maxSyncFailureRoll && isRunning()) {
     LOG.error("Sync slots after log roll failed, abort.", e);
     throw e;
    }
    if (!rollWriterWithRetries()) {
     throw e;
    }
    logRolled++;
    retry = 0;
   }
  }
 } while (isRunning());
 return totalSynced;
}

代码示例来源:origin: apache/hbase

private long pushData(final PushType type, final ByteSlot slot,
  final long procId, final long[] subProcIds) {
 if (!isRunning()) {
  throw new RuntimeException("the store must be running before inserting data");
   if (!isRunning()) {
    throw new RuntimeException("store no longer running");
   } else if (isSyncAborted()) {
  while (pushSyncId == syncId.get() && isRunning()) {
   syncCond.await();

代码示例来源:origin: apache/hbase

/**
 * Make sure that the file set are gotten by calling {@link #getLogFiles()}, where we will sort
 * the file set by log id.
 * @return Max-LogID of the specified log file set
 */
private long initOldLogs(FileStatus[] logFiles) throws IOException {
 if (logFiles == null || logFiles.length == 0) {
  return 0L;
 }
 long maxLogId = 0;
 for (int i = 0; i < logFiles.length; ++i) {
  final Path logPath = logFiles[i].getPath();
  leaseRecovery.recoverFileLease(fs, logPath);
  if (!isRunning()) {
   throw new IOException("wal aborting");
  }
  maxLogId = Math.max(maxLogId, getLogIdFromName(logPath.getName()));
  ProcedureWALFile log = initOldLog(logFiles[i], this.walArchiveDir);
  if (log != null) {
   this.logs.add(log);
  }
 }
 initTrackerFromOldLogs();
 return maxLogId;
}

代码示例来源:origin: apache/hbase

private boolean rollWriter() throws IOException {
 if (!isRunning()) {
  return false;
 }
 // Create new state-log
 if (!rollWriter(flushLogId + 1)) {
  LOG.warn("someone else has already created log {}", flushLogId);
  return false;
 }
 // We have the lease on the log,
 // but we should check if someone else has created new files
 if (getMaxLogId(getLogFiles()) > flushLogId) {
  LOG.warn("Someone else created new logs. Expected maxLogId < {}", flushLogId);
  logs.getLast().removeFile(this.walArchiveDir);
  return false;
 }
 // We have the lease on the log
 return true;
}

代码示例来源:origin: apache/hbase

LOG.debug("Starting WAL Procedure Store lease recovery");
boolean afterFirstAttempt = false;
while (isRunning()) {

代码示例来源:origin: apache/hbase

/**
 * If last log's tracker is not null, use it as {@link #storeTracker}. Otherwise, set storeTracker
 * as partial, and let {@link ProcedureWALFormatReader} rebuild it using entries in the log.
 */
private void initTrackerFromOldLogs() {
 if (logs.isEmpty() || !isRunning()) {
  return;
 }
 ProcedureWALFile log = logs.getLast();
 if (!log.getTracker().isPartial()) {
  storeTracker.resetTo(log.getTracker());
 } else {
  storeTracker.reset();
  storeTracker.setPartialFlag(true);
 }
}

代码示例来源:origin: apache/hbase

lock.lock();
try {
 while (isRunning()) {
  try {

代码示例来源:origin: apache/hbase

@Test(expected=RuntimeException.class)
public void testWalAbortOnLowReplication() throws Exception {
 setupDFS();
 assertEquals(3, UTIL.getDFSCluster().getDataNodes().size());
 LOG.info("Stop DataNode");
 UTIL.getDFSCluster().stopDataNode(0);
 assertEquals(2, UTIL.getDFSCluster().getDataNodes().size());
 store.insert(new TestProcedure(1, -1), null);
 for (long i = 2; store.isRunning(); ++i) {
  assertEquals(2, UTIL.getDFSCluster().getDataNodes().size());
  store.insert(new TestProcedure(i, -1), null);
  Thread.sleep(100);
 }
 assertFalse(store.isRunning());
}

代码示例来源:origin: apache/hbase

assertFalse(store.isRunning());
assertTrue(reCount.toString(), reCount.get() >= store.getNumThreads() &&
                reCount.get() < thread.length);

代码示例来源:origin: apache/hbase

@Test
public void testWalRollOnLowReplication() throws Exception {
 UTIL.getConfiguration().setInt("dfs.namenode.replication.min", 1);
 setupDFS();
 int dnCount = 0;
 store.insert(new TestProcedure(1, -1), null);
 UTIL.getDFSCluster().restartDataNode(dnCount);
 for (long i = 2; i < 100; ++i) {
  store.insert(new TestProcedure(i, -1), null);
  waitForNumReplicas(3);
  Thread.sleep(100);
  if ((i % 30) == 0) {
   LOG.info("Restart Data Node");
   UTIL.getDFSCluster().restartDataNode(++dnCount % 3);
  }
 }
 assertTrue(store.isRunning());
}

代码示例来源:origin: org.apache.hbase/hbase-procedure

private boolean rollWriterWithRetries() {
 for (int i = 0; i < rollRetries && isRunning(); ++i) {
  if (i > 0) Threads.sleepWithoutInterrupt(waitBeforeRoll * i);
  try {
   if (rollWriter()) {
    return true;
   }
  } catch (IOException e) {
   LOG.warn("Unable to roll the log, attempt=" + (i + 1), e);
  }
 }
 LOG.error(HBaseMarkers.FATAL, "Unable to roll the log");
 return false;
}

代码示例来源:origin: com.aliyun.hbase/alihbase-procedure

private boolean rollWriterWithRetries() {
 for (int i = 0; i < rollRetries && isRunning(); ++i) {
  if (i > 0) Threads.sleepWithoutInterrupt(waitBeforeRoll * i);
  try {
   if (rollWriter()) {
    return true;
   }
  } catch (IOException e) {
   LOG.warn("Unable to roll the log, attempt=" + (i + 1), e);
  }
 }
 LOG.error(HBaseMarkers.FATAL, "Unable to roll the log");
 return false;
}

代码示例来源:origin: com.aliyun.hbase/alihbase-procedure

/**
 * @return Max-LogID of the specified log file set
 */
private long initOldLogs(final FileStatus[] logFiles) throws IOException {
 this.logs.clear();
 long maxLogId = 0;
 if (logFiles != null && logFiles.length > 0) {
  for (int i = 0; i < logFiles.length; ++i) {
   final Path logPath = logFiles[i].getPath();
   leaseRecovery.recoverFileLease(fs, logPath);
   if (!isRunning()) {
    throw new IOException("wal aborting");
   }
   maxLogId = Math.max(maxLogId, getLogIdFromName(logPath.getName()));
   ProcedureWALFile log = initOldLog(logFiles[i], this.walArchiveDir);
   if (log != null) {
    this.logs.add(log);
   }
  }
  Collections.sort(this.logs);
  initTrackerFromOldLogs();
 }
 return maxLogId;
}

代码示例来源:origin: com.aliyun.hbase/alihbase-procedure

private boolean rollWriter() throws IOException {
 if (!isRunning()) return false;
 // Create new state-log
 if (!rollWriter(flushLogId + 1)) {
  LOG.warn("someone else has already created log " + flushLogId);
  return false;
 }
 // We have the lease on the log,
 // but we should check if someone else has created new files
 if (getMaxLogId(getLogFiles()) > flushLogId) {
  LOG.warn("Someone else created new logs. Expected maxLogId < " + flushLogId);
  logs.getLast().removeFile(this.walArchiveDir);
  return false;
 }
 // We have the lease on the log
 return true;
}

代码示例来源:origin: org.apache.hbase/hbase-procedure

private boolean rollWriter() throws IOException {
 if (!isRunning()) {
  return false;
 }
 // Create new state-log
 if (!rollWriter(flushLogId + 1)) {
  LOG.warn("someone else has already created log {}", flushLogId);
  return false;
 }
 // We have the lease on the log,
 // but we should check if someone else has created new files
 if (getMaxLogId(getLogFiles()) > flushLogId) {
  LOG.warn("Someone else created new logs. Expected maxLogId < {}", flushLogId);
  logs.getLast().removeFile(this.walArchiveDir);
  return false;
 }
 // We have the lease on the log
 return true;
}

代码示例来源:origin: org.apache.hbase/hbase-procedure

/**
 * If last log's tracker is not null, use it as {@link #storeTracker}. Otherwise, set storeTracker
 * as partial, and let {@link ProcedureWALFormatReader} rebuild it using entries in the log.
 */
private void initTrackerFromOldLogs() {
 if (logs.isEmpty() || !isRunning()) {
  return;
 }
 ProcedureWALFile log = logs.getLast();
 if (!log.getTracker().isPartial()) {
  storeTracker.resetTo(log.getTracker());
 } else {
  storeTracker.reset();
  storeTracker.setPartialFlag(true);
 }
}

代码示例来源:origin: com.aliyun.hbase/alihbase-procedure

/**
 * If last log's tracker is not null, use it as {@link #storeTracker}.
 * Otherwise, set storeTracker as partial, and let {@link ProcedureWALFormatReader} rebuild
 * it using entries in the log.
 */
private void initTrackerFromOldLogs() {
 if (logs.isEmpty() || !isRunning()) return;
 ProcedureWALFile log = logs.getLast();
 if (!log.getTracker().isPartial()) {
  storeTracker.resetTo(log.getTracker());
 } else {
  storeTracker.reset();
  storeTracker.setPartialFlag(true);
 }
}

代码示例来源:origin: org.apache.hbase/hbase-server

@Test(expected=RuntimeException.class)
public void testWalAbortOnLowReplication() throws Exception {
 setupDFS();
 assertEquals(3, UTIL.getDFSCluster().getDataNodes().size());
 LOG.info("Stop DataNode");
 UTIL.getDFSCluster().stopDataNode(0);
 assertEquals(2, UTIL.getDFSCluster().getDataNodes().size());
 store.insert(new TestProcedure(1, -1), null);
 for (long i = 2; store.isRunning(); ++i) {
  assertEquals(2, UTIL.getDFSCluster().getDataNodes().size());
  store.insert(new TestProcedure(i, -1), null);
  Thread.sleep(100);
 }
 assertFalse(store.isRunning());
}

代码示例来源:origin: org.apache.hbase/hbase-server

@Test
public void testWalRollOnLowReplication() throws Exception {
 UTIL.getConfiguration().setInt("dfs.namenode.replication.min", 1);
 setupDFS();
 int dnCount = 0;
 store.insert(new TestProcedure(1, -1), null);
 UTIL.getDFSCluster().restartDataNode(dnCount);
 for (long i = 2; i < 100; ++i) {
  store.insert(new TestProcedure(i, -1), null);
  waitForNumReplicas(3);
  Thread.sleep(100);
  if ((i % 30) == 0) {
   LOG.info("Restart Data Node");
   UTIL.getDFSCluster().restartDataNode(++dnCount % 3);
  }
 }
 assertTrue(store.isRunning());
}

26 4 0
Copyright 2021 - 2024 cfsdn All Rights Reserved 蜀ICP备2022000587号
广告合作:1813099741@qq.com 6ren.com