You are viewing a plain text version of this content. The canonical link for it is here.
Posted to common-commits@hadoop.apache.org by ta...@apache.org on 2021/12/16 04:52:31 UTC
[hadoop] branch branch-3.2 updated: HDFS-16377. Should CheckNotNull before access FsDatasetSpi (#3784)
This is an automated email from the ASF dual-hosted git repository.
tasanuma pushed a commit to branch branch-3.2
in repository https://gitbox.apache.org/repos/asf/hadoop.git
The following commit(s) were added to refs/heads/branch-3.2 by this push:
new 3257646 HDFS-16377. Should CheckNotNull before access FsDatasetSpi (#3784)
3257646 is described below
commit 3257646975e7ceb337afb51f53abc4dd106d4bf0
Author: litao <to...@gmail.com>
AuthorDate: Thu Dec 16 12:49:50 2021 +0800
HDFS-16377. Should CheckNotNull before access FsDatasetSpi (#3784)
Reviewed-by: Viraj Jasani <vj...@apache.org>
Signed-off-by: Takanobu Asanuma <ta...@apache.org>
(cherry picked from commit 22f5e1885d21c9db9ceecf611128508542ec0f11)
---
.../java/org/apache/hadoop/hdfs/server/datanode/DataNode.java | 8 +++++++-
1 file changed, 7 insertions(+), 1 deletion(-)
diff --git a/hadoop-hdfs-project/hadoop-hdfs/src/main/java/org/apache/hadoop/hdfs/server/datanode/DataNode.java b/hadoop-hdfs-project/hadoop-hdfs/src/main/java/org/apache/hadoop/hdfs/server/datanode/DataNode.java
index 80f6540..58fcff8 100644
--- a/hadoop-hdfs-project/hadoop-hdfs/src/main/java/org/apache/hadoop/hdfs/server/datanode/DataNode.java
+++ b/hadoop-hdfs-project/hadoop-hdfs/src/main/java/org/apache/hadoop/hdfs/server/datanode/DataNode.java
@@ -780,6 +780,7 @@ public class DataNode extends ReconfigurableBase
.newFixedThreadPool(changedVolumes.newLocations.size());
List<Future<IOException>> exceptions = Lists.newArrayList();
+ Preconditions.checkNotNull(data, "Storage not yet initialized");
for (final StorageLocation location : changedVolumes.newLocations) {
exceptions.add(service.submit(new Callable<IOException>() {
@Override
@@ -879,6 +880,7 @@ public class DataNode extends ReconfigurableBase
clearFailure, Joiner.on(",").join(storageLocations)));
IOException ioe = null;
+ Preconditions.checkNotNull(data, "Storage not yet initialized");
// Remove volumes and block infos from FsDataset.
data.removeVolumes(storageLocations, clearFailure);
@@ -1982,6 +1984,7 @@ public class DataNode extends ReconfigurableBase
FileInputStream fis[] = new FileInputStream[2];
try {
+ Preconditions.checkNotNull(data, "Storage not yet initialized");
fis[0] = (FileInputStream)data.getBlockInputStream(blk, 0);
fis[1] = DatanodeUtil.getMetaDataInputStream(blk, data);
} catch (ClassCastException e) {
@@ -2939,6 +2942,7 @@ public class DataNode extends ReconfigurableBase
@Override // InterDatanodeProtocol
public ReplicaRecoveryInfo initReplicaRecovery(RecoveringBlock rBlock)
throws IOException {
+ Preconditions.checkNotNull(data, "Storage not yet initialized");
return data.initReplicaRecovery(rBlock);
}
@@ -2949,6 +2953,7 @@ public class DataNode extends ReconfigurableBase
public String updateReplicaUnderRecovery(final ExtendedBlock oldBlock,
final long recoveryId, final long newBlockId, final long newLength)
throws IOException {
+ Preconditions.checkNotNull(data, "Storage not yet initialized");
final Replica r = data.updateReplicaUnderRecovery(oldBlock,
recoveryId, newBlockId, newLength);
// Notify the namenode of the updated block info. This is important
@@ -3221,7 +3226,7 @@ public class DataNode extends ReconfigurableBase
"The block pool is still running. First do a refreshNamenodes to " +
"shutdown the block pool service");
}
-
+ Preconditions.checkNotNull(data, "Storage not yet initialized");
data.deleteBlockPool(blockPoolId, force);
}
@@ -3683,6 +3688,7 @@ public class DataNode extends ReconfigurableBase
@Override
public List<DatanodeVolumeInfo> getVolumeReport() throws IOException {
checkSuperuserPrivilege();
+ Preconditions.checkNotNull(data, "Storage not yet initialized");
Map<String, Object> volumeInfoMap = data.getVolumeInfoMap();
if (volumeInfoMap == null) {
LOG.warn("DataNode volume info not available.");
---------------------------------------------------------------------
To unsubscribe, e-mail: common-commits-unsubscribe@hadoop.apache.org
For additional commands, e-mail: common-commits-help@hadoop.apache.org