private static boolean createStorageID(StorageDirectory sd, int lv, Configuration conf) { // Clusters previously upgraded from layout versions earlier than // ADD_DATANODE_AND_STORAGE_UUIDS failed to correctly generate a // new storage ID. We check for that and fix it now. final boolean haveValidStorageId = DataNodeLayoutVersion.supports( LayoutVersion.Feature.ADD_DATANODE_AND_STORAGE_UUIDS, lv) && DatanodeStorage.isValidStorageId(sd.getStorageUuid()); return createStorageID(sd, !haveValidStorageId, conf); }
private static boolean createStorageID(StorageDirectory sd, int lv) { // Clusters previously upgraded from layout versions earlier than // ADD_DATANODE_AND_STORAGE_UUIDS failed to correctly generate a // new storage ID. We check for that and fix it now. final boolean haveValidStorageId = DataNodeLayoutVersion.supports( LayoutVersion.Feature.ADD_DATANODE_AND_STORAGE_UUIDS, lv) && DatanodeStorage.isValidStorageId(sd.getStorageUuid()); return createStorageID(sd, !haveValidStorageId); }
private static boolean createStorageID(StorageDirectory sd, int lv) { // Clusters previously upgraded from layout versions earlier than // ADD_DATANODE_AND_STORAGE_UUIDS failed to correctly generate a // new storage ID. We check for that and fix it now. final boolean haveValidStorageId = DataNodeLayoutVersion.supports( LayoutVersion.Feature.ADD_DATANODE_AND_STORAGE_UUIDS, lv) && DatanodeStorage.isValidStorageId(sd.getStorageUuid()); return createStorageID(sd, !haveValidStorageId); }
@Override public void verifyClusterPostUpgrade(MiniDFSCluster cluster) throws IOException { // Verify that a GUID-based storage ID was generated. final String bpid = cluster.getNamesystem().getBlockPoolId(); StorageReport[] reports = cluster.getDataNodes().get(0).getFSDataset().getStorageReports(bpid); assertThat(reports.length, is(1)); final String storageID = reports[0].getStorage().getStorageID(); assertTrue(DatanodeStorage.isValidStorageId(storageID)); if (expectedStorageId != null) { assertThat(storageID, is(expectedStorageId)); } } });