HDFS-16704. Datanode return empty response instead of NPE for GetVolumeInfo during restarting (#4661). Contributed by ZanderXu.

Signed-off-by: Ayush Saxena <ayushsaxena@apache.org>
Signed-off-by: He Xiaoqiao <hexiaoqiao@apache.org>
This commit is contained in:
xuzq 2022-08-15 20:57:27 +08:00 committed by GitHub
parent 86cc96c493
commit b1d4af2492
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23

View File

@ -3628,7 +3628,10 @@ public String getBPServiceActorInfo() {
*/
@Override // DataNodeMXBean
public String getVolumeInfo() {
Preconditions.checkNotNull(data, "Storage not yet initialized");
if (data == null) {
LOG.debug("Storage not yet initialized.");
return "";
}
return JSON.toString(data.getVolumeInfoMap());
}