Java 类org.apache.hadoop.hdfs.server.datanode.DataNodeLayoutVersion 实例源码

项目:hadoop    文件:DFSTestUtil.java   
public static void addDataNodeLayoutVersion(final int lv, final String description)
    throws NoSuchFieldException, IllegalAccessException {
  Preconditions.checkState(lv < DataNodeLayoutVersion.CURRENT_LAYOUT_VERSION);

  // Override {@link DataNodeLayoutVersion#CURRENT_LAYOUT_VERSION} via reflection.
  Field modifiersField = Field.class.getDeclaredField("modifiers");
  modifiersField.setAccessible(true);
  Field field = DataNodeLayoutVersion.class.getField("CURRENT_LAYOUT_VERSION");
  field.setAccessible(true);
  modifiersField.setInt(field, field.getModifiers() & ~Modifier.FINAL);
  field.setInt(null, lv);

  // Override {@link HdfsConstants#DATANODE_LAYOUT_VERSION}
  field = HdfsConstants.class.getField("DATANODE_LAYOUT_VERSION");
  field.setAccessible(true);
  modifiersField.setInt(field, field.getModifiers() & ~Modifier.FINAL);
  field.setInt(null, lv);

  // Inject the feature into the FEATURES map.
  final LayoutVersion.FeatureInfo featureInfo =
      new LayoutVersion.FeatureInfo(lv, lv + 1, description, false);
  final LayoutVersion.LayoutFeature feature =
      new LayoutVersion.LayoutFeature() {
    @Override
    public LayoutVersion.FeatureInfo getInfo() {
      return featureInfo;
    }
  };

  // Update the FEATURES map with the new layout version.
  LayoutVersion.updateMap(DataNodeLayoutVersion.FEATURES,
                          new LayoutVersion.LayoutFeature[] { feature });
}
项目:hadoop    文件:TestLayoutVersion.java   
/**
 * Test to make sure DataNode.Feature support previous features
 */
@Test
public void testDataNodeFeature() {
  final LayoutFeature first = DataNodeLayoutVersion.Feature.FIRST_LAYOUT; 
  assertTrue(DataNodeLayoutVersion.supports(LAST_NON_RESERVED_COMMON_FEATURE,
      first.getInfo().getLayoutVersion()));
  assertEquals(LAST_COMMON_FEATURE.getInfo().getLayoutVersion() - 1,
      first.getInfo().getLayoutVersion());
}
项目:hadoop    文件:UpgradeUtilities.java   
public static void createBlockPoolVersionFile(File bpDir,
    StorageInfo version, String bpid) throws IOException {
  // Create block pool version files
  if (DataNodeLayoutVersion.supports(
      LayoutVersion.Feature.FEDERATION, version.layoutVersion)) {
    File bpCurDir = new File(bpDir, Storage.STORAGE_DIR_CURRENT);
    BlockPoolSliceStorage bpStorage = new BlockPoolSliceStorage(version,
        bpid);
    File versionFile = new File(bpCurDir, "VERSION");
    StorageDirectory sd = new StorageDirectory(bpDir);
    bpStorage.writeProperties(versionFile, sd);
  }
}
项目:aliyun-oss-hadoop-fs    文件:DFSTestUtil.java   
public static void addDataNodeLayoutVersion(final int lv, final String description)
    throws NoSuchFieldException, IllegalAccessException {
  Preconditions.checkState(lv < DataNodeLayoutVersion.CURRENT_LAYOUT_VERSION);

  // Override {@link DataNodeLayoutVersion#CURRENT_LAYOUT_VERSION} via reflection.
  Field modifiersField = Field.class.getDeclaredField("modifiers");
  modifiersField.setAccessible(true);
  Field field = DataNodeLayoutVersion.class.getField("CURRENT_LAYOUT_VERSION");
  field.setAccessible(true);
  modifiersField.setInt(field, field.getModifiers() & ~Modifier.FINAL);
  field.setInt(null, lv);

  field = HdfsServerConstants.class.getField("DATANODE_LAYOUT_VERSION");
  field.setAccessible(true);
  modifiersField.setInt(field, field.getModifiers() & ~Modifier.FINAL);
  field.setInt(null, lv);

  // Inject the feature into the FEATURES map.
  final LayoutVersion.FeatureInfo featureInfo =
      new LayoutVersion.FeatureInfo(lv, lv + 1, description, false);
  final LayoutVersion.LayoutFeature feature =
      new LayoutVersion.LayoutFeature() {
    @Override
    public LayoutVersion.FeatureInfo getInfo() {
      return featureInfo;
    }
  };

  // Update the FEATURES map with the new layout version.
  LayoutVersion.updateMap(DataNodeLayoutVersion.FEATURES,
                          new LayoutVersion.LayoutFeature[] { feature });
}
项目:aliyun-oss-hadoop-fs    文件:TestLayoutVersion.java   
/**
 * Test to make sure DataNode.Feature support previous features
 */
@Test
public void testDataNodeFeature() {
  final LayoutFeature first = DataNodeLayoutVersion.Feature.FIRST_LAYOUT; 
  assertTrue(DataNodeLayoutVersion.supports(LAST_NON_RESERVED_COMMON_FEATURE,
      first.getInfo().getLayoutVersion()));
  assertEquals(LAST_COMMON_FEATURE.getInfo().getLayoutVersion() - 1,
      first.getInfo().getLayoutVersion());
}
项目:aliyun-oss-hadoop-fs    文件:UpgradeUtilities.java   
public static void createBlockPoolVersionFile(File bpDir,
    StorageInfo version, String bpid) throws IOException {
  // Create block pool version files
  if (DataNodeLayoutVersion.supports(
      LayoutVersion.Feature.FEDERATION, version.layoutVersion)) {
    File bpCurDir = new File(bpDir, Storage.STORAGE_DIR_CURRENT);
    BlockPoolSliceStorage bpStorage = new BlockPoolSliceStorage(version,
        bpid);
    File versionFile = new File(bpCurDir, "VERSION");
    StorageDirectory sd = new StorageDirectory(bpDir);
    bpStorage.writeProperties(versionFile, sd);
  }
}
项目:big-c    文件:DFSTestUtil.java   
public static void addDataNodeLayoutVersion(final int lv, final String description)
    throws NoSuchFieldException, IllegalAccessException {
  Preconditions.checkState(lv < DataNodeLayoutVersion.CURRENT_LAYOUT_VERSION);

  // Override {@link DataNodeLayoutVersion#CURRENT_LAYOUT_VERSION} via reflection.
  Field modifiersField = Field.class.getDeclaredField("modifiers");
  modifiersField.setAccessible(true);
  Field field = DataNodeLayoutVersion.class.getField("CURRENT_LAYOUT_VERSION");
  field.setAccessible(true);
  modifiersField.setInt(field, field.getModifiers() & ~Modifier.FINAL);
  field.setInt(null, lv);

  // Override {@link HdfsConstants#DATANODE_LAYOUT_VERSION}
  field = HdfsConstants.class.getField("DATANODE_LAYOUT_VERSION");
  field.setAccessible(true);
  modifiersField.setInt(field, field.getModifiers() & ~Modifier.FINAL);
  field.setInt(null, lv);

  // Inject the feature into the FEATURES map.
  final LayoutVersion.FeatureInfo featureInfo =
      new LayoutVersion.FeatureInfo(lv, lv + 1, description, false);
  final LayoutVersion.LayoutFeature feature =
      new LayoutVersion.LayoutFeature() {
    @Override
    public LayoutVersion.FeatureInfo getInfo() {
      return featureInfo;
    }
  };

  // Update the FEATURES map with the new layout version.
  LayoutVersion.updateMap(DataNodeLayoutVersion.FEATURES,
                          new LayoutVersion.LayoutFeature[] { feature });
}
项目:big-c    文件:TestLayoutVersion.java   
/**
 * Test to make sure DataNode.Feature support previous features
 */
@Test
public void testDataNodeFeature() {
  final LayoutFeature first = DataNodeLayoutVersion.Feature.FIRST_LAYOUT; 
  assertTrue(DataNodeLayoutVersion.supports(LAST_NON_RESERVED_COMMON_FEATURE,
      first.getInfo().getLayoutVersion()));
  assertEquals(LAST_COMMON_FEATURE.getInfo().getLayoutVersion() - 1,
      first.getInfo().getLayoutVersion());
}
项目:big-c    文件:UpgradeUtilities.java   
public static void createBlockPoolVersionFile(File bpDir,
    StorageInfo version, String bpid) throws IOException {
  // Create block pool version files
  if (DataNodeLayoutVersion.supports(
      LayoutVersion.Feature.FEDERATION, version.layoutVersion)) {
    File bpCurDir = new File(bpDir, Storage.STORAGE_DIR_CURRENT);
    BlockPoolSliceStorage bpStorage = new BlockPoolSliceStorage(version,
        bpid);
    File versionFile = new File(bpCurDir, "VERSION");
    StorageDirectory sd = new StorageDirectory(bpDir);
    bpStorage.writeProperties(versionFile, sd);
  }
}
项目:hadoop-2.6.0-cdh5.4.3    文件:DFSTestUtil.java   
public static void addDataNodeLayoutVersion(final int lv, final String description)
    throws NoSuchFieldException, IllegalAccessException {
  Preconditions.checkState(lv < DataNodeLayoutVersion.CURRENT_LAYOUT_VERSION);

  // Override {@link DataNodeLayoutVersion#CURRENT_LAYOUT_VERSION} via reflection.
  Field modifiersField = Field.class.getDeclaredField("modifiers");
  modifiersField.setAccessible(true);
  Field field = DataNodeLayoutVersion.class.getField("CURRENT_LAYOUT_VERSION");
  field.setAccessible(true);
  modifiersField.setInt(field, field.getModifiers() & ~Modifier.FINAL);
  field.setInt(null, lv);

  // Override {@link HdfsConstants#DATANODE_LAYOUT_VERSION}
  field = HdfsConstants.class.getField("DATANODE_LAYOUT_VERSION");
  field.setAccessible(true);
  modifiersField.setInt(field, field.getModifiers() & ~Modifier.FINAL);
  field.setInt(null, lv);

  // Inject the feature into the FEATURES map.
  final LayoutVersion.FeatureInfo featureInfo =
      new LayoutVersion.FeatureInfo(lv, lv + 1, description, false);
  final LayoutVersion.LayoutFeature feature =
      new LayoutVersion.LayoutFeature() {
    @Override
    public LayoutVersion.FeatureInfo getInfo() {
      return featureInfo;
    }
  };

  // Update the FEATURES map with the new layout version.
  LayoutVersion.updateMap(DataNodeLayoutVersion.FEATURES,
                          new LayoutVersion.LayoutFeature[] { feature });
}
项目:hadoop-2.6.0-cdh5.4.3    文件:TestLayoutVersion.java   
/**
 * Test to make sure DataNode.Feature support previous features
 */
@Test
public void testDataNodeFeature() {
  final LayoutFeature first = DataNodeLayoutVersion.Feature.FIRST_LAYOUT; 
  assertTrue(DataNodeLayoutVersion.supports(LAST_NON_RESERVED_COMMON_FEATURE,
      first.getInfo().getLayoutVersion()));
  assertEquals(LAST_COMMON_FEATURE.getInfo().getLayoutVersion() - 1,
      first.getInfo().getLayoutVersion());
}
项目:hadoop-2.6.0-cdh5.4.3    文件:UpgradeUtilities.java   
public static void createBlockPoolVersionFile(File bpDir,
    StorageInfo version, String bpid) throws IOException {
  // Create block pool version files
  if (DataNodeLayoutVersion.supports(
      LayoutVersion.Feature.FEDERATION, version.layoutVersion)) {
    File bpCurDir = new File(bpDir, Storage.STORAGE_DIR_CURRENT);
    BlockPoolSliceStorage bpStorage = new BlockPoolSliceStorage(version,
        bpid);
    File versionFile = new File(bpCurDir, "VERSION");
    StorageDirectory sd = new StorageDirectory(bpDir);
    bpStorage.writeProperties(versionFile, sd);
  }
}
项目:FlexMap    文件:DFSTestUtil.java   
public static void addDataNodeLayoutVersion(final int lv, final String description)
    throws NoSuchFieldException, IllegalAccessException {
  Preconditions.checkState(lv < DataNodeLayoutVersion.CURRENT_LAYOUT_VERSION);

  // Override {@link DataNodeLayoutVersion#CURRENT_LAYOUT_VERSION} via reflection.
  Field modifiersField = Field.class.getDeclaredField("modifiers");
  modifiersField.setAccessible(true);
  Field field = DataNodeLayoutVersion.class.getField("CURRENT_LAYOUT_VERSION");
  field.setAccessible(true);
  modifiersField.setInt(field, field.getModifiers() & ~Modifier.FINAL);
  field.setInt(null, lv);

  // Override {@link HdfsConstants#DATANODE_LAYOUT_VERSION}
  field = HdfsConstants.class.getField("DATANODE_LAYOUT_VERSION");
  field.setAccessible(true);
  modifiersField.setInt(field, field.getModifiers() & ~Modifier.FINAL);
  field.setInt(null, lv);

  // Inject the feature into the FEATURES map.
  final LayoutVersion.FeatureInfo featureInfo =
      new LayoutVersion.FeatureInfo(lv, lv + 1, description, false);
  final LayoutVersion.LayoutFeature feature =
      new LayoutVersion.LayoutFeature() {
    @Override
    public LayoutVersion.FeatureInfo getInfo() {
      return featureInfo;
    }
  };

  // Update the FEATURES map with the new layout version.
  LayoutVersion.updateMap(DataNodeLayoutVersion.FEATURES,
                          new LayoutVersion.LayoutFeature[] { feature });
}
项目:FlexMap    文件:TestLayoutVersion.java   
/**
 * Test to make sure DataNode.Feature support previous features
 */
@Test
public void testDataNodeFeature() {
  final LayoutFeature first = DataNodeLayoutVersion.Feature.FIRST_LAYOUT; 
  assertTrue(DataNodeLayoutVersion.supports(LAST_NON_RESERVED_COMMON_FEATURE,
      first.getInfo().getLayoutVersion()));
  assertEquals(LAST_COMMON_FEATURE.getInfo().getLayoutVersion() - 1,
      first.getInfo().getLayoutVersion());
}
项目:FlexMap    文件:UpgradeUtilities.java   
public static void createBlockPoolVersionFile(File bpDir,
    StorageInfo version, String bpid) throws IOException {
  // Create block pool version files
  if (DataNodeLayoutVersion.supports(
      LayoutVersion.Feature.FEDERATION, version.layoutVersion)) {
    File bpCurDir = new File(bpDir, Storage.STORAGE_DIR_CURRENT);
    BlockPoolSliceStorage bpStorage = new BlockPoolSliceStorage(version,
        bpid);
    File versionFile = new File(bpCurDir, "VERSION");
    StorageDirectory sd = new StorageDirectory(bpDir);
    bpStorage.writeProperties(versionFile, sd);
  }
}
项目:hadoop-on-lustre2    文件:TestLayoutVersion.java   
/**
 * Test to make sure DataNode.Feature support previous features
 */
@Test
public void testDataNodeFeature() {
  final LayoutFeature first = DataNodeLayoutVersion.Feature.FIRST_LAYOUT; 
  assertTrue(DataNodeLayoutVersion.supports(LAST_NON_RESERVED_COMMON_FEATURE,
      first.getInfo().getLayoutVersion()));
  assertEquals(LAST_COMMON_FEATURE.getInfo().getLayoutVersion() - 1,
      first.getInfo().getLayoutVersion());
}
项目:hadoop-on-lustre2    文件:UpgradeUtilities.java   
public static void createBlockPoolVersionFile(File bpDir,
    StorageInfo version, String bpid) throws IOException {
  // Create block pool version files
  if (DataNodeLayoutVersion.supports(
      LayoutVersion.Feature.FEDERATION, version.layoutVersion)) {
    File bpCurDir = new File(bpDir, Storage.STORAGE_DIR_CURRENT);
    BlockPoolSliceStorage bpStorage = new BlockPoolSliceStorage(version,
        bpid);
    File versionFile = new File(bpCurDir, "VERSION");
    StorageDirectory sd = new StorageDirectory(bpDir);
    bpStorage.writeProperties(versionFile, sd);
  }
}
项目:hadoop    文件:StorageInfo.java   
public Map<Integer, SortedSet<LayoutFeature>> getServiceLayoutFeatureMap() {
  return storageType == NodeType.DATA_NODE? DataNodeLayoutVersion.FEATURES
      : NameNodeLayoutVersion.FEATURES;
}
项目:aliyun-oss-hadoop-fs    文件:StorageInfo.java   
public Map<Integer, SortedSet<LayoutFeature>> getServiceLayoutFeatureMap() {
  return storageType == NodeType.DATA_NODE? DataNodeLayoutVersion.FEATURES
      : NameNodeLayoutVersion.FEATURES;
}
项目:big-c    文件:StorageInfo.java   
public Map<Integer, SortedSet<LayoutFeature>> getServiceLayoutFeatureMap() {
  return storageType == NodeType.DATA_NODE? DataNodeLayoutVersion.FEATURES
      : NameNodeLayoutVersion.FEATURES;
}
项目:hadoop-2.6.0-cdh5.4.3    文件:StorageInfo.java   
public Map<Integer, SortedSet<LayoutFeature>> getServiceLayoutFeatureMap() {
  return storageType == NodeType.DATA_NODE? DataNodeLayoutVersion.FEATURES
      : NameNodeLayoutVersion.FEATURES;
}
项目:FlexMap    文件:StorageInfo.java   
public Map<Integer, SortedSet<LayoutFeature>> getServiceLayoutFeatureMap() {
  return storageType == NodeType.DATA_NODE? DataNodeLayoutVersion.FEATURES
      : NameNodeLayoutVersion.FEATURES;
}
项目:hadoop-on-lustre2    文件:StorageInfo.java   
public Map<Integer, SortedSet<LayoutFeature>> getServiceLayoutFeatureMap() {
  return storageType == NodeType.DATA_NODE? DataNodeLayoutVersion.FEATURES
      : NameNodeLayoutVersion.FEATURES;
}