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