[fix](mtmv)Solving the problem of calling each other in toString() loops (#34277) (#34317)

bp #34277
This commit is contained in:
zhangdong
2024-04-29 21:46:29 +08:00
committed by GitHub
parent f76bf66903
commit d1df0b8878
12 changed files with 199 additions and 28 deletions

View File

@ -364,6 +364,51 @@ public class MTMV extends OlapTable {
return res;
}
// for test
public void setRefreshInfo(MTMVRefreshInfo refreshInfo) {
this.refreshInfo = refreshInfo;
}
// for test
public void setQuerySql(String querySql) {
this.querySql = querySql;
}
// for test
public void setStatus(MTMVStatus status) {
this.status = status;
}
// for test
public void setEnvInfo(EnvInfo envInfo) {
this.envInfo = envInfo;
}
// for test
public void setJobInfo(MTMVJobInfo jobInfo) {
this.jobInfo = jobInfo;
}
// for test
public void setMvProperties(Map<String, String> mvProperties) {
this.mvProperties = mvProperties;
}
// for test
public void setRelation(MTMVRelation relation) {
this.relation = relation;
}
// for test
public void setMvPartitionInfo(MTMVPartitionInfo mvPartitionInfo) {
this.mvPartitionInfo = mvPartitionInfo;
}
// for test
public void setRefreshSnapshot(MTMVRefreshSnapshot refreshSnapshot) {
this.refreshSnapshot = refreshSnapshot;
}
public void readMvLock() {
this.mvRwLock.readLock().lock();
}
@ -405,23 +450,29 @@ 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 + '\''
+ '}';
// toString() is not easy to find where to call the method
public String toInfoString() {
final StringBuilder sb = new StringBuilder("MTMV{");
sb.append("refreshInfo=").append(refreshInfo);
sb.append(", querySql='").append(querySql).append('\'');
sb.append(", status=").append(status);
sb.append(", envInfo=").append(envInfo);
if (jobInfo != null) {
sb.append(", jobInfo=").append(jobInfo.toInfoString());
}
sb.append(", mvProperties=").append(mvProperties);
if (relation != null) {
sb.append(", relation=").append(relation.toInfoString());
}
if (mvPartitionInfo != null) {
sb.append(", mvPartitionInfo=").append(mvPartitionInfo.toInfoString());
}
sb.append(", refreshSnapshot=").append(refreshSnapshot);
sb.append(", id=").append(id);
sb.append(", name='").append(name).append('\'');
sb.append(", qualifiedDbName='").append(qualifiedDbName).append('\'');
sb.append(", comment='").append(comment).append('\'');
sb.append('}');
return sb.toString();
}
}

View File

@ -441,9 +441,6 @@ public class MTMVTask extends AbstractTask {
+ ", needRefreshPartitions=" + needRefreshPartitions
+ ", completedPartitions=" + completedPartitions
+ ", refreshMode=" + refreshMode
+ ", mtmv=" + mtmv
+ ", relation=" + relation
+ ", executor=" + executor
+ "} " + super.toString();
}
}

View File

@ -56,8 +56,8 @@ public class MTMVJobInfo {
return historyTasks;
}
@Override
public String toString() {
// toString() is not easy to find where to call the method
public String toInfoString() {
return "MTMVJobInfo{"
+ "jobName='" + jobName + '\''
+ ", historyTasks=" + historyTasks

View File

@ -56,4 +56,12 @@ public class MTMVMaxTimestampSnapshot implements MTMVSnapshotIf {
public int hashCode() {
return Objects.hashCode(partitionId, timestamp);
}
@Override
public String toString() {
return "MTMVMaxTimestampSnapshot{"
+ "partitionId=" + partitionId
+ ", timestamp=" + timestamp
+ '}';
}
}

View File

@ -102,8 +102,8 @@ public class MTMVPartitionInfo {
return MTMVPartitionUtil.getPos(getRelatedTable(), relatedCol);
}
@Override
public String toString() {
// toString() is not easy to find where to call the method
public String toInfoString() {
return "MTMVPartitionInfo{"
+ "partitionType=" + partitionType
+ ", relatedTable=" + relatedTable

View File

@ -40,4 +40,12 @@ public class MTMVRefreshPartitionSnapshot {
public Map<Long, MTMVSnapshotIf> getTables() {
return tables;
}
@Override
public String toString() {
return "MTMVRefreshPartitionSnapshot{"
+ "partitions=" + partitions
+ ", tables=" + tables
+ '}';
}
}

View File

@ -72,4 +72,11 @@ public class MTMVRefreshSnapshot {
}
}
}
@Override
public String toString() {
return "MTMVRefreshSnapshot{"
+ "partitionSnapshots=" + partitionSnapshots
+ '}';
}
}

View File

@ -44,8 +44,8 @@ public class MTMVRelation {
return baseViews;
}
@Override
public String toString() {
// toString() is not easy to find where to call the method
public String toInfoString() {
return "MTMVRelation{"
+ "baseTables=" + baseTables
+ ", baseViews=" + baseViews

View File

@ -48,4 +48,11 @@ public class MTMVTimestampSnapshot implements MTMVSnapshotIf {
public int hashCode() {
return Objects.hashCode(timestamp);
}
@Override
public String toString() {
return "MTMVTimestampSnapshot{"
+ "timestamp=" + timestamp
+ '}';
}
}

View File

@ -44,4 +44,11 @@ public class MTMVVersionSnapshot implements MTMVSnapshotIf {
public int hashCode() {
return Objects.hashCode(version);
}
@Override
public String toString() {
return "MTMVVersionSnapshot{"
+ "version=" + version
+ '}';
}
}

View File

@ -727,7 +727,7 @@ public class MetadataGenerator {
}
MTMV mv = (MTMV) table;
if (LOG.isDebugEnabled()) {
LOG.debug("mv: " + mv);
LOG.debug("mv: " + mv.toInfoString());
}
TRow trow = new TRow();
trow.addToColumnValue(new TCell().setLongVal(mv.getId()));