HDFS-5417. Fix storage IDs in PBHelper and UpgradeUtilities.
git-svn-id: https://svn.apache.org/repos/asf/hadoop/common/branches/HDFS-2832@1535791 13f79535-47bb-0310-9956-ffa450edef68
This commit is contained in:
parent
1fcc24d56a
commit
ec01db59ce
|
@ -47,3 +47,5 @@ IMPROVEMENTS:
|
||||||
(Arpit Agarwal)
|
(Arpit Agarwal)
|
||||||
|
|
||||||
HDFS-5401. Fix NPE in Directory Scanner. (Arpit Agarwal)
|
HDFS-5401. Fix NPE in Directory Scanner. (Arpit Agarwal)
|
||||||
|
|
||||||
|
HDFS-5417. Fix storage IDs in PBHelper and UpgradeUtilities. (szetszwo)
|
||||||
|
|
|
@ -581,7 +581,10 @@ public class PBHelper {
|
||||||
builder.addStorageTypes(PBHelper.convertStorageType(storageTypes[i]));
|
builder.addStorageTypes(PBHelper.convertStorageType(storageTypes[i]));
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
final String[] storageIDs = b.getStorageIDs();
|
||||||
|
if (storageIDs != null) {
|
||||||
builder.addAllStorageIDs(Arrays.asList(b.getStorageIDs()));
|
builder.addAllStorageIDs(Arrays.asList(b.getStorageIDs()));
|
||||||
|
}
|
||||||
|
|
||||||
return builder.setB(PBHelper.convert(b.getBlock()))
|
return builder.setB(PBHelper.convert(b.getBlock()))
|
||||||
.setBlockToken(PBHelper.convert(b.getBlockToken()))
|
.setBlockToken(PBHelper.convert(b.getBlockToken()))
|
||||||
|
@ -609,9 +612,11 @@ public class PBHelper {
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
final int storageIDsCount = proto.getStorageIDsCount();
|
||||||
|
final String[] storageIDs = storageIDsCount == 0? null
|
||||||
|
: proto.getStorageIDsList().toArray(new String[storageIDsCount]);
|
||||||
LocatedBlock lb = new LocatedBlock(PBHelper.convert(proto.getB()), targets,
|
LocatedBlock lb = new LocatedBlock(PBHelper.convert(proto.getB()), targets,
|
||||||
proto.getStorageIDsList().toArray(new String[proto.getStorageIDsCount()]),
|
storageIDs, storageTypes, proto.getOffset(), proto.getCorrupt());
|
||||||
storageTypes, proto.getOffset(), proto.getCorrupt());
|
|
||||||
lb.setBlockToken(PBHelper.convert(proto.getBlockToken()));
|
lb.setBlockToken(PBHelper.convert(proto.getBlockToken()));
|
||||||
return lb;
|
return lb;
|
||||||
}
|
}
|
||||||
|
|
|
@ -459,6 +459,7 @@ public class UpgradeUtilities {
|
||||||
for (int i = 0; i < parent.length; i++) {
|
for (int i = 0; i < parent.length; i++) {
|
||||||
File versionFile = new File(parent[i], "VERSION");
|
File versionFile = new File(parent[i], "VERSION");
|
||||||
StorageDirectory sd = new StorageDirectory(parent[i].getParentFile());
|
StorageDirectory sd = new StorageDirectory(parent[i].getParentFile());
|
||||||
|
storage.createStorageID(sd);
|
||||||
storage.writeProperties(versionFile, sd);
|
storage.writeProperties(versionFile, sd);
|
||||||
versionFiles[i] = versionFile;
|
versionFiles[i] = versionFile;
|
||||||
File bpDir = BlockPoolSliceStorage.getBpRoot(bpid, parent[i]);
|
File bpDir = BlockPoolSliceStorage.getBpRoot(bpid, parent[i]);
|
||||||
|
|
Loading…
Reference in New Issue