当前位置: 首页>>代码示例>>Java>>正文


Java HLogSplitter类代码示例

本文整理汇总了Java中org.apache.hadoop.hbase.regionserver.wal.HLogSplitter的典型用法代码示例。如果您正苦于以下问题:Java HLogSplitter类的具体用法?Java HLogSplitter怎么用?Java HLogSplitter使用的例子?那么, 这里精选的类代码示例或许可以为您提供帮助。


HLogSplitter类属于org.apache.hadoop.hbase.regionserver.wal包,在下文中一共展示了HLogSplitter类的15个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的Java代码示例。

示例1: SplitLogManager

import org.apache.hadoop.hbase.regionserver.wal.HLogSplitter; //导入依赖的package包/类
/**
 * Wrapper around {@link #SplitLogManager(ZooKeeperWatcher, Configuration,
 * Stoppable, String, TaskFinisher)} that provides a task finisher for
 * copying recovered edits to their final destination. The task finisher
 * has to be robust because it can be arbitrarily restarted or called
 * multiple times.
 * 
 * @param zkw
 * @param conf
 * @param stopper
 * @param serverName
 */
public SplitLogManager(ZooKeeperWatcher zkw, final Configuration conf,
    Stoppable stopper, MasterServices master, String serverName) {
  this(zkw, conf, stopper, master, serverName, new TaskFinisher() {
    @Override
    public Status finish(String workerName, String logfile) {
      try {
        HLogSplitter.finishSplitLogFile(logfile, conf);
      } catch (IOException e) {
        LOG.warn("Could not finish splitting of log file " + logfile, e);
        return Status.ERR;
      }
      return Status.DONE;
    }
  });
}
 
开发者ID:fengchen8086,项目名称:LCIndex-HBase-0.94.16,代码行数:28,代码来源:SplitLogManager.java

示例2: doOfflineLogSplitting

import org.apache.hadoop.hbase.regionserver.wal.HLogSplitter; //导入依赖的package包/类
/**
 * Performs log splitting for all regionserver directories.
 * @throws Exception
 */
private void doOfflineLogSplitting() throws Exception {
  LOG.info("Starting Log splitting");
  final Path rootDir = FSUtils.getRootDir(getConf());
  final Path oldLogDir = new Path(rootDir, HConstants.HREGION_OLDLOGDIR_NAME);
  FileSystem fs = FSUtils.getCurrentFileSystem(getConf());
  Path logDir = new Path(rootDir, HConstants.HREGION_LOGDIR_NAME);
  FileStatus[] regionServerLogDirs = FSUtils.listStatus(fs, logDir);
  if (regionServerLogDirs == null || regionServerLogDirs.length == 0) {
    LOG.info("No log directories to split, returning");
    return;
  }
  try {
    for (FileStatus regionServerLogDir : regionServerLogDirs) {
      // split its log dir, if exists
      HLogSplitter.split(rootDir, regionServerLogDir.getPath(), oldLogDir, fs, getConf());
    }
    LOG.info("Successfully completed Log splitting");
  } catch (Exception e) {
    LOG.error("Got exception while doing Log splitting ", e);
    throw e;
  }
}
 
开发者ID:tenggyut,项目名称:HIndex,代码行数:27,代码来源:UpgradeTo96.java

示例3: MasterFileSystem

import org.apache.hadoop.hbase.regionserver.wal.HLogSplitter; //导入依赖的package包/类
public MasterFileSystem(Server master, MasterServices services, boolean masterRecovery)
throws IOException {
  this.conf = master.getConfiguration();
  this.master = master;
  this.services = services;
  // Set filesystem to be that of this.rootdir else we get complaints about
  // mismatched filesystems if hbase.rootdir is hdfs and fs.defaultFS is
  // default localfs.  Presumption is that rootdir is fully-qualified before
  // we get to here with appropriate fs scheme.
  this.rootdir = FSUtils.getRootDir(conf);
  this.tempdir = new Path(this.rootdir, HConstants.HBASE_TEMP_DIRECTORY);
  // Cover both bases, the old way of setting default fs and the new.
  // We're supposed to run on 0.20 and 0.21 anyways.
  this.fs = this.rootdir.getFileSystem(conf);
  FSUtils.setFsDefault(conf, new Path(this.fs.getUri()));
  // make sure the fs has the same conf
  fs.setConf(conf);
  this.distributedLogReplay = HLogSplitter.isDistributedLogReplay(this.conf);
  // setup the filesystem variable
  // set up the archived logs path
  this.oldLogDir = createInitialFileSystemLayout();
  HFileSystem.addLocationsOrderInterceptor(conf);
  this.splitLogManager = new SplitLogManager(master.getZooKeeper(),
    master.getConfiguration(), master, services,
    master.getServerName(), masterRecovery);
}
 
开发者ID:tenggyut,项目名称:HIndex,代码行数:27,代码来源:MasterFileSystem.java

示例4: ServerShutdownHandler

import org.apache.hadoop.hbase.regionserver.wal.HLogSplitter; //导入依赖的package包/类
ServerShutdownHandler(final Server server, final MasterServices services,
    final DeadServer deadServers, final ServerName serverName, EventType type,
    final boolean shouldSplitHlog) {
  super(server, type);
  this.serverName = serverName;
  this.server = server;
  this.services = services;
  this.deadServers = deadServers;
  if (!this.deadServers.isDeadServer(this.serverName)) {
    LOG.warn(this.serverName + " is NOT in deadservers; it should be!");
  }
  this.shouldSplitHlog = shouldSplitHlog;
  this.distributedLogReplay = HLogSplitter.isDistributedLogReplay(server.getConfiguration());
  this.regionAssignmentWaitTimeout = server.getConfiguration().getInt(
    HConstants.LOG_REPLAY_WAIT_REGION_TIMEOUT, 15000);
}
 
开发者ID:tenggyut,项目名称:HIndex,代码行数:17,代码来源:ServerShutdownHandler.java

示例5: SplitLogManager

import org.apache.hadoop.hbase.regionserver.wal.HLogSplitter; //导入依赖的package包/类
/**
 * Wrapper around {@link #SplitLogManager(ZooKeeperWatcher zkw, Configuration conf,
 *   Stoppable stopper, MasterServices master, ServerName serverName,
 *   boolean masterRecovery, TaskFinisher tf)}
 * that provides a task finisher for copying recovered edits to their final destination.
 * The task finisher has to be robust because it can be arbitrarily restarted or called
 * multiple times.
 *
 * @param zkw the ZK watcher
 * @param conf the HBase configuration
 * @param stopper the stoppable in case anything is wrong
 * @param master the master services
 * @param serverName the master server name
 * @param masterRecovery an indication if the master is in recovery
 */
public SplitLogManager(ZooKeeperWatcher zkw, final Configuration conf,
    Stoppable stopper, MasterServices master, ServerName serverName, boolean masterRecovery) {
  this(zkw, conf, stopper, master, serverName, masterRecovery, new TaskFinisher() {
    @Override
    public Status finish(ServerName workerName, String logfile) {
      try {
        HLogSplitter.finishSplitLogFile(logfile, conf);
      } catch (IOException e) {
        LOG.warn("Could not finish splitting of log file " + logfile, e);
        return Status.ERR;
      }
      return Status.DONE;
    }
  });
}
 
开发者ID:tenggyut,项目名称:HIndex,代码行数:31,代码来源:SplitLogManager.java

示例6: SplitLogManager

import org.apache.hadoop.hbase.regionserver.wal.HLogSplitter; //导入依赖的package包/类
/**
 * Wrapper around {@link #SplitLogManager(ZooKeeperWatcher, Configuration,
 * Stoppable, String, TaskFinisher)} that provides a task finisher for
 * copying recovered edits to their final destination. The task finisher
 * has to be robust because it can be arbitrarily restarted or called
 * multiple times.
 * 
 * @param zkw
 * @param conf
 * @param stopper
 * @param serverName
 */
public SplitLogManager(ZooKeeperWatcher zkw, final Configuration conf,
    Stoppable stopper, String serverName) {
  this(zkw, conf, stopper, serverName, new TaskFinisher() {
    @Override
    public Status finish(String workerName, String logfile) {
      String tmpname =
        ZKSplitLog.getSplitLogDirTmpComponent(workerName, logfile);
      try {
        HLogSplitter.moveRecoveredEditsFromTemp(tmpname, logfile, conf);
      } catch (IOException e) {
        LOG.warn("Could not finish splitting of log file " + logfile);
        return Status.ERR;
      }
      return Status.DONE;
    }
  });
}
 
开发者ID:lifeng5042,项目名称:RStore,代码行数:30,代码来源:SplitLogManager.java

示例7: MasterFileSystem

import org.apache.hadoop.hbase.regionserver.wal.HLogSplitter; //导入依赖的package包/类
public MasterFileSystem(Server master, MasterServices services)
throws IOException {
  this.conf = master.getConfiguration();
  this.master = master;
  this.services = services;
  // Set filesystem to be that of this.rootdir else we get complaints about
  // mismatched filesystems if hbase.rootdir is hdfs and fs.defaultFS is
  // default localfs.  Presumption is that rootdir is fully-qualified before
  // we get to here with appropriate fs scheme.
  this.rootdir = FSUtils.getRootDir(conf);
  this.tempdir = new Path(this.rootdir, HConstants.HBASE_TEMP_DIRECTORY);
  // Cover both bases, the old way of setting default fs and the new.
  // We're supposed to run on 0.20 and 0.21 anyways.
  this.fs = this.rootdir.getFileSystem(conf);
  FSUtils.setFsDefault(conf, new Path(this.fs.getUri()));
  // make sure the fs has the same conf
  fs.setConf(conf);
  this.distributedLogReplay = HLogSplitter.isDistributedLogReplay(this.conf);
  // setup the filesystem variable
  // set up the archived logs path
  this.oldLogDir = createInitialFileSystemLayout();
  HFileSystem.addLocationsOrderInterceptor(conf);
  this.splitLogManager = new SplitLogManager(master.getZooKeeper(),
    master.getConfiguration(), master, services,
    master.getServerName());
}
 
开发者ID:shenli-uiuc,项目名称:PyroDB,代码行数:27,代码来源:MasterFileSystem.java

示例8: SplitLogManager

import org.apache.hadoop.hbase.regionserver.wal.HLogSplitter; //导入依赖的package包/类
/**
 * Wrapper around {@link #SplitLogManager(ZooKeeperWatcher zkw, Configuration conf,
 *   Stoppable stopper, MasterServices master, ServerName serverName, TaskFinisher tf)}
 * that provides a task finisher for copying recovered edits to their final destination.
 * The task finisher has to be robust because it can be arbitrarily restarted or called
 * multiple times.
 *
 * @param zkw the ZK watcher
 * @param conf the HBase configuration
 * @param stopper the stoppable in case anything is wrong
 * @param master the master services
 * @param serverName the master server name
 */
public SplitLogManager(ZooKeeperWatcher zkw, final Configuration conf,
    Stoppable stopper, MasterServices master, ServerName serverName) {
  this(zkw, conf, stopper, master, serverName, new TaskFinisher() {
    @Override
    public Status finish(ServerName workerName, String logfile) {
      try {
        HLogSplitter.finishSplitLogFile(logfile, conf);
      } catch (IOException e) {
        LOG.warn("Could not finish splitting of log file " + logfile, e);
        return Status.ERR;
      }
      return Status.DONE;
    }
  });
}
 
开发者ID:shenli-uiuc,项目名称:PyroDB,代码行数:29,代码来源:SplitLogManager.java

示例9: SplitLogManager

import org.apache.hadoop.hbase.regionserver.wal.HLogSplitter; //导入依赖的package包/类
/**
 * Wrapper around {@link #SplitLogManager(ZooKeeperWatcher zkw, Configuration conf,
 *   Stoppable stopper, MasterServices master, ServerName serverName, TaskFinisher tf)}
 * that provides a task finisher for copying recovered edits to their final destination.
 * The task finisher has to be robust because it can be arbitrarily restarted or called
 * multiple times.
 * 
 * @param zkw
 * @param conf
 * @param stopper
 * @param serverName
 */
public SplitLogManager(ZooKeeperWatcher zkw, final Configuration conf,
     Stoppable stopper, MasterServices master, ServerName serverName) {
  this(zkw, conf, stopper,  master, serverName, new TaskFinisher() {
    @Override
    public Status finish(ServerName workerName, String logfile) {
      try {
        HLogSplitter.finishSplitLogFile(logfile, conf);
      } catch (IOException e) {
        LOG.warn("Could not finish splitting of log file " + logfile, e);
        return Status.ERR;
      }
      return Status.DONE;
    }
  });
}
 
开发者ID:daidong,项目名称:DominoHBase,代码行数:28,代码来源:SplitLogManager.java

示例10: runWALSplit

import org.apache.hadoop.hbase.regionserver.wal.HLogSplitter; //导入依赖的package包/类
private Path runWALSplit(final Configuration c) throws IOException {
  FileSystem fs = FileSystem.get(c);
  HLogSplitter logSplitter = HLogSplitter.createLogSplitter(c,
      this.hbaseRootDir, this.logDir, this.oldLogDir, fs);
  List<Path> splits = logSplitter.splitLog();
  // Split should generate only 1 file since there's only 1 region
  assertEquals(1, splits.size());
  // Make sure the file exists
  assertTrue(fs.exists(splits.get(0)));
  LOG.info("Split file=" + splits.get(0));
  return splits.get(0);
}
 
开发者ID:fengchen8086,项目名称:LCIndex-HBase-0.94.16,代码行数:13,代码来源:TestWALObserver.java

示例11: doReplayBatchOp

import org.apache.hadoop.hbase.regionserver.wal.HLogSplitter; //导入依赖的package包/类
/**
 * Execute a list of Put/Delete mutations. The function returns OperationStatus instead of
 * constructing MultiResponse to save a possible loop if caller doesn't need MultiResponse.
 * @param region
 * @param mutations
 * @return an array of OperationStatus which internally contains the OperationStatusCode and the
 *         exceptionMessage if any
 * @throws IOException
 */
protected OperationStatus [] doReplayBatchOp(final HRegion region,
    final List<HLogSplitter.MutationReplay> mutations) throws IOException {
  HLogSplitter.MutationReplay[] mArray = new HLogSplitter.MutationReplay[mutations.size()];

  long before = EnvironmentEdgeManager.currentTimeMillis();
  boolean batchContainsPuts = false, batchContainsDelete = false;
  try {
    int i = 0;
    for (HLogSplitter.MutationReplay m : mutations) {
      if (m.type == MutationType.PUT) {
        batchContainsPuts = true;
      } else {
        batchContainsDelete = true;
      }
      mArray[i++] = m;
    }
    requestCount.add(mutations.size());
    if (!region.getRegionInfo().isMetaTable()) {
      cacheFlusher.reclaimMemStoreMemory();
    }
    return region.batchReplay(mArray);
  } finally {
    long after = EnvironmentEdgeManager.currentTimeMillis();
    if (batchContainsPuts) {
      metricsRegionServer.updatePut(after - before);
    }
    if (batchContainsDelete) {
      metricsRegionServer.updateDelete(after - before);
    }
  }
}
 
开发者ID:tenggyut,项目名称:HIndex,代码行数:41,代码来源:HRegionServer.java

示例12: runWALSplit

import org.apache.hadoop.hbase.regionserver.wal.HLogSplitter; //导入依赖的package包/类
private Path runWALSplit(final Configuration c) throws IOException {
  List<Path> splits = HLogSplitter.split(
    hbaseRootDir, logDir, oldLogDir, FileSystem.get(c), c);
  // Split should generate only 1 file since there's only 1 region
  assertEquals(1, splits.size());
  // Make sure the file exists
  assertTrue(fs.exists(splits.get(0)));
  LOG.info("Split file=" + splits.get(0));
  return splits.get(0);
}
 
开发者ID:tenggyut,项目名称:HIndex,代码行数:11,代码来源:TestWALObserver.java

示例13: doReplayBatchOp

import org.apache.hadoop.hbase.regionserver.wal.HLogSplitter; //导入依赖的package包/类
/**
 * Execute a list of Put/Delete mutations. The function returns OperationStatus instead of
 * constructing MultiResponse to save a possible loop if caller doesn't need MultiResponse.
 * @param region
 * @param mutations
 * @return an array of OperationStatus which internally contains the OperationStatusCode and the
 *         exceptionMessage if any
 * @throws IOException
 */
private OperationStatus [] doReplayBatchOp(final HRegion region,
    final List<HLogSplitter.MutationReplay> mutations) throws IOException {
  HLogSplitter.MutationReplay[] mArray = new HLogSplitter.MutationReplay[mutations.size()];

  long before = EnvironmentEdgeManager.currentTimeMillis();
  boolean batchContainsPuts = false, batchContainsDelete = false;
  try {
    int i = 0;
    for (HLogSplitter.MutationReplay m : mutations) {
      if (m.type == MutationType.PUT) {
        batchContainsPuts = true;
      } else {
        batchContainsDelete = true;
      }
      mArray[i++] = m;
    }
    requestCount.add(mutations.size());
    if (!region.getRegionInfo().isMetaTable()) {
      regionServer.cacheFlusher.reclaimMemStoreMemory();
    }
    return region.batchReplay(mArray);
  } finally {
    if (regionServer.metricsRegionServer != null) {
      long after = EnvironmentEdgeManager.currentTimeMillis();
        if (batchContainsPuts) {
        regionServer.metricsRegionServer.updatePut(after - before);
      }
      if (batchContainsDelete) {
        regionServer.metricsRegionServer.updateDelete(after - before);
      }
    }
  }
}
 
开发者ID:shenli-uiuc,项目名称:PyroDB,代码行数:43,代码来源:RSRpcServices.java

示例14: initializeTHLog

import org.apache.hadoop.hbase.regionserver.wal.HLogSplitter; //导入依赖的package包/类
private void initializeTHLog() throws IOException {
	// We keep in the same directory as the core HLog.
	Path oldLogDir = new Path(getRootDir(), HLogSplitter.RECOVERED_EDITS);
	Path logdir = new Path(getRootDir(),
			HLog.getHLogDirectoryName(super.getServerName().getServerName()));

	trxHLog = new THLog(getFileSystem(), logdir, oldLogDir, conf, null);
}
 
开发者ID:mayanhui,项目名称:hbase-secondary-index,代码行数:9,代码来源:TransactionalRegionServer.java

示例15: splitLog

import org.apache.hadoop.hbase.regionserver.wal.HLogSplitter; //导入依赖的package包/类
/**
 * This method is the base split method that splits HLog files matching a filter.
 * Callers should pass the appropriate filter for meta and non-meta HLogs.
 * @param serverNames
 * @param filter
 * @throws IOException
 */
public void splitLog(final List<ServerName> serverNames, PathFilter filter) throws IOException {
  long splitTime = 0, splitLogSize = 0;
  List<Path> logDirs = getLogDirs(serverNames);

  if (logDirs.isEmpty()) {
    LOG.info("No logs to split");
    return;
  }

  boolean lockAcquired = false;
  if (distributedLogSplitting) {
    try {
      if (!this.services.isServerShutdownHandlerEnabled()) {
        // process one log splitting task at one time before SSH is enabled.
        // because ROOT SSH and HMaster#assignMeta could both log split a same server
        this.splitLogLock.lock();
        lockAcquired = true;
      }
      splitLogManager.handleDeadWorkers(serverNames);
      splitTime = EnvironmentEdgeManager.currentTimeMillis();
      splitLogSize = splitLogManager.splitLogDistributed(logDirs, filter);
      splitTime = EnvironmentEdgeManager.currentTimeMillis() - splitTime;
    } finally {
      if (lockAcquired) {
        this.splitLogLock.unlock();
      }
    }
  } else {
    for(Path logDir: logDirs){
      // splitLogLock ensures that dead region servers' logs are processed
      // one at a time
      this.splitLogLock.lock();
      try {
        HLogSplitter splitter = HLogSplitter.createLogSplitter(
          conf, rootdir, logDir, oldLogDir, this.fs);
        try {
          // If FS is in safe mode, just wait till out of it.
          FSUtils.waitOnSafeMode(conf, conf.getInt(HConstants.THREAD_WAKE_FREQUENCY, 1000));
          splitter.splitLog();
        } catch (OrphanHLogAfterSplitException e) {
          LOG.warn("Retrying splitting because of:", e);
          //An HLogSplitter instance can only be used once.  Get new instance.
          splitter = HLogSplitter.createLogSplitter(conf, rootdir, logDir,
            oldLogDir, this.fs);
          splitter.splitLog();
        }
        splitTime = splitter.getTime();
        splitLogSize = splitter.getSize();
      } finally {
        this.splitLogLock.unlock();
      }
    }
  }

  if (this.metrics != null) {
    this.metrics.addSplit(splitTime, splitLogSize);
  }
}
 
开发者ID:fengchen8086,项目名称:LCIndex-HBase-0.94.16,代码行数:66,代码来源:MasterFileSystem.java


注:本文中的org.apache.hadoop.hbase.regionserver.wal.HLogSplitter类示例由纯净天空整理自Github/MSDocs等开源代码及文档管理平台,相关代码片段筛选自各路编程大神贡献的开源项目,源码版权归原作者所有,传播和使用请参考对应项目的License;未经允许,请勿转载。