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


Java MetricsWAL类代码示例

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


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

示例1: getMetaWAL

import org.apache.hadoop.hbase.regionserver.wal.MetricsWAL; //导入依赖的package包/类
/**
 * @param identifier may not be null, contents will not be altered
 */
public WAL getMetaWAL(final byte[] identifier) throws IOException {
  WALProvider metaProvider = this.metaProvider.get();
  if (null == metaProvider) {
    final WALProvider temp = getProvider(META_WAL_PROVIDER, DEFAULT_META_WAL_PROVIDER,
        Collections.<WALActionsListener>singletonList(new MetricsWAL()),
        DefaultWALProvider.META_WAL_PROVIDER_ID);
    if (this.metaProvider.compareAndSet(null, temp)) {
      metaProvider = temp;
    } else {
      // reference must now be to a provider created in another thread.
      temp.close();
      metaProvider = this.metaProvider.get();
    }
  }
  return metaProvider.getWAL(identifier);
}
 
开发者ID:fengchen8086,项目名称:ditb,代码行数:20,代码来源:WALFactory.java

示例2: createHRegion

import org.apache.hadoop.hbase.regionserver.wal.MetricsWAL; //导入依赖的package包/类
/**
 * Convenience method creating new HRegions. Used by createTable. The {@link WAL} for the created
 * region needs to be closed explicitly, if it is not null. Use {@link HRegion#getWAL()} to get
 * access.
 *
 * @param info       Info for region to create.
 * @param rootDir    Root directory for HBase instance
 * @param tableDir   table directory
 * @param wal        shared WAL
 * @param initialize - true to initialize the region
 * @param ignoreWAL  - true to skip generate new wal if it is null, mostly for createTable
 * @return new HRegion
 * @throws IOException
 */
public static HRegion createHRegion(final HRegionInfo info, final Path rootDir,
    final Path tableDir, final Configuration conf, final HTableDescriptor hTableDescriptor,
    final WAL wal, final boolean initialize, final boolean ignoreWAL) throws IOException {
  LOG.info("creating HRegion " + info.getTable().getNameAsString() + " HTD == " + hTableDescriptor
      + " RootDir = " + rootDir + " Table name == " + info.getTable().getNameAsString());
  FileSystem fs = FileSystem.get(conf);
  HRegionFileSystem.createRegionOnFileSystem(conf, fs, tableDir, info);
  WAL effectiveWAL = wal;
  if (wal == null && !ignoreWAL) {
    // TODO HBASE-11983 There'll be no roller for this wal?
    // The WAL subsystem will use the default rootDir rather than the passed
    // in rootDir
    // unless I pass along via the conf.
    Configuration confForWAL = new Configuration(conf);
    confForWAL.set(HConstants.HBASE_DIR, rootDir.toString());
    effectiveWAL = (new WALFactory(confForWAL,
        Collections.<WALActionsListener>singletonList(new MetricsWAL()),
        "hregion-" + RandomStringUtils.randomNumeric(8))).getWAL(info.getEncodedNameAsBytes());
  }
  HRegion region =
      HRegion.newHRegion(tableDir, effectiveWAL, fs, conf, info, hTableDescriptor, null);
  if (initialize) region.initialize(null);
  return region;
}
 
开发者ID:fengchen8086,项目名称:ditb,代码行数:39,代码来源:HRegion.java

示例3: setupWALAndReplication

import org.apache.hadoop.hbase.regionserver.wal.MetricsWAL; //导入依赖的package包/类
/**
 * Setup WAL log and replication if enabled.
 * Replication setup is done in here because it wants to be hooked up to WAL.
 *
 * @return A WAL instance.
 * @throws IOException
 */
private WALFactory setupWALAndReplication() throws IOException {
  // TODO Replication make assumptions here based on the default filesystem impl
  final Path oldLogDir = new Path(rootDir, HConstants.HREGION_OLDLOGDIR_NAME);
  final String logName = DefaultWALProvider.getWALDirectoryName(this.serverName.toString());

  Path logdir = new Path(rootDir, logName);
  if (LOG.isDebugEnabled()) LOG.debug("logdir=" + logdir);
  if (this.fs.exists(logdir)) {
    throw new RegionServerRunningException(
        "Region server has already " + "created directory at " + this.serverName.toString());
  }

  // Instantiate replication manager if replication enabled.  Pass it the
  // log directories.
  createNewReplicationInstance(conf, this, this.fs, logdir, oldLogDir);

  // listeners the wal factory will add to wals it creates.
  final List<WALActionsListener> listeners = new ArrayList<WALActionsListener>();
  listeners.add(new MetricsWAL());
  if (this.replicationSourceHandler != null
      && this.replicationSourceHandler.getWALActionsListener() != null) {
    // Replication handler is an implementation of WALActionsListener.
    listeners.add(this.replicationSourceHandler.getWALActionsListener());
  }

  return new WALFactory(conf, listeners, serverName.toString());
}
 
开发者ID:fengchen8086,项目名称:ditb,代码行数:35,代码来源:HRegionServer.java

示例4: createWal

import org.apache.hadoop.hbase.regionserver.wal.MetricsWAL; //导入依赖的package包/类
/**
 * Create an unmanaged WAL. Be sure to close it when you're through.
 */
public static WAL createWal(final Configuration conf, final Path rootDir, final HRegionInfo hri)
    throws IOException {
  // The WAL subsystem will use the default rootDir rather than the passed in rootDir
  // unless I pass along via the conf.
  Configuration confForWAL = new Configuration(conf);
  confForWAL.set(HConstants.HBASE_DIR, rootDir.toString());
  return (new WALFactory(confForWAL,
      Collections.<WALActionsListener>singletonList(new MetricsWAL()),
      "hregion-" + RandomStringUtils.randomNumeric(8))).
      getWAL(hri.getEncodedNameAsBytes());
}
 
开发者ID:fengchen8086,项目名称:ditb,代码行数:15,代码来源:HBaseTestingUtility.java

示例5: createWALFactory

import org.apache.hadoop.hbase.regionserver.wal.MetricsWAL; //导入依赖的package包/类
static WALFactory createWALFactory(Configuration conf, Path rootDir) throws IOException {
  Configuration confForWAL = new Configuration(conf);
  confForWAL.set(HConstants.HBASE_DIR, rootDir.toString());
  return new WALFactory(confForWAL,
      Collections.<WALActionsListener>singletonList(new MetricsWAL()),
      "hregion-" + RandomStringUtils.randomNumeric(8));
}
 
开发者ID:fengchen8086,项目名称:ditb,代码行数:8,代码来源:TestHRegion.java

示例6: setupWALAndReplication

import org.apache.hadoop.hbase.regionserver.wal.MetricsWAL; //导入依赖的package包/类
/**
 * Setup WAL log and replication if enabled.
 * Replication setup is done in here because it wants to be hooked up to WAL.
 *
 * @return A WAL instance.
 * @throws IOException
 */
private WALFactory setupWALAndReplication() throws IOException {
    // TODO Replication make assumptions here based on the default filesystem impl
    final Path oldLogDir = new Path(rootDir, HConstants.HREGION_OLDLOGDIR_NAME);
    final String logName = DefaultWALProvider.getWALDirectoryName(this.serverName.toString());

    Path logdir = new Path(rootDir, logName);
    if (LOG.isDebugEnabled()) LOG.debug("logdir=" + logdir);
    if (this.fs.exists(logdir)) {
        throw new RegionServerRunningException("Region server has already " +
                "created directory at " + this.serverName.toString());
    }

    // Instantiate replication manager if replication enabled.  Pass it the
    // log directories.
    createNewReplicationInstance(conf, this, this.fs, logdir, oldLogDir);

    // listeners the wal factory will add to wals it creates.
    final List<WALActionsListener> listeners = new ArrayList<WALActionsListener>();
    listeners.add(new MetricsWAL());
    if (this.replicationSourceHandler != null &&
            this.replicationSourceHandler.getWALActionsListener() != null) {
        // Replication handler is an implementation of WALActionsListener.
        listeners.add(this.replicationSourceHandler.getWALActionsListener());
    }

    return new WALFactory(conf, listeners, serverName.toString());
}
 
开发者ID:grokcoder,项目名称:pbase,代码行数:35,代码来源:HRegionServer.java

示例7: createHRegion

import org.apache.hadoop.hbase.regionserver.wal.MetricsWAL; //导入依赖的package包/类
/**
 * Convenience method creating new HRegions. Used by createTable.
 * The {@link WAL} for the created region needs to be closed
 * explicitly, if it is not null.
 * Use {@link HRegion#getWAL()} to get access.
 *
 * @param info       Info for region to create.
 * @param rootDir    Root directory for HBase instance
 * @param tableDir   table directory
 * @param wal        shared WAL
 * @param initialize - true to initialize the region
 * @param ignoreWAL  - true to skip generate new wal if it is null, mostly for createTable
 * @return new HRegion
 * @throws IOException
 */
public static HRegion createHRegion(final HRegionInfo info, final Path rootDir, final Path tableDir,
                                    final Configuration conf,
                                    final HTableDescriptor hTableDescriptor,
                                    final WAL wal,
                                    final boolean initialize, final boolean ignoreWAL)
        throws IOException {
    LOG.info("creating HRegion " + info.getTable().getNameAsString()
            + " HTD == " + hTableDescriptor + " RootDir = " + rootDir +
            " Table name == " + info.getTable().getNameAsString());
    FileSystem fs = FileSystem.get(conf);
    HRegionFileSystem.createRegionOnFileSystem(conf, fs, tableDir, info);
    WAL effectiveWAL = wal;
    if (wal == null && !ignoreWAL) {
        // TODO HBASE-11983 There'll be no roller for this wal?
        // The WAL subsystem will use the default rootDir rather than the passed in rootDir
        // unless I pass along via the conf.
        Configuration confForWAL = new Configuration(conf);
        confForWAL.set(HConstants.HBASE_DIR, rootDir.toString());
        effectiveWAL = (new WALFactory(confForWAL,
                Collections.<WALActionsListener>singletonList(new MetricsWAL()),
                "hregion-" + RandomStringUtils.randomNumeric(8))).
                getWAL(info.getEncodedNameAsBytes());
    }
    HRegion region = HRegion.newHRegion(tableDir,
            effectiveWAL, fs, conf, info, hTableDescriptor, null);
    if (initialize) {
        // If initializing, set the sequenceId. It is also required by WALPerformanceEvaluation when
        // verifying the WALEdits.
        region.setSequenceId(region.initialize(null));
    }
    return region;
}
 
开发者ID:grokcoder,项目名称:pbase,代码行数:48,代码来源:HRegion.java

示例8: getProvider

import org.apache.hadoop.hbase.regionserver.wal.MetricsWAL; //导入依赖的package包/类
/**
 * instantiate a provider from a config property. requires conf to have already been set (as well
 * as anything the provider might need to read).
 */
WALProvider getProvider(String key, String defaultValue, String providerId) throws IOException {
  Class<? extends WALProvider> clazz = getProviderClass(key, defaultValue);
  WALProvider provider = createProvider(clazz, providerId);
  provider.addWALActionsListener(new MetricsWAL());
  return provider;
}
 
开发者ID:apache,项目名称:hbase,代码行数:11,代码来源:WALFactory.java


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