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


Java Triple.getThird方法代码示例

本文整理汇总了Java中org.apache.hadoop.hbase.util.Triple.getThird方法的典型用法代码示例。如果您正苦于以下问题:Java Triple.getThird方法的具体用法?Java Triple.getThird怎么用?Java Triple.getThird使用的例子?那么恭喜您, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在org.apache.hadoop.hbase.util.Triple的用法示例。


在下文中一共展示了Triple.getThird方法的13个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的Java代码示例。

示例1: testSecondaryAndTertiaryPlacementWithSingleRack

import org.apache.hadoop.hbase.util.Triple; //导入方法依赖的package包/类
@Ignore("Disabled for now until FavoredNodes gets finished as a feature") @Test
public void testSecondaryAndTertiaryPlacementWithSingleRack() {
  // Test the case where there is a single rack and we need to choose
  // Primary/Secondary/Tertiary from a single rack.
  Map<String,Integer> rackToServerCount = new HashMap<String,Integer>();
  rackToServerCount.put("rack1", 10);
  // have lots of regions to test with
  Triple<Map<HRegionInfo, ServerName>, FavoredNodeAssignmentHelper, List<HRegionInfo>>
    primaryRSMapAndHelper = secondaryAndTertiaryRSPlacementHelper(60000, rackToServerCount);
  FavoredNodeAssignmentHelper helper = primaryRSMapAndHelper.getSecond();
  Map<HRegionInfo, ServerName> primaryRSMap = primaryRSMapAndHelper.getFirst();
  List<HRegionInfo> regions = primaryRSMapAndHelper.getThird();
  Map<HRegionInfo, ServerName[]> secondaryAndTertiaryMap =
      helper.placeSecondaryAndTertiaryRS(primaryRSMap);
  // although we created lots of regions we should have no overlap on the
  // primary/secondary/tertiary for any given region
  for (HRegionInfo region : regions) {
    ServerName[] secondaryAndTertiaryServers = secondaryAndTertiaryMap.get(region);
    assertTrue(!secondaryAndTertiaryServers[0].equals(primaryRSMap.get(region)));
    assertTrue(!secondaryAndTertiaryServers[1].equals(primaryRSMap.get(region)));
    assertTrue(!secondaryAndTertiaryServers[0].equals(secondaryAndTertiaryServers[1]));
  }
}
 
开发者ID:fengchen8086,项目名称:ditb,代码行数:24,代码来源:TestFavoredNodeAssignmentHelper.java

示例2: testSecondaryAndTertiaryPlacementWithSingleServer

import org.apache.hadoop.hbase.util.Triple; //导入方法依赖的package包/类
@Ignore("Disabled for now until FavoredNodes gets finished as a feature") @Test
public void testSecondaryAndTertiaryPlacementWithSingleServer() {
  // Test the case where we have a single node in the cluster. In this case
  // the primary can be assigned but the secondary/tertiary would be null
  Map<String,Integer> rackToServerCount = new HashMap<String,Integer>();
  rackToServerCount.put("rack1", 1);
  Triple<Map<HRegionInfo, ServerName>, FavoredNodeAssignmentHelper, List<HRegionInfo>>
    primaryRSMapAndHelper = secondaryAndTertiaryRSPlacementHelper(1, rackToServerCount);
  FavoredNodeAssignmentHelper helper = primaryRSMapAndHelper.getSecond();
  Map<HRegionInfo, ServerName> primaryRSMap = primaryRSMapAndHelper.getFirst();
  List<HRegionInfo> regions = primaryRSMapAndHelper.getThird();

  Map<HRegionInfo, ServerName[]> secondaryAndTertiaryMap =
      helper.placeSecondaryAndTertiaryRS(primaryRSMap);
  // no secondary/tertiary placement in case of a single RegionServer
  assertTrue(secondaryAndTertiaryMap.get(regions.get(0)) == null);
}
 
开发者ID:fengchen8086,项目名称:ditb,代码行数:18,代码来源:TestFavoredNodeAssignmentHelper.java

示例3: testSecondaryAndTertiaryPlacementWithLessThanTwoServersInRacks

import org.apache.hadoop.hbase.util.Triple; //导入方法依赖的package包/类
@Ignore("Disabled for now until FavoredNodes gets finished as a feature") @Test
public void testSecondaryAndTertiaryPlacementWithLessThanTwoServersInRacks() {
  // Test the case where we have two racks but with less than two servers in each
  // We will not have enough machines to select secondary/tertiary
  Map<String,Integer> rackToServerCount = new HashMap<String,Integer>();
  rackToServerCount.put("rack1", 1);
  rackToServerCount.put("rack2", 1);
  Triple<Map<HRegionInfo, ServerName>, FavoredNodeAssignmentHelper, List<HRegionInfo>>
    primaryRSMapAndHelper = secondaryAndTertiaryRSPlacementHelper(6, rackToServerCount);
  FavoredNodeAssignmentHelper helper = primaryRSMapAndHelper.getSecond();
  Map<HRegionInfo, ServerName> primaryRSMap = primaryRSMapAndHelper.getFirst();
  List<HRegionInfo> regions = primaryRSMapAndHelper.getThird();
  assertTrue(primaryRSMap.size() == 6);
  Map<HRegionInfo, ServerName[]> secondaryAndTertiaryMap =
        helper.placeSecondaryAndTertiaryRS(primaryRSMap);
  for (HRegionInfo region : regions) {
    // not enough secondary/tertiary room to place the regions
    assertTrue(secondaryAndTertiaryMap.get(region) == null);
  }
}
 
开发者ID:fengchen8086,项目名称:ditb,代码行数:21,代码来源:TestFavoredNodeAssignmentHelper.java

示例4: testSecondaryAndTertiaryPlacementWithSingleRack

import org.apache.hadoop.hbase.util.Triple; //导入方法依赖的package包/类
@Test
public void testSecondaryAndTertiaryPlacementWithSingleRack() {
  // Test the case where there is a single rack and we need to choose
  // Primary/Secondary/Tertiary from a single rack.
  Map<String,Integer> rackToServerCount = new HashMap<String,Integer>();
  rackToServerCount.put("rack1", 10);
  // have lots of regions to test with
  Triple<Map<HRegionInfo, ServerName>, FavoredNodeAssignmentHelper, List<HRegionInfo>>
    primaryRSMapAndHelper = secondaryAndTertiaryRSPlacementHelper(60000, rackToServerCount);
  FavoredNodeAssignmentHelper helper = primaryRSMapAndHelper.getSecond();
  Map<HRegionInfo, ServerName> primaryRSMap = primaryRSMapAndHelper.getFirst();
  List<HRegionInfo> regions = primaryRSMapAndHelper.getThird();
  Map<HRegionInfo, ServerName[]> secondaryAndTertiaryMap =
      helper.placeSecondaryAndTertiaryRS(primaryRSMap);
  // although we created lots of regions we should have no overlap on the
  // primary/secondary/tertiary for any given region
  for (HRegionInfo region : regions) {
    ServerName[] secondaryAndTertiaryServers = secondaryAndTertiaryMap.get(region);
    assertTrue(!secondaryAndTertiaryServers[0].equals(primaryRSMap.get(region)));
    assertTrue(!secondaryAndTertiaryServers[1].equals(primaryRSMap.get(region)));
    assertTrue(!secondaryAndTertiaryServers[0].equals(secondaryAndTertiaryServers[1]));
  }
}
 
开发者ID:grokcoder,项目名称:pbase,代码行数:24,代码来源:TestFavoredNodeAssignmentHelper.java

示例5: testSecondaryAndTertiaryPlacementWithSingleServer

import org.apache.hadoop.hbase.util.Triple; //导入方法依赖的package包/类
@Test
public void testSecondaryAndTertiaryPlacementWithSingleServer() {
  // Test the case where we have a single node in the cluster. In this case
  // the primary can be assigned but the secondary/tertiary would be null
  Map<String,Integer> rackToServerCount = new HashMap<String,Integer>();
  rackToServerCount.put("rack1", 1);
  Triple<Map<HRegionInfo, ServerName>, FavoredNodeAssignmentHelper, List<HRegionInfo>>
    primaryRSMapAndHelper = secondaryAndTertiaryRSPlacementHelper(1, rackToServerCount);
  FavoredNodeAssignmentHelper helper = primaryRSMapAndHelper.getSecond();
  Map<HRegionInfo, ServerName> primaryRSMap = primaryRSMapAndHelper.getFirst();
  List<HRegionInfo> regions = primaryRSMapAndHelper.getThird();

  Map<HRegionInfo, ServerName[]> secondaryAndTertiaryMap =
      helper.placeSecondaryAndTertiaryRS(primaryRSMap);
  // no secondary/tertiary placement in case of a single RegionServer
  assertTrue(secondaryAndTertiaryMap.get(regions.get(0)) == null);
}
 
开发者ID:grokcoder,项目名称:pbase,代码行数:18,代码来源:TestFavoredNodeAssignmentHelper.java

示例6: testSecondaryAndTertiaryPlacementWithLessThanTwoServersInRacks

import org.apache.hadoop.hbase.util.Triple; //导入方法依赖的package包/类
@Test
public void testSecondaryAndTertiaryPlacementWithLessThanTwoServersInRacks() {
  // Test the case where we have two racks but with less than two servers in each
  // We will not have enough machines to select secondary/tertiary
  Map<String,Integer> rackToServerCount = new HashMap<String,Integer>();
  rackToServerCount.put("rack1", 1);
  rackToServerCount.put("rack2", 1);
  Triple<Map<HRegionInfo, ServerName>, FavoredNodeAssignmentHelper, List<HRegionInfo>>
    primaryRSMapAndHelper = secondaryAndTertiaryRSPlacementHelper(6, rackToServerCount);
  FavoredNodeAssignmentHelper helper = primaryRSMapAndHelper.getSecond();
  Map<HRegionInfo, ServerName> primaryRSMap = primaryRSMapAndHelper.getFirst();
  List<HRegionInfo> regions = primaryRSMapAndHelper.getThird();
  assertTrue(primaryRSMap.size() == 6);
  Map<HRegionInfo, ServerName[]> secondaryAndTertiaryMap =
        helper.placeSecondaryAndTertiaryRS(primaryRSMap);
  for (HRegionInfo region : regions) {
    // not enough secondary/tertiary room to place the regions
    assertTrue(secondaryAndTertiaryMap.get(region) == null);
  }
}
 
开发者ID:grokcoder,项目名称:pbase,代码行数:21,代码来源:TestFavoredNodeAssignmentHelper.java

示例7: testSecondaryAndTertiaryPlacementWithSingleRack

import org.apache.hadoop.hbase.util.Triple; //导入方法依赖的package包/类
@Test
public void testSecondaryAndTertiaryPlacementWithSingleRack() {
  // Test the case where there is a single rack and we need to choose
  // Primary/Secondary/Tertiary from a single rack.
  Map<String,Integer> rackToServerCount = new HashMap<>();
  rackToServerCount.put("rack1", 10);
  // have lots of regions to test with
  Triple<Map<RegionInfo, ServerName>, FavoredNodeAssignmentHelper, List<RegionInfo>>
    primaryRSMapAndHelper = secondaryAndTertiaryRSPlacementHelper(60000, rackToServerCount);
  FavoredNodeAssignmentHelper helper = primaryRSMapAndHelper.getSecond();
  Map<RegionInfo, ServerName> primaryRSMap = primaryRSMapAndHelper.getFirst();
  List<RegionInfo> regions = primaryRSMapAndHelper.getThird();
  Map<RegionInfo, ServerName[]> secondaryAndTertiaryMap =
      helper.placeSecondaryAndTertiaryRS(primaryRSMap);
  // although we created lots of regions we should have no overlap on the
  // primary/secondary/tertiary for any given region
  for (RegionInfo region : regions) {
    ServerName[] secondaryAndTertiaryServers = secondaryAndTertiaryMap.get(region);
    assertNotNull(secondaryAndTertiaryServers);
    assertTrue(primaryRSMap.containsKey(region));
    assertTrue(!secondaryAndTertiaryServers[0].equals(primaryRSMap.get(region)));
    assertTrue(!secondaryAndTertiaryServers[1].equals(primaryRSMap.get(region)));
    assertTrue(!secondaryAndTertiaryServers[0].equals(secondaryAndTertiaryServers[1]));
  }
}
 
开发者ID:apache,项目名称:hbase,代码行数:26,代码来源:TestFavoredNodeAssignmentHelper.java

示例8: testSecondaryAndTertiaryPlacementWithSingleServer

import org.apache.hadoop.hbase.util.Triple; //导入方法依赖的package包/类
@Test
public void testSecondaryAndTertiaryPlacementWithSingleServer() {
  // Test the case where we have a single node in the cluster. In this case
  // the primary can be assigned but the secondary/tertiary would be null
  Map<String,Integer> rackToServerCount = new HashMap<>();
  rackToServerCount.put("rack1", 1);
  Triple<Map<RegionInfo, ServerName>, FavoredNodeAssignmentHelper, List<RegionInfo>>
    primaryRSMapAndHelper = secondaryAndTertiaryRSPlacementHelper(1, rackToServerCount);
  FavoredNodeAssignmentHelper helper = primaryRSMapAndHelper.getSecond();
  Map<RegionInfo, ServerName> primaryRSMap = primaryRSMapAndHelper.getFirst();
  List<RegionInfo> regions = primaryRSMapAndHelper.getThird();

  Map<RegionInfo, ServerName[]> secondaryAndTertiaryMap =
      helper.placeSecondaryAndTertiaryRS(primaryRSMap);
  // no secondary/tertiary placement in case of a single RegionServer
  assertTrue(secondaryAndTertiaryMap.get(regions.get(0)) == null);
}
 
开发者ID:apache,项目名称:hbase,代码行数:18,代码来源:TestFavoredNodeAssignmentHelper.java

示例9: testSecondaryAndTertiaryPlacementWithLessThanTwoServersInRacks

import org.apache.hadoop.hbase.util.Triple; //导入方法依赖的package包/类
@Test
public void testSecondaryAndTertiaryPlacementWithLessThanTwoServersInRacks() {
  // Test the case where we have two racks but with less than two servers in each
  // We will not have enough machines to select secondary/tertiary
  Map<String,Integer> rackToServerCount = new HashMap<>();
  rackToServerCount.put("rack1", 1);
  rackToServerCount.put("rack2", 1);
  Triple<Map<RegionInfo, ServerName>, FavoredNodeAssignmentHelper, List<RegionInfo>>
    primaryRSMapAndHelper = secondaryAndTertiaryRSPlacementHelper(6, rackToServerCount);
  FavoredNodeAssignmentHelper helper = primaryRSMapAndHelper.getSecond();
  Map<RegionInfo, ServerName> primaryRSMap = primaryRSMapAndHelper.getFirst();
  List<RegionInfo> regions = primaryRSMapAndHelper.getThird();
  assertTrue(primaryRSMap.size() == 6);
  Map<RegionInfo, ServerName[]> secondaryAndTertiaryMap =
        helper.placeSecondaryAndTertiaryRS(primaryRSMap);
  for (RegionInfo region : regions) {
    // not enough secondary/tertiary room to place the regions
    assertTrue(secondaryAndTertiaryMap.get(region) == null);
  }
}
 
开发者ID:apache,项目名称:hbase,代码行数:21,代码来源:TestFavoredNodeAssignmentHelper.java

示例10: createSubmittableJob

import org.apache.hadoop.hbase.util.Triple; //导入方法依赖的package包/类
/**
 * Sets up the actual job.
 *
 * @param conf  The current configuration.
 * @param args  The command line parameters.
 * @return The newly created job.
 * @throws IOException When setting up the job fails.
 */
public static Job createSubmittableJob(Configuration conf, String[] args)
throws IOException {
  Triple<TableName, Scan, Path> arguments = ExportUtils.getArgumentsFromCommandLine(conf, args);
  String tableName = arguments.getFirst().getNameAsString();
  Path outputDir = arguments.getThird();
  Job job = Job.getInstance(conf, conf.get(JOB_NAME_CONF_KEY, NAME + "_" + tableName));
  job.setJobName(NAME + "_" + tableName);
  job.setJarByClass(Export.class);
  // Set optional scan parameters
  Scan s = arguments.getSecond();
  IdentityTableMapper.initJob(tableName, s, IdentityTableMapper.class, job);
  // No reducers.  Just write straight to output files.
  job.setNumReduceTasks(0);
  job.setOutputFormatClass(SequenceFileOutputFormat.class);
  job.setOutputKeyClass(ImmutableBytesWritable.class);
  job.setOutputValueClass(Result.class);
  FileOutputFormat.setOutputPath(job, outputDir); // job conf doesn't contain the conf so doesn't have a default fs.
  return job;
}
 
开发者ID:apache,项目名称:hbase,代码行数:28,代码来源:Export.java

示例11: testSecondaryAndTertiaryPlacementWithMoreThanOneServerInPrimaryRack

import org.apache.hadoop.hbase.util.Triple; //导入方法依赖的package包/类
@Ignore("Disabled for now until FavoredNodes gets finished as a feature") @Test
public void testSecondaryAndTertiaryPlacementWithMoreThanOneServerInPrimaryRack() {
  // Test the case where there is only one server in one rack and another rack
  // has more servers. We try to choose secondary/tertiary on different
  // racks than what the primary is on. But if the other rack doesn't have
  // enough nodes to have both secondary/tertiary RSs, the tertiary is placed
  // on the same rack as the primary server is on
  Map<String,Integer> rackToServerCount = new HashMap<String,Integer>();
  rackToServerCount.put("rack1", 2);
  rackToServerCount.put("rack2", 1);
  Triple<Map<HRegionInfo, ServerName>, FavoredNodeAssignmentHelper, List<HRegionInfo>>
    primaryRSMapAndHelper = secondaryAndTertiaryRSPlacementHelper(6, rackToServerCount);
  FavoredNodeAssignmentHelper helper = primaryRSMapAndHelper.getSecond();
  Map<HRegionInfo, ServerName> primaryRSMap = primaryRSMapAndHelper.getFirst();
  List<HRegionInfo> regions = primaryRSMapAndHelper.getThird();
  assertTrue(primaryRSMap.size() == 6);
  Map<HRegionInfo, ServerName[]> secondaryAndTertiaryMap =
        helper.placeSecondaryAndTertiaryRS(primaryRSMap);
  for (HRegionInfo region : regions) {
    ServerName s = primaryRSMap.get(region);
    ServerName secondaryRS = secondaryAndTertiaryMap.get(region)[0];
    ServerName tertiaryRS = secondaryAndTertiaryMap.get(region)[1];
    if (rackManager.getRack(s).equals("rack1")) {
      assertTrue(rackManager.getRack(secondaryRS).equals("rack2") &&
          rackManager.getRack(tertiaryRS).equals("rack1"));
    }
    if (rackManager.getRack(s).equals("rack2")) {
      assertTrue(rackManager.getRack(secondaryRS).equals("rack1") &&
          rackManager.getRack(tertiaryRS).equals("rack1"));
    }
  }
}
 
开发者ID:fengchen8086,项目名称:ditb,代码行数:33,代码来源:TestFavoredNodeAssignmentHelper.java

示例12: testSecondaryAndTertiaryPlacementWithMoreThanOneServerInPrimaryRack

import org.apache.hadoop.hbase.util.Triple; //导入方法依赖的package包/类
@Test
public void testSecondaryAndTertiaryPlacementWithMoreThanOneServerInPrimaryRack() {
  // Test the case where there is only one server in one rack and another rack
  // has more servers. We try to choose secondary/tertiary on different
  // racks than what the primary is on. But if the other rack doesn't have
  // enough nodes to have both secondary/tertiary RSs, the tertiary is placed
  // on the same rack as the primary server is on
  Map<String,Integer> rackToServerCount = new HashMap<String,Integer>();
  rackToServerCount.put("rack1", 2);
  rackToServerCount.put("rack2", 1);
  Triple<Map<HRegionInfo, ServerName>, FavoredNodeAssignmentHelper, List<HRegionInfo>>
    primaryRSMapAndHelper = secondaryAndTertiaryRSPlacementHelper(6, rackToServerCount);
  FavoredNodeAssignmentHelper helper = primaryRSMapAndHelper.getSecond();
  Map<HRegionInfo, ServerName> primaryRSMap = primaryRSMapAndHelper.getFirst();
  List<HRegionInfo> regions = primaryRSMapAndHelper.getThird();
  assertTrue(primaryRSMap.size() == 6);
  Map<HRegionInfo, ServerName[]> secondaryAndTertiaryMap =
        helper.placeSecondaryAndTertiaryRS(primaryRSMap);
  for (HRegionInfo region : regions) {
    ServerName s = primaryRSMap.get(region);
    ServerName secondaryRS = secondaryAndTertiaryMap.get(region)[0];
    ServerName tertiaryRS = secondaryAndTertiaryMap.get(region)[1];
    if (rackManager.getRack(s).equals("rack1")) {
      assertTrue(rackManager.getRack(secondaryRS).equals("rack2") &&
          rackManager.getRack(tertiaryRS).equals("rack1"));
    }
    if (rackManager.getRack(s).equals("rack2")) {
      assertTrue(rackManager.getRack(secondaryRS).equals("rack1") &&
          rackManager.getRack(tertiaryRS).equals("rack1"));
    }
  }
}
 
开发者ID:grokcoder,项目名称:pbase,代码行数:33,代码来源:TestFavoredNodeAssignmentHelper.java

示例13: testSecondaryAndTertiaryPlacementWithMoreThanOneServerInPrimaryRack

import org.apache.hadoop.hbase.util.Triple; //导入方法依赖的package包/类
@Test
public void testSecondaryAndTertiaryPlacementWithMoreThanOneServerInPrimaryRack() {
  // Test the case where there is only one server in one rack and another rack
  // has more servers. We try to choose secondary/tertiary on different
  // racks than what the primary is on. But if the other rack doesn't have
  // enough nodes to have both secondary/tertiary RSs, the tertiary is placed
  // on the same rack as the primary server is on
  Map<String,Integer> rackToServerCount = new HashMap<>();
  rackToServerCount.put("rack1", 2);
  rackToServerCount.put("rack2", 1);
  Triple<Map<RegionInfo, ServerName>, FavoredNodeAssignmentHelper, List<RegionInfo>>
    primaryRSMapAndHelper = secondaryAndTertiaryRSPlacementHelper(6, rackToServerCount);
  FavoredNodeAssignmentHelper helper = primaryRSMapAndHelper.getSecond();
  Map<RegionInfo, ServerName> primaryRSMap = primaryRSMapAndHelper.getFirst();
  List<RegionInfo> regions = primaryRSMapAndHelper.getThird();
  assertTrue(primaryRSMap.size() == 6);
  Map<RegionInfo, ServerName[]> secondaryAndTertiaryMap =
        helper.placeSecondaryAndTertiaryRS(primaryRSMap);
  assertTrue(secondaryAndTertiaryMap.size() == regions.size());
  for (RegionInfo region : regions) {
    ServerName s = primaryRSMap.get(region);
    ServerName secondaryRS = secondaryAndTertiaryMap.get(region)[0];
    ServerName tertiaryRS = secondaryAndTertiaryMap.get(region)[1];
    Set<String> racks = Sets.newHashSet(rackManager.getRack(s));
    racks.add(rackManager.getRack(secondaryRS));
    racks.add(rackManager.getRack(tertiaryRS));
    assertTrue(racks.size() >= 2);
  }
}
 
开发者ID:apache,项目名称:hbase,代码行数:30,代码来源:TestFavoredNodeAssignmentHelper.java


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