HDFS-11947. When constructing a thread name, BPOfferService may print a bogus warning message. Contributed by Weiwei Yang
This commit is contained in:
parent
b3d3ede91a
commit
bec79ca249
@ -183,14 +183,16 @@ class BPOfferService {
|
|||||||
return nameserviceId;
|
return nameserviceId;
|
||||||
}
|
}
|
||||||
|
|
||||||
String getBlockPoolId() {
|
String getBlockPoolId(boolean quiet) {
|
||||||
readLock();
|
readLock();
|
||||||
try {
|
try {
|
||||||
if (bpNSInfo != null) {
|
if (bpNSInfo != null) {
|
||||||
return bpNSInfo.getBlockPoolID();
|
return bpNSInfo.getBlockPoolID();
|
||||||
} else {
|
} else {
|
||||||
LOG.warn("Block pool ID needed, but service not yet registered with " +
|
if (!quiet) {
|
||||||
"NN, trace:", new Exception());
|
LOG.warn("Block pool ID needed, but service not yet registered with "
|
||||||
|
+ "NN, trace:", new Exception());
|
||||||
|
}
|
||||||
return null;
|
return null;
|
||||||
}
|
}
|
||||||
} finally {
|
} finally {
|
||||||
@ -198,6 +200,10 @@ class BPOfferService {
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
String getBlockPoolId() {
|
||||||
|
return getBlockPoolId(false);
|
||||||
|
}
|
||||||
|
|
||||||
boolean hasBlockPoolId() {
|
boolean hasBlockPoolId() {
|
||||||
return getNamespaceInfo() != null;
|
return getNamespaceInfo() != null;
|
||||||
}
|
}
|
||||||
|
@ -553,8 +553,8 @@ class BPServiceActor implements Runnable {
|
|||||||
private String formatThreadName(
|
private String formatThreadName(
|
||||||
final String action,
|
final String action,
|
||||||
final InetSocketAddress addr) {
|
final InetSocketAddress addr) {
|
||||||
final String prefix = bpos.getBlockPoolId() != null ? bpos.getBlockPoolId()
|
String bpId = bpos.getBlockPoolId(true);
|
||||||
: bpos.getNameserviceId();
|
final String prefix = bpId != null ? bpId : bpos.getNameserviceId();
|
||||||
return prefix + " " + action + " to " + addr;
|
return prefix + " " + action + " to " + addr;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
Loading…
x
Reference in New Issue
Block a user