[feature](mtmv) task tvf add queryId (#29671)

To better locate abnormal situations, add queryId
This commit is contained in:
zhangdong
2024-01-11 14:35:37 +08:00
committed by yiguolei
parent 4d97f8ea75
commit 8ba1eb0b02

View File

@ -29,6 +29,7 @@ import org.apache.doris.common.DdlException;
import org.apache.doris.common.FeConstants;
import org.apache.doris.common.MetaNotFoundException;
import org.apache.doris.common.UserException;
import org.apache.doris.common.util.DebugUtil;
import org.apache.doris.common.util.TimeUtils;
import org.apache.doris.job.exception.JobException;
import org.apache.doris.job.task.AbstractTask;
@ -88,7 +89,8 @@ public class MTMVTask extends AbstractTask {
new Column("RefreshMode", ScalarType.createStringType()),
new Column("NeedRefreshPartitions", ScalarType.createStringType()),
new Column("CompletedPartitions", ScalarType.createStringType()),
new Column("Progress", ScalarType.createStringType()));
new Column("Progress", ScalarType.createStringType()),
new Column("LastQueryId", ScalarType.createStringType()));
public static final ImmutableMap<String, Integer> COLUMN_TO_INDEX;
@ -123,6 +125,8 @@ public class MTMVTask extends AbstractTask {
List<String> completedPartitions;
@SerializedName("refreshMode")
MTMVTaskRefreshMode refreshMode;
@SerializedName("lastQueryId")
String lastQueryId;
private MTMV mtmv;
private MTMVRelation relation;
@ -175,6 +179,7 @@ public class MTMVTask extends AbstractTask {
private void exec(ConnectContext ctx, Set<Long> refreshPartitionIds, Map<OlapTable, String> tableWithPartKey)
throws Exception {
TUniqueId queryId = generateQueryId();
lastQueryId = DebugUtil.printId(queryId);
// if SELF_MANAGE mv, only have default partition, will not have partitionItem, so we give empty set
UpdateMvByPartitionCommand command = UpdateMvByPartitionCommand
.from(mtmv, mtmv.getMvPartitionInfo().getPartitionType() == MTMVPartitionType.FOLLOW_BASE_TABLE
@ -290,6 +295,8 @@ public class MTMVTask extends AbstractTask {
completedPartitions)));
trow.addToColumnValue(
new TCell().setStringVal(getProgress()));
trow.addToColumnValue(
new TCell().setStringVal(lastQueryId));
return trow;
}