[improvement](hint) query fail print tablet detail info (#28476)

This commit is contained in:
yujun
2023-12-16 12:54:25 +08:00
committed by GitHub
parent b11b76e778
commit 92a4a9770c
3 changed files with 31 additions and 15 deletions

View File

@ -21,6 +21,7 @@ import org.apache.doris.common.Config;
import org.apache.doris.common.io.Text;
import org.apache.doris.common.io.Writable;
import org.apache.doris.common.util.DebugPointUtil;
import org.apache.doris.system.Backend;
import org.apache.doris.thrift.TUniqueId;
import com.google.gson.annotations.SerializedName;
@ -597,8 +598,16 @@ public class Replica implements Writable {
strBuffer.append(", backendId=");
strBuffer.append(backendId);
if (checkBeAlive) {
strBuffer.append(", backendAlive=");
strBuffer.append(Env.getCurrentSystemInfo().checkBackendAlive(backendId));
Backend backend = Env.getCurrentSystemInfo().getBackend(backendId);
if (backend == null) {
strBuffer.append(", backend=null");
} else {
strBuffer.append(", backendAlive=");
strBuffer.append(backend.isAlive());
if (backend.isDecommissioned()) {
strBuffer.append(", backendDecommission=true");
}
}
}
strBuffer.append(", version=");
strBuffer.append(version);
@ -610,6 +619,20 @@ public class Replica implements Writable {
strBuffer.append(", lastFailedTimestamp=");
strBuffer.append(lastFailedTimestamp);
}
if (isBad()) {
strBuffer.append(", isBad=true");
Backend backend = Env.getCurrentSystemInfo().getBackend(backendId);
if (backend != null && pathHash != -1) {
DiskInfo diskInfo = backend.getDisks().values().stream()
.filter(disk -> disk.getPathHash() == pathHash)
.findFirst().orElse(null);
if (diskInfo == null) {
strBuffer.append(", disk with path hash " + pathHash + " not exists");
} else if (diskInfo.getState() == DiskInfo.DiskState.OFFLINE) {
strBuffer.append(", disk " + diskInfo.getRootPath() + " is bad");
}
}
}
strBuffer.append(", state=");
strBuffer.append(state.name());
strBuffer.append("]");

View File

@ -31,6 +31,7 @@ import org.apache.doris.resource.Tag;
import org.apache.doris.system.Backend;
import org.apache.doris.system.SystemInfoService;
import com.google.common.base.Joiner;
import com.google.common.collect.HashMultimap;
import com.google.common.collect.Lists;
import com.google.common.collect.Maps;
@ -287,18 +288,10 @@ public class Tablet extends MetaObject implements Writable {
StringBuilder sb = new StringBuilder("Visible Replicas:");
sb.append("Visible version: ").append(visibleVersion);
sb.append(", Replicas: ");
for (Replica replica : replicas) {
sb.append(replica.toString());
}
sb.append(", Backends: ");
for (Replica replica : replicas) {
Backend be = Env.getCurrentSystemInfo().getBackend(replica.getBackendId());
if (be == null) {
sb.append("Backend [id=" + id + ", not exists]");
} else {
sb.append(be.getHealthyStatus());
}
}
sb.append(Joiner.on(", ").join(replicas.stream().map(replica -> replica.toStringSimple(true))
.collect(Collectors.toList())));
sb.append(".");
return sb.toString();
}