Skip to content
Open
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
Original file line number Diff line number Diff line change
Expand Up @@ -69,6 +69,10 @@ public class BackendsTableValuedFunction extends MetadataTableValuedFunction {
new Column("Version", ScalarType.createStringType()),
new Column("Status", ScalarType.createStringType()),
new Column("HeartbeatFailureCounter", ScalarType.createType(PrimitiveType.INT)),
new Column("CpuCores", ScalarType.createType(PrimitiveType.INT)),
new Column("Memory", ScalarType.createStringType()),
new Column("LiveSince", ScalarType.createStringType()),
new Column("RunningTasks", ScalarType.createType(PrimitiveType.BIGINT)),
new Column("NodeRole", ScalarType.createStringType()));

private static final ImmutableMap<String, Integer> COLUMN_TO_INDEX;
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -46,6 +46,7 @@
import org.apache.doris.common.Pair;
import org.apache.doris.common.proc.FrontendsProcNode;
import org.apache.doris.common.proc.PartitionsProcDir;
import org.apache.doris.common.profile.RuntimeProfile;
import org.apache.doris.common.util.DebugUtil;
import org.apache.doris.common.util.NetUtils;
import org.apache.doris.common.util.TimeUtils;
Expand Down Expand Up @@ -105,6 +106,7 @@
import org.apache.doris.thrift.TStatus;
import org.apache.doris.thrift.TStatusCode;
import org.apache.doris.thrift.TTasksMetadataParams;
import org.apache.doris.thrift.TUnit;
import org.apache.doris.thrift.TUserIdentity;

import com.codahale.metrics.Snapshot;
Expand Down Expand Up @@ -498,6 +500,15 @@ private static TFetchSchemaTableDataResult backendsMetadataResult(TMetadataTable
trow.addToColumnValue(new TCell().setStringVal(new Gson().toJson(backend.getBackendStatus())));
// heartbeat failure counter
trow.addToColumnValue(new TCell().setIntVal(backend.getHeartbeatFailureCounter()));
// cpu cores
trow.addToColumnValue(new TCell().setIntVal(backend.getCputCores()));
// memory
trow.addToColumnValue(new TCell()
.setStringVal(RuntimeProfile.printCounter(backend.getBeMemory(), TUnit.BYTES)));
// live since
trow.addToColumnValue(new TCell().setStringVal(TimeUtils.longToTimeString(backend.getLiveSince())));
// running tasks
trow.addToColumnValue(new TCell().setLongVal(backend.getRunningTasks()));

// node role, show the value only when backend is alive.
trow.addToColumnValue(new TCell().setStringVal(backend.isAlive() ? backend.getNodeRoleTag().value : ""));
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -40,6 +40,10 @@ ErrMsg text No false \N NONE
Version text No false \N NONE
Status text No false \N NONE
HeartbeatFailureCounter int No false \N NONE
CpuCores int No false \N NONE
Memory text No false \N NONE
LiveSince text No false \N NONE
RunningTasks bigint No false \N NONE
NodeRole text No false \N NONE

-- !cmd --
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -19,7 +19,7 @@
suite("test_backends_tvf","p0,external,tvf,external_docker") {
List<List<Object>> table = sql """ select * from backends(); """
assertTrue(table.size() > 0)
assertEquals(25, table[0].size())
assertEquals(29, table[0].size())

// filter columns
table = sql """ select BackendId, Host, Alive, TotalCapacity, Version, NodeRole from backends();"""
Expand Down Expand Up @@ -56,7 +56,7 @@ suite("test_backends_tvf","p0,external,tvf,external_docker") {
SystemDecommissioned, tabletnum
DataUsedCapacity, AvailCapacity, TotalCapacity, UsedPct
MaxDiskUsedPct, RemoteUsedCapacity, Tag, ErrMsg, Version, Status
HeartbeatFailureCounter, NodeRole from backends();
HeartbeatFailureCounter, CpuCores, Memory, LiveSince, RunningTasks, NodeRole from backends();
"""


Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -20,7 +20,7 @@ import java.util.regex.Pattern;
suite("information_schema") {
List<List<Object>> table = sql """ select * from backends(); """
assertTrue(table.size() > 0)
assertTrue(table[0].size() == 25)
assertTrue(table[0].size() == 29)

sql "SELECT DATABASE();"
sql "select USER();"
Expand Down