This is an automated email from the ASF dual-hosted git repository.
morningman pushed a commit to branch master
in repository https://gitbox.apache.org/repos/asf/doris.git
The following commit(s) were added to refs/heads/master by this push:
new 47bb99f1394 [fix](mtmv)add logs for mv_infos() (#33485)
47bb99f1394 is described below
commit 47bb99f13941c12d840be2543494ea8590c1b875
Author: zhangdong <[email protected]>
AuthorDate: Thu Apr 11 16:15:36 2024 +0800
[fix](mtmv)add logs for mv_infos() (#33485)
---
.../main/java/org/apache/doris/catalog/MTMV.java | 19 +++++++++++
.../doris/tablefunction/MetadataGenerator.java | 37 ++++++++++++++++++++++
.../tablefunction/MvInfosTableValuedFunction.java | 16 ++++++++++
3 files changed, 72 insertions(+)
diff --git a/fe/fe-core/src/main/java/org/apache/doris/catalog/MTMV.java
b/fe/fe-core/src/main/java/org/apache/doris/catalog/MTMV.java
index 80feb8f12ae..a751cd4beec 100644
--- a/fe/fe-core/src/main/java/org/apache/doris/catalog/MTMV.java
+++ b/fe/fe-core/src/main/java/org/apache/doris/catalog/MTMV.java
@@ -405,4 +405,23 @@ public class MTMV extends OlapTable {
}
}
+ @Override
+ public String toString() {
+ return "MTMV{"
+ + ", refreshInfo=" + refreshInfo
+ + ", querySql='" + querySql + '\''
+ + ", status=" + status
+ + ", envInfo=" + envInfo
+ + ", jobInfo=" + jobInfo
+ + ", mvProperties=" + mvProperties
+ + ", relation=" + relation
+ + ", mvPartitionInfo=" + mvPartitionInfo
+ + ", refreshSnapshot=" + refreshSnapshot
+ + ", cache=" + cache
+ + ", id=" + id
+ + ", name='" + name + '\''
+ + ", qualifiedDbName='" + qualifiedDbName + '\''
+ + ", comment='" + comment + '\''
+ + '}';
+ }
}
diff --git
a/fe/fe-core/src/main/java/org/apache/doris/tablefunction/MetadataGenerator.java
b/fe/fe-core/src/main/java/org/apache/doris/tablefunction/MetadataGenerator.java
index ba727063712..ac4a8558887 100644
---
a/fe/fe-core/src/main/java/org/apache/doris/tablefunction/MetadataGenerator.java
+++
b/fe/fe-core/src/main/java/org/apache/doris/tablefunction/MetadataGenerator.java
@@ -120,7 +120,13 @@ public class MetadataGenerator {
}
public static TFetchSchemaTableDataResult
getMetadataTable(TFetchSchemaTableDataRequest request) throws TException {
+ if (LOG.isDebugEnabled()) {
+ LOG.debug("getMetadataTable() start.");
+ }
if (!request.isSetMetadaTableParams() ||
!request.getMetadaTableParams().isSetMetadataType()) {
+ if (LOG.isDebugEnabled()) {
+ LOG.debug("Metadata table params is not set.");
+ }
return errorResult("Metadata table params is not set. ");
}
TFetchSchemaTableDataResult result;
@@ -159,6 +165,9 @@ public class MetadataGenerator {
if (result.getStatus().getStatusCode() == TStatusCode.OK) {
filterColumns(result, params.getColumnsName(),
params.getMetadataType(), params);
}
+ if (LOG.isDebugEnabled()) {
+ LOG.debug("getMetadataTable() end.");
+ }
return result;
}
@@ -613,6 +622,9 @@ public class MetadataGenerator {
private static void filterColumns(TFetchSchemaTableDataResult result,
List<String> columnNames, TMetadataType type,
TMetadataTableRequestParams params) throws TException {
+ if (LOG.isDebugEnabled()) {
+ LOG.debug("filterColumns() start.");
+ }
List<TRow> fullColumnsRow = result.getDataBatch();
List<TRow> filterColumnsRows = Lists.newArrayList();
for (TRow row : fullColumnsRow) {
@@ -628,6 +640,9 @@ public class MetadataGenerator {
filterColumnsRows.add(filterRow);
}
result.setDataBatch(filterColumnsRows);
+ if (LOG.isDebugEnabled()) {
+ LOG.debug("filterColumns() end.");
+ }
}
private static void filterColumns(TFetchSchemaTableDataResult result,
@@ -658,14 +673,26 @@ public class MetadataGenerator {
}
private static TFetchSchemaTableDataResult
mtmvMetadataResult(TMetadataTableRequestParams params) {
+ if (LOG.isDebugEnabled()) {
+ LOG.debug("mtmvMetadataResult() start");
+ }
if (!params.isSetMaterializedViewsMetadataParams()) {
+ if (LOG.isDebugEnabled()) {
+ LOG.debug("MaterializedViews metadata params is not set.");
+ }
return errorResult("MaterializedViews metadata params is not
set.");
}
TMaterializedViewsMetadataParams mtmvMetadataParams =
params.getMaterializedViewsMetadataParams();
String dbName = mtmvMetadataParams.getDatabase();
+ if (LOG.isDebugEnabled()) {
+ LOG.debug("dbName: " + dbName);
+ }
TUserIdentity currentUserIdent =
mtmvMetadataParams.getCurrentUserIdent();
UserIdentity userIdentity = UserIdentity.fromThrift(currentUserIdent);
+ if (LOG.isDebugEnabled()) {
+ LOG.debug("userIdentity: " + userIdentity);
+ }
List<TRow> dataBatch = Lists.newArrayList();
TFetchSchemaTableDataResult result = new TFetchSchemaTableDataResult();
List<Table> tables;
@@ -674,6 +701,7 @@ public class MetadataGenerator {
.getCatalogOrAnalysisException(InternalCatalog.INTERNAL_CATALOG_NAME)
.getDbOrAnalysisException(dbName).getTables();
} catch (AnalysisException e) {
+ LOG.warn(e.getMessage());
return errorResult(e.getMessage());
}
@@ -686,6 +714,9 @@ public class MetadataGenerator {
continue;
}
MTMV mv = (MTMV) table;
+ if (LOG.isDebugEnabled()) {
+ LOG.debug("mv: " + mv);
+ }
TRow trow = new TRow();
trow.addToColumnValue(new TCell().setLongVal(mv.getId()));
trow.addToColumnValue(new TCell().setStringVal(mv.getName()));
@@ -699,11 +730,17 @@ public class MetadataGenerator {
trow.addToColumnValue(new
TCell().setStringVal(mv.getMvProperties().toString()));
trow.addToColumnValue(new
TCell().setStringVal(mv.getMvPartitionInfo().toNameString()));
trow.addToColumnValue(new
TCell().setBoolVal(MTMVPartitionUtil.isMTMVSync(mv)));
+ if (LOG.isDebugEnabled()) {
+ LOG.debug("mvend: " + mv.getName());
+ }
dataBatch.add(trow);
}
}
result.setDataBatch(dataBatch);
result.setStatus(new TStatus(TStatusCode.OK));
+ if (LOG.isDebugEnabled()) {
+ LOG.debug("mtmvMetadataResult() end");
+ }
return result;
}
diff --git
a/fe/fe-core/src/main/java/org/apache/doris/tablefunction/MvInfosTableValuedFunction.java
b/fe/fe-core/src/main/java/org/apache/doris/tablefunction/MvInfosTableValuedFunction.java
index 0b415ccae84..fbc414e717f 100644
---
a/fe/fe-core/src/main/java/org/apache/doris/tablefunction/MvInfosTableValuedFunction.java
+++
b/fe/fe-core/src/main/java/org/apache/doris/tablefunction/MvInfosTableValuedFunction.java
@@ -30,6 +30,8 @@ import com.google.common.collect.ImmutableList;
import com.google.common.collect.ImmutableMap;
import com.google.common.collect.ImmutableSet;
import com.google.common.collect.Maps;
+import org.apache.logging.log4j.LogManager;
+import org.apache.logging.log4j.Logger;
import java.util.List;
import java.util.Map;
@@ -39,6 +41,8 @@ import java.util.Map;
* mv_infos("database" = "db1").
*/
public class MvInfosTableValuedFunction extends MetadataTableValuedFunction {
+ private static final Logger LOG =
LogManager.getLogger(MvInfosTableValuedFunction.class);
+
public static final String NAME = "mv_infos";
private static final String DB = "database";
@@ -75,6 +79,9 @@ public class MvInfosTableValuedFunction extends
MetadataTableValuedFunction {
private final String databaseName;
public MvInfosTableValuedFunction(Map<String, String> params) throws
AnalysisException {
+ if (LOG.isDebugEnabled()) {
+ LOG.debug("MvInfosTableValuedFunction() start");
+ }
Map<String, String> validParams = Maps.newHashMap();
for (String key : params.keySet()) {
if (!PROPERTIES_SET.contains(key.toLowerCase())) {
@@ -88,6 +95,9 @@ public class MvInfosTableValuedFunction extends
MetadataTableValuedFunction {
throw new AnalysisException("Invalid mtmv metadata query");
}
this.databaseName = dbName;
+ if (LOG.isDebugEnabled()) {
+ LOG.debug("MvInfosTableValuedFunction() end");
+ }
}
@Override
@@ -97,12 +107,18 @@ public class MvInfosTableValuedFunction extends
MetadataTableValuedFunction {
@Override
public TMetaScanRange getMetaScanRange() {
+ if (LOG.isDebugEnabled()) {
+ LOG.debug("getMetaScanRange() start");
+ }
TMetaScanRange metaScanRange = new TMetaScanRange();
metaScanRange.setMetadataType(TMetadataType.MATERIALIZED_VIEWS);
TMaterializedViewsMetadataParams mtmvParam = new
TMaterializedViewsMetadataParams();
mtmvParam.setDatabase(databaseName);
mtmvParam.setCurrentUserIdent(ConnectContext.get().getCurrentUserIdentity().toThrift());
metaScanRange.setMaterializedViewsParams(mtmvParam);
+ if (LOG.isDebugEnabled()) {
+ LOG.debug("getMetaScanRange() end");
+ }
return metaScanRange;
}
---------------------------------------------------------------------
To unsubscribe, e-mail: [email protected]
For additional commands, e-mail: [email protected]