Skip to content

Commit 1009445

Browse files
yujun777pull[bot]
authored andcommitted
[improvement](hint) query fail print tablet detail info (#28476)
1 parent 801ff8c commit 1009445

3 files changed

Lines changed: 31 additions & 15 deletions

File tree

‎fe/fe-common/src/main/java/org/apache/doris/common/Config.java‎

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -2107,7 +2107,7 @@ public class Config extends ConfigBase {
21072107
"When set to true, if a query is unable to select a healthy replica, "
21082108
+ "the detailed information of all the replicas of the tablet,"
21092109
+ " including the specific reason why they are unqueryable, will be printed out."})
2110-
public static boolean show_details_for_unaccessible_tablet = false;
2110+
public static boolean show_details_for_unaccessible_tablet = true;
21112111

21122112
@ConfField(mutable = false, masterOnly = false, varType = VariableAnnotation.EXPERIMENTAL, description = {
21132113
"是否启用binlog特性",

‎fe/fe-core/src/main/java/org/apache/doris/catalog/Replica.java‎

Lines changed: 25 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -21,6 +21,7 @@
2121
import org.apache.doris.common.io.Text;
2222
import org.apache.doris.common.io.Writable;
2323
import org.apache.doris.common.util.DebugPointUtil;
24+
import org.apache.doris.system.Backend;
2425
import org.apache.doris.thrift.TUniqueId;
2526

2627
import com.google.gson.annotations.SerializedName;
@@ -597,8 +598,16 @@ public String toStringSimple(boolean checkBeAlive) {
597598
strBuffer.append(", backendId=");
598599
strBuffer.append(backendId);
599600
if (checkBeAlive) {
600-
strBuffer.append(", backendAlive=");
601-
strBuffer.append(Env.getCurrentSystemInfo().checkBackendAlive(backendId));
601+
Backend backend = Env.getCurrentSystemInfo().getBackend(backendId);
602+
if (backend == null) {
603+
strBuffer.append(", backend=null");
604+
} else {
605+
strBuffer.append(", backendAlive=");
606+
strBuffer.append(backend.isAlive());
607+
if (backend.isDecommissioned()) {
608+
strBuffer.append(", backendDecommission=true");
609+
}
610+
}
602611
}
603612
strBuffer.append(", version=");
604613
strBuffer.append(version);
@@ -610,6 +619,20 @@ public String toStringSimple(boolean checkBeAlive) {
610619
strBuffer.append(", lastFailedTimestamp=");
611620
strBuffer.append(lastFailedTimestamp);
612621
}
622+
if (isBad()) {
623+
strBuffer.append(", isBad=true");
624+
Backend backend = Env.getCurrentSystemInfo().getBackend(backendId);
625+
if (backend != null && pathHash != -1) {
626+
DiskInfo diskInfo = backend.getDisks().values().stream()
627+
.filter(disk -> disk.getPathHash() == pathHash)
628+
.findFirst().orElse(null);
629+
if (diskInfo == null) {
630+
strBuffer.append(", disk with path hash " + pathHash + " not exists");
631+
} else if (diskInfo.getState() == DiskInfo.DiskState.OFFLINE) {
632+
strBuffer.append(", disk " + diskInfo.getRootPath() + " is bad");
633+
}
634+
}
635+
}
613636
strBuffer.append(", state=");
614637
strBuffer.append(state.name());
615638
strBuffer.append("]");

‎fe/fe-core/src/main/java/org/apache/doris/catalog/Tablet.java‎

Lines changed: 5 additions & 12 deletions
Original file line numberDiff line numberDiff line change
@@ -31,6 +31,7 @@
3131
import org.apache.doris.system.Backend;
3232
import org.apache.doris.system.SystemInfoService;
3333

34+
import com.google.common.base.Joiner;
3435
import com.google.common.collect.HashMultimap;
3536
import com.google.common.collect.Lists;
3637
import com.google.common.collect.Maps;
@@ -287,18 +288,10 @@ public String getDetailsStatusForQuery(long visibleVersion) {
287288
StringBuilder sb = new StringBuilder("Visible Replicas:");
288289
sb.append("Visible version: ").append(visibleVersion);
289290
sb.append(", Replicas: ");
290-
for (Replica replica : replicas) {
291-
sb.append(replica.toString());
292-
}
293-
sb.append(", Backends: ");
294-
for (Replica replica : replicas) {
295-
Backend be = Env.getCurrentSystemInfo().getBackend(replica.getBackendId());
296-
if (be == null) {
297-
sb.append("Backend [id=" + id + ", not exists]");
298-
} else {
299-
sb.append(be.getHealthyStatus());
300-
}
301-
}
291+
sb.append(Joiner.on(", ").join(replicas.stream().map(replica -> replica.toStringSimple(true))
292+
.collect(Collectors.toList())));
293+
sb.append(".");
294+
302295
return sb.toString();
303296
}
304297

0 commit comments

Comments
 (0)