• 设为首页
  • 点击收藏
  • 手机版
    手机扫一扫访问
    迪恩网络手机版
  • 关注官方公众号
    微信扫一扫关注
    公众号

Java VolumeChoosingPolicy类代码示例

原作者: [db:作者] 来自: [db:来源] 收藏 邀请

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



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

示例1: FsVolumeList

import org.apache.hadoop.hdfs.server.datanode.fsdataset.VolumeChoosingPolicy; //导入依赖的package包/类
FsVolumeList(List<VolumeFailureInfo> initialVolumeFailureInfos,
    BlockScanner blockScanner,
    VolumeChoosingPolicy<FsVolumeImpl> blockChooser) {
  this.blockChooser = blockChooser;
  this.blockScanner = blockScanner;
  for (VolumeFailureInfo volumeFailureInfo: initialVolumeFailureInfos) {
    volumeFailureInfos.put(volumeFailureInfo.getFailedStorageLocation(),
        volumeFailureInfo);
  }
}
 
开发者ID:naver,项目名称:hadoop,代码行数:11,代码来源:FsVolumeList.java


示例2: FsDatasetImpl

import org.apache.hadoop.hdfs.server.datanode.fsdataset.VolumeChoosingPolicy; //导入依赖的package包/类
/**
 * An FSDataset has a directory where it loads its data files.
 */
FsDatasetImpl(DataNode datanode, DataStorage storage, Configuration conf
    ) throws IOException {
  this.fsRunning = true;
  this.datanode = datanode;
  this.dataStorage = storage;
  this.conf = conf;
  // The number of volumes required for operation is the total number 
  // of volumes minus the number of failed volumes we can tolerate.
  final int volFailuresTolerated =
    conf.getInt(DFSConfigKeys.DFS_DATANODE_FAILED_VOLUMES_TOLERATED_KEY,
                DFSConfigKeys.DFS_DATANODE_FAILED_VOLUMES_TOLERATED_DEFAULT);

  String[] dataDirs = conf.getTrimmedStrings(DFSConfigKeys.DFS_DATANODE_DATA_DIR_KEY);
  Collection<StorageLocation> dataLocations = DataNode.getStorageLocations(conf);
  List<VolumeFailureInfo> volumeFailureInfos = getInitialVolumeFailureInfos(
      dataLocations, storage);

  int volsConfigured = (dataDirs == null) ? 0 : dataDirs.length;
  int volsFailed = volumeFailureInfos.size();
  this.validVolsRequired = volsConfigured - volFailuresTolerated;

  if (volFailuresTolerated < 0 || volFailuresTolerated >= volsConfigured) {
    throw new DiskErrorException("Invalid volume failure "
        + " config value: " + volFailuresTolerated);
  }
  if (volsFailed > volFailuresTolerated) {
    throw new DiskErrorException("Too many failed volumes - "
        + "current valid volumes: " + storage.getNumStorageDirs() 
        + ", volumes configured: " + volsConfigured 
        + ", volumes failed: " + volsFailed
        + ", volume failures tolerated: " + volFailuresTolerated);
  }

  storageMap = new ConcurrentHashMap<String, DatanodeStorage>();
  volumeMap = new ReplicaMap(this);
  ramDiskReplicaTracker = RamDiskReplicaTracker.getInstance(conf, this);

  @SuppressWarnings("unchecked")
  final VolumeChoosingPolicy<FsVolumeImpl> blockChooserImpl =
      ReflectionUtils.newInstance(conf.getClass(
          DFSConfigKeys.DFS_DATANODE_FSDATASET_VOLUME_CHOOSING_POLICY_KEY,
          RoundRobinVolumeChoosingPolicy.class,
          VolumeChoosingPolicy.class), conf);
  volumes = new FsVolumeList(volumeFailureInfos, datanode.getBlockScanner(),
      blockChooserImpl);
  asyncDiskService = new FsDatasetAsyncDiskService(datanode, this);
  asyncLazyPersistService = new RamDiskAsyncLazyPersistService(datanode);
  deletingBlock = new HashMap<String, Set<Long>>();

  for (int idx = 0; idx < storage.getNumStorageDirs(); idx++) {
    addVolume(dataLocations, storage.getStorageDir(idx));
  }
  setupAsyncLazyPersistThreads();

  cacheManager = new FsDatasetCache(this);

  // Start the lazy writer once we have built the replica maps.
  lazyWriter = new Daemon(new LazyWriter(conf));
  lazyWriter.start();
  registerMBean(datanode.getDatanodeUuid());
  localFS = FileSystem.getLocal(conf);
  blockPinningEnabled = conf.getBoolean(
    DFSConfigKeys.DFS_DATANODE_BLOCK_PINNING_ENABLED,
    DFSConfigKeys.DFS_DATANODE_BLOCK_PINNING_ENABLED_DEFAULT);
}
 
开发者ID:naver,项目名称:hadoop,代码行数:69,代码来源:FsDatasetImpl.java


示例3: FsDatasetImpl

import org.apache.hadoop.hdfs.server.datanode.fsdataset.VolumeChoosingPolicy; //导入依赖的package包/类
/**
 * An FSDataset has a directory where it loads its data files.
 */
FsDatasetImpl(DataNode datanode, DataStorage storage, Configuration conf
    ) throws IOException {
  this.fsRunning = true;
  this.datanode = datanode;
  this.dataStorage = storage;
  this.conf = conf;
  // The number of volumes required for operation is the total number 
  // of volumes minus the number of failed volumes we can tolerate.
  volFailuresTolerated =
    conf.getInt(DFSConfigKeys.DFS_DATANODE_FAILED_VOLUMES_TOLERATED_KEY,
                DFSConfigKeys.DFS_DATANODE_FAILED_VOLUMES_TOLERATED_DEFAULT);

  String[] dataDirs = conf.getTrimmedStrings(DFSConfigKeys.DFS_DATANODE_DATA_DIR_KEY);
  Collection<StorageLocation> dataLocations = DataNode.getStorageLocations(conf);
  List<VolumeFailureInfo> volumeFailureInfos = getInitialVolumeFailureInfos(
      dataLocations, storage);

  int volsConfigured = (dataDirs == null) ? 0 : dataDirs.length;
  int volsFailed = volumeFailureInfos.size();

  if (volFailuresTolerated < 0 || volFailuresTolerated >= volsConfigured) {
    throw new DiskErrorException("Invalid volume failure "
        + " config value: " + volFailuresTolerated);
  }
  if (volsFailed > volFailuresTolerated) {
    throw new DiskErrorException("Too many failed volumes - "
        + "current valid volumes: " + storage.getNumStorageDirs() 
        + ", volumes configured: " + volsConfigured 
        + ", volumes failed: " + volsFailed
        + ", volume failures tolerated: " + volFailuresTolerated);
  }

  storageMap = new ConcurrentHashMap<String, DatanodeStorage>();
  volumeMap = new ReplicaMap(this);
  ramDiskReplicaTracker = RamDiskReplicaTracker.getInstance(conf, this);

  @SuppressWarnings("unchecked")
  final VolumeChoosingPolicy<FsVolumeImpl> blockChooserImpl =
      ReflectionUtils.newInstance(conf.getClass(
          DFSConfigKeys.DFS_DATANODE_FSDATASET_VOLUME_CHOOSING_POLICY_KEY,
          RoundRobinVolumeChoosingPolicy.class,
          VolumeChoosingPolicy.class), conf);
  volumes = new FsVolumeList(volumeFailureInfos, datanode.getBlockScanner(),
      blockChooserImpl);
  asyncDiskService = new FsDatasetAsyncDiskService(datanode);
  asyncLazyPersistService = new RamDiskAsyncLazyPersistService(datanode);

  for (int idx = 0; idx < storage.getNumStorageDirs(); idx++) {
    addVolume(dataLocations, storage.getStorageDir(idx));
  }
  setupAsyncLazyPersistThreads();

  cacheManager = new FsDatasetCache(this);

  // Start the lazy writer once we have built the replica maps.
  lazyWriter = new Daemon(new LazyWriter(conf));
  lazyWriter.start();
  registerMBean(datanode.getDatanodeUuid());
}
 
开发者ID:Nextzero,项目名称:hadoop-2.6.0-cdh5.4.3,代码行数:63,代码来源:FsDatasetImpl.java


示例4: FsDatasetImpl

import org.apache.hadoop.hdfs.server.datanode.fsdataset.VolumeChoosingPolicy; //导入依赖的package包/类
/**
 * An FSDataset has a directory where it loads its data files.
 */
FsDatasetImpl(DataNode datanode, DataStorage storage, Configuration conf
    ) throws IOException {
  this.datanode = datanode;
  // The number of volumes required for operation is the total number 
  // of volumes minus the number of failed volumes we can tolerate.
  final int volFailuresTolerated =
    conf.getInt(DFSConfigKeys.DFS_DATANODE_FAILED_VOLUMES_TOLERATED_KEY,
                DFSConfigKeys.DFS_DATANODE_FAILED_VOLUMES_TOLERATED_DEFAULT);

  String[] dataDirs = conf.getTrimmedStrings(DFSConfigKeys.DFS_DATANODE_DATA_DIR_KEY);

  int volsConfigured = (dataDirs == null) ? 0 : dataDirs.length;
  int volsFailed = volsConfigured - storage.getNumStorageDirs();
  this.validVolsRequired = volsConfigured - volFailuresTolerated;

  if (volFailuresTolerated < 0 || volFailuresTolerated >= volsConfigured) {
    throw new DiskErrorException("Invalid volume failure "
        + " config value: " + volFailuresTolerated);
  }
  if (volsFailed > volFailuresTolerated) {
    throw new DiskErrorException("Too many failed volumes - "
        + "current valid volumes: " + storage.getNumStorageDirs() 
        + ", volumes configured: " + volsConfigured 
        + ", volumes failed: " + volsFailed
        + ", volume failures tolerated: " + volFailuresTolerated);
  }

  final List<FsVolumeImpl> volArray = new ArrayList<FsVolumeImpl>(
      storage.getNumStorageDirs());
  for (int idx = 0; idx < storage.getNumStorageDirs(); idx++) {
    final File dir = storage.getStorageDir(idx).getCurrentDir();
    volArray.add(new FsVolumeImpl(this, storage.getStorageID(), dir, conf));
    LOG.info("Added volume - " + dir);
  }
  volumeMap = new ReplicaMap(this);

  @SuppressWarnings("unchecked")
  final VolumeChoosingPolicy<FsVolumeImpl> blockChooserImpl =
      ReflectionUtils.newInstance(conf.getClass(
          DFSConfigKeys.DFS_DATANODE_FSDATASET_VOLUME_CHOOSING_POLICY_KEY,
          RoundRobinVolumeChoosingPolicy.class,
          VolumeChoosingPolicy.class), conf);
  volumes = new FsVolumeList(volArray, volsFailed, blockChooserImpl);
  volumes.getVolumeMap(volumeMap);

  File[] roots = new File[storage.getNumStorageDirs()];
  for (int idx = 0; idx < storage.getNumStorageDirs(); idx++) {
    roots[idx] = storage.getStorageDir(idx).getCurrentDir();
  }
  asyncDiskService = new FsDatasetAsyncDiskService(datanode, roots);
  registerMBean(storage.getStorageID());
}
 
开发者ID:ict-carch,项目名称:hadoop-plus,代码行数:56,代码来源:FsDatasetImpl.java


示例5: FsVolumeList

import org.apache.hadoop.hdfs.server.datanode.fsdataset.VolumeChoosingPolicy; //导入依赖的package包/类
FsVolumeList(List<FsVolumeImpl> volumes, int failedVols,
    VolumeChoosingPolicy<FsVolumeImpl> blockChooser) {
  this.volumes = Collections.unmodifiableList(volumes);
  this.blockChooser = blockChooser;
  this.numFailedVolumes = failedVols;
}
 
开发者ID:ict-carch,项目名称:hadoop-plus,代码行数:7,代码来源:FsVolumeList.java


示例6: FsDatasetImpl

import org.apache.hadoop.hdfs.server.datanode.fsdataset.VolumeChoosingPolicy; //导入依赖的package包/类
/**
 * An FSDataset has a directory where it loads its data files.
 */
FsDatasetImpl(DataNode datanode, DataStorage storage, Configuration conf
    ) throws IOException {
  this.fsRunning = true;
  this.datanode = datanode;
  this.dataStorage = storage;
  this.conf = conf;
  // The number of volumes required for operation is the total number 
  // of volumes minus the number of failed volumes we can tolerate.
  final int volFailuresTolerated =
    conf.getInt(DFSConfigKeys.DFS_DATANODE_FAILED_VOLUMES_TOLERATED_KEY,
                DFSConfigKeys.DFS_DATANODE_FAILED_VOLUMES_TOLERATED_DEFAULT);

  String[] dataDirs = conf.getTrimmedStrings(DFSConfigKeys.DFS_DATANODE_DATA_DIR_KEY);
  Collection<StorageLocation> dataLocations = DataNode.getStorageLocations(conf);

  int volsConfigured = (dataDirs == null) ? 0 : dataDirs.length;
  int volsFailed = volsConfigured - storage.getNumStorageDirs();
  this.validVolsRequired = volsConfigured - volFailuresTolerated;

  if (volFailuresTolerated < 0 || volFailuresTolerated >= volsConfigured) {
    throw new DiskErrorException("Invalid volume failure "
        + " config value: " + volFailuresTolerated);
  }
  if (volsFailed > volFailuresTolerated) {
    throw new DiskErrorException("Too many failed volumes - "
        + "current valid volumes: " + storage.getNumStorageDirs() 
        + ", volumes configured: " + volsConfigured 
        + ", volumes failed: " + volsFailed
        + ", volume failures tolerated: " + volFailuresTolerated);
  }

  storageMap = new ConcurrentHashMap<String, DatanodeStorage>();
  volumeMap = new ReplicaMap(this);
  ramDiskReplicaTracker = RamDiskReplicaTracker.getInstance(conf, this);

  @SuppressWarnings("unchecked")
  final VolumeChoosingPolicy<FsVolumeImpl> blockChooserImpl =
      ReflectionUtils.newInstance(conf.getClass(
          DFSConfigKeys.DFS_DATANODE_FSDATASET_VOLUME_CHOOSING_POLICY_KEY,
          RoundRobinVolumeChoosingPolicy.class,
          VolumeChoosingPolicy.class), conf);
  volumes = new FsVolumeList(volsFailed, blockChooserImpl);
  asyncDiskService = new FsDatasetAsyncDiskService(datanode);
  asyncLazyPersistService = new RamDiskAsyncLazyPersistService(datanode);

  for (int idx = 0; idx < storage.getNumStorageDirs(); idx++) {
    addVolume(dataLocations, storage.getStorageDir(idx));
  }
  setupAsyncLazyPersistThreads();

  cacheManager = new FsDatasetCache(this);

  // Start the lazy writer once we have built the replica maps.
  lazyWriter = new Daemon(new LazyWriter(conf));
  lazyWriter.start();
  registerMBean(datanode.getDatanodeUuid());
}
 
开发者ID:yncxcw,项目名称:FlexMap,代码行数:61,代码来源:FsDatasetImpl.java


示例7: FsVolumeList

import org.apache.hadoop.hdfs.server.datanode.fsdataset.VolumeChoosingPolicy; //导入依赖的package包/类
FsVolumeList(int failedVols,
    VolumeChoosingPolicy<FsVolumeImpl> blockChooser) {
  this.blockChooser = blockChooser;
  this.numFailedVolumes = failedVols;
}
 
开发者ID:yncxcw,项目名称:FlexMap,代码行数:6,代码来源:FsVolumeList.java


示例8: FsDatasetImpl

import org.apache.hadoop.hdfs.server.datanode.fsdataset.VolumeChoosingPolicy; //导入依赖的package包/类
/**
 * An FSDataset has a directory where it loads its data files.
 */
FsDatasetImpl(DataNode datanode, DataStorage storage, Configuration conf)
    throws IOException {
  this.datanode = datanode;
  // The number of volumes required for operation is the total number 
  // of volumes minus the number of failed volumes we can tolerate.
  final int volFailuresTolerated =
      conf.getInt(DFSConfigKeys.DFS_DATANODE_FAILED_VOLUMES_TOLERATED_KEY,
          DFSConfigKeys.DFS_DATANODE_FAILED_VOLUMES_TOLERATED_DEFAULT);

  String[] dataDirs =
      conf.getTrimmedStrings(DFSConfigKeys.DFS_DATANODE_DATA_DIR_KEY);

  int volsConfigured = (dataDirs == null) ? 0 : dataDirs.length;
  int volsFailed = volsConfigured - storage.getNumStorageDirs();
  this.validVolsRequired = volsConfigured - volFailuresTolerated;

  if (volFailuresTolerated < 0 || volFailuresTolerated >= volsConfigured) {
    throw new DiskErrorException(
        "Invalid volume failure " + " config value: " + volFailuresTolerated);
  }
  if (volsFailed > volFailuresTolerated) {
    throw new DiskErrorException(
        "Too many failed volumes - " + "current valid volumes: " +
            storage.getNumStorageDirs() + ", volumes configured: " +
            volsConfigured + ", volumes failed: " + volsFailed +
            ", volume failures tolerated: " + volFailuresTolerated);
  }

  final List<FsVolumeImpl> volArray =
      new ArrayList<>(storage.getNumStorageDirs());
  for (int idx = 0; idx < storage.getNumStorageDirs(); idx++) {
    final File dir = storage.getStorageDir(idx).getCurrentDir();
    volArray.add(new FsVolumeImpl(this, storage.getStorageID(), dir, conf));
    LOG.info("Added volume - " + dir);
  }
  volumeMap = new ReplicaMap(this);

  @SuppressWarnings("unchecked")
  final VolumeChoosingPolicy<FsVolumeImpl> blockChooserImpl = ReflectionUtils
      .newInstance(conf.getClass(
          DFSConfigKeys.DFS_DATANODE_FSDATASET_VOLUME_CHOOSING_POLICY_KEY,
          RoundRobinVolumeChoosingPolicy.class, VolumeChoosingPolicy.class),
          conf);
  volumes = new FsVolumeList(volArray, volsFailed, blockChooserImpl);
  volumes.getVolumeMap(volumeMap);

  File[] roots = new File[storage.getNumStorageDirs()];
  for (int idx = 0; idx < storage.getNumStorageDirs(); idx++) {
    roots[idx] = storage.getStorageDir(idx).getCurrentDir();
  }
  asyncDiskService = new FsDatasetAsyncDiskService(datanode, roots);
  registerMBean(storage.getStorageID());
  NUM_BUCKETS = conf.getInt(DFSConfigKeys.DFS_NUM_BUCKETS_KEY,
      DFSConfigKeys.DFS_NUM_BUCKETS_DEFAULT);
}
 
开发者ID:hopshadoop,项目名称:hops,代码行数:59,代码来源:FsDatasetImpl.java



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


鲜花

握手

雷人

路过

鸡蛋
该文章已有0人参与评论

请发表评论

全部评论

专题导读
上一篇:
Java User类代码示例发布时间:2022-05-22
下一篇:
Java BsonFactory类代码示例发布时间:2022-05-22
热门推荐
阅读排行榜

扫描微信二维码

查看手机版网站

随时了解更新最新资讯

139-2527-9053

在线客服(服务时间 9:00~18:00)

在线QQ客服
地址:深圳市南山区西丽大学城创智工业园
电邮:jeky_zhao#qq.com
移动电话:139-2527-9053

Powered by 互联科技 X3.4© 2001-2213 极客世界.|Sitemap